• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kdefx
 

kdefx

Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions | List of all members
KStyle Class Reference

#include <kstyle.h>

Inherits TQCommonStyle.

Public Types

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
}
 
typedef uint KStyleFlags
 

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 TQColorGroup &cg, const TQPopupMenu *popup) const
 
virtual void drawKStylePrimitive (KStylePrimitive kpe, TQPainter *p, const TQWidget *widget, const TQRect &r, const TQColorGroup &cg, SFlags flags=Style_Default, const TQStyleOption &=TQStyleOption::SO_Default) const
 
int kPixelMetric (KStylePixelMetric kpm, const TQWidget *widget=0) const
 
void polish (TQWidget *widget)
 
void unPolish (TQWidget *widget)
 
void polishPopupMenu (TQPopupMenu *)
 
void tqdrawPrimitive (TQ_PrimitiveElement pe, TQPainter *p, const TQRect &r, const TQColorGroup &cg, SFlags flags=Style_Default, const TQStyleOption &=TQStyleOption::SO_Default) const
 
void drawControl (TQ_ControlElement element, TQPainter *p, const TQWidget *widget, const TQRect &r, const TQColorGroup &cg, SFlags flags=Style_Default, const TQStyleOption &=TQStyleOption::SO_Default) const
 
void drawComplexControl (TQ_ComplexControl control, TQPainter *p, const TQWidget *widget, const TQRect &r, const TQColorGroup &cg, SFlags flags=Style_Default, SCFlags controls=SC_All, SCFlags active=SC_None, const TQStyleOption &=TQStyleOption::SO_Default) const
 
SubControl querySubControl (TQ_ComplexControl control, const TQWidget *widget, const TQPoint &pos, const TQStyleOption &=TQStyleOption::SO_Default) const
 
TQRect querySubControlMetrics (TQ_ComplexControl control, const TQWidget *widget, SubControl sc, const TQStyleOption &=TQStyleOption::SO_Default) const
 
int pixelMetric (PixelMetric m, const TQWidget *widget=0) const
 
TQRect subRect (SubRect r, const TQWidget *widget) const
 
TQPixmap stylePixmap (StylePixmap stylepixmap, const TQWidget *widget=0, const TQStyleOption &=TQStyleOption::SO_Default) const
 
int styleHint (TQ_StyleHint sh, const TQWidget *w=0, const TQStyleOption &opt=TQStyleOption::SO_Default, TQStyleHintReturn *shr=0) const
 

Static Public Member Functions

static TQString defaultStyle ()
 

Protected Member Functions

bool eventFilter (TQObject *object, TQEvent *event)
 
virtual void virtual_hook (int id, void *data)
 

Related Functions

(Note that these are not member functions.)

KDEFX_EXPORT void kDrawNextButton (TQPainter *p, const TQRect &r, const TQColorGroup &g, bool sunken=false, const TQBrush *fill=0)
 
KDEFX_EXPORT void kDrawNextButton (TQPainter *p, int x, int y, int w, int h, const TQColorGroup &g, bool sunken=false, const TQBrush *fill=0)
 
KDEFX_EXPORT void kDrawBeButton (TQPainter *p, TQRect &r, const TQColorGroup &g, bool sunken=false, const TQBrush *fill=0)
 
KDEFX_EXPORT void kDrawBeButton (TQPainter *p, int x, int y, int w, int h, const TQColorGroup &g, bool sunken=false, const TQBrush *fill=0)
 
KDEFX_EXPORT void kDrawRoundButton (TQPainter *p, const TQRect &r, const TQColorGroup &g, bool sunken=false)
 
KDEFX_EXPORT void kDrawRoundButton (TQPainter *p, int x, int y, int w, int h, const TQColorGroup &g, bool sunken=false)
 
KDEFX_EXPORT void kRoundMaskRegion (TQRegion &r, int x, int y, int w, int h)
 
KDEFX_EXPORT void kDrawRoundMask (TQPainter *p, int x, int y, int w, int h, bool clear=false)
 
KDEFX_EXPORT void kColorBitmaps (TQPainter *p, const TQColorGroup &g, int x, int y, TQBitmap *lightColor=0, TQBitmap *midColor=0, TQBitmap *midlightColor=0, TQBitmap *darkColor=0, TQBitmap *blackColor=0, TQBitmap *whiteColor=0)
 
KDEFX_EXPORT void kColorBitmaps (TQPainter *p, const TQColorGroup &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 TQStyle 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 TQStyle API, such as the PopupMenuItems, ScrollBars and Sliders by providing extra "primitive elements" which are simple to implement by the style writer.

See also
TQStyle::QStyle
TQCommonStyle::QCommonStyle
Author
Karol Szwed (galli.nosp@m.um@k.nosp@m.de.or.nosp@m.g)
Version
$Id$

Definition at line 57 of file kstyle.h.

Member Typedef Documentation

typedef uint KStyle::KStyleFlags

KStyle Flags:

  • Default - Default style setting, where menu transparency and the FilledFrameWorkaround are disabled.
  • AllowMenuTransparency - Enable this flag to use KStyle's internal menu transparency engine.
  • FilledFrameWorkaround - Enable this flag to facilitate proper repaints of QMenuBars and QToolBars when the style chooses to paint the interior of a TQFrame. The style primitives in question are PE_PanelMenuBar and PE_PanelDockWindow. The HighColor style uses this workaround to enable painting of gradients in menubars and toolbars.

Definition at line 80 of file kstyle.h.

Member Enumeration Documentation

enum KStyle::KStyleOption
Enumerator
Default 

All options disabled.

AllowMenuTransparency 

Internal transparency enabled.

FilledFrameWorkaround 

Filled frames enabled.

Definition at line 81 of file kstyle.h.

enum KStyle::KStylePrimitive

KStyle Primitive Elements:

The KStyle class extends the Qt's Style API by providing certain simplifications for parts of TQStyle. 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.

  • KPE_DockWindowHandle - This primitive is already implemented in KStyle, and paints a bevelled rect with the DockWindow caption text. Re-implement this primitive to perform other more fancy effects when drawing the dock window handle.
  • KPE_ToolBarHandle - This primitive must be reimplemented. It currently only paints a filled rectangle as default behavior. This primitive is used to render TQToolBar handles.
  • KPE_GeneralHandle - This primitive must be reimplemented. It is used to render general handles that are not part of a TQToolBar or TQDockWindow, such as the applet handles used in Kicker. The default implementation paints a filled rect of arbitrary color.
  • KPE_SliderGroove - This primitive must be reimplemented. It is used to paint the slider groove. The default implementation paints a filled rect of arbitrary color.
  • KPE_SliderHandle - This primitive must be reimplemented. It is used to paint the slider handle. The default implementation paints a filled rect of arbitrary color.
  • KPE_ListViewExpander - This primitive is already implemented in KStyle. It is used to draw the Expand/Collapse element in QListViews. To indicate the expanded state, the style flags are set to Style_Off, while Style_On implies collapsed.
  • KPE_ListViewBranch - This primitive is already implemented in KStyle. It is used to draw the ListView branches where necessary.

Definition at line 228 of file kstyle.h.

enum KStyle::KStyleScrollBarType

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.

  • WindowsStyleScrollBar - Two button scrollbar with the previous button at the top/left, and the next button at the bottom/right.
  • PlatinumStyleScrollBar - Two button scrollbar with both the previous and next buttons at the bottom/right.
  • ThreeButtonScrollBar - KDE style three button scrollbar with two previous buttons, and one next button. The next button is always at the bottom/right, whilst the two previous buttons are on either end of the scrollbar.
  • NextStyleScrollBar - Similar to the PlatinumStyle scroll bar, but with the buttons grouped on the opposite end of the scrollbar.
See also
KStyle::KStyle()
Enumerator
WindowsStyleScrollBar 

two button, windows style

PlatinumStyleScrollBar 

two button, platinum style

ThreeButtonScrollBar 

three buttons, KDE style

NextStyleScrollBar 

two button, NeXT style

Definition at line 110 of file kstyle.h.

Constructor & Destructor Documentation

KStyle::KStyle ( KStyleFlags  flags = KStyle::Default,
KStyleScrollBarType  sbtype = KStyle::WindowsStyleScrollBar 
)

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 TQSettings and are automatically applied to the style. As a fallback, KStyle paints progressbars and tabbars. It inherits from TQCommonStyle 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.

Parameters
flagsthe style to be applied
sbtypethe scroll bar type
See also
KStyle::KStyleFlags
KStyle::KStyleScrollBarType
Author
Karol Szwed (galli.nosp@m.um@k.nosp@m.de.or.nosp@m.g)

Definition at line 188 of file kstyle.cpp.

KStyle::~KStyle ( )

Destructs the KStyle object.

Definition at line 242 of file kstyle.cpp.

Member Function Documentation

TQString KStyle::defaultStyle ( )
static

Returns the default widget style depending on color depth.

Definition at line 254 of file kstyle.cpp.

void KStyle::drawKStylePrimitive ( KStylePrimitive  kpe,
TQPainter *  p,
const TQWidget *  widget,
const TQRect &  r,
const TQColorGroup &  cg,
SFlags  flags = Style_Default,
const TQStyleOption &  = TQStyleOption::SO_Default 
) const
virtual

This function is identical to Qt's TQStyle::tqdrawPrimitive(), except that it adds one further parameter, 'widget', that can be used to determine the widget state of the KStylePrimitive in question.

See also
KStyle::KStylePrimitive
TQStyle::tqdrawPrimitive
TQStyle::drawComplexControl

Definition at line 332 of file kstyle.cpp.

void KStyle::renderMenuBlendPixmap ( KPixmap &  pix,
const TQColorGroup &  cg,
const TQPopupMenu *  popup 
) const
virtual

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 325 of file kstyle.cpp.

void KStyle::setScrollBarType ( KStyleScrollBarType  sbtype)

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.

Parameters
sbtypethe scroll bar type
See also
KStyle::KStyleScrollBarType

Definition at line 315 of file kstyle.cpp.

KStyle::KStyleFlags KStyle::styleFlags ( ) const

Returns the KStyle flags used to initialize the style.

This is used solely for the kcmstyle module, and hence is internal.

Definition at line 320 of file kstyle.cpp.

Friends And Related Function Documentation

KDEFX_EXPORT void kColorBitmaps ( TQPainter *  p,
const TQColorGroup &  g,
int  x,
int  y,
TQBitmap *  lightColor = 0,
TQBitmap *  midColor = 0,
TQBitmap *  midlightColor = 0,
TQBitmap *  darkColor = 0,
TQBitmap *  blackColor = 0,
TQBitmap *  whiteColor = 0 
)
related

#include <kdrawutil.h>

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.

Note
The bitmaps will be self-masked automatically if not masked prior to calling this routine.
Parameters
pThe painter to use for drawing the bitmaps.
gSpecifies the shading colors.
xThe X coordinate at which to draw the bitmaps.
yThe Y coordinate at which to draw the bitmaps.
lightColorThe bitmap to use for the light part.
midColorThe bitmap to use for the mid part.
midlightColorThe bitmap to use for the midlight part.
darkColorThe bitmap to use for the dark part.
blackColorThe bitmap to use for the black part.
whiteColorThe bitmap to use for the white part.
See also
QColorGroup

Definition at line 217 of file kdrawutil.cpp.

KDEFX_EXPORT void kColorBitmaps ( TQPainter *  p,
const TQColorGroup &  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 
)
related

#include <kdrawutil.h> 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.

KDEFX_EXPORT void kDrawBeButton ( TQPainter *  p,
TQRect &  r,
const TQColorGroup &  g,
bool  sunken = false,
const TQBrush *  fill = 0 
)
related

#include <kdrawutil.h>

Draws a Be-style button.

Parameters
pThe painter to use for drawing the button.
rSpecifies the rect in which to draw the button.
gSpecifies the shading colors.
sunkenWhether to draw the button as sunken (pressed) or not.
fillThe brush to use for filling the interior of the button. Pass null to prevent the button from being filled.

Definition at line 93 of file kdrawutil.cpp.

KDEFX_EXPORT void kDrawBeButton ( TQPainter *  p,
int  x,
int  y,
int  w,
int  h,
const TQColorGroup &  g,
bool  sunken = false,
const TQBrush *  fill = 0 
)
related

#include <kdrawutil.h> 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.

KDEFX_EXPORT void kDrawNextButton ( TQPainter *  p,
const TQRect &  r,
const TQColorGroup &  g,
bool  sunken = false,
const TQBrush *  fill = 0 
)
related

#include <kdrawutil.h>

Draws a Next-style button (solid black shadow with light and midlight highlight).

Parameters
pThe painter to use for drawing the button.
rSpecifies the rect in which to draw the button.
gSpecifies the shading colors.
sunkenWhether to draw the button as sunken (pressed) or not.
fillThe brush to use for filling the interior of the button. Pass null to prevent the button from being filled.

Definition at line 43 of file kdrawutil.cpp.

KDEFX_EXPORT void kDrawNextButton ( TQPainter *  p,
int  x,
int  y,
int  w,
int  h,
const TQColorGroup &  g,
bool  sunken = false,
const TQBrush *  fill = 0 
)
related

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.

KDEFX_EXPORT void kDrawRoundButton ( TQPainter *  p,
const TQRect &  r,
const TQColorGroup &  g,
bool  sunken = false 
)
related

#include <kdrawutil.h>

Draws a rounded oval button. This function doesn't fill the button. See kRoundMaskRegion() for setting masks for fills.

Parameters
pThe painter to use for drawing the button.
rSpecifies the rect in which to draw the button.
gSpecifies the shading colors.
sunkenWhether to draw the button as sunken (pressed) or not.

Definition at line 99 of file kdrawutil.cpp.

KDEFX_EXPORT void kDrawRoundButton ( TQPainter *  p,
int  x,
int  y,
int  w,
int  h,
const TQColorGroup &  g,
bool  sunken = false 
)
related

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.

KDEFX_EXPORT void kDrawRoundMask ( TQPainter *  p,
int  x,
int  y,
int  w,
int  h,
bool  clear = false 
)
related

#include <kdrawutil.h>

Paints the pixels covered by a round button of the given size with Qt::color1. This function is useful in TQStyle::drawControlMask().

Parameters
pThe painter to use for drawing the button.
xThe X coordinate of the button.
yThe Y coordinate of the button.
wThe width of the button.
hThe height of the button.
clearWhether to clear the rectangle specified by (x, y, w, h) to Qt::color0 before drawing the mask.

Definition at line 148 of file kdrawutil.cpp.

KDEFX_EXPORT void kRoundMaskRegion ( TQRegion &  r,
int  x,
int  y,
int  w,
int  h 
)
related

#include <kdrawutil.h>

Sets a region to the pixels covered by a round button of the given size. You can use this to set clipping regions.

Parameters
rReference to the region to set.
xThe X coordinate of the button.
yThe Y coordinate of the button.
wThe width of the button.
hThe height of the button.
See also
kDrawRoundButton() and kDrawRoundMask()

Definition at line 197 of file kdrawutil.cpp.


The documentation for this class was generated from the following files:
  • kstyle.h
  • kdrawutil.h
  • kstyle.cpp

kdefx

Skip menu "kdefx"
  • Main Page
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

kdefx

Skip menu "kdefx"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kdefx by doxygen 1.8.8
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |