korganizer Library API Documentation

komonthview.h

00001 /* 00002 This file is part of KOrganizer. 00003 00004 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00019 00020 As a special exception, permission is given to link this program 00021 with any edition of Qt, and distribute the resulting executable, 00022 without including the source code for Qt in the source distribution. 00023 */ 00024 00025 #ifndef _KOMONTHVIEW_H 00026 #define _KOMONTHVIEW_H 00027 00028 #include <qlistbox.h> 00029 #include <qptrvector.h> 00030 #include <qtooltip.h> 00031 #include "koeventview.h" 00032 00033 class KNoScrollListBox; 00034 00035 class KOMonthCellToolTip : public QToolTip 00036 { 00037 public: 00038 KOMonthCellToolTip (QWidget* parent, KNoScrollListBox* lv ); 00039 00040 protected: 00041 void maybeTip( const QPoint & pos); 00042 00043 private: 00044 KNoScrollListBox* eventlist; 00045 }; 00046 00047 00048 class KNoScrollListBox: public QListBox 00049 { 00050 Q_OBJECT 00051 public: 00052 KNoScrollListBox(QWidget *parent=0, const char *name=0); 00053 ~KNoScrollListBox() {} 00054 00055 void setBackground( bool primary, bool workday ); 00056 00057 signals: 00058 void shiftDown(); 00059 void shiftUp(); 00060 void rightClick(); 00061 00062 protected slots: 00063 void keyPressEvent(QKeyEvent *); 00064 void keyReleaseEvent(QKeyEvent *); 00065 void mousePressEvent(QMouseEvent *); 00066 void resizeEvent(QResizeEvent *); 00067 void contentsMouseDoubleClickEvent( QMouseEvent * e ); 00068 00069 private: 00070 bool mSqueezing; 00071 }; 00072 00073 00074 class MonthViewItem: public QListBoxItem 00075 { 00076 public: 00077 MonthViewItem( Incidence *, QDate qd, const QString & title ); 00078 00079 void setTodo(bool on) { mTodo = on; } 00080 void setTodoDone(bool on) { mTodoDone = on; } 00081 void setRecur(bool on) { mRecur = on; } 00082 void setAlarm(bool on) { mAlarm = on; } 00083 void setReply(bool on) { mReply = on; } 00084 00085 void setPalette(const QPalette &p) { mPalette = p; } 00086 QPalette palette() const { return mPalette; } 00087 00088 Incidence *incidence() const { return mIncidence; } 00089 QDate incidenceDate() { return mDate; } 00090 00091 protected: 00092 virtual void paint(QPainter *); 00093 virtual int height(const QListBox *) const; 00094 virtual int width(const QListBox *) const; 00095 00096 private: 00097 bool mTodo; 00098 bool mTodoDone; 00099 bool mRecur; 00100 bool mAlarm; 00101 bool mReply; 00102 00103 QPixmap mTodoPixmap; 00104 QPixmap mTodoDonePixmap; 00105 QPixmap mAlarmPixmap; 00106 QPixmap mRecurPixmap; 00107 QPixmap mReplyPixmap; 00108 00109 QPalette mPalette; 00110 QDate mDate; 00111 00112 Incidence *mIncidence; 00113 }; 00114 00115 00116 class KOMonthView; 00117 00122 class MonthViewCell : public QWidget 00123 { 00124 Q_OBJECT 00125 public: 00126 MonthViewCell( KOMonthView * ); 00127 00129 void setDate( const QDate & ); 00131 QDate date() const; 00132 00133 void setPrimary( bool ); 00134 bool isPrimary() const; 00135 00137 void setHoliday( bool ); 00138 void setHoliday( const QString & ); 00139 00140 void updateCell(); 00144 void addIncidence( Incidence * ); 00149 bool removeIncidence( Incidence * ); 00150 00151 void updateConfig(); 00152 00153 void enableScrollBars( bool ); 00154 00155 Incidence *selectedIncidence(); 00156 QDate selectedIncidenceDate(); 00157 00158 void deselect(); 00159 00160 signals: 00161 void defaultAction( Incidence * ); 00162 void newEventSignal( QDate ); 00163 00164 protected: 00165 void resizeEvent( QResizeEvent * ); 00166 00167 protected slots: 00168 void defaultAction( QListBoxItem * ); 00169 void contextMenu( QListBoxItem * ); 00170 void selection( QListBoxItem * ); 00171 void cellClicked( QListBoxItem * ); 00172 00173 private: 00174 KOMonthView *mMonthView; 00175 00176 QDate mDate; 00177 bool mPrimary; 00178 bool mHoliday; 00179 QString mHolidayString; 00180 00181 QLabel *mLabel; 00182 KNoScrollListBox *mItemList; 00183 00184 QSize mLabelSize; 00185 // QPalette mOriginalPalette; 00186 QPalette mHolidayPalette; 00187 QPalette mStandardPalette; 00188 QPalette mTodayPalette; 00189 }; 00190 00198 class KOMonthView: public KOEventView 00199 { 00200 Q_OBJECT 00201 public: 00202 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); 00203 ~KOMonthView(); 00204 00206 virtual int maxDatesHint(); 00207 00209 virtual int currentDateCount(); 00210 00212 virtual Incidence::List selectedIncidences(); 00213 00215 virtual DateList selectedDates(); 00216 00217 virtual bool eventDurationHint(QDateTime &startDt, QDateTime &endDt, bool &allDay); 00218 00219 virtual void printPreview(CalPrinter *calPrinter, 00220 const QDate &, const QDate &); 00221 00222 public slots: 00223 virtual void updateView(); 00224 virtual void updateConfig(); 00225 virtual void showDates(const QDate &start, const QDate &end); 00226 virtual void showIncidences( const Incidence::List & ); 00227 00228 void changeIncidenceDisplay(Incidence *, int); 00229 void changeIncidenceDisplayAdded(Incidence *); 00230 00231 void clearSelection(); 00232 00233 void showEventContextMenu( Incidence *, QDate ); 00234 void showGeneralContextMenu(); 00235 00236 void setSelectedCell( MonthViewCell * ); 00237 00238 protected slots: 00239 void processSelectionChange(); 00240 00241 protected: 00242 void resizeEvent(QResizeEvent *); 00243 00244 void viewChanged(); 00245 void updateDayLabels(); 00246 00249 MonthViewCell *lookupCellByDate( const QDate &date ); 00250 00251 private: 00252 int mDaysPerWeek; 00253 int mNumWeeks; 00254 int mNumCells; 00255 int mWeekStartDay; 00256 00257 QPtrVector<MonthViewCell> mCells; 00258 QPtrVector<QLabel> mDayLabels; 00259 00260 bool mShortDayLabels; 00261 int mWidthLongDayLabel; 00262 00263 QDate mStartDate; 00264 QDate mSelectedDate; 00265 00266 MonthViewCell *mSelectedCell; 00267 00268 KOEventPopupMenu *mEventContextMenu; 00269 }; 00270 00271 #endif
KDE Logo
This file is part of the documentation for korganizer Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Aug 27 12:53:25 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003