author | mickeyl <mickeyl> | 2004-01-15 13:59:58 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-01-15 13:59:58 (UTC) |
commit | dde789ef19fa3a3913805e452ac1e3400688e8a0 (patch) (unidiff) | |
tree | a33a0ce31750ad56cfd3362585d4e7b32ca0a456 /libopie2/opieui/oclickablelabel.h | |
parent | 3c74c5343a8432c494ace71d94cca354c01ef1d3 (diff) | |
download | opie-dde789ef19fa3a3913805e452ac1e3400688e8a0.zip opie-dde789ef19fa3a3913805e452ac1e3400688e8a0.tar.gz opie-dde789ef19fa3a3913805e452ac1e3400688e8a0.tar.bz2 |
more libopie1 --> libopie2 with namespace cleanups and code layout cleanups
Diffstat (limited to 'libopie2/opieui/oclickablelabel.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opieui/oclickablelabel.h | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/libopie2/opieui/oclickablelabel.h b/libopie2/opieui/oclickablelabel.h new file mode 100644 index 0000000..b224d61 --- a/dev/null +++ b/libopie2/opieui/oclickablelabel.h | |||
@@ -0,0 +1,103 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | Copyright (C) Maximillian Reiß <harlekin@handhelds.org> | ||
4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> | ||
5 | .=l. | ||
6 | .>+-= | ||
7 | _;:, .> :=|. This program is free software; you can | ||
8 | .> <`_, > . <= redistribute it and/or modify it under | ||
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
10 | .="- .-=="i, .._ License as published by the Free Software | ||
11 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
12 | ._= =} : or (at your option) any later version. | ||
13 | .%`+i> _;_. | ||
14 | .i_,=:_. -<s. This program is distributed in the hope that | ||
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
16 | : .. .:, . . . without even the implied warranty of | ||
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
19 | ..}^=.= = ; Library General Public License for more | ||
20 | ++= -. .` .: details. | ||
21 | : = ...= . :.=- | ||
22 | -. .:....=;==+<; You should have received a copy of the GNU | ||
23 | -_. . . )=. = Library General Public License along with | ||
24 | -- :-=` this library; see the file COPYING.LIB. | ||
25 | If not, write to the Free Software Foundation, | ||
26 | Inc., 59 Temple Place - Suite 330, | ||
27 | Boston, MA 02111-1307, USA. | ||
28 | */ | ||
29 | |||
30 | #ifndef OCLICKABLELABEL_H | ||
31 | #define OCLICKABLELABEL_H | ||
32 | |||
33 | /* QT */ | ||
34 | #include <qlabel.h> | ||
35 | |||
36 | namespace Opie | ||
37 | { | ||
38 | |||
39 | /** | ||
40 | * This class is a special QLabel which can behave | ||
41 | * as a QPushButton or QToggleButton. | ||
42 | * The reason to use a clickable is if you want to save space | ||
43 | * or you want to skip the border of a normal button | ||
44 | * | ||
45 | * <pre> | ||
46 | * QLabel* lbl = new OClickableLabel( parent, "PushLabel" ); | ||
47 | * lbl->setPixmap( "config" ); | ||
48 | * QWhatsThis::add( lbl, tr("Click here to do something") ); | ||
49 | * </pre> | ||
50 | * | ||
51 | * @short A Label behaving as button | ||
52 | * @author Hakan Ardo, Maximillian Reiß ( harlekin@handhelds.org ) | ||
53 | * @see QLabel | ||
54 | * @see QPushButton | ||
55 | * @see QToggleButton | ||
56 | * @version 1.0 | ||
57 | */ | ||
58 | |||
59 | class OClickableLabel: public QLabel | ||
60 | { | ||
61 | Q_OBJECT | ||
62 | public: | ||
63 | OClickableLabel(QWidget* parent = 0, const char* name = 0, | ||
64 | WFlags fl = 0); | ||
65 | void setToggleButton(bool t); | ||
66 | |||
67 | protected: | ||
68 | /** @internal */ | ||
69 | void mousePressEvent( QMouseEvent *e ); | ||
70 | /** @internal */ | ||
71 | void mouseReleaseEvent( QMouseEvent *e ); | ||
72 | /** @internal */ | ||
73 | void mouseMoveEvent( QMouseEvent *e ); | ||
74 | |||
75 | public slots: | ||
76 | void setOn(bool on); | ||
77 | signals: | ||
78 | /** | ||
79 | * emitted when the labels gets clicked | ||
80 | */ | ||
81 | void clicked(); | ||
82 | |||
83 | /** | ||
84 | * emitted when the labels gets toggled | ||
85 | * @param on the new new state of the label | ||
86 | */ | ||
87 | void toggled(bool on); | ||
88 | private: | ||
89 | bool isToggle : 1; | ||
90 | bool isDown : 1; | ||
91 | bool textInverted : 1; | ||
92 | |||
93 | void showState(bool on); | ||
94 | void setInverted(bool on); | ||
95 | |||
96 | private: | ||
97 | class Private; | ||
98 | Private *d; // private d pointer | ||
99 | }; | ||
100 | |||
101 | }; | ||
102 | |||
103 | #endif | ||