summaryrefslogtreecommitdiffabout
path: root/korganizer/koagendaview.h
authorzautrix <zautrix>2004-06-26 19:01:18 (UTC)
committer zautrix <zautrix>2004-06-26 19:01:18 (UTC)
commitb9aad1f15dc600e4dbe4c62d3fcced6363188ba3 (patch) (unidiff)
tree2c3d4004fb21c72cba65793859f9bcd8ffd3a49c /korganizer/koagendaview.h
downloadkdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.zip
kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.gz
kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.bz2
Initial revision
Diffstat (limited to 'korganizer/koagendaview.h') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaview.h252
1 files changed, 252 insertions, 0 deletions
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h
new file mode 100644
index 0000000..0079253
--- a/dev/null
+++ b/korganizer/koagendaview.h
@@ -0,0 +1,252 @@
1/*
2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution.
22*/
23#ifndef KOAGENDAVIEW_H
24#define KOAGENDAVIEW_H
25
26#include <qscrollview.h>
27#include <qdatetime.h>
28#include <qlayout.h>
29#ifndef DESKTOP_VERSION
30#include <qksplitter.h>
31#else
32#include <qsplitter.h>
33#endif
34#include <qmemarray.h>
35
36#include "koeventview.h"
37
38
39class QHBox;
40class QFrame;
41class QLabel;
42class QPushButton;
43class CalendarView;
44class KOAgenda;
45class KOAgendaItem;
46class KConfig;
47class KDGanttMinimizeSplitter;
48class TimeLabels : public QScrollView {
49 Q_OBJECT
50 public:
51 TimeLabels(int rows,QWidget *parent=0,const char *name=0,WFlags f=0);
52
53 void setCellHeight(int height);
54
55 /** Calculates the minimum width */
56 virtual int minimumWidth() const;
57
58 /** updates widget's internal state */
59 void updateConfig();
60
61 /** */
62 void setAgenda(KOAgenda* agenda);
63
64 /** */
65 virtual void paintEvent(QPaintEvent* e);
66
67 public slots:
68 /** update time label positions */
69 void positionChanged();
70
71 protected:
72 void drawContents(QPainter *p,int cx, int cy, int cw, int ch);
73
74 private:
75 int mRows;
76 int mCellHeight;
77
78 /** */
79 KOAgenda* mAgenda;
80};
81
82class EventIndicator : public QFrame {
83 Q_OBJECT
84 public:
85 enum Location { Top, Bottom };
86 EventIndicator(Location loc=Top,QWidget *parent=0,const char *name=0);
87 virtual ~EventIndicator();
88
89 void changeColumns(int columns);
90 void setPaintWidget( KDGanttMinimizeSplitter* );
91 void setXOffset( int );
92 void enableColumn(int column, bool enable);
93
94 protected:
95 void drawContents(QPainter *);
96
97 private:
98 int mXOffset;
99 KDGanttMinimizeSplitter* mPaintWidget;
100 int mColumns;
101 QHBox *mTopBox;
102 QBoxLayout *mTopLayout;
103 Location mLocation;
104 QPixmap mPixmap;
105 QMemArray<bool> mEnabled;
106};
107
108/**
109 KOAgendaView is the agenda-like view used to display events in an one or
110 multi-day view.
111*/
112class KOAgendaView : public KOEventView {
113 Q_OBJECT
114 public:
115 KOAgendaView(Calendar *cal,QWidget *parent = 0,const char *name = 0 );
116 virtual ~KOAgendaView();
117 void setStartHour( int );
118 void toggleAllDay();
119
120
121 /** Returns maximum number of days supported by the koagendaview */
122 virtual int maxDatesHint();
123
124 /** Returns number of currently shown dates. */
125 virtual int currentDateCount();
126
127 /** returns the currently selected events */
128 virtual QPtrList<Incidence> selectedIncidences();
129
130 /** returns the currently selected events */
131 virtual DateList selectedDates();
132
133 /** Remove all events from view */
134 void clearView();
135 KOAgenda *agenda() { return mAgenda;}
136 virtual void printPreview(CalPrinter *calPrinter,
137 const QDate &, const QDate &);
138
139 /** start-datetime of selection */
140 QDateTime selectionStart() {return mTimeSpanBegin;}
141 /** end-datetime of selection */
142 QDateTime selectionEnd() {return mTimeSpanEnd;}
143 /** returns true if selection is for whole day */
144 bool selectedIsAllDay() {return mTimeSpanInAllDay;}
145 /** make selected start/end invalid */
146 void deleteSelectedDateTime();
147 void repaintAgenda();
148 public slots:
149 virtual void updateView();
150 virtual void updateConfig();
151 virtual void showDates(const QDate &start, const QDate &end);
152 virtual void showEvents(QPtrList<Event> eventList);
153
154 void updateTodo( Todo *, int );
155 void changeEventDisplay(Event *, int);
156
157 void clearSelection();
158
159 void newEvent(int gx,int gy);
160 void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd);
161 void newEventAllDay(int gx, int gy);
162
163 void startDrag(Event *);
164
165 void readSettings();
166 void readSettings(KConfig *);
167 void writeSettings(KConfig *);
168
169 void setContentsPos(int y);
170
171 void setExpandedButton( bool expanded );
172 void scrollOneHourUp();
173 void scrollOneHourDown();
174 void addToCalSlot(Incidence *, Incidence *);
175
176 signals:
177 void toggleExpand();
178 void todoMoved( Todo *, int );
179 void incidenceChanged(Incidence * , int );
180 // void cloneIncidenceSignal(Incidence *);
181
182 protected:
183 bool mBlockUpdating;
184 int mUpcomingWidth;
185 /** Fill agenda beginning with date startDate */
186 void fillAgenda(const QDate &startDate);
187 void resizeEvent( QResizeEvent* e );
188 /** Fill agenda using the current set value for the start date */
189 void fillAgenda();
190
191 /** Create labels for the selected dates. */
192 void createDayLabels();
193
194 /**
195 Set the masks on the agenda widgets indicating, which days are holidays.
196 */
197 void setHolidayMasks();
198
199 protected slots:
200 /** Update event belonging to agenda item */
201 void updateEventDates(KOAgendaItem *item, int mode = -1);
202 //void updateMovedTodo();
203
204 void updateEventIndicatorTop(int newY);
205 void updateEventIndicatorBottom(int newY);
206
207 /** Updates data for selected timespan */
208 void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd);
209 /** Updates data for selected timespan for all day event*/
210 void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd);
211
212 private:
213 // view widgets
214 QFrame *mDayLabels;
215 QHBox *mDayLabelsFrame;
216 QBoxLayout *mLayoutDayLabels;
217 QFrame *mAllDayFrame;
218 KOAgenda *mAllDayAgenda;
219 KOAgenda *mAgenda;
220 TimeLabels *mTimeLabels;
221 QWidget *mDummyAllDayLeft;
222
223 KDGanttMinimizeSplitter* mSplitterAgenda;
224 QPushButton *mExpandButton;
225
226 DateList mSelectedDates; // List of dates to be displayed
227 int mViewType;
228
229 bool mWeekStartsMonday;
230 int mStartHour;
231
232 KOEventPopupMenu *mAgendaPopup;
233 KOEventPopupMenu *mAllDayAgendaPopup;
234
235 EventIndicator *mEventIndicatorTop;
236 EventIndicator *mEventIndicatorBottom;
237
238 QMemArray<int> mMinY;
239 QMemArray<int> mMaxY;
240
241 QMemArray<bool> mHolidayMask;
242
243 QPixmap mExpandedPixmap;
244 QPixmap mNotExpandedPixmap;
245 QPtrList<QLabel> mDayLabelsList;
246 QDateTime mTimeSpanBegin;
247 QDateTime mTimeSpanEnd;
248 bool mTimeSpanInAllDay;
249 void keyPressEvent ( QKeyEvent * e );
250};
251
252#endif // KOAGENDAVIEW_H