summaryrefslogtreecommitdiffabout
path: root/korganizer/komonthview.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/komonthview.h
downloadkdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.zip
kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.gz
kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.bz2
Initial revision
Diffstat (limited to 'korganizer/komonthview.h') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.h252
1 files changed, 252 insertions, 0 deletions
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
new file mode 100644
index 0000000..d976246
--- a/dev/null
+++ b/korganizer/komonthview.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
20#ifndef _KOMONTHVIEW_H
21#define _KOMONTHVIEW_H
22
23#include <qlabel.h>
24#include <qframe.h>
25#include <qdatetime.h>
26#include <qlistbox.h>
27#include <qpoint.h>
28#include <qlayout.h>
29#include <qintdict.h>
30#include <qpushbutton.h>
31#include <qvaluelist.h>
32#include <qptrvector.h>
33
34#include <libkcal/calendar.h>
35#include <libkcal/event.h>
36
37#include "koeventview.h"
38
39class KOWeekButton : public QPushButton
40{
41 Q_OBJECT
42 public:
43 KOWeekButton( QWidget *parent=0, const char *name=0 ) :
44 QPushButton( parent, name)
45 {
46 connect( this, SIGNAL( clicked() ),
47 SLOT( bottonClicked() ));
48 mNumber = -1;
49 }
50 void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));}
51 signals:
52 void selectWeekNum ( int );
53private:
54 int mNumber;
55private slots :
56 void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); }
57};
58
59class KNoScrollListBox: public QListBox
60{
61 Q_OBJECT
62 public:
63 KNoScrollListBox(QWidget *parent=0, const char *name=0);
64 ~KNoScrollListBox() {}
65 QString getWhatsThisText(QPoint p) ;
66
67 signals:
68 void shiftDown();
69 void shiftUp();
70 void rightClick();
71
72 protected slots:
73 void keyPressEvent(QKeyEvent *);
74 void keyReleaseEvent(QKeyEvent *);
75 void mousePressEvent(QMouseEvent *);
76};
77
78
79class MonthViewItem: public QListBoxItem
80{
81 public:
82 MonthViewItem( Incidence *, QDate qd, const QString & title );
83
84 void setRecur(bool on) { mRecur = on; }
85 void setAlarm(bool on) { mAlarm = on; }
86 void setReply(bool on) { mReply = on; }
87 void setMoreInfo(bool on) { mInfo = on; }
88
89
90 void setPalette(const QPalette &p) { mPalette = p; }
91 QPalette palette() const { return mPalette; }
92
93 Incidence *incidence() const { return mIncidence; }
94 QDate incidenceDate() { return mDate; }
95
96 protected:
97 virtual void paint(QPainter *);
98 virtual int height(const QListBox *) const;
99 virtual int width(const QListBox *) const;
100
101 private:
102 bool mRecur;
103 bool mAlarm;
104 bool mReply;
105 bool mInfo;
106
107 QPalette mPalette;
108 QDate mDate;
109
110 Incidence *mIncidence;
111};
112
113
114class KOMonthView;
115
116class MonthViewCell : public QWidget
117{
118 Q_OBJECT
119 public:
120 MonthViewCell( KOMonthView * );
121
122 void setDate( const QDate & );
123 QDate date() const;
124
125 void setPrimary( bool );
126 bool isPrimary() const;
127
128 void setHoliday( bool );
129 void setHoliday( const QString & );
130
131 void updateCell();
132
133 void updateConfig();
134
135 void enableScrollBars( bool );
136
137 Incidence *selectedIncidence();
138 QDate selectedIncidenceDate();
139
140 void deselect();
141 void select();
142
143 signals:
144 void defaultAction( Incidence * );
145 void newEventSignal( QDateTime );
146
147 protected:
148 void resizeEvent( QResizeEvent * );
149
150 protected slots:
151 void defaultAction( QListBoxItem * );
152 void contextMenu( QListBoxItem * );
153 void selection( QListBoxItem * );
154 void cellClicked( QListBoxItem * );
155 void newEvent();
156
157 private:
158 KOMonthView *mMonthView;
159
160 QDate mDate;
161 bool mPrimary;
162 bool mHoliday;
163 QString mHolidayString;
164
165 //QLabel *mLabel;
166 QPushButton *mLabel;
167 QListBox *mItemList;
168
169 QSize mLabelSize;
170 QSize mLabelBigSize;
171 QPalette mHolidayPalette;
172 QPalette mStandardPalette;
173 QPalette mPrimaryPalette;
174 QPalette mNonPrimaryPalette;
175 void setMyPalette();
176 QPalette getPalette ();
177 void keyPressEvent ( QKeyEvent * ) ;
178
179};
180
181
182class KOMonthView: public KOEventView
183{
184 Q_OBJECT
185 public:
186 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 );
187 ~KOMonthView();
188
189 /** Returns maximum number of days supported by the komonthview */
190 virtual int maxDatesHint();
191
192 /** Returns number of currently shown dates. */
193 virtual int currentDateCount();
194
195 /** returns the currently selected events */
196 virtual QPtrList<Incidence> selectedIncidences();
197
198 /** returns dates of the currently selected events */
199 virtual DateList selectedDates();
200
201 virtual void printPreview(CalPrinter *calPrinter,
202 const QDate &, const QDate &);
203
204 MonthViewCell * selectedCell();
205 public slots:
206 virtual void updateView();
207 virtual void updateConfig();
208 virtual void showDates(const QDate &start, const QDate &end);
209 virtual void showEvents(QPtrList<Event> eventList);
210
211 void changeEventDisplay(Event *, int);
212
213 void clearSelection();
214
215 void showContextMenu( Incidence * );
216
217 void setSelectedCell( MonthViewCell * );
218
219 protected slots:
220 void processSelectionChange();
221 signals:
222 void selectWeekNum ( int );
223 protected:
224 void resizeEvent(QResizeEvent *);
225 void viewChanged();
226 void updateDayLabels();
227
228 private:
229 int mDaysPerWeek;
230 int mNumWeeks;
231 int mNumCells;
232 bool mWeekStartsMonday;
233 bool mShowSatSunComp;
234 void computeLayout();
235
236 QPtrVector<MonthViewCell> mCells;
237 QPtrVector<QLabel> mDayLabels;
238 QPtrVector<KOWeekButton> mWeekLabels;
239
240 bool mShortDayLabels;
241 int mWidthLongDayLabel;
242
243 QDate mStartDate;
244
245 MonthViewCell *mSelectedCell;
246
247 KOEventPopupMenu *mContextMenu;
248 void keyPressEvent ( QKeyEvent * ) ;
249
250};
251
252#endif