author | mickeyl <mickeyl> | 2003-02-24 15:54:13 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-02-24 15:54:13 (UTC) |
commit | f294a5d101fc9935e1a73f3d44b43ea00d0a03c7 (patch) (unidiff) | |
tree | 3fb4345bb3bacb023c217d55786b734c052de545 /noncore/net/wellenreiter/cornucopia/olistview.h | |
parent | 25725a7cd45731656e3ee3476614512b027dacf8 (diff) | |
download | opie-f294a5d101fc9935e1a73f3d44b43ea00d0a03c7.zip opie-f294a5d101fc9935e1a73f3d44b43ea00d0a03c7.tar.gz opie-f294a5d101fc9935e1a73f3d44b43ea00d0a03c7.tar.bz2 |
visual enhancements for the listview...
Diffstat (limited to 'noncore/net/wellenreiter/cornucopia/olistview.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/cornucopia/olistview.h | 168 |
1 files changed, 168 insertions, 0 deletions
diff --git a/noncore/net/wellenreiter/cornucopia/olistview.h b/noncore/net/wellenreiter/cornucopia/olistview.h new file mode 100644 index 0000000..4b9e4b0 --- a/dev/null +++ b/noncore/net/wellenreiter/cornucopia/olistview.h | |||
@@ -0,0 +1,168 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | |||
4 | Copyright (C) 2003 Michael 'Mickey' Lauer | ||
5 | <mickey@tm.informatik.uni-frankfurt.de> | ||
6 | =. | ||
7 | .=l. | ||
8 | .>+-= | ||
9 | _;:, .> :=|. This program is free software; you can | ||
10 | .> <`_, > . <= redistribute it and/or modify it under | ||
11 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
12 | .="- .-=="i, .._ License as published by the Free Software | ||
13 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
14 | ._= =} : or (at your option) any later version. | ||
15 | .%`+i> _;_. | ||
16 | .i_,=:_. -<s. This program is distributed in the hope that | ||
17 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
18 | : .. .:, . . . without even the implied warranty of | ||
19 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
20 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
21 | ..}^=.= = ; Library General Public License for more | ||
22 | ++= -. .` .: details. | ||
23 | : = ...= . :.=- | ||
24 | -. .:....=;==+<; You should have received a copy of the GNU | ||
25 | -_. . . )=. = Library General Public License along with | ||
26 | -- :-=` this library; see the file COPYING.LIB. | ||
27 | If not, write to the Free Software Foundation, | ||
28 | Inc., 59 Temple Place - Suite 330, | ||
29 | Boston, MA 02111-1307, USA. | ||
30 | |||
31 | */ | ||
32 | |||
33 | #ifndef OLISTVIEW_H | ||
34 | #define OLISTVIEW_H | ||
35 | |||
36 | #include <qlistview.h> | ||
37 | #include <qcolor.h> | ||
38 | #include <qpen.h> | ||
39 | |||
40 | /** | ||
41 | * A @ref QListView variant featuring visual enhancements | ||
42 | * like an alternate background for odd rows and an autostretch | ||
43 | * mode for the width of the widget. | ||
44 | * | ||
45 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | ||
46 | * @short OListView list/tree widget. | ||
47 | */ | ||
48 | class OListView: public QListView | ||
49 | { | ||
50 | public: | ||
51 | /** | ||
52 | * Constructor. | ||
53 | * | ||
54 | * The parameters @p parent and @p name are handled by | ||
55 | * @ref QListView, as usual. | ||
56 | */ | ||
57 | OListView ( QWidget *parent = 0, const char *name = 0 ); | ||
58 | |||
59 | /** | ||
60 | * Destructor. | ||
61 | */ | ||
62 | virtual ~OListView(); | ||
63 | |||
64 | /** | ||
65 | * Let the last column fit exactly all the available width. | ||
66 | */ | ||
67 | void setFullWidth( bool fullWidth ); | ||
68 | |||
69 | /** | ||
70 | * Returns whether the last column is set to fit the available width. | ||
71 | */ | ||
72 | bool fullWidth() const; | ||
73 | |||
74 | /** | ||
75 | * Reimplemented for full width support | ||
76 | */ | ||
77 | virtual int addColumn( const QString& label, int width = -1 ); | ||
78 | |||
79 | /** | ||
80 | * Reimplemented for full width support | ||
81 | */ | ||
82 | virtual int addColumn( const QIconSet& iconset, const QString& label, int width = -1 ); | ||
83 | |||
84 | /** | ||
85 | * Reimplemented for full width support | ||
86 | */ | ||
87 | virtual void removeColumn(int index); | ||
88 | |||
89 | /** | ||
90 | * sets the alternate background background color. | ||
91 | * This only has an effect if the items are OListViewItems | ||
92 | * | ||
93 | * @param c the color to use for every other item. Set to an invalid | ||
94 | * color to disable alternate colors. | ||
95 | */ | ||
96 | void setAlternateBackground( const QColor &c ); | ||
97 | |||
98 | /** | ||
99 | * sets the column separator pen. | ||
100 | * | ||
101 | * @param p the pen used to draw the column separator. | ||
102 | */ | ||
103 | void setColumnSeparator( const QPen &p ); | ||
104 | |||
105 | /** | ||
106 | * @return the alternate background color | ||
107 | */ | ||
108 | const QColor& alternateBackground() const; | ||
109 | |||
110 | /** | ||
111 | * @return the column separator pen | ||
112 | */ | ||
113 | const QPen& columnSeparator() const; | ||
114 | |||
115 | private: | ||
116 | QColor m_alternateBackground; | ||
117 | bool m_fullWidth; | ||
118 | QPen m_columnSeparator; | ||
119 | |||
120 | }; | ||
121 | |||
122 | //****************************** OListViewItem ****************************************************************** | ||
123 | |||
124 | class OListViewItem: public QListViewItem | ||
125 | { | ||
126 | public: | ||
127 | OListViewItem( QListView * parent ); | ||
128 | OListViewItem( QListViewItem * parent ); | ||
129 | OListViewItem( QListView * parent, QListViewItem * after ); | ||
130 | OListViewItem( QListViewItem * parent, QListViewItem * after ); | ||
131 | |||
132 | OListViewItem( QListView * parent, | ||
133 | QString, QString = QString::null, | ||
134 | QString = QString::null, QString = QString::null, | ||
135 | QString = QString::null, QString = QString::null, | ||
136 | QString = QString::null, QString = QString::null ); | ||
137 | |||
138 | OListViewItem( QListViewItem * parent, | ||
139 | QString, QString = QString::null, | ||
140 | QString = QString::null, QString = QString::null, | ||
141 | QString = QString::null, QString = QString::null, | ||
142 | QString = QString::null, QString = QString::null ); | ||
143 | |||
144 | OListViewItem( QListView * parent, QListViewItem * after, | ||
145 | QString, QString = QString::null, | ||
146 | QString = QString::null, QString = QString::null, | ||
147 | QString = QString::null, QString = QString::null, | ||
148 | QString = QString::null, QString = QString::null ); | ||
149 | |||
150 | OListViewItem( QListViewItem * parent, QListViewItem * after, | ||
151 | QString, QString = QString::null, | ||
152 | QString = QString::null, QString = QString::null, | ||
153 | QString = QString::null, QString = QString::null, | ||
154 | QString = QString::null, QString = QString::null ); | ||
155 | |||
156 | virtual ~OListViewItem(); | ||
157 | |||
158 | const QColor& backgroundColor(); | ||
159 | bool isAlternate(); | ||
160 | void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int alignment ); | ||
161 | void init(); | ||
162 | |||
163 | private: | ||
164 | bool m_known; | ||
165 | bool m_odd; | ||
166 | }; | ||
167 | |||
168 | #endif | ||