Diffstat (limited to 'core/pim/datebook/datebookday.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/datebook/datebookday.h | 138 |
1 files changed, 138 insertions, 0 deletions
diff --git a/core/pim/datebook/datebookday.h b/core/pim/datebook/datebookday.h new file mode 100644 index 0000000..531fded --- a/dev/null +++ b/core/pim/datebook/datebookday.h | |||
@@ -0,0 +1,138 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of 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 | #ifndef DATEBOOKDAY_H | ||
21 | #define DATEBOOKDAY_H | ||
22 | |||
23 | #include <qpe/event.h> | ||
24 | |||
25 | #include <qdatetime.h> | ||
26 | #include <qtable.h> | ||
27 | #include <qvbox.h> | ||
28 | #include <qlist.h> | ||
29 | |||
30 | class DateBookDayHeader; | ||
31 | class DateBookDB; | ||
32 | class QDateTime; | ||
33 | class QMouseEvent; | ||
34 | class QPaintEvent; | ||
35 | class QResizeEvent; | ||
36 | |||
37 | class DateBookDayView : public QTable | ||
38 | { | ||
39 | Q_OBJECT | ||
40 | public: | ||
41 | DateBookDayView( bool hourClock, QWidget *parent, const char *name ); | ||
42 | bool whichClock() const; | ||
43 | |||
44 | public slots: | ||
45 | void moveUp(); | ||
46 | void moveDown(); | ||
47 | |||
48 | signals: | ||
49 | void sigColWidthChanged(); | ||
50 | void sigCapturedKey( const QString &txt ); | ||
51 | protected slots: | ||
52 | void slotChangeClock( bool ); | ||
53 | protected: | ||
54 | virtual void paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected ); | ||
55 | virtual void paintFocus( QPainter *p, const QRect &cr ); | ||
56 | virtual void resizeEvent( QResizeEvent *e ); | ||
57 | void keyPressEvent( QKeyEvent *e ); | ||
58 | void initHeader(); | ||
59 | private: | ||
60 | bool ampm; | ||
61 | }; | ||
62 | |||
63 | class DateBookDay; | ||
64 | class DateBookDayWidget : public QWidget | ||
65 | { | ||
66 | Q_OBJECT | ||
67 | |||
68 | public: | ||
69 | DateBookDayWidget( const EffectiveEvent &e, DateBookDay *db ); | ||
70 | ~DateBookDayWidget(); | ||
71 | |||
72 | const QRect &geometry() { return geom; } | ||
73 | void setGeometry( const QRect &r ); | ||
74 | |||
75 | const EffectiveEvent &event() const { return ev; } | ||
76 | |||
77 | signals: | ||
78 | void deleteMe( const Event &e ); | ||
79 | void editMe( const Event &e ); | ||
80 | void beamMe( const Event &e ); | ||
81 | |||
82 | protected: | ||
83 | void paintEvent( QPaintEvent *e ); | ||
84 | void mousePressEvent( QMouseEvent *e ); | ||
85 | |||
86 | private: | ||
87 | const EffectiveEvent ev; | ||
88 | DateBookDay *dateBook; | ||
89 | QString text; | ||
90 | QRect geom; | ||
91 | }; | ||
92 | |||
93 | class DateBookDay : public QVBox | ||
94 | { | ||
95 | Q_OBJECT | ||
96 | |||
97 | public: | ||
98 | DateBookDay( bool ampm, bool startOnMonday, DateBookDB *newDb, | ||
99 | QWidget *parent, const char *name ); | ||
100 | void selectedDates( QDateTime &start, QDateTime &end ); | ||
101 | QDate date() const; | ||
102 | DateBookDayView *dayView() const { return view; } | ||
103 | void setStartViewTime( int startHere ); | ||
104 | int startViewTime() const; | ||
105 | |||
106 | public slots: | ||
107 | void setDate( int y, int m, int d ); | ||
108 | void setDate( QDate ); | ||
109 | void redraw(); | ||
110 | void slotWeekChanged( bool bStartOnMonday ); | ||
111 | |||
112 | signals: | ||
113 | void removeEvent( const Event& ); | ||
114 | void editEvent( const Event& ); | ||
115 | void beamEvent( const Event& ); | ||
116 | void newEvent(); | ||
117 | void sigNewEvent( const QString & ); | ||
118 | |||
119 | protected slots: | ||
120 | void keyPressEvent(QKeyEvent *); | ||
121 | |||
122 | private slots: | ||
123 | void dateChanged( int y, int m, int d ); | ||
124 | void slotColWidthChanged() { relayoutPage(); }; | ||
125 | |||
126 | private: | ||
127 | void getEvents(); | ||
128 | void relayoutPage( bool fromResize = false ); | ||
129 | DateBookDayWidget *intersects( const DateBookDayWidget *item, const QRect &geom ); | ||
130 | QDate currDate; | ||
131 | DateBookDayView *view; | ||
132 | DateBookDayHeader *header; | ||
133 | DateBookDB *db; | ||
134 | QList<DateBookDayWidget> widgetList; | ||
135 | int startTime; | ||
136 | }; | ||
137 | |||
138 | #endif | ||