\section{KStyle Class Reference}
\label{classKStyle}\index{KStyle@{KStyle}}
Simplifies and extends the {\bf QStyle} API to make style coding easier.  


{\tt \#include $<$kstyle.h$>$}

Inheritance diagram for KStyle:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=62pt]{classKStyle__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KStyle:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=62pt]{classKStyle__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{CompactItemize}
\item 
typedef uint {\bf KStyle\-Flags}
\begin{CompactList}\small\item\em KStyle Flags:. \item\end{CompactList}\item 
enum {\bf KStyle\-Option} \{ {\bf Default} =  0x00000000, 
{\bf Allow\-Menu\-Transparency} =  0x00000001, 
{\bf Filled\-Frame\-Workaround} =  0x00000002
 \}
\item 
enum {\bf KStyle\-Scroll\-Bar\-Type} \{ {\bf Windows\-Style\-Scroll\-Bar} =  0x00000000, 
{\bf Platinum\-Style\-Scroll\-Bar} =  0x00000001, 
{\bf Three\-Button\-Scroll\-Bar} =  0x00000002, 
{\bf Next\-Style\-Scroll\-Bar} =  0x00000004
 \}
\begin{CompactList}\small\item\em KStyle Scroll\-Bar\-Type:. \item\end{CompactList}\item 
enum {\bf KStyle\-Primitive} \{ \par
{\bf KPE\_\-Dock\-Window\-Handle}, 
{\bf KPE\_\-Tool\-Bar\-Handle}, 
{\bf KPE\_\-General\-Handle}, 
{\bf KPE\_\-Slider\-Groove}, 
\par
{\bf KPE\_\-Slider\-Handle}, 
{\bf KPE\_\-List\-View\-Expander}, 
{\bf KPE\_\-List\-View\-Branch}
 \}
\begin{CompactList}\small\item\em KStyle Primitive Elements:. \item\end{CompactList}\item 
enum {\bf KStyle\-Pixel\-Metric} \{ \par
{\bf KPM\_\-Menu\-Item\-Separator\-Height} =  0x00000001, 
{\bf KPM\_\-Menu\-Item\-HMargin} =  0x00000002, 
{\bf KPM\_\-Menu\-Item\-VMargin} =  0x00000004, 
{\bf KPM\_\-Menu\-Item\-HFrame} =  0x00000008, 
\par
{\bf KPM\_\-Menu\-Item\-VFrame} =  0x00000010, 
{\bf KPM\_\-Menu\-Item\-Check\-Mark\-HMargin} =  0x00000020, 
{\bf KPM\_\-Menu\-Item\-Arrow\-HMargin} =  0x00000040, 
{\bf KPM\_\-Menu\-Item\-Tab\-Spacing} =  0x00000080, 
\par
{\bf KPM\_\-List\-View\-Branch\-Thickness} =  0x00000100
 \}
\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KStyle} ({\bf KStyle\-Flags} flags=KStyle::Default, {\bf KStyle\-Scroll\-Bar\-Type} sbtype=KStyle::Windows\-Style\-Scroll\-Bar)
\begin{CompactList}\small\item\em Constructs a KStyle object. \item\end{CompactList}\item 
{\bf $\sim$KStyle} ()
\begin{CompactList}\small\item\em Destructs the KStyle object. \item\end{CompactList}\item 
void {\bf set\-Scroll\-Bar\-Type} ({\bf KStyle\-Scroll\-Bar\-Type} sbtype)
\begin{CompactList}\small\item\em Modifies the scrollbar type used by the style. \item\end{CompactList}\item 
{\bf KStyle\-Flags} {\bf style\-Flags} () const 
\begin{CompactList}\small\item\em Returns the KStyle flags used to initialise the style. \item\end{CompactList}\item 
virtual void {\bf render\-Menu\-Blend\-Pixmap} ({\bf KPixmap} \&pix, const  {\bf QColor\-Group} \&cg, const  {\bf QPopup\-Menu} $\ast$popup) const 
\begin{CompactList}\small\item\em This virtual function defines the pixmap used to blend between the popup menu and the background to create different menu transparency effects. \item\end{CompactList}\item 
virtual void {\bf draw\-KStyle\-Primitive} ({\bf KStyle\-Primitive} kpe, {\bf QPainter} $\ast$p, const  {\bf QWidget} $\ast$widget, const  {\bf QRect} \&r, const  {\bf QColor\-Group} \&cg, SFlags flags=Style\_\-Default, const  {\bf QStyle\-Option} \&=QStyle\-Option::Default) const 
\begin{CompactList}\small\item\em This function is identical to Qt's {\bf QStyle::draw\-Primitive()}, except that it adds one further parameter, 'widget', that can be used to determine the widget state of the KStyle\-Primitive in question. \item\end{CompactList}\item 
int {\bf k\-Pixel\-Metric} (KStyle\-Pixel\-Metric kpm, const  {\bf QWidget} $\ast$widget=0) const \label{classKStyle_a6}

\item 
void {\bf polish} ({\bf QWidget} $\ast$widget)\label{classKStyle_a7}

\item 
void {\bf un\-Polish} ({\bf QWidget} $\ast$widget)\label{classKStyle_a8}

\item 
void {\bf polish\-Popup\-Menu} ({\bf QPopup\-Menu} $\ast$)\label{classKStyle_a9}

\item 
void {\bf draw\-Primitive} (Primitive\-Element pe, {\bf QPainter} $\ast$p, const  {\bf QRect} \&r, const  {\bf QColor\-Group} \&cg, SFlags flags=Style\_\-Default, const  {\bf QStyle\-Option} \&=QStyle\-Option::Default) const \label{classKStyle_a10}

\item 
void {\bf draw\-Control} (Control\-Element element, {\bf QPainter} $\ast$p, const  {\bf QWidget} $\ast$widget, const  {\bf QRect} \&r, const  {\bf QColor\-Group} \&cg, SFlags flags=Style\_\-Default, const  {\bf QStyle\-Option} \&=QStyle\-Option::Default) const \label{classKStyle_a11}

\item 
void {\bf draw\-Complex\-Control} (Complex\-Control control, {\bf QPainter} $\ast$p, const  {\bf QWidget} $\ast$widget, const  {\bf QRect} \&r, const  {\bf QColor\-Group} \&cg, SFlags flags=Style\_\-Default, SCFlags controls=SC\_\-All, SCFlags active=SC\_\-None, const  {\bf QStyle\-Option} \&=QStyle\-Option::Default) const \label{classKStyle_a12}

\item 
Sub\-Control {\bf query\-Sub\-Control} (Complex\-Control control, const  {\bf QWidget} $\ast$widget, const  {\bf QPoint} \&pos, const  {\bf QStyle\-Option} \&=QStyle\-Option::Default) const \label{classKStyle_a13}

\item 
{\bf QRect} {\bf query\-Sub\-Control\-Metrics} (Complex\-Control control, const  {\bf QWidget} $\ast$widget, Sub\-Control sc, const  {\bf QStyle\-Option} \&=QStyle\-Option::Default) const \label{classKStyle_a14}

\item 
int {\bf pixel\-Metric} (Pixel\-Metric m, const  {\bf QWidget} $\ast$widget=0) const \label{classKStyle_a15}

\item 
{\bf QRect} {\bf sub\-Rect} (Sub\-Rect r, const  {\bf QWidget} $\ast$widget) const \label{classKStyle_a16}

\item 
{\bf QPixmap} {\bf style\-Pixmap} (Style\-Pixmap stylepixmap, const  {\bf QWidget} $\ast$widget=0, const  {\bf QStyle\-Option} \&=QStyle\-Option::Default) const \label{classKStyle_a17}

\item 
int {\bf style\-Hint} (Style\-Hint sh, const  {\bf QWidget} $\ast$w=0, const  {\bf QStyle\-Option} \&opt=QStyle\-Option::Default, QStyle\-Hint\-Return $\ast$shr=0) const \label{classKStyle_a18}

\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
{\bf QString} {\bf default\-Style} ()
\begin{CompactList}\small\item\em Returns the default widget style depending on color depth. \item\end{CompactList}\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
bool {\bf event\-Filter} ({\bf QObject} $\ast$object, {\bf QEvent} $\ast$event)\label{classKStyle_b0}

\item 
virtual void {\bf virtual\_\-hook} (int id, void $\ast$data)\label{classKStyle_b1}

\end{CompactItemize}


\subsection{Detailed Description}
Simplifies and extends the {\bf 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 {\bf QStyle} API, such as the Popup\-Menu\-Items, Scroll\-Bars and Sliders by providing extra \char`\"{}primitive elements\char`\"{} which are simple to implement by the style writer.

\begin{Desc}
\item[Author:]Karol Szwed ({\tt gallium@kde.org}) \end{Desc}
\begin{Desc}
\item[See also:]{\bf QStyle::QStyle} 

{\bf QCommon\-Style::QCommon\-Style} \end{Desc}
\begin{Desc}
\item[Version:]\begin{Desc}
\item[Id]{\bf kstyle.h}{\rm (p.\,\pageref{kstyle_8h})},v 1.11 2002/10/26 08:59:39 gallium Exp \end{Desc}
\end{Desc}




Definition at line 56 of file kstyle.h.

\subsection{Member Typedef Documentation}
\index{KStyle@{KStyle}!KStyleFlags@{KStyleFlags}}
\index{KStyleFlags@{KStyleFlags}!KStyle@{KStyle}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef uint {\bf KStyle::KStyle\-Flags}}\label{classKStyle_w0}


KStyle Flags:. 

\begin{itemize}
\item Default - Default style setting, where menu transparency and the Filled\-Frame\-Workaround are disabled.\end{itemize}
\begin{itemize}
\item Allow\-Menu\-Transparency - Enable this flag to use KStyle's internal menu transparency engine.\end{itemize}
\begin{itemize}
\item Filled\-Frame\-Workaround - Enable this flag to facilitate proper repaints of QMenu\-Bars and QTool\-Bars when the style chooses to paint the interior of a {\bf QFrame}. The style primitives in question are PE\_\-Panel\-Menu\-Bar and PE\_\-Panel\-Dock\-Window. The High\-Color style uses this workaround to enable painting of gradients in menubars and toolbars.\end{itemize}


Definition at line 78 of file kstyle.h.

Referenced by KStyle(), and style\-Flags().

\subsection{Member Enumeration Documentation}
\index{KStyle@{KStyle}!KStyleScrollBarType@{KStyleScrollBarType}}
\index{KStyleScrollBarType@{KStyleScrollBarType}!KStyle@{KStyle}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}enum {\bf KStyle::KStyle\-Scroll\-Bar\-Type}}\label{classKStyle_w25}


KStyle Scroll\-Bar\-Type:. 

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\_\-Scroll\-Bar.

\begin{itemize}
\item Windows\-Style\-Scroll\-Bar - Two button scrollbar with the previous button at the top/left, and the next button at the bottom/right.\end{itemize}
\begin{itemize}
\item Platinum\-Style\-Sroll\-Bar - Two button scrollbar with both the previous and next buttons at the bottom/right.\end{itemize}
\begin{itemize}
\item Three\-Button\-Scroll\-Bar - {\bf 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.\end{itemize}
\begin{itemize}
\item Next\-Style\-Scroll\-Bar - Similar to the Platinum\-Style scroll bar, but with the buttons grouped on the opposite end of the scrollbar.\end{itemize}


Definition at line 106 of file kstyle.h.\index{KStyle@{KStyle}!KStylePrimitive@{KStylePrimitive}}
\index{KStylePrimitive@{KStylePrimitive}!KStyle@{KStyle}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}enum {\bf KStyle::KStyle\-Primitive}}\label{classKStyle_w26}


KStyle Primitive Elements:. 

The KStyle class extends the Qt's Style API by providing certain simplifications for parts of {\bf QStyle}. To do this, the KStyle\-Primitive elements were defined, which are very similar to Qt's Primitive\-Element.

The first three Handle primitives simplify and extend PE\_\-Dock\-Window\-Handle, so do not reimplement PE\_\-Dock\-Window\-Handle if you want the KStyle handle simplifications to be operable. Similarly do not reimplement CC\_\-Slider, SC\_\-Slider\-Groove and SC\_\-Slider\-Handle when using the KStyle slider primitives. KStyle automatically double-buffers slider painting when they are drawn via these KStyle primitives to avoid flicker.

\begin{itemize}
\item KPE\_\-Dock\-Window\-Handle - This primitive is already implemented in KStyle, and paints a bevelled rect with the Dock\-Window caption text. Re-implement this primitive to perform other more fancy effects when drawing the dock window handle.\end{itemize}
\begin{itemize}
\item KPE\_\-Tool\-Bar\-Handle - This primitive must be reimplemented. It currently only paints a filled rectangle as default behaviour. This primitive is used to render {\bf QTool\-Bar} handles.\end{itemize}
\begin{itemize}
\item KPE\_\-General\-Handle - This primitive must be reimplemented. It is used to render general handles that are not part of a {\bf QTool\-Bar} or {\bf QDock\-Window}, such as the applet handles used in Kicker. The default implementation paints a filled rect of arbitrary color.\end{itemize}
\begin{itemize}
\item KPE\_\-Slider\-Groove - This primitive must be reimplemented. It is used to paint the slider groove. The default implementation paints a filled rect of arbitrary color.\end{itemize}
\begin{itemize}
\item KPE\_\-Slider\-Handle - This primitive must be reimplemented. It is used to paint the slider handle. The default implementation paints a filled rect of arbitrary color.\end{itemize}
\begin{itemize}
\item KPE\_\-List\-View\-Expander - This primitive is already implemented in KStyle. It is used to draw the Expand/Collapse element in QList\-Views. To indicate the expanded state, the style flags are set to Style\_\-Off, while Style\_\-On implies collapsed.\end{itemize}
\begin{itemize}
\item KPE\_\-List\-View\-Branch - This primitive is already implemented in KStyle. It is used to draw the List\-View branches where necessary.\end{itemize}


Definition at line 220 of file kstyle.h.

\subsection{Constructor \& Destructor Documentation}
\index{KStyle@{KStyle}!KStyle@{KStyle}}
\index{KStyle@{KStyle}!KStyle@{KStyle}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KStyle::KStyle ({\bf KStyle\-Flags} {\em flags} = KStyle::Default, {\bf KStyle\-Scroll\-Bar\-Type} {\em sbtype} = KStyle::Windows\-Style\-Scroll\-Bar)}\label{classKStyle_a0}


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 {\bf QSettings} and are automatically applied to the style. As a fallback, KStyle paints progressbars and tabbars. It inherits from {\bf QCommon\-Style} for speed, so don't expect much to be implemented.

It is advisable to use a currently implemented style such as the High\-Color style as a foundation for any new KStyle, so the limited number of drawing fallbacks should not prove problematic.

\begin{Desc}
\item[See also:]{\bf KStyle::KStyle\-Flags}{\rm (p.\,\pageref{classKStyle_w0})} 

{\bf KStyle::KStyle\-Scroll\-Bar\-Type}{\rm (p.\,\pageref{classKStyle_w25})} \end{Desc}
\begin{Desc}
\item[Author:]Karol Szwed ({\tt gallium@kde.org})\end{Desc}


Definition at line 162 of file kstyle.cpp.

References QPixmap::default\-Depth(), KStyle\-Flags, QSettings::read\-Bool\-Entry(), QSettings::read\-Double\-Entry(), QSettings::read\-Entry(), and QSettings::read\-Num\-Entry().\index{KStyle@{KStyle}!~KStyle@{$\sim$KStyle}}
\index{~KStyle@{$\sim$KStyle}!KStyle@{KStyle}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KStyle::$\sim${\bf KStyle} ()}\label{classKStyle_a1}


Destructs the KStyle object. 



Definition at line 211 of file kstyle.cpp.

\subsection{Member Function Documentation}
\index{KStyle@{KStyle}!defaultStyle@{defaultStyle}}
\index{defaultStyle@{defaultStyle}!KStyle@{KStyle}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KStyle::default\-Style ()\hspace{0.3cm}{\tt  [static]}}\label{classKStyle_e0}


Returns the default widget style depending on color depth. 



Definition at line 221 of file kstyle.cpp.

References QPixmap::default\-Depth().\index{KStyle@{KStyle}!setScrollBarType@{setScrollBarType}}
\index{setScrollBarType@{setScrollBarType}!KStyle@{KStyle}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KStyle::set\-Scroll\-Bar\-Type ({\bf KStyle\-Scroll\-Bar\-Type} {\em sbtype})}\label{classKStyle_a2}


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.

Definition at line 271 of file kstyle.cpp.\index{KStyle@{KStyle}!styleFlags@{styleFlags}}
\index{styleFlags@{styleFlags}!KStyle@{KStyle}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KStyle::KStyle\-Flags} KStyle::style\-Flags () const}\label{classKStyle_a3}


Returns the KStyle flags used to initialise the style. 

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

Definition at line 276 of file kstyle.cpp.

References KStyle\-Flags.\index{KStyle@{KStyle}!renderMenuBlendPixmap@{renderMenuBlendPixmap}}
\index{renderMenuBlendPixmap@{renderMenuBlendPixmap}!KStyle@{KStyle}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KStyle::render\-Menu\-Blend\-Pixmap ({\bf KPixmap} \& {\em pix}, const {\bf QColor\-Group} \& {\em cg}, const {\bf QPopup\-Menu} $\ast$ {\em popup}) const\hspace{0.3cm}{\tt  [virtual]}}\label{classKStyle_a4}


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 \char`\"{}pix\char`\"{} with a gradient based on the popup's color\-Group, a texture, or some other fancy painting routine. KStyle will then internally blend this pixmap with a snapshot of the background behind the popup\-Menu 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 281 of file kstyle.cpp.

References QColor\-Group::button(), and QPixmap::fill().\index{KStyle@{KStyle}!drawKStylePrimitive@{drawKStylePrimitive}}
\index{drawKStylePrimitive@{drawKStylePrimitive}!KStyle@{KStyle}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KStyle::draw\-KStyle\-Primitive ({\bf KStyle\-Primitive} {\em kpe}, {\bf QPainter} $\ast$ {\em p}, const {\bf QWidget} $\ast$ {\em widget}, const {\bf QRect} \& {\em r}, const {\bf QColor\-Group} \& {\em cg}, SFlags {\em flags} = Style\_\-Default, const {\bf QStyle\-Option} \& = QStyle\-Option::Default) const\hspace{0.3cm}{\tt  [virtual]}}\label{classKStyle_a5}


This function is identical to Qt's {\bf QStyle::draw\-Primitive()}, except that it adds one further parameter, 'widget', that can be used to determine the widget state of the KStyle\-Primitive in question. 

\begin{Desc}
\item[See also:]{\bf KStyle::KStyle\-Primitive}{\rm (p.\,\pageref{classKStyle_w26})} 

{\bf QStyle::draw\-Primitive} 

{\bf QStyle::draw\-Complex\-Control}\end{Desc}


Definition at line 288 of file kstyle.cpp.

References QPainter::begin(), QColor\-Group::brush(), QColor\-Group::dark(), QPainter::draw\-Line(), QPainter::draw\-Pixmap(), QPainter::draw\-Points(), QPainter::draw\-Rect(), QPainter::draw\-Text(), KStd\-Accel::end(), QPainter::end(), QPainter::fill\-Rect(), QApplication::flush\-X(), QApplication::font(), QRect::height(), QWidget::height(), QColor\-Group::highlight(), QColor\-Group::highlighted\-Text(), QColor\-Group::light(), QColor\-Group::mid(), QWidget::parent\-Widget(), QFont::point\-Size(), QPixmap::rect(), QRect::rect(), QPixmap::resize(), QWMatrix::rotate(), QPainter::set\-Font(), QPainter::set\-Pen(), QPoint\-Array::set\-Point(), QFont::set\-Point\-Size(), QColor\-Group::text(), QRect::width(), QWidget::width(), QRect::x(), QPixmap::x\-Form(), and QRect::y().

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
kstyle.h\item 
kstyle.cpp\end{CompactItemize}
