summaryrefslogtreecommitdiff
path: root/libopie2
authorzecke <zecke>2004-02-06 19:07:45 (UTC)
committer zecke <zecke>2004-02-06 19:07:45 (UTC)
commit180d7023bf344ff23a6a0b7bf807e4cf85d35d9b (patch) (unidiff)
tree98b4f01471cf6fd333cef093f43771f192945587 /libopie2
parent6704298d8a7c1fdfb4e7ed203f1c46e5c3c0b74a (diff)
downloadopie-180d7023bf344ff23a6a0b7bf807e4cf85d35d9b.zip
opie-180d7023bf344ff23a6a0b7bf807e4cf85d35d9b.tar.gz
opie-180d7023bf344ff23a6a0b7bf807e4cf85d35d9b.tar.bz2
Remove OCheckItem...
Forward port the recent API docu of the FileSelector
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/ocheckitem.cpp127
-rw-r--r--libopie2/opieui/ocheckitem.h86
-rw-r--r--libopie2/opieui/opieui.pro6
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
35using 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 */
44OCheckItem::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 */
53QString 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 */
64void 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 */
74void 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 */
84bool OCheckItem::isChecked() const
85{
86 return m_checked;
87}
88
89/**
90 * @internal
91 * This paints the item
92 */
93void 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
36namespace 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
51class OCheckItem : public QTableItem
52{
53public:
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
76private:
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,11 +1,10 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on debug 2CONFIG += qt warn_on debug
3DESTDIR = $(OPIEDIR)/lib 3DESTDIR = $(OPIEDIR)/lib
4HEADERS = ocheckitem.h \ 4HEADERS = 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 \
@@ -19,14 +18,13 @@ HEADERS = ocheckitem.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
25SOURCES = ocheckitem.cpp \ 24SOURCES = 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 \