Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

KDualColorButton Class Reference

A widget for selecting two related colors. More...

#include <kdualcolorbutton.h>

List of all members.

Public Slots

void setForeground (const QColor &c)
void setBackground (const QColor &c)
void setCurrent (DualColor s)
void setCurrentColor (const QColor &c)

Signals

void fgChanged (const QColor &c)
void bgChanged (const QColor &c)
void currentChanged (KDualColorButton::DualColor s)

Public Methods

 KDualColorButton (QWidget *parent=0, const char *name=0, QWidget *dialogParent=0)
 KDualColorButton (const QColor &fgColor, const QColor &bgColor, QWidget *parent=0, const char *name=0, QWidget *dialogParent=0)
QColor foreground () const
QColor background () const
DualColor current () const
QColor currentColor () const
virtual QSize sizeHint () const

Protected Methods

virtual void metrics (QRect &fgRect, QRect &bgRect)


Detailed Description

A widget for selecting two related colors.

KDualColorButton allows the user to select two cascaded colors (usually a foreground and background color). Other features include drag and drop from other 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 currentChanged() signal is emitted. Further clicks will present a color dialog and emit either the fgChanged() or bgChanged() 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.

Author:
Daniel M. Duley <mosfet@kde.org>

Definition at line 43 of file kdualcolorbutton.h.


Constructor & Destructor Documentation

KDualColorButton::KDualColorButton QWidget *    parent = 0,
const char *    name = 0,
QWidget *    dialogParent = 0
 

Constructs a new KDualColorButton using the default black and white colors.

KDualColorButton::KDualColorButton const QColor &    fgColor,
const QColor &    bgColor,
QWidget *    parent = 0,
const char *    name = 0,
QWidget *    dialogParent = 0
 

Constructs a new KDualColorButton with the supplied foreground and background colors.


Member Function Documentation

QColor KDualColorButton::background  
 

Returns the current background color.

void KDualColorButton::bgChanged const QColor &    c [signal]
 

Emitted when the background color is changed.

DualColor KDualColorButton::current  
 

Returns the current color item selected by the user.

void KDualColorButton::currentChanged KDualColorButton::DualColor    s [signal]
 

Emitted when the user changes the current color selection.

QColor KDualColorButton::currentColor  
 

Returns the color of the selected item.

void KDualColorButton::fgChanged const QColor &    c [signal]
 

Emitted when the foreground color is changed.

QColor KDualColorButton::foreground  
 

Returns the current foreground color.

virtual void KDualColorButton::metrics QRect &    fgRect,
QRect &    bgRect
[protected, virtual]
 

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.

void KDualColorButton::setBackground const QColor &    c [slot]
 

Sets the background color.

void KDualColorButton::setCurrent DualColor    s [slot]
 

Sets the current selected color item.

void KDualColorButton::setCurrentColor const QColor &    c [slot]
 

Sets the color of the selected item.

void KDualColorButton::setForeground const QColor &    c [slot]
 

Sets the foreground color.

virtual QSize KDualColorButton::sizeHint   [virtual]
 

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


The documentation for this class was generated from the following file:
Generated on Wed Aug 13 23:30:11 2003 for kdelibs by doxygen1.2.18