-rw-r--r-- | libopie/oclickablelabel.cpp | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/libopie/oclickablelabel.cpp b/libopie/oclickablelabel.cpp index 5768529..bc7037b 100644 --- a/libopie/oclickablelabel.cpp +++ b/libopie/oclickablelabel.cpp | |||
@@ -2,6 +2,13 @@ | |||
2 | #include <stdio.h> | 2 | #include <stdio.h> |
3 | 3 | ||
4 | OClickableLabel::OClickableLabel(QWidget* parent, | 4 | /** |
5 | const char* name, | 5 | * This constructs the clickable ButtonLabel |
6 | * | ||
7 | * @param parent The parent of this label | ||
8 | * @param name A name of this label @see QObject | ||
9 | * @param fl The windowing flags | ||
10 | */ | ||
11 | OClickableLabel::OClickableLabel(QWidget* parent, | ||
12 | const char* name, | ||
6 | WFlags fl) : | 13 | WFlags fl) : |
7 | QLabel(parent,name,fl) | 14 | QLabel(parent,name,fl) |
@@ -14,8 +21,16 @@ OClickableLabel::OClickableLabel(QWidget* parent, | |||
14 | } | 21 | } |
15 | 22 | ||
23 | /** | ||
24 | * This method makes the label behave as a toggle button | ||
25 | * | ||
26 | * @param t Whether or not to behave like a toggle button | ||
27 | */ | ||
16 | void OClickableLabel::setToggleButton(bool t) { | 28 | void OClickableLabel::setToggleButton(bool t) { |
17 | isToggle=t; | 29 | isToggle=t; |
18 | } | 30 | } |
19 | 31 | ||
32 | /** | ||
33 | * @internal | ||
34 | */ | ||
20 | void OClickableLabel::mousePressEvent( QMouseEvent * /*e*/ ) { | 35 | void OClickableLabel::mousePressEvent( QMouseEvent * /*e*/ ) { |
21 | if (isToggle && isDown) { | 36 | if (isToggle && isDown) { |
@@ -26,4 +41,7 @@ void OClickableLabel::mousePressEvent( QMouseEvent * /*e*/ ) { | |||
26 | } | 41 | } |
27 | 42 | ||
43 | /** | ||
44 | * @internal | ||
45 | */ | ||
28 | void OClickableLabel::mouseReleaseEvent( QMouseEvent *e ) { | 46 | void OClickableLabel::mouseReleaseEvent( QMouseEvent *e ) { |
29 | if (rect().contains(e->pos()) && isToggle) isDown=!isDown; | 47 | if (rect().contains(e->pos()) && isToggle) isDown=!isDown; |
@@ -43,4 +61,7 @@ void OClickableLabel::mouseReleaseEvent( QMouseEvent *e ) { | |||
43 | } | 61 | } |
44 | 62 | ||
63 | /** | ||
64 | * @internal | ||
65 | */ | ||
45 | void OClickableLabel::mouseMoveEvent( QMouseEvent *e ) { | 66 | void OClickableLabel::mouseMoveEvent( QMouseEvent *e ) { |
46 | if (rect().contains(e->pos())) { | 67 | if (rect().contains(e->pos())) { |
@@ -59,4 +80,9 @@ void OClickableLabel::mouseMoveEvent( QMouseEvent *e ) { | |||
59 | } | 80 | } |
60 | 81 | ||
82 | /** | ||
83 | * this toggles the label and inverts the color of | ||
84 | * the label | ||
85 | * @param on | ||
86 | */ | ||
61 | void OClickableLabel::showState(bool on) { | 87 | void OClickableLabel::showState(bool on) { |
62 | if (on) { | 88 | if (on) { |
@@ -83,4 +109,7 @@ void OClickableLabel::setInverted(bool on) { | |||
83 | } | 109 | } |
84 | 110 | ||
111 | /** | ||
112 | * @param on if the Label is down or up | ||
113 | */ | ||
85 | void OClickableLabel::setOn(bool on) { | 114 | void OClickableLabel::setOn(bool on) { |
86 | isDown=on; | 115 | isDown=on; |