class KThemeBase

This is a base class for KDE themed styles. More...

Definition#include <kthemebase.h>
InheritsKStyle (kdecore) [public ]
Inherited byKThemeStyle
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods

Public Static Methods

Protected Methods


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:
widgetA Widgets enum value.

Returns: A ScaleHint enum value.

Gradient  gradientHint (WidgetType widget)

gradientHint

[const]

The gradient type specified by the KConfig file.

Parameters:
widgetA 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:
defaultColorThe colorGroup to set if one is available.
widgetThe 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.

KThemePixmapscalePixmap (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:
wRequested width.
hRequested height.
widgetWidget 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:
fileThe 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:
colorStyleThe 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.