.TH "KDualColorButton" 3 "28 Jan 2004" "kdeui Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KDualColorButton \- KDualColorButton allows the user to select two cascaded colors (usually a foreground and background color). A widget for selecting two related colors.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <kdualcolorbutton.h>\fP
.PP
Inherits \fBQWidget\fP.
.PP
.SS "Public Types"

.in +1c
.ti -1c
.RI "enum \fBDualColor\fP { \fBForeground\fP, \fBBackground\fP }"
.br
.in -1c
.SS "Public Slots"

.in +1c
.ti -1c
.RI "void \fBsetForeground\fP (const  \fBQColor\fP &c)"
.br
.RI "\fISets the foreground color. \fP"
.ti -1c
.RI "void \fBsetBackground\fP (const  \fBQColor\fP &c)"
.br
.RI "\fISets the background color. \fP"
.ti -1c
.RI "void \fBsetCurrent\fP (DualColor s)"
.br
.RI "\fISets the current selected color item. \fP"
.ti -1c
.RI "void \fBsetCurrentColor\fP (const  \fBQColor\fP &c)"
.br
.RI "\fISets the color of the selected item. \fP"
.in -1c
.SS "Signals"

.in +1c
.ti -1c
.RI "void \fBfgChanged\fP (const  \fBQColor\fP &c)"
.br
.RI "\fIEmitted when the foreground color is changed. \fP"
.ti -1c
.RI "void \fBbgChanged\fP (const  \fBQColor\fP &c)"
.br
.RI "\fIEmitted when the background color is changed. \fP"
.ti -1c
.RI "void \fBcurrentChanged\fP (KDualColorButton::DualColor s)"
.br
.RI "\fIEmitted when the user changes the current color selection. \fP"
.in -1c
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKDualColorButton\fP (\fBQWidget\fP *parent=0, const  char *name=0, \fBQWidget\fP *dialogParent=0)"
.br
.RI "\fIConstructs a new KDualColorButton using the default black and white colors. \fP"
.ti -1c
.RI "\fBKDualColorButton\fP (const  \fBQColor\fP &fgColor, const  \fBQColor\fP &bgColor, \fBQWidget\fP *parent=0, const  char *name=0, \fBQWidget\fP *dialogParent=0)"
.br
.RI "\fIConstructs a new KDualColorButton with the supplied foreground and background colors. \fP"
.ti -1c
.RI "\fBQColor\fP \fBforeground\fP () const "
.br
.RI "\fIReturns the current foreground color. \fP"
.ti -1c
.RI "\fBQColor\fP \fBbackground\fP () const "
.br
.RI "\fIReturns the current background color. \fP"
.ti -1c
.RI "DualColor \fBcurrent\fP () const "
.br
.RI "\fIReturns the current color item selected by the user. \fP"
.ti -1c
.RI "\fBQColor\fP \fBcurrentColor\fP () const "
.br
.RI "\fIReturns the color of the selected item. \fP"
.ti -1c
.RI "virtual \fBQSize\fP \fBsizeHint\fP () const "
.br
.RI "\fIReturns the minimum size needed to display the widget and all its controls. \fP"
.in -1c
.SS "Protected Member Functions"

.in +1c
.ti -1c
.RI "virtual void \fBmetrics\fP (\fBQRect\fP &fgRect, \fBQRect\fP &bgRect)"
.br
.RI "\fISets the supplied rectangles to the proper size and position for the current widget size. \fP"
.ti -1c
.RI "virtual void \fBpaintEvent\fP (\fBQPaintEvent\fP *ev)"
.br
.ti -1c
.RI "virtual void \fBmousePressEvent\fP (\fBQMouseEvent\fP *ev)"
.br
.ti -1c
.RI "virtual void \fBmouseMoveEvent\fP (\fBQMouseEvent\fP *ev)"
.br
.ti -1c
.RI "virtual void \fBmouseReleaseEvent\fP (\fBQMouseEvent\fP *ev)"
.br
.ti -1c
.RI "virtual void \fBdragEnterEvent\fP (\fBQDragEnterEvent\fP *ev)"
.br
.ti -1c
.RI "virtual void \fBdropEvent\fP (\fBQDropEvent\fP *ev)"
.br
.ti -1c
.RI "virtual void \fBvirtual_hook\fP (int id, void *data)"
.br
.in -1c
.SH "Detailed Description"
.PP 
KDualColorButton allows the user to select two cascaded colors (usually a foreground and background color). A widget for selecting two related colors. 

Other features include drag and drop from other \fBKDE\fP color widgets, a reset to black and white control, and a swap colors control.
.PP
When the user clicks on the foreground or background rectangle the rectangle is first sunken and the \fBcurrentChanged\fP() signal is emitted. Further clicks will present a color dialog and emit either the \fBfgChanged\fP() or \fBbgChanged\fP() if a new color is selected.
.PP
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.
.PP
\fBAuthor:\fP
.RS 4
Daniel M. Duley <mosfet@kde.org> 
.RE
.PP

.PP
Definition at line 43 of file kdualcolorbutton.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KDualColorButton::KDualColorButton (\fBQWidget\fP * parent = 0, const char * name = 0, \fBQWidget\fP * dialogParent = 0)"
.PP
Constructs a new KDualColorButton using the default black and white colors. Definition at line 35 of file kdualcolorbutton.cpp.
.PP
References QSize::isValid(), KStdAccel::name(), QWidget::setAcceptDrops(), QWidget::setMinimumSize(), and sizeHint().
.SS "KDualColorButton::KDualColorButton (const \fBQColor\fP & fgColor, const \fBQColor\fP & bgColor, \fBQWidget\fP * parent = 0, const char * name = 0, \fBQWidget\fP * dialogParent = 0)"
.PP
Constructs a new KDualColorButton with the supplied foreground and background colors. Definition at line 55 of file kdualcolorbutton.cpp.
.PP
References QSize::isValid(), KStdAccel::name(), QWidget::setAcceptDrops(), QWidget::setMinimumSize(), and sizeHint().
.SH "Member Function Documentation"
.PP 
.SS "\fBQColor\fP KDualColorButton::foreground () const"
.PP
Returns the current foreground color. Definition at line 83 of file kdualcolorbutton.cpp.
.PP
References QBrush::color().
.SS "\fBQColor\fP KDualColorButton::background () const"
.PP
Returns the current background color. Definition at line 88 of file kdualcolorbutton.cpp.
.PP
References QBrush::color().
.SS "KDualColorButton::DualColor KDualColorButton::current () const"
.PP
Returns the current color item selected by the user. Definition at line 93 of file kdualcolorbutton.cpp.
.SS "\fBQColor\fP KDualColorButton::currentColor () const"
.PP
Returns the color of the selected item. Definition at line 98 of file kdualcolorbutton.cpp.
.PP
References QBrush::color().
.SS "\fBQSize\fP KDualColorButton::sizeHint () const\fC [virtual]\fP"
.PP
Returns the minimum size needed to display the widget and all its controls. Reimplemented from \fBQWidget\fP.
.PP
Definition at line 103 of file kdualcolorbutton.cpp.
.PP
Referenced by KDualColorButton().
.SS "void KDualColorButton::setForeground (const \fBQColor\fP & c)\fC [slot]\fP"
.PP
Sets the foreground color. Definition at line 108 of file kdualcolorbutton.cpp.
.PP
References QBrush::color(), fgChanged(), and QWidget::repaint().
.SS "void KDualColorButton::setBackground (const \fBQColor\fP & c)\fC [slot]\fP"
.PP
Sets the background color. Definition at line 116 of file kdualcolorbutton.cpp.
.PP
References bgChanged(), QBrush::color(), and QWidget::repaint().
.SS "void KDualColorButton::setCurrent (DualColor s)\fC [slot]\fP"
.PP
Sets the current selected color item. Definition at line 133 of file kdualcolorbutton.cpp.
.PP
References QWidget::repaint().
.SS "void KDualColorButton::setCurrentColor (const \fBQColor\fP & c)\fC [slot]\fP"
.PP
Sets the color of the selected item. Definition at line 124 of file kdualcolorbutton.cpp.
.PP
References QWidget::repaint().
.SS "void KDualColorButton::fgChanged (const \fBQColor\fP & c)\fC [signal]\fP"
.PP
Emitted when the foreground color is changed. Referenced by setForeground().
.SS "void KDualColorButton::bgChanged (const \fBQColor\fP & c)\fC [signal]\fP"
.PP
Emitted when the background color is changed. Referenced by setBackground().
.SS "void KDualColorButton::currentChanged (KDualColorButton::DualColor s)\fC [signal]\fP"
.PP
Emitted when the user changes the current color selection. 
.SS "void KDualColorButton::metrics (\fBQRect\fP & fgRect, \fBQRect\fP & bgRect)\fC [protected, virtual]\fP"
.PP
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.
.PP
References QWidget::height(), and QWidget::width().

.SH "Author"
.PP 
Generated automatically by Doxygen for kdeui Library from the source code.
