KStyle Class Reference
Simplifies and extends the QStyle API to make style coding easier. More...
#include <kstyle.h>
Inheritance diagram for KStyle:

Public Types | |
typedef uint | KStyleFlags |
enum | KStyleOption { Default = 0x00000000, AllowMenuTransparency = 0x00000001, FilledFrameWorkaround = 0x00000002 } |
enum | KStyleScrollBarType { WindowsStyleScrollBar = 0x00000000, PlatinumStyleScrollBar = 0x00000001, ThreeButtonScrollBar = 0x00000002, NextStyleScrollBar = 0x00000004 } |
enum | KStylePrimitive { KPE_DockWindowHandle, KPE_ToolBarHandle, KPE_GeneralHandle, KPE_SliderGroove, KPE_SliderHandle, KPE_ListViewExpander, KPE_ListViewBranch } |
enum | KStylePixelMetric { KPM_MenuItemSeparatorHeight = 0x00000001, KPM_MenuItemHMargin = 0x00000002, KPM_MenuItemVMargin = 0x00000004, KPM_MenuItemHFrame = 0x00000008, KPM_MenuItemVFrame = 0x00000010, KPM_MenuItemCheckMarkHMargin = 0x00000020, KPM_MenuItemArrowHMargin = 0x00000040, KPM_MenuItemTabSpacing = 0x00000080, KPM_ListViewBranchThickness = 0x00000100 } |
Public Member Functions | |
KStyle (KStyleFlags flags=KStyle::Default, KStyleScrollBarType sbtype=KStyle::WindowsStyleScrollBar) | |
~KStyle () | |
void | setScrollBarType (KStyleScrollBarType sbtype) |
KStyleFlags | styleFlags () const |
virtual void | renderMenuBlendPixmap (KPixmap &pix, const QColorGroup &cg, const QPopupMenu *popup) const |
virtual void | drawKStylePrimitive (KStylePrimitive kpe, QPainter *p, const QWidget *widget, const QRect &r, const QColorGroup &cg, SFlags flags=Style_Default, const QStyleOption &=QStyleOption::Default) const |
int | kPixelMetric (KStylePixelMetric kpm, const QWidget *widget=0) const |
void | polish (QWidget *widget) |
void | unPolish (QWidget *widget) |
void | polishPopupMenu (QPopupMenu *) |
void | drawPrimitive (PrimitiveElement pe, QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags=Style_Default, const QStyleOption &=QStyleOption::Default) const |
void | drawControl (ControlElement element, QPainter *p, const QWidget *widget, const QRect &r, const QColorGroup &cg, SFlags flags=Style_Default, const QStyleOption &=QStyleOption::Default) const |
void | drawComplexControl (ComplexControl control, QPainter *p, const QWidget *widget, const QRect &r, const QColorGroup &cg, SFlags flags=Style_Default, SCFlags controls=SC_All, SCFlags active=SC_None, const QStyleOption &=QStyleOption::Default) const |
SubControl | querySubControl (ComplexControl control, const QWidget *widget, const QPoint &pos, const QStyleOption &=QStyleOption::Default) const |
QRect | querySubControlMetrics (ComplexControl control, const QWidget *widget, SubControl sc, const QStyleOption &=QStyleOption::Default) const |
int | pixelMetric (PixelMetric m, const QWidget *widget=0) const |
QRect | subRect (SubRect r, const QWidget *widget) const |
QPixmap | stylePixmap (StylePixmap stylepixmap, const QWidget *widget=0, const QStyleOption &=QStyleOption::Default) const |
int | styleHint (StyleHint sh, const QWidget *w=0, const QStyleOption &opt=QStyleOption::Default, QStyleHintReturn *shr=0) const |
Static Public Member Functions | |
QString | defaultStyle () |
Protected Member Functions | |
bool | eventFilter (QObject *object, QEvent *event) |
virtual void | virtual_hook (int id, void *data) |
Related Functions | |
(Note that these are not member functions.) | |
void | kDrawNextButton (QPainter *p, const QRect &r, const QColorGroup &g, bool sunken=false, const QBrush *fill=0) |
void | kDrawNextButton (QPainter *p, int x, int y, int w, int h, const QColorGroup &g, bool sunken=false, const QBrush *fill=0) |
void | kDrawBeButton (QPainter *p, QRect &r, const QColorGroup &g, bool sunken=false, const QBrush *fill=0) |
void | kDrawBeButton (QPainter *p, int x, int y, int w, int h, const QColorGroup &g, bool sunken=false, const QBrush *fill=0) |
void | kDrawRoundButton (QPainter *p, const QRect &r, const QColorGroup &g, bool sunken=false) |
void | kDrawRoundButton (QPainter *p, int x, int y, int w, int h, const QColorGroup &g, bool sunken=false) |
void | kRoundMaskRegion (QRegion &r, int x, int y, int w, int h) |
void | kDrawRoundMask (QPainter *p, int x, int y, int w, int h, bool clear=false) |
void | kColorBitmaps (QPainter *p, const QColorGroup &g, int x, int y, QBitmap *lightColor=0, QBitmap *midColor=0, QBitmap *midlightColor=0, QBitmap *darkColor=0, QBitmap *blackColor=0, QBitmap *whiteColor=0) |
void | kColorBitmaps (QPainter *p, const QColorGroup &g, int x, int y, int w, int h, bool isXBitmaps=true, const uchar *lightColor=0, const uchar *midColor=0, const uchar *midlightColor=0, const uchar *darkColor=0, const uchar *blackColor=0, const uchar *whiteColor=0) |
Detailed Description
Simplifies and extends the QStyle API to make style coding easier.The KStyle class provides a simple internal menu transparency engine which attempts to use XRender for accelerated blending where requested, or falls back to fast internal software tinting/blending routines. It also simplifies more complex portions of the QStyle API, such as the PopupMenuItems, ScrollBars and Sliders by providing extra "primitive elements" which are simple to implement by the style writer.
- See also:
- QStyle::QStyle
QCommonStyle::QCommonStyle
- Author:
- Karol Szwed (gallium@kde.org)
- Version:
- Id
- kstyle.h,v 1.15 2003/10/07 22:40:42 mueller Exp
Definition at line 55 of file kstyle.h.
Member Typedef Documentation
|
KStyle Flags:.
Referenced by KStyle(), and styleFlags(). |
Member Enumeration Documentation
|
|
|
KStyle ScrollBarType:. Allows the style writer to easily select what type of scrollbar should be used without having to duplicate large amounts of source code by implementing the complex control CC_ScrollBar.
|
|
KStyle Primitive Elements:. The KStyle class extends the Qt's Style API by providing certain simplifications for parts of QStyle. To do this, the KStylePrimitive elements were defined, which are very similar to Qt's PrimitiveElement. The first three Handle primitives simplify and extend PE_DockWindowHandle, so do not reimplement PE_DockWindowHandle if you want the KStyle handle simplifications to be operable. Similarly do not reimplement CC_Slider, SC_SliderGroove and SC_SliderHandle when using the KStyle slider primitives. KStyle automatically double-buffers slider painting when they are drawn via these KStyle primitives to avoid flicker.
|
Constructor & Destructor Documentation
|
Constructs a KStyle object. Select the appropriate KStyle flags and scrollbar type for your style. The user's style preferences selected in KControl are read by using QSettings and are automatically applied to the style. As a fallback, KStyle paints progressbars and tabbars. It inherits from QCommonStyle for speed, so don't expect much to be implemented. It is advisable to use a currently implemented style such as the HighColor style as a foundation for any new KStyle, so the limited number of drawing fallbacks should not prove problematic.
References AllowMenuTransparency, FilledFrameWorkaround, and KStyleFlags. |
|
Destructs the KStyle object. Definition at line 226 of file kstyle.cpp. |
Member Function Documentation
|
Returns the default widget style depending on color depth. Definition at line 238 of file kstyle.cpp. |
|
Modifies the scrollbar type used by the style. This function is only provided for convenience. It allows you to make a late decision about what scrollbar type to use for the style after performing some processing in your style's constructor. In most situations however, setting the scrollbar type via the KStyle constructor should suffice.
|
|
Returns the KStyle flags used to initialize the style. This is used solely for the kcmstyle module, and hence is internal.Definition at line 295 of file kstyle.cpp. References KStyleFlags. |
|
This virtual function defines the pixmap used to blend between the popup menu and the background to create different menu transparency effects. For example, you can fill the pixmap "pix" with a gradient based on the popup's colorGroup, a texture, or some other fancy painting routine. KStyle will then internally blend this pixmap with a snapshot of the background behind the popupMenu to create the illusion of transparency. This virtual is never called if XRender/Software blending is disabled by the user in KDE's style control module.Definition at line 300 of file kstyle.cpp. |
|
This function is identical to Qt's QStyle::drawPrimitive(), except that it adds one further parameter, 'widget', that can be used to determine the widget state of the KStylePrimitive in question.
References QFont::pointSize(). |
Friends And Related Function Documentation
|
Draws a Next-style button (solid black shadow with light and midlight highlight).
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Definition at line 21 of file kdrawutil.cpp. |
|
Draws a Be-style button.
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Definition at line 49 of file kdrawutil.cpp. |
|
Draws a rounded oval button. This function doesn't fill the button. See kRoundMaskRegion() for setting masks for fills.
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Definition at line 139 of file kdrawutil.cpp. |
|
Sets a region to the pixels covered by a round button of the given size. You can use this to set clipping regions.
|
|
Paints the pixels covered by a round button of the given size with Qt::color1. This function is useful in QStyle::drawControlMask().
|
|
Paints the provided bitmaps in the painter, using the supplied colorgroup for the foreground colors. There's one bitmap for each color. If you want to skip a color, pass null for the corresponding bitmap.
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Definition at line 239 of file kdrawutil.cpp. |
The documentation for this class was generated from the following files: