korganizer Library API Documentation

komonthview.h

00001 /* 00002 This file is part of KOrganizer. 00003 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with this program; if not, write to the Free Software 00017 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 */ 00019 00020 #ifndef _KOMONTHVIEW_H 00021 #define _KOMONTHVIEW_H 00022 00023 #include <qlabel.h> 00024 #include <qframe.h> 00025 #include <qdatetime.h> 00026 #include <qlistbox.h> 00027 #include <qlayout.h> 00028 #include <qintdict.h> 00029 #include <qpushbutton.h> 00030 #include <qvaluelist.h> 00031 #include <qptrvector.h> 00032 #include <qtooltip.h> 00033 00034 #include <libkcal/calendar.h> 00035 #include <libkcal/event.h> 00036 00037 #include "koeventview.h" 00038 00039 class KNoScrollListBox; 00040 00041 class KOMonthCellToolTip : public QToolTip 00042 { 00043 public: 00044 KOMonthCellToolTip (QWidget* parent, KNoScrollListBox* lv ); 00045 00046 protected: 00047 void maybeTip( const QPoint & pos); 00048 00049 private: 00050 KNoScrollListBox* eventlist; 00051 }; 00052 00053 00054 class KNoScrollListBox: public QListBox 00055 { 00056 Q_OBJECT 00057 public: 00058 KNoScrollListBox(QWidget *parent=0, const char *name=0); 00059 ~KNoScrollListBox() {} 00060 00061 signals: 00062 void shiftDown(); 00063 void shiftUp(); 00064 void rightClick(); 00065 00066 protected slots: 00067 void keyPressEvent(QKeyEvent *); 00068 void keyReleaseEvent(QKeyEvent *); 00069 void mousePressEvent(QMouseEvent *); 00070 void resizeEvent(QResizeEvent *); 00071 void contentsMouseDoubleClickEvent( QMouseEvent * e ); 00072 00073 private: 00074 bool mSqueezing; 00075 }; 00076 00077 00078 class MonthViewItem: public QListBoxItem 00079 { 00080 public: 00081 MonthViewItem( Incidence *, QDate qd, const QString & title ); 00082 00083 void setRecur(bool on) { mRecur = on; } 00084 void setAlarm(bool on) { mAlarm = on; } 00085 void setReply(bool on) { mReply = on; } 00086 00087 void setPalette(const QPalette &p) { mPalette = p; } 00088 QPalette palette() const { return mPalette; } 00089 00090 Incidence *incidence() const { return mIncidence; } 00091 QDate incidenceDate() { return mDate; } 00092 00093 protected: 00094 virtual void paint(QPainter *); 00095 virtual int height(const QListBox *) const; 00096 virtual int width(const QListBox *) const; 00097 00098 private: 00099 bool mRecur; 00100 bool mAlarm; 00101 bool mReply; 00102 00103 QPixmap mAlarmPixmap; 00104 QPixmap mRecurPixmap; 00105 QPixmap mReplyPixmap; 00106 00107 QPalette mPalette; 00108 QDate mDate; 00109 00110 Incidence *mIncidence; 00111 }; 00112 00113 00114 class KOMonthView; 00115 00116 class MonthViewCell : public QWidget 00117 { 00118 Q_OBJECT 00119 public: 00120 MonthViewCell( KOMonthView * ); 00121 00122 void setDate( const QDate & ); 00123 QDate date() const; 00124 00125 void setPrimary( bool ); 00126 bool isPrimary() const; 00127 00128 void setHoliday( bool ); 00129 void setHoliday( const QString & ); 00130 00131 void updateCell(); 00132 00133 void updateConfig(); 00134 00135 void enableScrollBars( bool ); 00136 00137 Incidence *selectedIncidence(); 00138 QDate selectedIncidenceDate(); 00139 00140 void deselect(); 00141 00142 signals: 00143 void defaultAction( Incidence * ); 00144 void newEventSignal( QDate ); 00145 00146 protected: 00147 void resizeEvent( QResizeEvent * ); 00148 00149 protected slots: 00150 void defaultAction( QListBoxItem * ); 00151 void contextMenu( QListBoxItem * ); 00152 void selection( QListBoxItem * ); 00153 void cellClicked( QListBoxItem * ); 00154 00155 private: 00156 KOMonthView *mMonthView; 00157 00158 QDate mDate; 00159 bool mPrimary; 00160 bool mHoliday; 00161 QString mHolidayString; 00162 00163 QLabel *mLabel; 00164 QListBox *mItemList; 00165 00166 QSize mLabelSize; 00167 QPalette mHolidayPalette; 00168 QPalette mStandardPalette; 00169 QPalette mTodayPalette; 00170 }; 00171 00172 00173 class KOMonthView: public KOEventView 00174 { 00175 Q_OBJECT 00176 public: 00177 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); 00178 ~KOMonthView(); 00179 00181 virtual int maxDatesHint(); 00182 00184 virtual int currentDateCount(); 00185 00187 virtual Incidence::List selectedIncidences(); 00188 00190 virtual DateList selectedDates(); 00191 00192 virtual void printPreview(CalPrinter *calPrinter, 00193 const QDate &, const QDate &); 00194 00195 public slots: 00196 virtual void updateView(); 00197 virtual void updateConfig(); 00198 virtual void showDates(const QDate &start, const QDate &end); 00199 virtual void showEvents( const Event::List &eventList ); 00200 00201 void changeEventDisplay(Event *, int); 00202 00203 void clearSelection(); 00204 00205 void showEventContextMenu( Incidence * ); 00206 void showGeneralContextMenu(); 00207 00208 void setSelectedCell( MonthViewCell * ); 00209 00210 protected slots: 00211 void processSelectionChange(); 00212 00213 protected: 00214 void resizeEvent(QResizeEvent *); 00215 00216 void viewChanged(); 00217 void updateDayLabels(); 00218 00219 private: 00220 int mDaysPerWeek; 00221 int mNumWeeks; 00222 int mNumCells; 00223 int mWeekStartDay; 00224 00225 QPtrVector<MonthViewCell> mCells; 00226 QPtrVector<QLabel> mDayLabels; 00227 00228 bool mShortDayLabels; 00229 int mWidthLongDayLabel; 00230 00231 QDate mStartDate; 00232 00233 MonthViewCell *mSelectedCell; 00234 00235 KOEventPopupMenu *mEventContextMenu; 00236 }; 00237 00238 #endif
KDE Logo
This file is part of the documentation for korganizer Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jul 28 23:58:13 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003