korganizer Library API Documentation

koagendaview.h

00001 /*
00002     This file is part of KOrganizer.
00003 
00004     Copyright (c) 2000,2001,2003 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 #ifndef KOAGENDAVIEW_H
00025 #define KOAGENDAVIEW_H
00026 
00027 #include <qscrollview.h>
00028 #include <qdatetime.h>
00029 #include <qlayout.h>
00030 #include <qsplitter.h>
00031 #include <qmemarray.h>
00032 #include <qlabel.h>
00033 
00034 #include "koeventview.h"
00035 #include "calprinter.h"
00036 
00037 class QHBox;
00038 class QFrame;
00039 class QPushButton;
00040 
00041 class KOAgenda;
00042 class KOAgendaItem;
00043 class KConfig;
00044 
00045 class TimeLabels : public QScrollView
00046 {
00047     Q_OBJECT
00048   public:
00049     TimeLabels( int rows, QWidget *parent = 0, const char *name = 0,
00050                 WFlags f = 0 );
00051 
00052     void setCellHeight( int height );
00053 
00055     virtual int minimumWidth() const;
00056 
00058     void updateConfig();
00059 
00061     void setAgenda( KOAgenda *agenda );
00062 
00064     virtual void paintEvent( QPaintEvent *e );
00065 
00066   public slots:
00068     void positionChanged();
00069 
00070   protected:
00071     void drawContents( QPainter *p, int cx, int cy, int cw, int ch );
00072 
00073   private:
00074     int mRows;
00075     int mCellHeight;
00076 
00077     KOAgenda* mAgenda;
00078 };
00079 
00080 class EventIndicator : public QFrame
00081 {
00082     Q_OBJECT
00083   public:
00084     enum Location { Top, Bottom };
00085     EventIndicator( Location loc = Top, QWidget *parent = 0,
00086                     const char *name = 0 );
00087     virtual ~EventIndicator();
00088 
00089     void changeColumns( int columns );
00090 
00091     void enableColumn( int column, bool enable );
00092 
00093   protected:
00094     void drawContents( QPainter * );
00095 
00096   private:
00097     int mColumns;
00098     QHBox *mTopBox;
00099     QBoxLayout *mTopLayout;
00100     Location mLocation;
00101     QPixmap mPixmap;
00102     QMemArray<bool> mEnabled;
00103 };
00104 
00105 class KOAlternateLabel : public QLabel
00106 {
00107     Q_OBJECT
00108   public:
00109     KOAlternateLabel( QString shortlabel, QString longlabel,
00110                       QString extensivelabel = QString::null,
00111                       QWidget *parent = 0, const char *name = 0 );
00112     ~KOAlternateLabel();
00113 
00114     virtual QSize minimumSizeHint() const;
00115 
00116   public slots:
00117     void setText( const QString & );
00118     void useShortText();
00119     void useLongText();
00120     void useExtensiveText();
00121     void useDefaultText();
00122 
00123   protected:
00124     virtual void resizeEvent( QResizeEvent * );
00125     virtual void squeezeTextToLabel();
00126     bool mTextTypeFixed;
00127     QString mShortText, mLongText, mExtensiveText;
00128 };
00129 
00134 class KOAgendaView : public KOEventView
00135 {
00136     Q_OBJECT
00137   public:
00138     KOAgendaView( Calendar *cal, QWidget *parent = 0, const char *name = 0 );
00139     virtual ~KOAgendaView();
00140 
00142     virtual int maxDatesHint();
00143 
00145     virtual int currentDateCount();
00146 
00148     virtual Incidence::List selectedIncidences();
00149 
00151     virtual DateList selectedDates();
00152 
00154     void clearView();
00155 
00156     virtual void printPreview( CalPrinter *calPrinter,
00157                                const QDate &, const QDate & );
00158 
00159     CalPrinter::PrintType printType();
00160 
00162     QDateTime selectionStart() { return mTimeSpanBegin; }
00164     QDateTime selectionEnd() { return mTimeSpanEnd; }
00166     bool selectedIsAllDay() { return mTimeSpanInAllDay; }
00168     void deleteSelectedDateTime();
00170     bool selectedIsSingleCell();
00171 
00172     void setTypeAheadReceiver( QObject * );
00173 
00174   public slots:
00175     virtual void updateView();
00176     virtual void updateConfig();
00177     virtual void showDates( const QDate &start, const QDate &end );
00178     virtual void showEvents( const Event::List & );
00179     virtual void showNewEventPopup();
00180 
00181     void insertEvent( Event *event, QDate curDate, int curCol = -1 );
00182     void changeEventDisplayAdded( Event *event );
00183     void changeEventDisplay( Event *event, int mode );
00184 
00185     void clearSelection();
00186 
00187     void newEvent( int gx, int gy );
00188     void newEvent( int gxStart, int gyStart, int gxEnd, int gyEnd );
00189     void newEventAllDay( int gx, int gy );
00190 
00191     void startDrag( Incidence * );
00192 
00193     void readSettings();
00194     void readSettings( KConfig * );
00195     void writeSettings( KConfig * );
00196 
00197     void setContentsPos( int y );
00198 
00199     void setExpandedButton( bool expanded );
00200 
00201     void finishTypeAhead();
00202 
00204     void slotTodoDropped( Todo *, int, int, bool );
00205 
00206   signals:
00207     void toggleExpand();
00208     void incidenceChanged( Incidence*, Incidence* );
00209 
00210     void todoChanged( Todo*, Todo* );
00211     void todoDropped( Todo* );
00212 
00213   protected:
00215     void fillAgenda( const QDate &startDate );
00216 
00218     void fillAgenda();
00219 
00221     void createDayLabels();
00222 
00226     void setHolidayMasks();
00227 
00228   protected slots:
00230     void updateEventDates( KOAgendaItem *item );
00231 
00232     void updateEventIndicatorTop( int newY );
00233     void updateEventIndicatorBottom( int newY );
00234 
00236     void newTimeSpanSelected( int gxStart, int gyStart, int gxEnd, int gyEnd );
00238     void newTimeSpanSelectedAllDay( int gxStart, int gyStart,
00239                                     int gxEnd, int gyEnd);
00240 
00241   private:
00242     // view widgets
00243     QFrame *mDayLabels;
00244     QHBox *mDayLabelsFrame;
00245     QBoxLayout *mLayoutDayLabels;
00246     QFrame *mAllDayFrame;
00247     KOAgenda *mAllDayAgenda;
00248     KOAgenda *mAgenda;
00249     TimeLabels *mTimeLabels;
00250     QWidget *mDummyAllDayLeft;
00251     QSplitter *mSplitterAgenda;
00252     QPushButton *mExpandButton;
00253 
00254     DateList mSelectedDates;  // List of dates to be displayed
00255     int mViewType;
00256 
00257     KOEventPopupMenu *mAgendaPopup;
00258     KOEventPopupMenu *mAllDayAgendaPopup;
00259 
00260     EventIndicator *mEventIndicatorTop;
00261     EventIndicator *mEventIndicatorBottom;
00262 
00263     QMemArray<int> mMinY;
00264     QMemArray<int> mMaxY;
00265 
00266     QMemArray<bool> mHolidayMask;
00267 
00268     QPixmap mExpandedPixmap;
00269     QPixmap mNotExpandedPixmap;
00270 
00271     QDateTime mTimeSpanBegin;
00272     QDateTime mTimeSpanEnd;
00273     bool mTimeSpanInAllDay;
00274 
00275 };
00276 
00277 #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 Sat May 1 11:38:28 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003