libplasma
checkbox.h
Go to the documentation of this file.00001 /* 00002 * Copyright 2007 by Siraj Razick <siraj@kde.org> 00003 * Copyright 2007 by Matt Broadstone <mbroadst@gmail.com> 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU Library General Public License as 00007 * published by the Free Software Foundation; either version 2, or 00008 * (at your option) any later version. 00009 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details 00015 * 00016 * You should have received a copy of the GNU Library General Public 00017 * License along with this program; if not, write to the 00018 * Free Software Foundation, Inc., 00019 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00020 */ 00021 00022 #ifndef CHECKBOX_H 00023 #define CHECKBOX_H 00024 00025 #include <QtCore/QObject> 00026 #include <QtGui/QGraphicsItem> 00027 00028 #include <plasma/plasma_export.h> 00029 #include <plasma/dataengine.h> 00030 #include <plasma/widgets/widget.h> 00031 00032 namespace Plasma 00033 { 00034 00041 class PLASMA_EXPORT CheckBox : public Plasma::Widget 00042 { 00043 Q_OBJECT 00044 public: 00049 explicit CheckBox(QGraphicsItem *parent = 0); 00050 00056 explicit CheckBox(const QString &text, QGraphicsItem *parent = 0); 00057 00061 virtual ~CheckBox(); 00062 00066 bool isChecked() const; 00067 00072 void setChecked(bool checked); 00073 00077 Qt::CheckState checkState() const; 00078 00084 void setCheckState(Qt::CheckState state); 00085 00089 QString text() const; 00090 00095 void setText(const QString &text); 00096 00097 /* 00098 bool isTristate() const; 00099 void setTristate(bool triState = true); 00100 */ 00101 00102 public Q_SLOTS: 00103 void dataUpdated(const QString&, const DataEngine::Data&); 00104 00105 Q_SIGNALS: 00109 void clicked(); 00110 00111 protected: 00112 //bool isDown(); 00113 void mousePressEvent ( QGraphicsSceneMouseEvent * event ); 00114 void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); 00115 void mouseMoveEvent (QGraphicsSceneMouseEvent * event); 00116 void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); 00117 void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); 00118 void hoverEnterEvent ( QGraphicsSceneHoverEvent * event ); 00119 00120 void paintWidget(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); 00121 00122 private: 00123 void init(); 00124 00125 class Private ; 00126 Private * const d; 00127 00128 }; 00129 00130 } // namespace Plasma 00131 00132 #endif
KDE 4.0 API Reference