2 * Copyright 2007 by Siraj Razick <siraj@kde.org>
3 * Copyright 2007 by Matt Broadstone <mbroadst@gmail.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Library General Public License as
7 * published by the Free Software Foundation; either version 2, or
8 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details
16 * You should have received a copy of the GNU Library General Public
17 * License along with this program; if not, write to the
18 * Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 #include <QtCore/QObject>
26 #include <QtGui/QGraphicsItem>
28 #include <plasma/plasma_export.h>
29 #include <plasma/dataengine.h>
30 #include <plasma/widgets/widget.h>
36 * This class provides a QCheckBox available as a Plasma::Widget, so it can be used
37 * within Plasma::Applet's.
39 * @author Siraj Razick <siraj@kde.org>
41 class PLASMA_EXPORT CheckBox
: public Plasma::Widget
46 * Creates a new Plasma::CheckBox.
47 * @param parent the QGraphicsItem this icon is parented to.
49 explicit CheckBox(QGraphicsItem
*parent
= 0);
52 * Creates a new Plasma::Icon with default text.
53 * @param text the text to display next to the checkbox.
54 * @param parent the QGraphicsItem this icon is parented to.
56 explicit CheckBox(const QString
&text
, QGraphicsItem
*parent
= 0);
59 * Destroys a Plasma::Icon.
64 * @return whether this checkbox is currently checked.
66 bool isChecked() const;
69 * Sets the checked state of this Plasma::CheckBox.
70 * @param checked whether the Plasma::CheckBox is checked or not.
72 void setChecked(bool checked
);
75 * @return the checkstate of this Plasma::CheckBox.
77 Qt::CheckState
checkState() const;
80 * Sets the checkstate of this Plasma::CheckBox
81 * @see <qt.h> for definition of Qt::CheckState
82 * @param state the checkstate of this Plasma::CheckBox
84 void setCheckState(Qt::CheckState state
);
87 * @return the text associated with this Plasma::CheckBox
92 * Sets the text associated with this Plasma::CheckBox
93 * @param text the text to associate with this Plasma::CheckBox.
95 void setText(const QString
&text
);
98 bool isTristate() const;
99 void setTristate(bool triState = true);
103 void dataUpdated(const QString
&, const DataEngine::Data
&);
107 * Indicates that this Plasma::CheckBox has been clicked, changing its state.
113 void mousePressEvent ( QGraphicsSceneMouseEvent
* event
);
114 void mouseReleaseEvent ( QGraphicsSceneMouseEvent
* event
);
115 void mouseMoveEvent (QGraphicsSceneMouseEvent
* event
);
116 void hoverMoveEvent ( QGraphicsSceneHoverEvent
* event
);
117 void hoverLeaveEvent ( QGraphicsSceneHoverEvent
* event
);
118 void hoverEnterEvent ( QGraphicsSceneHoverEvent
* event
);
120 void paintWidget(QPainter
*painter
, const QStyleOptionGraphicsItem
*option
, QWidget
*widget
= 0);
130 } // namespace Plasma