Diffstat (limited to 'libopie2/opieui/ocheckitem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opieui/ocheckitem.cpp | 127 |
1 files changed, 0 insertions, 127 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 | } | ||