-rw-r--r-- | libopie2/opieui/ocheckitem.cpp | 127 | ||||
-rw-r--r-- | libopie2/opieui/ocheckitem.h | 86 | ||||
-rw-r--r-- | libopie2/opieui/opieui.pro | 6 |
3 files changed, 2 insertions, 217 deletions
diff --git a/libopie2/opieui/ocheckitem.cpp b/libopie2/opieui/ocheckitem.cpp deleted file mode 100644 index 45f27ee..0000000 --- a/libopie2/opieui/ocheckitem.cpp +++ b/dev/null | |||
@@ -1,127 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | Copyright (C) Stefan Eilers <eilers.stefan@epost.de> | ||
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 | #include <opie2/ocheckitem.h> | ||
31 | |||
32 | /* QT */ | ||
33 | #include <qpainter.h> | ||
34 | |||
35 | using namespace Opie; | ||
36 | |||
37 | /** | ||
38 | * Constructs an CheckItem with a QTable as parent | ||
39 | * and a sort key for. | ||
40 | * The sort key will be used by QTable to sort the table later | ||
41 | * @param t The parent QTable where the check item belongs | ||
42 | * @param key A sort key | ||
43 | */ | ||
44 | OCheckItem::OCheckItem( QTable *t, const QString &key ) | ||
45 | :QTableItem( t, Never, "" ), m_checked( FALSE ), m_sortKey( key ) | ||
46 | {} | ||
47 | |||
48 | /** | ||
49 | * reimplemted for internal reasons | ||
50 | * @return Returns the sort key of the Item | ||
51 | * @see QTableItem | ||
52 | */ | ||
53 | QString OCheckItem::key() const | ||
54 | { | ||
55 | return m_sortKey; | ||
56 | } | ||
57 | |||
58 | /** | ||
59 | * This method can check or uncheck the item. It will | ||
60 | * call QTable to update the cell. | ||
61 | * | ||
62 | * @param b Whether to check or uncheck the item | ||
63 | */ | ||
64 | void OCheckItem::setChecked( bool b ) | ||
65 | { | ||
66 | m_checked = b; | ||
67 | table()->updateCell( row(), col() ); | ||
68 | } | ||
69 | |||
70 | /** | ||
71 | * This will toggle the item. If it is checked it'll get | ||
72 | * unchecked by this method or vice versa. | ||
73 | */ | ||
74 | void OCheckItem::toggle() | ||
75 | { | ||
76 | m_checked = !m_checked; | ||
77 | } | ||
78 | |||
79 | /** | ||
80 | * This will return the state of the item. | ||
81 | * | ||
82 | * @return Returns true if the item is checked | ||
83 | */ | ||
84 | bool OCheckItem::isChecked() const | ||
85 | { | ||
86 | return m_checked; | ||
87 | } | ||
88 | |||
89 | /** | ||
90 | * @internal | ||
91 | * This paints the item | ||
92 | */ | ||
93 | void OCheckItem::paint( QPainter *p, const QColorGroup &cg, const QRect &cr, bool ) | ||
94 | { | ||
95 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); | ||
96 | |||
97 | int marg = ( cr.width() - BoxSize ) / 2; | ||
98 | int x = 0; | ||
99 | int y = ( cr.height() - BoxSize ) / 2; | ||
100 | p->setPen( QPen( cg.text() ) ); | ||
101 | p->drawRect( x + marg, y, BoxSize, BoxSize ); | ||
102 | p->drawRect( x + marg+1, y+1, BoxSize-2, BoxSize-2 ); | ||
103 | p->setPen( darkGreen ); | ||
104 | x += 1; | ||
105 | y += 1; | ||
106 | if ( m_checked ) | ||
107 | { | ||
108 | QPointArray a( 7*2 ); | ||
109 | int i, xx, yy; | ||
110 | xx = x+1+marg; | ||
111 | yy = y+2; | ||
112 | for ( i=0; i<3; i++ ) | ||
113 | { | ||
114 | a.setPoint( 2*i, xx, yy ); | ||
115 | a.setPoint( 2*i+1, xx, yy+2 ); | ||
116 | xx++; yy++; | ||
117 | } | ||
118 | yy -= 2; | ||
119 | for ( i=3; i<7; i++ ) | ||
120 | { | ||
121 | a.setPoint( 2*i, xx, yy ); | ||
122 | a.setPoint( 2*i+1, xx, yy+2 ); | ||
123 | xx++; yy--; | ||
124 | } | ||
125 | p->drawLineSegments( a ); | ||
126 | } | ||
127 | } | ||
diff --git a/libopie2/opieui/ocheckitem.h b/libopie2/opieui/ocheckitem.h deleted file mode 100644 index db2e832..0000000 --- a/libopie2/opieui/ocheckitem.h +++ b/dev/null | |||
@@ -1,86 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | Copyright (C) Stefan Eilers <eilers.stefan@epost.de> | ||
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 OCHECKITEM_H_ | ||
31 | #define OCHECKITEM_H_ | ||
32 | |||
33 | /* QT */ | ||
34 | #include <qtable.h> | ||
35 | |||
36 | namespace Opie | ||
37 | { | ||
38 | |||
39 | /** | ||
40 | * This class represents a checkable QTableItem. This can | ||
41 | * be added to any QTable. | ||
42 | * | ||
43 | * | ||
44 | * @see QTable | ||
45 | * @see QTableItem | ||
46 | * @short An checkable QTableItem | ||
47 | * @version 1.0 | ||
48 | * @author Stefan Eilers ( eilers@handhelds.org ) | ||
49 | **/ | ||
50 | |||
51 | class OCheckItem : public QTableItem | ||
52 | { | ||
53 | public: | ||
54 | /** The size of a box currently unused */ | ||
55 | enum Size { BoxSize = 10 }; | ||
56 | OCheckItem( QTable *t, const QString &sortkey ); | ||
57 | |||
58 | virtual void setChecked( bool b ); | ||
59 | virtual void toggle(); | ||
60 | bool isChecked() const; | ||
61 | /** | ||
62 | * @short Set the sort key | ||
63 | * @reimp | ||
64 | */ | ||
65 | void setKey( const QString &key ) { m_sortKey = key; } | ||
66 | virtual QString key() const; | ||
67 | |||
68 | /** | ||
69 | * @short Paint the Checkitem | ||
70 | * @reimp | ||
71 | */ | ||
72 | void paint( QPainter *p, const QColorGroup &cg, const QRect &cr, bool selected ); | ||
73 | |||
74 | //static const int BoxSize = 10; | ||
75 | |||
76 | private: | ||
77 | class OCheckItemPrivate; | ||
78 | OCheckItemPrivate *d; | ||
79 | bool m_checked : 1; | ||
80 | QString m_sortKey; | ||
81 | |||
82 | }; | ||
83 | |||
84 | }; | ||
85 | |||
86 | #endif | ||
diff --git a/libopie2/opieui/opieui.pro b/libopie2/opieui/opieui.pro index 8b8ed21..708b1fe 100644 --- a/libopie2/opieui/opieui.pro +++ b/libopie2/opieui/opieui.pro | |||
@@ -1,13 +1,12 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt warn_on debug | 2 | CONFIG += qt warn_on debug |
3 | DESTDIR = $(OPIEDIR)/lib | 3 | DESTDIR = $(OPIEDIR)/lib |
4 | HEADERS = ocheckitem.h \ | 4 | HEADERS = oclickablelabel.h \ |
5 | oclickablelabel.h \ | ||
6 | odialog.h \ | 5 | odialog.h \ |
7 | ofontselector.h \ | 6 | ofontselector.h \ |
8 | oimageeffect.h \ | 7 | oimageeffect.h \ |
9 | olistview.h \ | 8 | olistview.h \ |
10 | opixmapeffect.h \ | 9 | opixmapeffect.h \ |
11 | opopupmenu.h \ | 10 | opopupmenu.h \ |
12 | opixmapprovider.h \ | 11 | opixmapprovider.h \ |
13 | oselector.h \ | 12 | oselector.h \ |
@@ -17,18 +16,17 @@ HEADERS = ocheckitem.h \ | |||
17 | otimepicker.h \ | 16 | otimepicker.h \ |
18 | oversatileview.h \ | 17 | oversatileview.h \ |
19 | oversatileviewitem.h \ | 18 | oversatileviewitem.h \ |
20 | omessagebox.h \ | 19 | omessagebox.h \ |
21 | oresource.h \ | 20 | oresource.h \ |
22 | otaskbarapplet.h \ | 21 | otaskbarapplet.h \ |
23 | oseparator.h | 22 | oseparator.h |
24 | 23 | ||
25 | SOURCES = ocheckitem.cpp \ | 24 | SOURCES = oclickablelabel.cpp \ |
26 | oclickablelabel.cpp \ | ||
27 | ofontselector.cpp \ | 25 | ofontselector.cpp \ |
28 | oimageeffect.cpp \ | 26 | oimageeffect.cpp \ |
29 | olistview.cpp \ | 27 | olistview.cpp \ |
30 | opixmapeffect.cpp \ | 28 | opixmapeffect.cpp \ |
31 | opopupmenu.cpp \ | 29 | opopupmenu.cpp \ |
32 | opixmapprovider.cpp \ | 30 | opixmapprovider.cpp \ |
33 | oselector.cpp \ | 31 | oselector.cpp \ |
34 | otabbar.cpp \ | 32 | otabbar.cpp \ |