summaryrefslogtreecommitdiff
path: root/libopie/oclickablelabel.h
Unidiff
Diffstat (limited to 'libopie/oclickablelabel.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/oclickablelabel.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/libopie/oclickablelabel.h b/libopie/oclickablelabel.h
index 4b6dcbc..6e7a123 100644
--- a/libopie/oclickablelabel.h
+++ b/libopie/oclickablelabel.h
@@ -1,53 +1,64 @@
1#ifndef CLICKABLELABEL 1#ifndef CLICKABLELABEL
2#define CLICKABLELABEL 2#define CLICKABLELABEL
3 3
4#include <qlabel.h> 4#include <qlabel.h>
5 5
6/** 6/**
7 * This class is a special QLabel which can behave 7 * This class is a special QLabel which can behave
8 * as a QPushButton or QToggleButton. 8 * as a QPushButton or QToggleButton.
9 * The reason to use a clickable is if you want to save space 9 * The reason to use a clickable is if you want to save space
10 * or you want to skip the border of a normal button 10 * or you want to skip the border of a normal button
11 * 11 *
12 * <pre> 12 * <pre>
13 * QLabel* lbl = new OClickableLabel( parent, "PushLabel" ); 13 * QLabel* lbl = new OClickableLabel( parent, "PushLabel" );
14 * lbl->setPixmap( "config" ); 14 * lbl->setPixmap( "config" );
15 * QWhatsThis::add( lbl, tr("Click here to do something") ); 15 * QWhatsThis::add( lbl, tr("Click here to do something") );
16 * </pre> 16 * </pre>
17 * 17 *
18 * @short A Label behaving as button 18 * @short A Label behaving as button
19 * @author Hakan Ardo, Maximillian Reiß ( harlekin@handhelds.org ) 19 * @author Hakan Ardo, Maximillian Reiß ( harlekin@handhelds.org )
20 * @see QLabel 20 * @see QLabel
21 * @see QPushButton 21 * @see QPushButton
22 * @see QToggleButton 22 * @see QToggleButton
23 * @version 1.0 23 * @version 1.0
24 */ 24 */
25 25
26class OClickableLabel: public QLabel 26class OClickableLabel: public QLabel
27{ 27{
28 Q_OBJECT 28 Q_OBJECT
29public: 29public:
30 OClickableLabel(QWidget* parent = 0, const char* name = 0, 30 OClickableLabel(QWidget* parent = 0, const char* name = 0,
31 WFlags fl = 0); 31 WFlags fl = 0);
32 void setToggleButton(bool t); 32 void setToggleButton(bool t);
33 33
34 protected: 34 protected:
35 /** @internal */
35 void mousePressEvent( QMouseEvent *e ); 36 void mousePressEvent( QMouseEvent *e );
37 /** @internal */
36 void mouseReleaseEvent( QMouseEvent *e ); 38 void mouseReleaseEvent( QMouseEvent *e );
39 /** @internal */
37 void mouseMoveEvent( QMouseEvent *e ); 40 void mouseMoveEvent( QMouseEvent *e );
38 41
39 public slots: 42 public slots:
40 void setOn(bool on); 43 void setOn(bool on);
41 signals: 44 signals:
45 /**
46 * emitted when the labels gets clicked
47 */
42 void clicked(); 48 void clicked();
49
50 /**
51 * emitted when the labels gets toggled
52 * @param the new new state of the label
53 */
43 void toggled(bool on); 54 void toggled(bool on);
44 private: 55 private:
45 bool isToggle : 1; 56 bool isToggle : 1;
46 bool isDown : 1; 57 bool isDown : 1;
47 bool textInverted : 1; 58 bool textInverted : 1;
48 59
49 void showState(bool on); 60 void showState(bool on);
50 void setInverted(bool on); 61 void setInverted(bool on);
51}; 62};
52 63
53#endif 64#endif