KDEUI
kcolorbutton.h
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 1997 Martin Jones (mjones@kde.org) 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef KCOLORBUTTON_H 00021 #define KCOLORBUTTON_H 00022 00023 #include <kdeui_export.h> 00024 00025 #include <QtGui/QPushButton> 00026 00027 class KColorButtonPrivate; 00037 class KDEUI_EXPORT KColorButton : public QPushButton 00038 { 00039 Q_OBJECT 00040 Q_PROPERTY( QColor color READ color WRITE setColor NOTIFY changed USER true ) 00041 Q_PROPERTY( QColor defaultColor READ defaultColor WRITE setDefaultColor ) 00042 Q_PROPERTY( bool alphaChannelEnabled READ isAlphaChannelEnabled WRITE setAlphaChannelEnabled ) 00043 00044 public: 00048 explicit KColorButton( QWidget *parent = 0 ); 00049 00053 explicit KColorButton( const QColor &c, QWidget *parent = 0 ); 00054 00058 KColorButton( const QColor &c, const QColor &defaultColor, QWidget *parent = 0 ); 00059 00060 virtual ~KColorButton(); 00061 00065 QColor color() const; 00066 00070 void setColor( const QColor &c ); 00071 00077 void setAlphaChannelEnabled( bool alpha ); 00078 00083 bool isAlphaChannelEnabled() const; 00084 00089 QColor defaultColor() const; 00090 00094 void setDefaultColor( const QColor &c ); 00095 00096 QSize sizeHint() const; 00097 QSize minimumSizeHint() const; 00098 00099 Q_SIGNALS: 00104 void changed( const QColor &newColor ); 00105 00106 protected: 00107 virtual void paintEvent( QPaintEvent *pe ); 00108 virtual void dragEnterEvent( QDragEnterEvent *); 00109 virtual void dropEvent( QDropEvent *); 00110 virtual void mousePressEvent( QMouseEvent *e ); 00111 virtual void mouseMoveEvent( QMouseEvent *e); 00112 virtual void keyPressEvent( QKeyEvent *e ); 00113 00114 private: 00115 class KColorButtonPrivate; 00116 KColorButtonPrivate * const d; 00117 00118 Q_PRIVATE_SLOT( d, void _k_chooseColor() ) 00119 }; 00120 00121 #endif 00122
KDE 4.6 API Reference