author | kergoth <kergoth> | 2002-06-06 23:31:00 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2002-06-06 23:31:00 (UTC) |
commit | dfb9c76738bb68e235114c5ad43dbd26a59b98ab (patch) (unidiff) | |
tree | 25ab1468116e8a092dc402f8aa96a9c6976ebdce /core/pim/datebook/layoutmanager.h | |
parent | 9d6af1137a96d63f71f8e4797fe3bf377d92a15a (diff) | |
download | opie-dfb9c76738bb68e235114c5ad43dbd26a59b98ab.zip opie-dfb9c76738bb68e235114c5ad43dbd26a59b98ab.tar.gz opie-dfb9c76738bb68e235114c5ad43dbd26a59b98ab.tar.bz2 |
Initial revision
Diffstat (limited to 'core/pim/datebook/layoutmanager.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/datebook/layoutmanager.h | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/core/pim/datebook/layoutmanager.h b/core/pim/datebook/layoutmanager.h new file mode 100644 index 0000000..128f927 --- a/dev/null +++ b/core/pim/datebook/layoutmanager.h | |||
@@ -0,0 +1,78 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of the Qtopia Environment. | ||
5 | ** | ||
6 | ** This file may be distributed and/or modified under the terms of the | ||
7 | ** GNU General Public License version 2 as published by the Free Software | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | |||
21 | #include <qvector.h> | ||
22 | #include <qvaluelist.h> | ||
23 | #include <qrect.h> | ||
24 | #include <qdatetime.h> | ||
25 | #include <qpe/event.h> | ||
26 | |||
27 | class LayoutItem | ||
28 | { | ||
29 | public: | ||
30 | LayoutItem( const EffectiveEvent e ); | ||
31 | |||
32 | void setGeometry(const QRect &rect) { r = rect; } | ||
33 | void setGeometry(int x, int y, int w, int h) | ||
34 | { setGeometry(QRect(x,y,w,h)); } | ||
35 | QRect geometry() const { return r; } | ||
36 | |||
37 | EffectiveEvent occurance() const { return eevent; } | ||
38 | Event event() const { return eevent.event(); } | ||
39 | |||
40 | private: | ||
41 | EffectiveEvent eevent; | ||
42 | QRect r; | ||
43 | }; | ||
44 | |||
45 | class LayoutManager | ||
46 | { | ||
47 | public: | ||
48 | LayoutManager(int w, int h); | ||
49 | virtual ~LayoutManager(); | ||
50 | |||
51 | void setSize(int w, int h); | ||
52 | void setMaximumColumnWidth(int x) { maxWidth = x; }; | ||
53 | int maximumColumnWidth() const { return maxWidth; }; | ||
54 | void setOccurances(QValueList<EffectiveEvent> &events); | ||
55 | virtual void addOccurance(EffectiveEvent &event); | ||
56 | |||
57 | void clear() { mItems.clear(); } | ||
58 | |||
59 | QVector<LayoutItem> items() const { return mItems; } | ||
60 | QSize size() const { return QSize(width, height); } | ||
61 | int count() const { return mItems.count(); } | ||
62 | |||
63 | virtual void layoutItems(bool resetMaxWidth = FALSE); | ||
64 | |||
65 | virtual int timeToHeight(const QTime &) const; | ||
66 | virtual QTime heightToTime(int) const; | ||
67 | |||
68 | protected: | ||
69 | void initializeGeometry(LayoutItem *); | ||
70 | LayoutItem *intersects(LayoutItem *, QRect) const; | ||
71 | void addItem(LayoutItem *); | ||
72 | |||
73 | private: | ||
74 | QVector<LayoutItem> mItems; | ||
75 | int width; | ||
76 | int height; | ||
77 | int maxWidth; | ||
78 | }; | ||