class KThemeBase
|
This is a base class for KDE themed styles. More... |
|
|
Public Types
- enum ScaleHint {FullScale, HorizontalScale, VerticalScale, TileScale};
}
- enum ArrowStyle {MotifArrow, LargeArrow, SmallArrow};
}
- enum ShadeStyle {Motif, Windows, Next, KDE};
}
- enum SButton {SBBottomLeft, SBBottomRight, SBOpposite};
}
- enum Gradient {GrNone, GrHorizontal, GrVertical, GrDiagonal, GrPyramid, GrRectangle, GrElliptic, GrReverseBevel}
- enum WidgetType {PushButton=0, ComboBox, HScrollBarSlider, VScrollBarSlider, Bevel, ToolButton, ScrollButton, HScrollDeco, VScrollDeco, ComboDeco, MenuItem, InactiveTab, ArrowUp, ArrowDown, ArrowLeft, ArrowRight, PushButtonDown, ComboBoxDown, HScrollBarSliderDown, VScrollBarSliderDown, BevelDown, ToolButtonDown, ScrollButtonDown, HScrollDecoDown, VScrollDecoDown, ComboDecoDown, MenuItemDown, ActiveTab, SunkenArrowUp, SunkenArrowDown, SunkenArrowLeft, SunkenArrowRight, HScrollGroove, VScrollGroove, Slider, SliderGroove, IndicatorOn, IndicatorOff, ExIndicatorOn, ExIndicatorOff, HBarHandle, VBarHandle, ToolBar, Splitter, CheckMark, MenuBar, DisArrowUp, DisArrowDown, DisArrowLeft, DisArrowRight, ProgressBar, ProgressBg, MenuBarItem, Background}
Public Methods
- KThemeBase (const QString &configFile)
- ~KThemeBase ()
- ScaleHint scaleHint (WidgetType widget) const
- Gradient gradientHint (WidgetType widget) const
- const QColorGroup* colorGroup (const QColorGroup &defaultGroup, WidgetType widget) const
- QBrush pixmapBrush (const QColorGroup &group, QColorGroup::ColorRole role, int w, int h, WidgetType widget)
- bool isPixmap (WidgetType widget) const
- bool isColor (WidgetType widget) const
- bool is3DFocus () const
- int focusOffset () const
- int borderWidth (WidgetType widget) const
- int pixBorderWidth (WidgetType widget) const
- KThemePixmap* borderPixmap (WidgetType widget)
- int highlightWidth (WidgetType widget) const
- int decoWidth (WidgetType widget) const
- int getSBExtent () const
- SButton scrollBarLayout () const
- ArrowStyle arrowType () const
- ShadeStyle shade () const
- int frameWidth () const
- int splitWidth () const
- int bevelContrast (WidgetType widget) const
- int buttonXShift () const
- int buttonYShift () const
- int sliderButtonLength () const
- bool roundButton () const
- bool roundComboBox () const
- bool roundSlider () const
- bool activeTabLine () const
- bool inactiveTabLine () const
- KThemePixmap* uncached (WidgetType widget) const
- virtual KThemePixmap * scalePixmap (int w, int h, WidgetType widget)
- QImage* image (WidgetType widget) const
- QColor* gradientHigh (WidgetType widget) const
- QColor* gradientLow (WidgetType widget) const
- void readConfig (Qt::GUIStyle colorStyle = Qt::WindowsStyle)
- void readWidgetConfig (int i, KConfig *config, QString *pixnames, QString *brdnames, bool *loadArray)
- void copyWidgetConfig (int sourceID, int destID, QString *pixnames, QString *brdnames)
- QColorGroup* makeColorGroup (QColor &fg, QColor &bg, Qt::GUIStyle style = Qt::WindowsStyle)
- KThemePixmap* scale (int w, int h, WidgetType widget)
- KThemePixmap* scaleBorder (int w, int h, WidgetType type)
- KThemePixmap* gradient (int w, int h, WidgetType widget)
- KThemePixmap* blend (WidgetType widget)
- void generateBorderPix (int i)
- void applyResourceGroup (KConfig *config, int i)
- void applyMiscResourceGroup (KConfig *config)
- void readResourceGroup (int i, QString *pixnames, QString *brdnames, bool *loadArray)
- void readMiscResourceGroup ()
- KThemePixmap* loadPixmap (QString &name)
- QImage* loadImage (QString &name)
- inline bool isPixmap ( WidgetType widget) const
- inline bool isColor (WidgetType widget) const
- inline bool is3DFocus () const
- inline int focusOffset () const
- inline int bevelContrast (WidgetType widget) const
- inline KThemeBase::ScaleHint scaleHint (WidgetType widget) const
- inline KThemeBase::Gradient gradientHint (WidgetType widget) const
- inline KThemePixmap* uncached (WidgetType widget) const
- inline QBrush pixmapBrush (const QColorGroup &group, QColorGroup::ColorRole role, int w, int h, WidgetType widget)
- inline const QColorGroup* colorGroup (const QColorGroup &defaultGroup, WidgetType widget) const
- inline int borderWidth (WidgetType widget) const
- inline int pixBorderWidth (WidgetType widget) const
- inline int highlightWidth (WidgetType widget) const
- inline int decoWidth (WidgetType widget) const
- inline QColor* gradientHigh (WidgetType widget) const
- inline QColor* gradientLow (WidgetType widget) const
- inline QImage* image (WidgetType widget) const
- inline KThemeBase::SButton scrollBarLayout () const
- inline KThemeBase::ArrowStyle arrowType () const
- inline KThemeBase::ShadeStyle shade () const
- inline int frameWidth () const
- inline int buttonXShift () const
- inline int splitWidth () const
- inline int buttonYShift () const
- inline int sliderButtonLength () const
- inline bool roundButton () const
- inline bool roundComboBox () const
- inline bool roundSlider () const
- inline bool activeTabLine () const
- inline bool inactiveTabLine () const
- inline int getSBExtent () const
- inline KThemePixmap* borderPixmap (WidgetType widget)
Public Static Methods
Protected Methods
- KThemeBase (const QString &configFile)
- ~KThemeBase ()
- ScaleHint scaleHint (WidgetType widget) const
- Gradient gradientHint (WidgetType widget) const
- const QColorGroup* colorGroup (const QColorGroup &defaultGroup, WidgetType widget) const
- QBrush pixmapBrush (const QColorGroup &group, QColorGroup::ColorRole role, int w, int h, WidgetType widget)
- bool isPixmap (WidgetType widget) const
- bool isColor (WidgetType widget) const
- bool is3DFocus () const
- int focusOffset () const
- int borderWidth (WidgetType widget) const
- int pixBorderWidth (WidgetType widget) const
- KThemePixmap* borderPixmap (WidgetType widget)
- int highlightWidth (WidgetType widget) const
- int decoWidth (WidgetType widget) const
- int getSBExtent () const
- SButton scrollBarLayout () const
- ArrowStyle arrowType () const
- ShadeStyle shade () const
- int frameWidth () const
- int splitWidth () const
- int bevelContrast (WidgetType widget) const
- int buttonXShift () const
- int buttonYShift () const
- int sliderButtonLength () const
- bool roundButton () const
- bool roundComboBox () const
- bool roundSlider () const
- bool activeTabLine () const
- bool inactiveTabLine () const
- KThemePixmap* uncached (WidgetType widget) const
- virtual KThemePixmap * scalePixmap (int w, int h, WidgetType widget)
- QImage* image (WidgetType widget) const
- QColor* gradientHigh (WidgetType widget) const
- QColor* gradientLow (WidgetType widget) const
- void readConfig (Qt::GUIStyle colorStyle = Qt::WindowsStyle)
- void readWidgetConfig (int i, KConfig *config, QString *pixnames, QString *brdnames, bool *loadArray)
- void copyWidgetConfig (int sourceID, int destID, QString *pixnames, QString *brdnames)
- QColorGroup* makeColorGroup (QColor &fg, QColor &bg, Qt::GUIStyle style = Qt::WindowsStyle)
- KThemePixmap* scale (int w, int h, WidgetType widget)
- KThemePixmap* scaleBorder (int w, int h, WidgetType type)
- KThemePixmap* gradient (int w, int h, WidgetType widget)
- KThemePixmap* blend (WidgetType widget)
- void generateBorderPix (int i)
- void applyResourceGroup (KConfig *config, int i)
- void applyMiscResourceGroup (KConfig *config)
- void readResourceGroup (int i, QString *pixnames, QString *brdnames, bool *loadArray)
- void readMiscResourceGroup ()
- KThemePixmap* loadPixmap (QString &name)
- QImage* loadImage (QString &name)
- inline bool isPixmap ( WidgetType widget) const
- inline bool isColor (WidgetType widget) const
- inline bool is3DFocus () const
- inline int focusOffset () const
- inline int bevelContrast (WidgetType widget) const
- inline KThemeBase::ScaleHint scaleHint (WidgetType widget) const
- inline KThemeBase::Gradient gradientHint (WidgetType widget) const
- inline KThemePixmap* uncached (WidgetType widget) const
- inline QBrush pixmapBrush (const QColorGroup &group, QColorGroup::ColorRole role, int w, int h, WidgetType widget)
- inline const QColorGroup* colorGroup (const QColorGroup &defaultGroup, WidgetType widget) const
- inline int borderWidth (WidgetType widget) const
- inline int pixBorderWidth (WidgetType widget) const
- inline int highlightWidth (WidgetType widget) const
- inline int decoWidth (WidgetType widget) const
- inline QColor* gradientHigh (WidgetType widget) const
- inline QColor* gradientLow (WidgetType widget) const
- inline QImage* image (WidgetType widget) const
- inline KThemeBase::SButton scrollBarLayout () const
- inline KThemeBase::ArrowStyle arrowType () const
- inline KThemeBase::ShadeStyle shade () const
- inline int frameWidth () const
- inline int buttonXShift () const
- inline int splitWidth () const
- inline int buttonYShift () const
- inline int sliderButtonLength () const
- inline bool roundButton () const
- inline bool roundComboBox () const
- inline bool roundSlider () const
- inline bool activeTabLine () const
- inline bool inactiveTabLine () const
- inline int getSBExtent () const
- inline KThemePixmap* borderPixmap (WidgetType widget)
This is a base class for KDE themed styles. It implements a cache,
configuration file parsing, pixmap scaling, gradients, and a lot
of inline methods for accessing user specified parameters.
Note that this class *does not* actually implement any themes. It just
provides the groundwork for doing so. The only reason to use this class
directly is if you plan to reimplement all of the widgets. Otherwise,
refer to KThemeStyle for a fully themed style you can derive from.
KThemeBase (const QString &configFile)
|
Constructs a new KThemeBase object.
enum ScaleHint {FullScale, HorizontalScale, VerticalScale, TileScale};
}
|
Describes if a pixmap should be scaled fully, horizontally, vertically,
or not at all and tiled.
enum ArrowStyle {MotifArrow, LargeArrow, SmallArrow};
}
|
The default arrow types.
enum ShadeStyle {Motif, Windows, Next, KDE};
}
|
The default frame shading styles.
enum SButton {SBBottomLeft, SBBottomRight, SBOpposite};
}
|
The default scrollbar button layout. BottomLeft is like what Next
uses, BottomRight is like Platinum, and Opposite it like Windows and
Motif.
enum Gradient {GrNone, GrHorizontal, GrVertical, GrDiagonal, GrPyramid, GrRectangle, GrElliptic, GrReverseBevel}
|
The gradient types. Horizontal is left to right, Vertical is top to
bottom, and diagonal is upper-left to bottom-right.
enum WidgetType {PushButton=0, ComboBox, HScrollBarSlider, VScrollBarSlider, Bevel, ToolButton, ScrollButton, HScrollDeco, VScrollDeco, ComboDeco, MenuItem, InactiveTab, ArrowUp, ArrowDown, ArrowLeft, ArrowRight, PushButtonDown, ComboBoxDown, HScrollBarSliderDown, VScrollBarSliderDown, BevelDown, ToolButtonDown, ScrollButtonDown, HScrollDecoDown, VScrollDecoDown, ComboDecoDown, MenuItemDown, ActiveTab, SunkenArrowUp, SunkenArrowDown, SunkenArrowLeft, SunkenArrowRight, HScrollGroove, VScrollGroove, Slider, SliderGroove, IndicatorOn, IndicatorOff, ExIndicatorOn, ExIndicatorOff, HBarHandle, VBarHandle, ToolBar, Splitter, CheckMark, MenuBar, DisArrowUp, DisArrowDown, DisArrowLeft, DisArrowRight, ProgressBar, ProgressBg, MenuBarItem, Background}
|
This provides a list of widget types that KThemeBase recognizes.
ScaleHint scaleHint (WidgetType widget)
|
[const]
The scaling type specified by the KConfig file.
Parameters:
widget | A Widgets enum value.
|
Returns: A ScaleHint enum value.
Gradient gradientHint (WidgetType widget)
|
[const]
The gradient type specified by the KConfig file.
Parameters:
widget | A Widgets enum value.
|
Returns: A Gradient enum value.
const QColorGroup* colorGroup (const QColorGroup &defaultGroup, WidgetType widget)
|
[const]
The color group specified for a given widget.
If a color group is set in the theme configuration
that is used, otherwise defaultColor is returned.
Parameters:
defaultColor | The colorGroup to set if one is available.
|
widget | The widget whose color group to retrieve.
|
QBrush pixmapBrush (const QColorGroup &group, QColorGroup::ColorRole role, int w, int h, WidgetType widget)
|
bool isPixmap (WidgetType widget)
|
[const]
True if the widget has a pixmap or gradient specified.
bool isColor (WidgetType widget)
|
[const]
True if the widget has a color group specified.
[const]
True if the user specified a 3D focus rectangle
[const]
If the user specified a 3D focus rectangle, they may also specify an
offset from the default rectangle to use when drawing it. This returns
the specified offset.
int borderWidth (WidgetType widget)
|
[const]
The border width of the specified widget.
int pixBorderWidth (WidgetType widget)
|
[const]
Pixmap border width of the specified widget.
Returns the border pixmap if enabled for the specified widget. This
will contain the originial pixmap, plus the edges separated in
KThemePixmap::border() if valid. If invalid it will return NULL.
int highlightWidth (WidgetType widget)
|
[const]
The highlight width of the specified widget.
int decoWidth (WidgetType widget)
|
[const]
The border plus highlight width of the widget.
[const]
The extent (width for vertical, height for horizontal) requested
for the scrollbars.
SButton scrollBarLayout ()
|
[const]
The scrollbar button layout.
[const]
The arrow type.
[const]
The shading type.
[const]
The frame width.
[const]
The splitter width.
int bevelContrast (WidgetType widget)
|
[const]
The contrast for some bevel effects such as reverse gradient.
[const]
The button text X shift.
[const]
The button text Y shift.
int sliderButtonLength ()
|
[const]
Returns either the slider length of the slider pixmap if available,
otherwise the length specified in the config file.
[const]
True if rounded buttons are requested.
[const]
True if rounded comboboxes are requested.
[const]
True if rounded slider grooves are requested.
[const]
True if a line should be drawn on the bottom of active tabs.
[const]
True if a line should be drawn on the bottom of inactive tabs.
[const]
Returns the current uncached pixmap for the given widget. This will
usually be either the last scaled or gradient pixmap if those have
been specified in the config file, the original pixmap if not, or NULL
if no pixmap has been specified.
KThemePixmap * scalePixmap (int w, int h, WidgetType widget)
|
[virtual]
Returns the pixmap for the given widget at the specified width and
height. This will return NULL if no pixmap or gradient is specified.
It may also return a different sized pixmap if the scaling
is set to Tiled. When using this method, you should call it using
the needed width and height then use QPainter::drawTiledPixmap to
paint it. Doing this, if the pixmap is scaled it will be the proper
size, otherwise it will be tiled.
Parameters:
w | Requested width.
|
h | Requested height.
|
widget | Widget type.
|
Returns: The pixmap or NULL if one is not specified.
void applyConfigFile (const QString &file)
|
[static]
This method reads a configuration file and applies it to the user's
kstylerc file. It does not signal applications to reload via the
KDEChangeGeneral atom, if you want to do this you must do so yourself.
See kcmdisplay's general.cpp for an example.
Parameters:
file | The configuration file to apply.
|
QImage* image (WidgetType widget)
|
[protected:
const]
Returns a QImage for the given widget if the widget is scaled, NULL
otherwise. QImages of the original pixmap are stored for scaled
widgets in order to facilitate fast and accurate smooth-scaling. This
also saves us a conversion from a pixmap to an image then back again.
QColor* gradientHigh (WidgetType widget)
|
[protected:
const]
Returns the gradient high color if one is specified, NULL otherwise.
QColor* gradientLow (WidgetType widget)
|
[protected:
const]
Returns the gradient low color if one is specified, NULL otherwise.
void readConfig (Qt::GUIStyle colorStyle = Qt::WindowsStyle)
|
[protected:
]
Reads in all the configuration file entries supported.
Parameters:
colorStyle | The style for the color groups. In KDE, colors were
calculated a little differently for Motif vs Windows styles. This
is obsolete.
|
[protected:
]
void copyWidgetConfig (int sourceID, int destID, QString *pixnames, QString *brdnames)
|
[protected:
]
QColorGroup* makeColorGroup (QColor &fg, QColor &bg, Qt::GUIStyle style = Qt::WindowsStyle)
|
[protected:
]
Makes a full color group based on the given foreground and background
colors. This is the same code used by KDE (kapp.cpp) in previous
versions.
[protected:
]
[protected:
]
[protected:
]
[protected:
]
void generateBorderPix (int i)
|
[protected:
]
void applyResourceGroup (KConfig *config, int i)
|
[protected:
]
void applyMiscResourceGroup (KConfig *config)
|
[protected:
]
void readResourceGroup (int i, QString *pixnames, QString *brdnames, bool *loadArray)
|
[protected:
]
void readMiscResourceGroup ()
|
[protected:
]
[protected:
]
Attempts to load a pixmap from the default KThemeBase locations.
[protected:
]
Attempts to load a image from the default KThemeBase locations.
- Author: Daniel M. Duley <mosfet@kde.org>
- Generated: marc@yogi on Tue Mar 27 13:07:09 2001, using kdoc 2.0a48.