korganizer
koagendaview.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 #ifndef KOAGENDAVIEW_H
00026 #define KOAGENDAVIEW_H
00027
00028 #include <qscrollview.h>
00029 #include <qlabel.h>
00030
00031 #include "koeventview.h"
00032
00033 class QHBox;
00034 class QPushButton;
00035 class QBoxLayout;
00036
00037 class KOAgenda;
00038 class KOAgendaItem;
00039 class KConfig;
00040
00041 class TimeLabels : public QScrollView
00042 {
00043 Q_OBJECT
00044 public:
00045 TimeLabels( int rows, QWidget *parent = 0, const char *name = 0,
00046 WFlags f = 0 );
00047
00049 virtual int minimumWidth() const;
00050
00052 void updateConfig();
00053
00055 void setAgenda( KOAgenda *agenda );
00056
00058 virtual void paintEvent( QPaintEvent *e );
00059
00060 public slots:
00062 void positionChanged();
00063
00064 protected:
00065 void drawContents( QPainter *p, int cx, int cy, int cw, int ch );
00066
00067 private slots:
00069 void mousePosChanged(const QPoint &pos);
00070
00071 void showMousePos();
00072 void hideMousePos();
00073
00074 void setCellHeight( double height );
00075
00076 private:
00077 int mRows;
00078 double mCellHeight;
00079 int mMiniWidth;
00080 KOAgenda* mAgenda;
00081
00082 QFrame *mMousePos;
00083 };
00084
00085 class EventIndicator : public QFrame
00086 {
00087 Q_OBJECT
00088 public:
00089 enum Location { Top, Bottom };
00090 EventIndicator( Location loc = Top, QWidget *parent = 0,
00091 const char *name = 0 );
00092 virtual ~EventIndicator();
00093
00094 void changeColumns( int columns );
00095
00096 void enableColumn( int column, bool enable );
00097
00098 protected:
00099 void drawContents( QPainter * );
00100
00101 private:
00102 int mColumns;
00103 QHBox *mTopBox;
00104 QBoxLayout *mTopLayout;
00105 Location mLocation;
00106 QPixmap mPixmap;
00107 QMemArray<bool> mEnabled;
00108 };
00109
00110 class KOAlternateLabel : public QLabel
00111 {
00112 Q_OBJECT
00113 public:
00114 KOAlternateLabel( const QString &shortlabel, const QString &longlabel,
00115 const QString &extensivelabel = QString::null,
00116 QWidget *parent = 0, const char *name = 0 );
00117 ~KOAlternateLabel();
00118
00119 virtual QSize minimumSizeHint() const;
00120
00121 public slots:
00122 void setText( const QString & );
00123 void useShortText();
00124 void useLongText();
00125 void useExtensiveText();
00126 void useDefaultText();
00127
00128 protected:
00129 virtual void resizeEvent( QResizeEvent * );
00130 virtual void squeezeTextToLabel();
00131 bool mTextTypeFixed;
00132 QString mShortText, mLongText, mExtensiveText;
00133 };
00134
00139 class KOAgendaView : public KOEventView
00140 {
00141 Q_OBJECT
00142 public:
00143 KOAgendaView( Calendar *cal, QWidget *parent = 0, const char *name = 0 );
00144 virtual ~KOAgendaView();
00145
00146
00147
00149 virtual int maxDatesHint();
00150
00152 virtual int currentDateCount();
00153
00155 virtual Incidence::List selectedIncidences();
00156
00158 virtual DateList selectedDates();
00159
00161 virtual bool eventDurationHint(QDateTime &startDt, QDateTime &endDt, bool &allDay);
00162
00164 void clearView();
00165
00166 CalPrinterBase::PrintType printType();
00167
00169 QDateTime selectionStart() { return mTimeSpanBegin; }
00171 QDateTime selectionEnd() { return mTimeSpanEnd; }
00173 bool selectedIsAllDay() { return mTimeSpanInAllDay; }
00175 void deleteSelectedDateTime();
00177 bool selectedIsSingleCell();
00178
00179 void setTypeAheadReceiver( QObject * );
00180
00181 public slots:
00182 virtual void updateView();
00183 virtual void updateConfig();
00184 virtual void showDates( const QDate &start, const QDate &end );
00185 virtual void showIncidences( const Incidence::List &incidenceList );
00186
00187 void insertIncidence( Incidence *incidence, const QDate &curDate, int curCol = -1 );
00188 void changeIncidenceDisplayAdded( Incidence *incidence );
00189 void changeIncidenceDisplay( Incidence *incidence, int mode );
00190
00191 void clearSelection();
00192
00193 void startDrag( Incidence * );
00194
00195 void readSettings();
00196 void readSettings( KConfig * );
00197 void writeSettings( KConfig * );
00198
00199 void setContentsPos( int y );
00200
00201 void setExpandedButton( bool expanded );
00202
00203 void finishTypeAhead();
00204
00206 void slotTodoDropped( Todo *, const QPoint &, bool );
00207
00208 void enableAgendaUpdate( bool enable );
00209 void setIncidenceChanger( IncidenceChangerBase *changer );
00210
00211 void zoomInHorizontally( const QDate& date=QDate() );
00212 void zoomOutHorizontally( const QDate& date=QDate() );
00213
00214 void zoomInVertically( );
00215 void zoomOutVertically( );
00216
00217 void zoomView( const int delta, const QPoint &pos,
00218 const Qt::Orientation orient=Qt::Horizontal );
00219 signals:
00220 void toggleExpand();
00221 void zoomViewHorizontally(const QDate &, int count );
00222
00223 protected:
00225 void fillAgenda( const QDate &startDate );
00226
00228 void fillAgenda();
00229
00230 void connectAgenda( KOAgenda*agenda, QPopupMenu*popup, KOAgenda* otherAgenda );
00231
00233 void createDayLabels();
00234
00238 void setHolidayMasks();
00239
00240 void removeIncidence( Incidence * );
00245 void updateEventIndicators();
00246
00247 void updateTimeBarWidth();
00248
00249 protected slots:
00251 void updateEventDates( KOAgendaItem *item );
00253 void doUpdateItem();
00254
00255 void updateEventIndicatorTop( int newY );
00256 void updateEventIndicatorBottom( int newY );
00257
00259 void newTimeSpanSelected( const QPoint &start, const QPoint &end );
00261 void newTimeSpanSelectedAllDay( const QPoint &start, const QPoint &end );
00262
00263 private:
00264
00265 QFrame *mDayLabels;
00266 QHBox *mDayLabelsFrame;
00267 QBoxLayout *mLayoutDayLabels;
00268 QFrame *mAllDayFrame;
00269 KOAgenda *mAllDayAgenda;
00270 KOAgenda *mAgenda;
00271 TimeLabels *mTimeLabels;
00272 QWidget *mDummyAllDayLeft;
00273 QSplitter *mSplitterAgenda;
00274 QPushButton *mExpandButton;
00275
00276 DateList mSelectedDates;
00277 int mViewType;
00278
00279 KOEventPopupMenu *mAgendaPopup;
00280 KOEventPopupMenu *mAllDayAgendaPopup;
00281
00282 EventIndicator *mEventIndicatorTop;
00283 EventIndicator *mEventIndicatorBottom;
00284
00285 QMemArray<int> mMinY;
00286 QMemArray<int> mMaxY;
00287
00288 QMemArray<bool> mHolidayMask;
00289
00290 QPixmap mExpandedPixmap;
00291 QPixmap mNotExpandedPixmap;
00292
00293 QDateTime mTimeSpanBegin;
00294 QDateTime mTimeSpanEnd;
00295 bool mTimeSpanInAllDay;
00296 bool mAllowAgendaUpdate;
00297
00298 Incidence *mUpdateItem;
00299 };
00300
00301 #endif
|