kcolorbutton.h
/* This file is part of the KDE libraries
Copyright (C) 1997 Martin Jones (mjones@kde.org)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __COLBTN_H__
#define __COLBTN_H__
#include <qpushbutton.h>
#include <kdelibs_export.h>
class KColorButtonPrivate;
class KDEUI_EXPORT KColorButton : public QPushButton
{
Q_OBJECT
Q_PROPERTY( QColor color READ color WRITE setColor )
Q_PROPERTY( QColor defaultColor READ defaultColor WRITE setDefaultColor )
public:
KColorButton( QWidget *parent, const char *name = 0L );
KColorButton( const QColor &c, QWidget *parent, const char *name = 0L );
KColorButton( const QColor &c, const QColor &defaultColor, QWidget *parent,
const char *name=0L );
virtual ~KColorButton();
QColor color() const
{ return col; }
void setColor( const QColor &c );
QColor defaultColor() const;
void setDefaultColor( const QColor &c );
QSize sizeHint() const;
signals:
void changed( const QColor &newColor );
protected slots:
void chooseColor();
protected:
virtual void drawButtonLabel( QPainter *p );
virtual void dragEnterEvent( QDragEnterEvent *);
virtual void dropEvent( QDropEvent *);
virtual void mousePressEvent( QMouseEvent *e );
virtual void mouseMoveEvent( QMouseEvent *e);
virtual void keyPressEvent( QKeyEvent *e );
private:
QColor col;
QPoint mPos;
bool dragFlag;
protected:
virtual void virtual_hook( int id, void* data );
private:
class KColorButtonPrivate;
KColorButtonPrivate *d;
};
#endif
KColorButton::color
QColor color() const
Returns the currently chosen color.
Definition: kcolorbutton.h:62
KColorButton
A pushbutton to display or allow user selection of a color.
Definition: kcolorbutton.h:37

KDE Home | KDE Accessibility Home | Description of Access Keys