korganizer
komonthview.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef _KOMONTHVIEW_H
00027 #define _KOMONTHVIEW_H
00028
00029 #include <tqlistbox.h>
00030 #include <tqptrvector.h>
00031 #include <tqtooltip.h>
00032 #include "koeventview.h"
00033
00034 class KNoScrollListBox;
00035
00036 class KOMonthCellToolTip : public QToolTip
00037 {
00038 public:
00039 KOMonthCellToolTip (TQWidget* parent, Calendar *calendar, const TQDate &date, KNoScrollListBox* lv );
00040
00041 protected:
00042 void maybeTip( const TQPoint & pos);
00043
00044 private:
00045 Calendar *mCalendar;
00046 TQDate mDate;
00047 KNoScrollListBox* eventlist;
00048 };
00049
00050
00051 class KNoScrollListBox: public QListBox
00052 {
00053 Q_OBJECT
00054 public:
00055 KNoScrollListBox(TQWidget *parent=0, const char *name=0);
00056 ~KNoScrollListBox() {}
00057
00058 void setBackground( bool primary, bool workday );
00059
00060 signals:
00061 void shiftDown();
00062 void shiftUp();
00063 void rightClick();
00064
00065 protected slots:
00066 void keyPressEvent(TQKeyEvent *);
00067 void keyReleaseEvent(TQKeyEvent *);
00068 void mousePressEvent(TQMouseEvent *);
00069 void resizeEvent(TQResizeEvent *);
00070 void contentsMouseDoubleClickEvent( TQMouseEvent * e );
00071
00072 private:
00073 bool mSqueezing;
00074 };
00075
00076
00077 class MonthViewItem: public QListBoxItem
00078 {
00079 public:
00080 MonthViewItem( Incidence *, const TQDateTime &qd, const TQString & title );
00081
00082 void setEvent(bool on) { mEvent = on; }
00083 void setTodo(bool on) { mTodo = on; }
00084 void setTodoDone(bool on) { mTodoDone = on; }
00085 void setRecur(bool on) { mRecur = on; }
00086 void setAlarm(bool on) { mAlarm = on; }
00087 void setReply(bool on) { mReply = on; }
00088
00089 void setPalette(const TQPalette &p) { mPalette = p; }
00090 TQPalette palette() const { return mPalette; }
00091
00092 Incidence *incidence() const { return mIncidence; }
00093 TQDateTime incidenceDateTime() { return mDateTime; }
00094
00095 void setResourceColor( TQColor& color ) { mResourceColor = color; }
00096 TQColor &resourceColor() { return mResourceColor; }
00097 protected:
00098 virtual void paint(TQPainter *);
00099 virtual int height(const TQListBox *) const;
00100 virtual int width(const TQListBox *) const;
00101
00102 TQColor mResourceColor;
00103 private:
00104 bool mEvent;
00105 bool mTodo;
00106 bool mTodoDone;
00107 bool mRecur;
00108 bool mAlarm;
00109 bool mReply;
00110
00111 TQPixmap mEventPixmap;
00112 TQPixmap mBirthdayPixmap;
00113 TQPixmap mAnniversaryPixmap;
00114 TQPixmap mTodoPixmap;
00115 TQPixmap mTodoDonePixmap;
00116 TQPixmap mAlarmPixmap;
00117 TQPixmap mRecurPixmap;
00118 TQPixmap mReplyPixmap;
00119
00120 TQPalette mPalette;
00121 TQDateTime mDateTime;
00122
00123 Incidence *mIncidence;
00124 TQColor catColor() const;
00125 };
00126
00127
00128 class KOMonthView;
00129
00134 class MonthViewCell : public QWidget
00135 {
00136 Q_OBJECT
00137 public:
00138 class CreateItemVisitor;
00139 MonthViewCell( KOMonthView * );
00140
00142 void setDate( const TQDate & );
00144 TQDate date() const;
00145
00147 KOMonthView *monthView() { return mMonthView; }
00148
00156 void setPrimary( bool primary );
00160 bool isPrimary() const;
00161
00163 void setHoliday( bool );
00169 void setHolidayString( const TQString &name );
00170
00171 void updateCell();
00179 void addIncidence( Incidence *incidence, MonthViewCell::CreateItemVisitor&v, int multiDay = 0 );
00184 void removeIncidence( Incidence * );
00185
00186 void updateConfig();
00187
00188 void enableScrollBars( bool );
00189
00190 Incidence *selectedIncidence();
00191 TQDate selectedIncidenceDate();
00192
00193 void deselect();
00194
00195 signals:
00196 void defaultAction( Incidence * );
00202 void newEventSignal( ResourceCalendar *res,const TQString &subResource,
00203 const TQDate &date );
00204
00205 public slots:
00206 void select();
00207
00208 protected:
00209 void setFrameWidth();
00210 void resizeEvent( TQResizeEvent * );
00211
00212 protected slots:
00213 void defaultAction( TQListBoxItem * );
00214 void contextMenu( TQListBoxItem * );
00215
00216 private:
00217 KOMonthView *mMonthView;
00218
00219 TQDate mDate;
00220 bool mPrimary;
00221 bool mHoliday;
00222 TQString mHolidayString;
00223
00224 TQLabel *mLabel;
00225 KNoScrollListBox *mItemList;
00226
00227 bool isSelected;
00228
00229 TQSize mLabelSize;
00230
00231 TQPalette mHolidayPalette;
00232 TQPalette mStandardPalette;
00233 TQPalette mTodayPalette;
00234 };
00235
00243 class KOMonthView: public KOEventView
00244 {
00245 Q_OBJECT
00246 public:
00247 KOMonthView(Calendar *cal, TQWidget *parent = 0, const char *name = 0 );
00248 ~KOMonthView();
00249
00251 virtual int maxDatesHint();
00252
00254 virtual int currentDateCount();
00255
00257 virtual Incidence::List selectedIncidences();
00258
00260 virtual DateList selectedIncidenceDates();
00261
00262 virtual TQDateTime selectionStart();
00263
00264 virtual TQDateTime selectionEnd();
00265
00266 virtual bool eventDurationHint(TQDateTime &startDt, TQDateTime &endDt, bool &allDay);
00267
00268 public slots:
00269 virtual void updateView();
00270 virtual void updateConfig();
00271 virtual void showDates(const TQDate &start, const TQDate &end);
00272 virtual void showIncidences( const Incidence::List &incidenceList, const TQDate &date );
00273
00274 void changeIncidenceDisplay(Incidence *, int);
00275 void changeIncidenceDisplayAdded(Incidence *, MonthViewCell::CreateItemVisitor&);
00276
00277 void clearSelection();
00278
00279 void showEventContextMenu( Calendar *, Incidence *, const TQDate & );
00280 void showGeneralContextMenu();
00281
00282 void setSelectedCell( MonthViewCell * );
00283
00284 protected slots:
00285 void processSelectionChange();
00286
00287 protected:
00288 void resizeEvent(TQResizeEvent *);
00289
00290 void viewChanged();
00291 void updateDayLabels();
00292
00293 private:
00294 void showLabel( bool show );
00295
00296 class GetDateVisitor;
00297 int mDaysPerWeek;
00298 int mNumWeeks;
00299 int mNumCells;
00300 int mWeekStartDay;
00301
00302 TQPtrVector<MonthViewCell> mCells;
00303 TQMap<TQDate,MonthViewCell *> mDateToCell;
00304 TQPtrVector<TQLabel> mDayLabels;
00305
00306 bool mShortDayLabels;
00307 int mWidthLongDayLabel;
00308
00309 TQDate mStartDate;
00310 TQDate mSelectedDate;
00311
00312 MonthViewCell *mSelectedCell;
00313
00314 KOEventPopupMenu *mEventContextMenu;
00315 TQLabel *mLabel;
00316 };
00317
00318 #endif
|