# class KThemeBase | This is a base class for KDE themed styles. More...
Definition | `#include <kthemebase.h>`
Inherits | KStyle (kdecore) [public ]
Inherited by | KThemeStyle
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### 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)

#### Public Static Methods

- static void applyConfigFile (const QString &file)

#### Protected Methods

- 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)

## Detailed Description

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) | ### KThemeBase

Constructs a new KThemeBase object.

~KThemeBase () | ### ~KThemeBase

enum ScaleHint {FullScale, HorizontalScale, VerticalScale, TileScale} | ### ScaleHint

Describes if a pixmap should be scaled fully, horizontally, vertically, or not at all and tiled.

enum ArrowStyle {MotifArrow, LargeArrow, SmallArrow} | ### ArrowStyle

The default arrow types.

enum ShadeStyle {Motif, Windows, Next, KDE} | ### ShadeStyle

The default frame shading styles.

enum SButton {SBBottomLeft, SBBottomRight, SBOpposite} | ### SButton

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} | ### Gradient

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} | ### WidgetType

This provides a list of widget types that KThemeBase recognizes.

ScaleHint scaleHint (WidgetType widget) | ### scaleHint

[const]

The scaling type specified by the KConfig file.

Parameters:

widget | A Widgets enum value.

Returns: A ScaleHint enum value.

Gradient gradientHint (WidgetType widget) | ### gradientHint

[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) | ### colorGroup

[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) | ### pixmapBrush

bool isPixmap (WidgetType widget) | ### isPixmap

[const]

True if the widget has a pixmap or gradient specified.

bool isColor (WidgetType widget) | ### isColor

[const]

True if the widget has a color group specified.

bool is3DFocus () | ### is3DFocus

[const]

True if the user specified a 3D focus rectangle

int focusOffset () | ### focusOffset

[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) | ### borderWidth

[const]

The border width of the specified widget.

int pixBorderWidth (WidgetType widget) | ### pixBorderWidth

[const]

Pixmap border width of the specified widget.

KThemePixmap* borderPixmap (WidgetType widget) | ### borderPixmap

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) | ### highlightWidth

[const]

The highlight width of the specified widget.

int decoWidth (WidgetType widget) | ### decoWidth

[const]

The border plus highlight width of the widget.

int getSBExtent () | ### getSBExtent

[const]

The extent (width for vertical, height for horizontal) requested for the scrollbars.

SButton scrollBarLayout () | ### scrollBarLayout

[const]

The scrollbar button layout.

ArrowStyle arrowType () | ### arrowType

[const]

The arrow type.

ShadeStyle shade () | ### shade

[const]

The shading type.

int frameWidth () | ### frameWidth

[const]

The frame width.

int splitWidth () | ### splitWidth

[const]

The splitter width.

int bevelContrast (WidgetType widget) | ### bevelContrast

[const]

The contrast for some bevel effects such as reverse gradient.

int buttonXShift () | ### buttonXShift

[const]

The button text X shift.

int buttonYShift () | ### buttonYShift

[const]

The button text Y shift.

int sliderButtonLength () | ### sliderButtonLength

[const]

Returns either the slider length of the slider pixmap if available, otherwise the length specified in the config file.

bool roundButton () | ### roundButton

[const]

True if rounded buttons are requested.

bool roundComboBox () | ### roundComboBox

[const]

True if rounded comboboxes are requested.

bool roundSlider () | ### roundSlider

[const]

True if rounded slider grooves are requested.

bool activeTabLine () | ### activeTabLine

[const]

True if a line should be drawn on the bottom of active tabs.

bool inactiveTabLine () | ### inactiveTabLine

[const]

True if a line should be drawn on the bottom of inactive tabs.

KThemePixmap* uncached (WidgetType widget) | ### uncached

[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) | ### scalePixmap

[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) | ### applyConfigFile

[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) | ### image

[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) | ### gradientHigh

[protected const]

Returns the gradient high color if one is specified, NULL otherwise.

QColor* gradientLow (WidgetType widget) | ### gradientLow

[protected const]

Returns the gradient low color if one is specified, NULL otherwise.

void readConfig (Qt::GUIStyle colorStyle = Qt::WindowsStyle) | ### readConfig

[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.

void readWidgetConfig (int i, KConfig *config, QString *pixnames, QString *brdnames, bool *loadArray) | ### readWidgetConfig

[protected]

void copyWidgetConfig (int sourceID, int destID, QString *pixnames, QString *brdnames) | ### copyWidgetConfig

[protected]

QColorGroup* makeColorGroup (QColor &fg, QColor &bg, Qt::GUIStyle style = Qt::WindowsStyle) | ### makeColorGroup

[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.

KThemePixmap* scale (int w, int h, WidgetType widget) | ### scale

[protected]

KThemePixmap* scaleBorder (int w, int h, WidgetType type) | ### scaleBorder

[protected]

KThemePixmap* gradient (int w, int h, WidgetType widget) | ### gradient

[protected]

KThemePixmap* blend (WidgetType widget) | ### blend

[protected]

void generateBorderPix (int i) | ### generateBorderPix

[protected]

void applyResourceGroup (KConfig *config, int i) | ### applyResourceGroup

[protected]

void applyMiscResourceGroup (KConfig *config) | ### applyMiscResourceGroup

[protected]

void readResourceGroup (int i, QString *pixnames, QString *brdnames, bool *loadArray) | ### readResourceGroup

[protected]

void readMiscResourceGroup () | ### readMiscResourceGroup

[protected]

KThemePixmap* loadPixmap (QString &name) | ### loadPixmap

[protected]

Attempts to load a pixmap from the default KThemeBase locations.

QImage* loadImage (QString &name) | ### loadImage

[protected]

Attempts to load a image from the default KThemeBase locations.

- Author: Daniel M. Duley <mosfet@kde.org>
- Generated: root@sparc.ports.openbsd.org on Wed May 2 09:37:45 2001, using kdoc 2.0a53.