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

tdeui

Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions | List of all members
KDualColorButton Class Reference

#include <kdualcolorbutton.h>

Inherits TQWidget.

Public Types

enum  DualColor { Foreground , Background }
 

Public Slots

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

Signals

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

Public Member Functions

 KDualColorButton (TQWidget *parent=0, const char *name=0, TQWidget *dialogParent=0)
 
 KDualColorButton (const TQColor &fgColor, const TQColor &bgColor, TQWidget *parent=0, const char *name=0, TQWidget *dialogParent=0)
 
TQColor foreground () const
 
TQColor background () const
 
DualColor current () const
 
TQColor currentColor () const
 
virtual TQSize sizeHint () const
 

Protected Member Functions

virtual void metrics (TQRect &fgRect, TQRect &bgRect)
 
virtual void paintEvent (TQPaintEvent *ev)
 
virtual void mousePressEvent (TQMouseEvent *ev)
 
virtual void mouseMoveEvent (TQMouseEvent *ev)
 
virtual void mouseReleaseEvent (TQMouseEvent *ev)
 
virtual void dragEnterEvent (TQDragEnterEvent *ev)
 
virtual void dropEvent (TQDropEvent *ev)
 
virtual void virtual_hook (int id, void *data)
 

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.

KDE Dual Color Button
Author
Daniel M. Duley mosfe.nosp@m.t@kd.nosp@m.e.org

Definition at line 48 of file kdualcolorbutton.h.

Member Enumeration Documentation

◆ DualColor

enum KDualColorButton::DualColor

Definition at line 59 of file kdualcolorbutton.h.

Constructor & Destructor Documentation

◆ KDualColorButton() [1/2]

KDualColorButton::KDualColorButton ( TQWidget *  parent = 0,
const char *  name = 0,
TQWidget *  dialogParent = 0 
)

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

As of KDE 3.5.1, sets the dialog parent to the same as "parent" if that argument is non-null and the dialogParent argument is null.

Definition at line 35 of file kdualcolorbutton.cpp.

◆ KDualColorButton() [2/2]

KDualColorButton::KDualColorButton ( const TQColor &  fgColor,
const TQColor &  bgColor,
TQWidget *  parent = 0,
const char *  name = 0,
TQWidget *  dialogParent = 0 
)

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

Definition at line 59 of file kdualcolorbutton.cpp.

◆ ~KDualColorButton()

KDualColorButton::~KDualColorButton ( )

Definition at line 80 of file kdualcolorbutton.cpp.

Member Function Documentation

◆ background()

TQColor KDualColorButton::background ( ) const

Returns the current background color.

Definition at line 92 of file kdualcolorbutton.cpp.

◆ bgChanged

void KDualColorButton::bgChanged ( const TQColor &  c)
signal

Emitted when the background color is changed.

◆ current()

KDualColorButton::DualColor KDualColorButton::current ( ) const

Returns the current color item selected by the user.

Definition at line 97 of file kdualcolorbutton.cpp.

◆ currentChanged

void KDualColorButton::currentChanged ( KDualColorButton::DualColor  s)
signal

Emitted when the user changes the current color selection.

◆ currentColor()

TQColor KDualColorButton::currentColor ( ) const

Returns the color of the selected item.

Definition at line 102 of file kdualcolorbutton.cpp.

◆ dragEnterEvent()

void KDualColorButton::dragEnterEvent ( TQDragEnterEvent *  ev)
protectedvirtual

Definition at line 167 of file kdualcolorbutton.cpp.

◆ dropEvent()

void KDualColorButton::dropEvent ( TQDropEvent *  ev)
protectedvirtual

Definition at line 172 of file kdualcolorbutton.cpp.

◆ fgChanged

void KDualColorButton::fgChanged ( const TQColor &  c)
signal

Emitted when the foreground color is changed.

◆ foreground()

TQColor KDualColorButton::foreground ( ) const

Returns the current foreground color.

Definition at line 87 of file kdualcolorbutton.cpp.

◆ metrics()

void KDualColorButton::metrics ( TQRect &  fgRect,
TQRect &  bgRect 
)
protectedvirtual

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 143 of file kdualcolorbutton.cpp.

◆ mouseMoveEvent()

void KDualColorButton::mouseMoveEvent ( TQMouseEvent *  ev)
protectedvirtual

Definition at line 224 of file kdualcolorbutton.cpp.

◆ mousePressEvent()

void KDualColorButton::mousePressEvent ( TQMouseEvent *  ev)
protectedvirtual

Definition at line 188 of file kdualcolorbutton.cpp.

◆ mouseReleaseEvent()

void KDualColorButton::mouseReleaseEvent ( TQMouseEvent *  ev)
protectedvirtual

Definition at line 239 of file kdualcolorbutton.cpp.

◆ paintEvent()

void KDualColorButton::paintEvent ( TQPaintEvent *  ev)
protectedvirtual

Definition at line 149 of file kdualcolorbutton.cpp.

◆ setBackground

void KDualColorButton::setBackground ( const TQColor &  c)
slot

Sets the background color.

Definition at line 120 of file kdualcolorbutton.cpp.

◆ setCurrent

void KDualColorButton::setCurrent ( DualColor  s)
slot

Sets the current selected color item.

Definition at line 137 of file kdualcolorbutton.cpp.

◆ setCurrentColor

void KDualColorButton::setCurrentColor ( const TQColor &  c)
slot

Sets the color of the selected item.

Definition at line 128 of file kdualcolorbutton.cpp.

◆ setForeground

void KDualColorButton::setForeground ( const TQColor &  c)
slot

Sets the foreground color.

Definition at line 112 of file kdualcolorbutton.cpp.

◆ sizeHint()

TQSize KDualColorButton::sizeHint ( void  ) const
virtual

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

Definition at line 107 of file kdualcolorbutton.cpp.

◆ virtual_hook()

void KDualColorButton::virtual_hook ( int  id,
void *  data 
)
protectedvirtual

Definition at line 280 of file kdualcolorbutton.cpp.


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

tdeui

Skip menu "tdeui"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeui

Skip menu "tdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.9.4
This website is maintained by Timothy Pearson.