korganizer Library API Documentation

koagendaview.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., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 
00019     As a special exception, permission is given to link this program
00020     with any edition of Qt, and distribute the resulting executable,
00021     without including the source code for Qt in the source distribution.
00022 */
00023 #ifndef KOAGENDAVIEW_H
00024 #define KOAGENDAVIEW_H
00025 
00026 #include <qscrollview.h>
00027 #include <qdatetime.h>
00028 #include <qlayout.h>
00029 #include <qsplitter.h>
00030 #include <qmemarray.h>
00031 
00032 #include "koeventview.h"
00033 
00034 
00035 class QHBox;
00036 class QFrame;
00037 class QPushButton;
00038 
00039 class KOAgenda;
00040 class KOAgendaItem;
00041 class KConfig;
00042 
00043 class TimeLabels : public QScrollView {
00044     Q_OBJECT
00045   public:
00046     TimeLabels(int rows,QWidget *parent=0,const char *name=0,WFlags f=0);
00047 
00048     void setCellHeight(int height);
00049 
00051     virtual int minimumWidth() const;
00052 
00054     void updateConfig();
00055 
00057     void setAgenda(KOAgenda* agenda);
00058 
00060     virtual void paintEvent(QPaintEvent* e);
00061 
00062   public slots:
00064     void positionChanged();
00065 
00066   protected:
00067     void drawContents(QPainter *p,int cx, int cy, int cw, int ch);
00068 
00069   private:
00070     int mRows;
00071     int mCellHeight;
00072 
00074     KOAgenda* mAgenda;
00075 };
00076 
00077 class EventIndicator : public QFrame {
00078     Q_OBJECT
00079   public:
00080     enum Location { Top, Bottom };
00081     EventIndicator(Location loc=Top,QWidget *parent=0,const char *name=0);
00082     virtual ~EventIndicator();
00083 
00084     void changeColumns(int columns);
00085 
00086     void enableColumn(int column, bool enable);
00087 
00088   protected:
00089     void drawContents(QPainter *);
00090 
00091   private:
00092     int mColumns;
00093     QHBox *mTopBox;
00094     QBoxLayout *mTopLayout;
00095     Location mLocation;
00096     QPixmap mPixmap;
00097     QMemArray<bool> mEnabled;
00098 };
00099 
00104 class KOAgendaView : public KOEventView {
00105     Q_OBJECT
00106   public:
00107     KOAgendaView(Calendar *cal,QWidget *parent = 0,const char *name = 0 );
00108     virtual ~KOAgendaView();
00109 
00111     virtual int maxDatesHint();
00112 
00114     virtual int currentDateCount();
00115 
00117     virtual QPtrList<Incidence> selectedIncidences();
00118     
00120     virtual DateList selectedDates();
00121 
00123     void clearView();
00124 
00125     virtual void printPreview(CalPrinter *calPrinter,
00126                               const QDate &, const QDate &);
00127                               
00129     QDateTime selectionStart() {return mTimeSpanBegin;}
00131     QDateTime selectionEnd() {return mTimeSpanEnd;}
00133     bool selectedIsAllDay() {return mTimeSpanInAllDay;}
00135     void deleteSelectedDateTime();
00136 
00137   public slots:
00138     virtual void updateView();
00139     virtual void updateConfig();
00140     virtual void showDates(const QDate &start, const QDate &end);
00141     virtual void showEvents(QPtrList<Event> eventList);
00142 
00143     void changeEventDisplay(Event *, int);
00144 
00145     void clearSelection();
00146 
00147     void newEvent(int gx,int gy);
00148     void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd);
00149     void newEventAllDay(int gx, int gy);
00150 
00151     void startDrag(Event *);
00152 
00153     void readSettings();
00154     void readSettings(KConfig *);
00155     void writeSettings(KConfig *);
00156 
00157     void setContentsPos(int y);
00158 
00159     void setExpandedButton( bool expanded );
00160 
00161   signals:
00162     void editEventSignal(Event *);  // From KOBaseView
00163     void showEventSignal(Event *);
00164     void deleteEventSignal(Event *);  // From KOBaseView
00165     void newEventSignal();  // From KOBaseView
00166     void newEventSignal(QDate);
00167     void newEventSignal(QDateTime);
00168     void newEventSignal(QDateTime, QDateTime);  // From KOBaseView
00169 
00170     void toggleExpand();
00171 
00172     void eventChanged();
00173 
00174   protected:
00176     void fillAgenda(const QDate &startDate);
00177 
00179     void fillAgenda();
00180 
00182     void createDayLabels();
00183 
00187     void setHolidayMasks();
00188 
00189   protected slots:
00191     void updateEventDates(KOAgendaItem *item);
00192 
00193     void showAgendaPopup(Event *event);
00194     void showAllDayAgendaPopup(Event *event);
00195 
00196     void updateEventIndicatorTop(int newY);
00197     void updateEventIndicatorBottom(int newY);
00198     
00200     void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd);
00202     void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd);
00203 
00204   private:
00205     // view widgets
00206     QFrame *mDayLabels;
00207     QHBox *mDayLabelsFrame;
00208     QBoxLayout *mLayoutDayLabels;
00209     QFrame *mAllDayFrame;
00210     KOAgenda *mAllDayAgenda;
00211     KOAgenda *mAgenda;
00212     TimeLabels *mTimeLabels;
00213     QWidget *mDummyAllDayLeft;
00214     QSplitter *mSplitterAgenda;
00215     QPushButton *mExpandButton;
00216 
00217     DateList mSelectedDates;  // List of dates to be displayed
00218     int mViewType;
00219 
00220     bool mWeekStartsMonday;
00221     int mStartHour;
00222 
00223     KOEventPopupMenu *mAgendaPopup;
00224     KOEventPopupMenu *mAllDayAgendaPopup;
00225 
00226     EventIndicator *mEventIndicatorTop;
00227     EventIndicator *mEventIndicatorBottom;
00228 
00229     QMemArray<int> mMinY;
00230     QMemArray<int> mMaxY;
00231 
00232     QMemArray<bool> mHolidayMask;
00233     
00234     QPixmap mExpandedPixmap;
00235     QPixmap mNotExpandedPixmap;
00236     
00237     QDateTime mTimeSpanBegin;
00238     QDateTime mTimeSpanEnd;
00239     bool mTimeSpanInAllDay;
00240 
00241 };
00242 
00243 #endif  // KOAGENDAVIEW_H
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sat Oct 18 02:47:31 2003 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001