author | zautrix <zautrix> | 2005-03-20 16:15:56 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-20 16:15:56 (UTC) |
commit | a9e08041c8978d52cfcabc84f579784af45eb8d9 (patch) (unidiff) | |
tree | 6448348326db4325938679350c58d87176d90771 /korganizer/kodaymatrix.h | |
parent | 69d75020eea5f95b9f5d77d97ed85ec8869d32db (diff) | |
download | kdepimpi-a9e08041c8978d52cfcabc84f579784af45eb8d9.zip kdepimpi-a9e08041c8978d52cfcabc84f579784af45eb8d9.tar.gz kdepimpi-a9e08041c8978d52cfcabc84f579784af45eb8d9.tar.bz2 |
layout fix
-rw-r--r-- | korganizer/kodaymatrix.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/kodaymatrix.h b/korganizer/kodaymatrix.h index 39946de..f4016b6 100644 --- a/korganizer/kodaymatrix.h +++ b/korganizer/kodaymatrix.h | |||
@@ -78,193 +78,193 @@ private: | |||
78 | }; | 78 | }; |
79 | 79 | ||
80 | /** | 80 | /** |
81 | * replacement for kdpdatebuton.cpp that used 42 widgets for the day matrix to be displayed. | 81 | * replacement for kdpdatebuton.cpp that used 42 widgets for the day matrix to be displayed. |
82 | * Cornelius thought this was a waste of memory and a lot of overhead. | 82 | * Cornelius thought this was a waste of memory and a lot of overhead. |
83 | * In addition the selection was not very intuitive so I decided to rewrite it using a QFrame | 83 | * In addition the selection was not very intuitive so I decided to rewrite it using a QFrame |
84 | * that draws the labels and allows for dragging selection while maintaining nearly full | 84 | * that draws the labels and allows for dragging selection while maintaining nearly full |
85 | * compatibility in behaviour with its predecessor. | 85 | * compatibility in behaviour with its predecessor. |
86 | * | 86 | * |
87 | * The following functionality has been changed: | 87 | * The following functionality has been changed: |
88 | * | 88 | * |
89 | * o when shifting events in the agenda view from one day to another the day matrix is updated now | 89 | * o when shifting events in the agenda view from one day to another the day matrix is updated now |
90 | * o TODO ET dragging an event to the matrix will MOVE not COPY the event to the new date. | 90 | * o TODO ET dragging an event to the matrix will MOVE not COPY the event to the new date. |
91 | * o no support for Ctrl+click to create groups of dates | 91 | * o no support for Ctrl+click to create groups of dates |
92 | * (This has not really been supported in the predecessor. It was not very intuitive nor was it | 92 | * (This has not really been supported in the predecessor. It was not very intuitive nor was it |
93 | * user friendly.) | 93 | * user friendly.) |
94 | * This feature has been replaced with dragging a selection on the matrix. The matrix will | 94 | * This feature has been replaced with dragging a selection on the matrix. The matrix will |
95 | * automatically choose the appropriate selection (e.g. you are not any longer able to select | 95 | * automatically choose the appropriate selection (e.g. you are not any longer able to select |
96 | * two distinct groups of date selections as in the old class) | 96 | * two distinct groups of date selections as in the old class) |
97 | * o now that you can select more then a week it can happen that not all selected days are | 97 | * o now that you can select more then a week it can happen that not all selected days are |
98 | * displayed in the matrix. However this is preferred to the alternative which would mean to | 98 | * displayed in the matrix. However this is preferred to the alternative which would mean to |
99 | * adjust the selection and leave some days undisplayed while scrolling through the months | 99 | * adjust the selection and leave some days undisplayed while scrolling through the months |
100 | * | 100 | * |
101 | * @short day matrix widget of the KDateNavigator | 101 | * @short day matrix widget of the KDateNavigator |
102 | * | 102 | * |
103 | * @author Eitzenberger Thomas | 103 | * @author Eitzenberger Thomas |
104 | */ | 104 | */ |
105 | class KODayMatrix: public QFrame { | 105 | class KODayMatrix: public QFrame { |
106 | 106 | ||
107 | Q_OBJECT | 107 | Q_OBJECT |
108 | 108 | ||
109 | public: | 109 | public: |
110 | 110 | ||
111 | /** constructor to create a day matrix widget. | 111 | /** constructor to create a day matrix widget. |
112 | * | 112 | * |
113 | * @param parent widget that is the parent of the day matrix. Normally this should | 113 | * @param parent widget that is the parent of the day matrix. Normally this should |
114 | * be a KDateNavigator | 114 | * be a KDateNavigator |
115 | * @param calendar instance of a calendar on which all calculations are based | 115 | * @param calendar instance of a calendar on which all calculations are based |
116 | * @param date start date of the matrix (is expected to be already fixed). It is | 116 | * @param date start date of the matrix (is expected to be already fixed). It is |
117 | * assumed that this date is the first week day to be shown in the matrix. | 117 | * assumed that this date is the first week day to be shown in the matrix. |
118 | * @param name name of the widget | 118 | * @param name name of the widget |
119 | */ | 119 | */ |
120 | KODayMatrix( QWidget *parent, const char *name ); | 120 | KODayMatrix( QWidget *parent, const char *name ); |
121 | //KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name ); | 121 | //KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name ); |
122 | 122 | ||
123 | /** destructor that deallocates all dynamically allocated private members. | 123 | /** destructor that deallocates all dynamically allocated private members. |
124 | */ | 124 | */ |
125 | ~KODayMatrix(); | 125 | ~KODayMatrix(); |
126 | 126 | ||
127 | /** updates the day matrix to start with the given date. Does all the necessary | 127 | /** updates the day matrix to start with the given date. Does all the necessary |
128 | * checks for holidays or events on a day and stores them for display later on. | 128 | * checks for holidays or events on a day and stores them for display later on. |
129 | * Does NOT update the view visually. Call repaint() for this. | 129 | * Does NOT update the view visually. Call repaint() for this. |
130 | * | 130 | * |
131 | * @param actdate recalculates the day matrix to show NUMDAYS starting from this | 131 | * @param actdate recalculates the day matrix to show NUMDAYS starting from this |
132 | * date. | 132 | * date. |
133 | */ | 133 | */ |
134 | void updateView(QDate actdate); | 134 | void updateView(QDate actdate); |
135 | void updateEvents(); | 135 | void updateEvents(); |
136 | 136 | ||
137 | /** returns the QDate object associated with day indexed by the | 137 | /** returns the QDate object associated with day indexed by the |
138 | * supplied offset. | 138 | * supplied offset. |
139 | */ | 139 | */ |
140 | const QDate& getDate(int offset); | 140 | const QDate& getDate(int offset); |
141 | void setCalendar( Calendar * ); | 141 | void setCalendar( Calendar * ); |
142 | /** returns the official name of this holy day or 0 if there is no label | 142 | /** returns the official name of this holy day or 0 if there is no label |
143 | * for this day. | 143 | * for this day. |
144 | */ | 144 | */ |
145 | QString getHolidayLabel(int offset); | 145 | QString getHolidayLabel(int offset); |
146 | 146 | ||
147 | /** adds all actual selected days from mSelStart to mSelEnd to the supplied | 147 | /** adds all actual selected days from mSelStart to mSelEnd to the supplied |
148 | * DateList. | 148 | * DateList. |
149 | */ | 149 | */ |
150 | void addSelectedDaysTo(DateList&); | 150 | void addSelectedDaysTo(DateList&); |
151 | 151 | ||
152 | /** sets the actual to be displayed selection in the day matrix starting from | 152 | /** sets the actual to be displayed selection in the day matrix starting from |
153 | * start and ending with end. Theview must be manually updated by calling | 153 | * start and ending with end. Theview must be manually updated by calling |
154 | * repaint. (?) | 154 | * repaint. (?) |
155 | */ | 155 | */ |
156 | void setSelectedDaysFrom(const QDate& start, const QDate& end); | 156 | void setSelectedDaysFrom(const QDate& start, const QDate& end); |
157 | void clearSelection(); | 157 | void clearSelection(); |
158 | 158 | ||
159 | /** Is today visible in the view? Keep this in sync with | 159 | /** Is today visible in the view? Keep this in sync with |
160 | * the values today (below) can take. | 160 | * the values today (below) can take. |
161 | */ | 161 | */ |
162 | bool isTodayVisible() const { return today>=0; } ; | 162 | bool isTodayVisible() const { return today>=0; } ; |
163 | 163 | ||
164 | /** If today is visible, then we can find out if today is | 164 | /** If today is visible, then we can find out if today is |
165 | * near the beginning or the end of the month. | 165 | * near the beginning or the end of the month. |
166 | * This is dependent on today remaining the index | 166 | * This is dependent on today remaining the index |
167 | * in the array of visible dates and going from | 167 | * in the array of visible dates and going from |
168 | * top left (0) to bottom right (41). | 168 | * top left (0) to bottom right (41). |
169 | */ | 169 | */ |
170 | bool isBeginningOfMonth() const { return today<=8; } ; | 170 | bool isBeginningOfMonth() const { return today<=8; } ; |
171 | bool isEndOfMonth() const { return today>=27; } ; | 171 | bool isEndOfMonth() const { return today>=27; } ; |
172 | QString getWhatsThisText( QPoint ) ; | 172 | QString getWhatsThisText( QPoint ) ; |
173 | QSize sizeHint() const; | 173 | QSize sizeHint() const; |
174 | 174 | QRect frameRect () const { int wid = frameWidth(); return QRect(0+wid,0+wid,width()-wid-wid,height()-wid-wid);} | |
175 | public slots: | 175 | public slots: |
176 | /** Recalculates all the flags of the days in the matrix like holidays or events | 176 | /** Recalculates all the flags of the days in the matrix like holidays or events |
177 | * on a day (Actually calls above method with the actual startdate). | 177 | * on a day (Actually calls above method with the actual startdate). |
178 | */ | 178 | */ |
179 | void updateView(); | 179 | void updateView(); |
180 | void updateViewTimed(); | 180 | void updateViewTimed(); |
181 | void repaintViewTimed(); | 181 | void repaintViewTimed(); |
182 | 182 | ||
183 | /** | 183 | /** |
184 | * Calculate which square in the matrix should be | 184 | * Calculate which square in the matrix should be |
185 | * hilighted to indicate it's today. | 185 | * hilighted to indicate it's today. |
186 | */ | 186 | */ |
187 | void recalculateToday(); | 187 | void recalculateToday(); |
188 | 188 | ||
189 | /* | 189 | /* |
190 | void setStartDate(QDate); | 190 | void setStartDate(QDate); |
191 | */ | 191 | */ |
192 | 192 | ||
193 | signals: | 193 | signals: |
194 | 194 | ||
195 | /** emitted if the user selects a block of days with the mouse by dragging a rectangle | 195 | /** emitted if the user selects a block of days with the mouse by dragging a rectangle |
196 | * inside the matrix | 196 | * inside the matrix |
197 | * | 197 | * |
198 | * @param daylist list of days that have been selected by the user | 198 | * @param daylist list of days that have been selected by the user |
199 | */ | 199 | */ |
200 | void selected( const KCal::DateList &daylist ); | 200 | void selected( const KCal::DateList &daylist ); |
201 | 201 | ||
202 | /** emitted if the user has dropped an event inside the matrix | 202 | /** emitted if the user has dropped an event inside the matrix |
203 | * | 203 | * |
204 | * @param event the dropped calendar event | 204 | * @param event the dropped calendar event |
205 | */ | 205 | */ |
206 | void eventDropped(Event *event); | 206 | void eventDropped(Event *event); |
207 | 207 | ||
208 | protected: | 208 | protected: |
209 | 209 | ||
210 | void paintEvent(QPaintEvent *ev); | 210 | void paintEvent(QPaintEvent *ev); |
211 | 211 | ||
212 | void mousePressEvent (QMouseEvent* e); | 212 | void mousePressEvent (QMouseEvent* e); |
213 | 213 | ||
214 | void mouseReleaseEvent (QMouseEvent* e); | 214 | void mouseReleaseEvent (QMouseEvent* e); |
215 | 215 | ||
216 | void mouseMoveEvent (QMouseEvent* e); | 216 | void mouseMoveEvent (QMouseEvent* e); |
217 | 217 | ||
218 | void dragEnterEvent(QDragEnterEvent *); | 218 | void dragEnterEvent(QDragEnterEvent *); |
219 | 219 | ||
220 | void dragMoveEvent(QDragMoveEvent *); | 220 | void dragMoveEvent(QDragMoveEvent *); |
221 | 221 | ||
222 | void dragLeaveEvent(QDragLeaveEvent *); | 222 | void dragLeaveEvent(QDragLeaveEvent *); |
223 | 223 | ||
224 | void dropEvent(QDropEvent *); | 224 | void dropEvent(QDropEvent *); |
225 | 225 | ||
226 | void resizeEvent(QResizeEvent *); | 226 | void resizeEvent(QResizeEvent *); |
227 | 227 | ||
228 | private: | 228 | private: |
229 | bool mouseDown; | 229 | bool mouseDown; |
230 | QBitArray bDays; | 230 | QBitArray bDays; |
231 | QPixmap myPix; | 231 | QPixmap myPix; |
232 | QTimer* mUpdateTimer; | 232 | QTimer* mUpdateTimer; |
233 | QTimer* mRepaintTimer; | 233 | QTimer* mRepaintTimer; |
234 | bool mDayChanged; | 234 | bool mDayChanged; |
235 | bool mPendingUpdateBeforeRepaint; | 235 | bool mPendingUpdateBeforeRepaint; |
236 | 236 | ||
237 | /** returns the index of the day located at the matrix's widget (x,y) position. | 237 | /** returns the index of the day located at the matrix's widget (x,y) position. |
238 | * | 238 | * |
239 | * @param x horizontal coordinate | 239 | * @param x horizontal coordinate |
240 | * @param y vertical coordinate | 240 | * @param y vertical coordinate |
241 | */ | 241 | */ |
242 | int getDayIndexFrom(int x, int y); | 242 | int getDayIndexFrom(int x, int y); |
243 | 243 | ||
244 | /** calculates a "shaded" color from the supplied color object. | 244 | /** calculates a "shaded" color from the supplied color object. |
245 | * (Copied from Cornelius's kdpdatebutton.cpp) | 245 | * (Copied from Cornelius's kdpdatebutton.cpp) |
246 | * | 246 | * |
247 | * @param color source based on which a shaded color should be calculated. | 247 | * @param color source based on which a shaded color should be calculated. |
248 | */ | 248 | */ |
249 | QColor getShadedColor(QColor color); | 249 | QColor getShadedColor(QColor color); |
250 | 250 | ||
251 | /** number of days to be displayed. For now there is no support for any other number then 42. | 251 | /** number of days to be displayed. For now there is no support for any other number then 42. |
252 | so change it at your own risk :o) */ | 252 | so change it at your own risk :o) */ |
253 | static const int NUMDAYS; | 253 | static const int NUMDAYS; |
254 | 254 | ||
255 | /** calendar instance to be queried for holidays, events, ... */ | 255 | /** calendar instance to be queried for holidays, events, ... */ |
256 | Calendar *mCalendar; | 256 | Calendar *mCalendar; |
257 | 257 | ||
258 | /** starting date of the matrix */ | 258 | /** starting date of the matrix */ |
259 | QDate startdate; | 259 | QDate startdate; |
260 | 260 | ||
261 | /** array of day labels to optimeize drawing performance. */ | 261 | /** array of day labels to optimeize drawing performance. */ |
262 | QString *daylbls; | 262 | QString *daylbls; |
263 | 263 | ||
264 | /** array of days displayed to reduce memory consumption by | 264 | /** array of days displayed to reduce memory consumption by |
265 | subsequently calling QDate::addDays(). */ | 265 | subsequently calling QDate::addDays(). */ |
266 | QDate *days; | 266 | QDate *days; |
267 | 267 | ||
268 | /** array of storing the number of events on a given day. | 268 | /** array of storing the number of events on a given day. |
269 | * used for drawing a bold font if there is at least one event on that day. | 269 | * used for drawing a bold font if there is at least one event on that day. |
270 | */ | 270 | */ |