\section{KDual\-Color\-Button Class Reference}
\label{classKDualColorButton}\index{KDualColorButton@{KDualColorButton}}
A widget for selecting two related colors.  


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

Inheritance diagram for KDual\-Color\-Button:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=66pt]{classKDualColorButton__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KDual\-Color\-Button:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=205pt]{classKDualColorButton__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{CompactItemize}
\item 
enum {\bf Dual\-Color} \{ {\bf Foreground}, 
{\bf Background}
 \}
\end{CompactItemize}
\subsection*{Public Slots}
\begin{CompactItemize}
\item 
void {\bf set\-Foreground} (const {\bf QColor} \&c)
\item 
void {\bf set\-Background} (const {\bf QColor} \&c)
\item 
void {\bf set\-Current} (Dual\-Color s)
\item 
void {\bf set\-Current\-Color} (const {\bf QColor} \&c)
\end{CompactItemize}
\subsection*{Signals}
\begin{CompactItemize}
\item 
void {\bf fg\-Changed} (const {\bf QColor} \&c)
\item 
void {\bf bg\-Changed} (const {\bf QColor} \&c)
\item 
void {\bf current\-Changed} (KDual\-Color\-Button::Dual\-Color s)
\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KDual\-Color\-Button} ({\bf QWidget} $\ast$parent=0, const char $\ast$name=0, {\bf QWidget} $\ast$dialog\-Parent=0)
\item 
{\bf KDual\-Color\-Button} (const {\bf QColor} \&fg\-Color, const {\bf QColor} \&bg\-Color, {\bf QWidget} $\ast$parent=0, const char $\ast$name=0, {\bf QWidget} $\ast$dialog\-Parent=0)
\item 
{\bf QColor} {\bf foreground} () const 
\item 
{\bf QColor} {\bf background} () const 
\item 
Dual\-Color {\bf current} () const 
\item 
{\bf QColor} {\bf current\-Color} () const 
\item 
virtual {\bf QSize} {\bf size\-Hint} () const 
\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
virtual void {\bf metrics} ({\bf QRect} \&fg\-Rect, {\bf QRect} \&bg\-Rect)
\item 
virtual void {\bf paint\-Event} ({\bf QPaint\-Event} $\ast$ev)\label{classKDualColorButton_b1}

\item 
virtual void {\bf mouse\-Press\-Event} ({\bf QMouse\-Event} $\ast$ev)\label{classKDualColorButton_b2}

\item 
virtual void {\bf mouse\-Move\-Event} ({\bf QMouse\-Event} $\ast$ev)\label{classKDualColorButton_b3}

\item 
virtual void {\bf mouse\-Release\-Event} ({\bf QMouse\-Event} $\ast$ev)\label{classKDualColorButton_b4}

\item 
virtual void {\bf drag\-Enter\-Event} ({\bf QDrag\-Enter\-Event} $\ast$ev)\label{classKDualColorButton_b5}

\item 
virtual void {\bf drop\-Event} ({\bf QDrop\-Event} $\ast$ev)\label{classKDualColorButton_b6}

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

\end{CompactItemize}
\subsection*{Properties}
\begin{CompactItemize}
\item 
{\bf QColor} {\bf foreground}\label{classKDualColorButton_00}

\item 
{\bf QColor} {\bf background}\label{classKDualColorButton_01}

\item 
{\bf QColor} {\bf current\-Color}\label{classKDualColorButton_02}

\item 
Dual\-Color {\bf current}\label{classKDualColorButton_03}

\end{CompactItemize}


\subsection{Detailed Description}
A widget for selecting two related colors. 

KDual\-Color\-Button allows the user to select two cascaded colors (usually a foreground and background color). Other features include drag and drop from other {\bf KDE} color widgets, a reset to black and white control, and a swap colors control.

When the user clicks on the foreground or background rectangle the rectangle is first sunken and the {\bf current\-Changed()}{\rm (p.\,\pageref{classKDualColorButton_l2})} signal is emitted. Further clicks will present a color dialog and emit either the {\bf fg\-Changed()}{\rm (p.\,\pageref{classKDualColorButton_l0})} or {\bf bg\-Changed()}{\rm (p.\,\pageref{classKDualColorButton_l1})} if a new color is selected.

Note: With drag and drop when dropping a color the current selected color will be set, while when dragging a color it will use whatever color rectangle the mouse was pressed inside.

 \begin{Desc}
\item[Author:]Daniel M. Duley $<${\tt mosfet@kde.org}$>$ \end{Desc}




Definition at line 48 of file kdualcolorbutton.h.

\subsection{Constructor \& Destructor Documentation}
\index{KDualColorButton@{KDual\-Color\-Button}!KDualColorButton@{KDualColorButton}}
\index{KDualColorButton@{KDualColorButton}!KDualColorButton@{KDual\-Color\-Button}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KDual\-Color\-Button::KDual\-Color\-Button ({\bf QWidget} $\ast$ {\em parent} = {\tt 0}, const char $\ast$ {\em name} = {\tt 0}, {\bf QWidget} $\ast$ {\em dialog\-Parent} = {\tt 0})}\label{classKDualColorButton_a0}


Constructs a new KDual\-Color\-Button using the default black and white colors. 



Definition at line 35 of file kdualcolorbutton.cpp.

References QSize::is\-Valid(), QWidget::set\-Accept\-Drops(), QWidget::set\-Minimum\-Size(), and size\-Hint().\index{KDualColorButton@{KDual\-Color\-Button}!KDualColorButton@{KDualColorButton}}
\index{KDualColorButton@{KDualColorButton}!KDualColorButton@{KDual\-Color\-Button}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KDual\-Color\-Button::KDual\-Color\-Button (const {\bf QColor} \& {\em fg\-Color}, const {\bf QColor} \& {\em bg\-Color}, {\bf QWidget} $\ast$ {\em parent} = {\tt 0}, const char $\ast$ {\em name} = {\tt 0}, {\bf QWidget} $\ast$ {\em dialog\-Parent} = {\tt 0})}\label{classKDualColorButton_a1}


Constructs a new KDual\-Color\-Button with the supplied foreground and background colors. 



Definition at line 55 of file kdualcolorbutton.cpp.

References QSize::is\-Valid(), QWidget::set\-Accept\-Drops(), QWidget::set\-Minimum\-Size(), and size\-Hint().

\subsection{Member Function Documentation}
\index{KDualColorButton@{KDual\-Color\-Button}!foreground@{foreground}}
\index{foreground@{foreground}!KDualColorButton@{KDual\-Color\-Button}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QColor} KDual\-Color\-Button::foreground () const}\label{classKDualColorButton_a3}


Returns the current foreground color. 

\index{KDualColorButton@{KDual\-Color\-Button}!background@{background}}
\index{background@{background}!KDualColorButton@{KDual\-Color\-Button}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QColor} KDual\-Color\-Button::background () const}\label{classKDualColorButton_a4}


Returns the current background color. 

\index{KDualColorButton@{KDual\-Color\-Button}!current@{current}}
\index{current@{current}!KDualColorButton@{KDual\-Color\-Button}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Dual\-Color KDual\-Color\-Button::current () const}\label{classKDualColorButton_a5}


Returns the current color item selected by the user. 

\index{KDualColorButton@{KDual\-Color\-Button}!currentColor@{currentColor}}
\index{currentColor@{currentColor}!KDualColorButton@{KDual\-Color\-Button}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QColor} KDual\-Color\-Button::current\-Color () const}\label{classKDualColorButton_a6}


Returns the color of the selected item. 

\index{KDualColorButton@{KDual\-Color\-Button}!sizeHint@{sizeHint}}
\index{sizeHint@{sizeHint}!KDualColorButton@{KDual\-Color\-Button}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QSize} KDual\-Color\-Button::size\-Hint () const\hspace{0.3cm}{\tt  [virtual]}}\label{classKDualColorButton_a7}


Returns the minimum size needed to display the widget and all its controls. 



Reimplemented from {\bf QWidget}.

Definition at line 103 of file kdualcolorbutton.cpp.

Referenced by KDual\-Color\-Button().\index{KDualColorButton@{KDual\-Color\-Button}!setForeground@{setForeground}}
\index{setForeground@{setForeground}!KDualColorButton@{KDual\-Color\-Button}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDual\-Color\-Button::set\-Foreground (const {\bf QColor} \& {\em c})\hspace{0.3cm}{\tt  [slot]}}\label{classKDualColorButton_i0}


Sets the foreground color. 



Definition at line 108 of file kdualcolorbutton.cpp.

References QBrush::color(), fg\-Changed(), and QWidget::repaint().\index{KDualColorButton@{KDual\-Color\-Button}!setBackground@{setBackground}}
\index{setBackground@{setBackground}!KDualColorButton@{KDual\-Color\-Button}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDual\-Color\-Button::set\-Background (const {\bf QColor} \& {\em c})\hspace{0.3cm}{\tt  [slot]}}\label{classKDualColorButton_i1}


Sets the background color. 



Definition at line 116 of file kdualcolorbutton.cpp.

References bg\-Changed(), QBrush::color(), and QWidget::repaint().\index{KDualColorButton@{KDual\-Color\-Button}!setCurrent@{setCurrent}}
\index{setCurrent@{setCurrent}!KDualColorButton@{KDual\-Color\-Button}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDual\-Color\-Button::set\-Current (Dual\-Color {\em s})\hspace{0.3cm}{\tt  [slot]}}\label{classKDualColorButton_i2}


Sets the current selected color item. 



Definition at line 133 of file kdualcolorbutton.cpp.

References QWidget::repaint().\index{KDualColorButton@{KDual\-Color\-Button}!setCurrentColor@{setCurrentColor}}
\index{setCurrentColor@{setCurrentColor}!KDualColorButton@{KDual\-Color\-Button}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDual\-Color\-Button::set\-Current\-Color (const {\bf QColor} \& {\em c})\hspace{0.3cm}{\tt  [slot]}}\label{classKDualColorButton_i3}


Sets the color of the selected item. 



Definition at line 124 of file kdualcolorbutton.cpp.

References QWidget::repaint().\index{KDualColorButton@{KDual\-Color\-Button}!fgChanged@{fgChanged}}
\index{fgChanged@{fgChanged}!KDualColorButton@{KDual\-Color\-Button}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDual\-Color\-Button::fg\-Changed (const {\bf QColor} \& {\em c})\hspace{0.3cm}{\tt  [signal]}}\label{classKDualColorButton_l0}


Emitted when the foreground color is changed. 



Referenced by set\-Foreground().\index{KDualColorButton@{KDual\-Color\-Button}!bgChanged@{bgChanged}}
\index{bgChanged@{bgChanged}!KDualColorButton@{KDual\-Color\-Button}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDual\-Color\-Button::bg\-Changed (const {\bf QColor} \& {\em c})\hspace{0.3cm}{\tt  [signal]}}\label{classKDualColorButton_l1}


Emitted when the background color is changed. 



Referenced by set\-Background().\index{KDualColorButton@{KDual\-Color\-Button}!currentChanged@{currentChanged}}
\index{currentChanged@{currentChanged}!KDualColorButton@{KDual\-Color\-Button}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDual\-Color\-Button::current\-Changed (KDual\-Color\-Button::Dual\-Color {\em s})\hspace{0.3cm}{\tt  [signal]}}\label{classKDualColorButton_l2}


Emitted when the user changes the current color selection. 

\index{KDualColorButton@{KDual\-Color\-Button}!metrics@{metrics}}
\index{metrics@{metrics}!KDualColorButton@{KDual\-Color\-Button}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDual\-Color\-Button::metrics ({\bf QRect} \& {\em fg\-Rect}, {\bf QRect} \& {\em bg\-Rect})\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKDualColorButton_b0}


Sets the supplied rectangles to the proper size and position for the current widget size. 

You can reimplement this to change the layout of the widget. Restrictions are that the swap control will always be at the top right, the reset control will always be at the bottom left, and you must leave at least a 14x14 space in those corners. 

Definition at line 139 of file kdualcolorbutton.cpp.

References QWidget::height(), and QWidget::width().

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