Qtopia library API Documentation

datebookmonth.h

00001 /**********************************************************************
00002 ** Copyright (C) 2000-2002 Trolltech AS.  All rights reserved.
00003 **
00004 ** This file is part of the Qtopia Environment.
00005 **
00006 ** This file may be distributed and/or modified under the terms of the
00007 ** GNU General Public License version 2 as published by the Free Software
00008 ** Foundation and appearing in the file LICENSE.GPL included in the
00009 ** packaging of this file.
00010 **
00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 **
00014 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00015 **
00016 ** Contact info@trolltech.com if any conditions of this licensing are
00017 ** not clear to you.
00018 **
00019 **********************************************************************/
00020 #ifndef DATEBOOKMONTH
00021 #define DATEBOOKMONTH
00022 
00023 #include <qtopia/private/event.h>
00024 
00025 #include <qvbox.h>
00026 #include <qhbox.h>
00027 #include <qdatetime.h>
00028 #include <qvaluelist.h>
00029 #include <qtable.h>
00030 #include <qpushbutton.h>
00031 #include <qpopupmenu.h>
00032 
00033 #include "calendar.h"
00034 #include "timestring.h"
00035 
00036 class QToolButton;
00037 class QComboBox;
00038 class QSpinBox;
00039 class Event;
00040 class DateBookDB;
00041 
00042 class DateBookMonthHeaderPrivate;
00043 class DateBookMonthHeader : public QHBox
00044 {
00045     Q_OBJECT
00046 
00047 public:
00048     DateBookMonthHeader( QWidget *parent = 0, const char *name = 0 );
00049     ~DateBookMonthHeader();
00050     void setDate( int year, int month );
00051 
00052 signals:
00053     void dateChanged( int year, int month );
00054 
00055 protected slots:
00056     void keyPressEvent(QKeyEvent *e ) {
00057     e->ignore();
00058     }
00059 
00060 private slots:
00061     void updateDate();
00062     void firstMonth();
00063     void lastMonth();
00064     void monthBack();
00065     void monthForward();
00066 
00067 private:
00068     QToolButton *begin, *back, *next, *end;
00069     QComboBox *month;
00070     QSpinBox *year;
00071     DateBookMonthHeaderPrivate *d;
00072     int focus;
00073 };
00074 
00075 class DayItemMonthPrivate;
00076 class DayItemMonth : public QTableItem
00077 {
00078 public:
00079     DayItemMonth( QTable *table, EditType et, const QString &t );
00080     ~DayItemMonth();
00081     void paint( QPainter *p, const QColorGroup &cg, const QRect &cr, bool selected );
00082     void setDay( int d ) { dy = d; }
00083     void setEvents( const QValueList<Event> &events ) { daysEvents = events; };
00084     void setEvents( const QValueList<EffectiveEvent> &effEvents );
00085     void clearEvents() { daysEvents.clear(); };
00086     void clearEffEvents();
00087     int day() const { return dy; }
00088     void setType( Calendar::Day::Type t );
00089     Calendar::Day::Type type() const { return typ; }
00090 
00091 private:
00092     QBrush back;
00093     QColor forg;
00094     int dy;
00095     Calendar::Day::Type typ;
00096     QValueList<Event> daysEvents; // not used anymore...
00097     DayItemMonthPrivate *d;
00098 };
00099 
00100 class DateBookMonthTablePrivate;
00101 class DateBookMonthTable : public QTable
00102 {
00103     Q_OBJECT
00104 
00105 public:
00106     DateBookMonthTable( QWidget *parent = 0, const char *name = 0,
00107                         DateBookDB *newDb = 0 );
00108     ~DateBookMonthTable();
00109     void setDate( int y, int m, int d );
00110     void redraw();
00111 
00112     QSize minimumSizeHint() const { return sizeHint(); }
00113     QSize minimumSize() const { return sizeHint(); }
00114     void  getDate( int& y, int &m, int &d ) const {y=selYear;m=selMonth;d=selDay;}
00115     void setWeekStart( bool onMonday );
00116 signals:
00117     void dateClicked( int year, int month, int day );
00118 
00119 protected:
00120     void viewportMouseReleaseEvent( QMouseEvent * );
00121 
00122 protected slots:
00123 
00124     void keyPressEvent(QKeyEvent *e ) {
00125     e->ignore();
00126     }
00127 
00128 private slots:
00129     void dayClicked( int row, int col );
00130     void dragDay( int row, int col );
00131 
00132 private:
00133     void setupTable();
00134     void setupLabels();
00135 
00136     void findDay( int day, int &row, int &col );
00137     void getEvents();
00138     void changeDaySelection( int row, int col );
00139 
00140     int year, month, day;
00141     int selYear, selMonth, selDay;
00142     QValueList<Event> monthsEvents; // not used anymore...
00143     DateBookDB *db;
00144     DateBookMonthTablePrivate *d;
00145 };
00146 
00147 class DateBookMonthPrivate;
00148 class DateBookMonth : public QVBox
00149 {
00150     Q_OBJECT
00151 
00152 public:
00153     /* ac = Auto Close */
00154     DateBookMonth( QWidget *parent = 0, const char *name = 0, bool ac = FALSE,
00155                    DateBookDB *data = 0 );
00156     ~DateBookMonth();
00157     QDate  selectedDate() const;
00158 
00159 signals:
00160     /* ### FIXME add a signal with QDate -zecke */
00161     void dateClicked( int year, int month, int day );
00162 
00163 public slots:
00164     void setDate( int y, int m );
00165     void setDate( int y, int m, int d );
00166     void setDate( QDate );
00167     void redraw();
00168     void slotWeekChange( bool );
00169 
00170 protected slots:
00171     virtual void keyPressEvent(QKeyEvent *e);
00172 
00173 private slots:
00174     void forwardDateClicked( int y, int m, int d ) { emit dateClicked(  y, m, d  ); }
00175     void finalDate(int, int, int);
00176 
00177 private:
00178     DateBookMonthHeader *header;
00179     DateBookMonthTable *table;
00180     int year, month, day;
00181     bool autoClose;
00182     class DateBookMonthPrivate *d;
00183 };
00184 
00185 class DateButton : public QPushButton
00186 {
00187     Q_OBJECT
00188 
00189 public:
00190     DateButton( bool longDate, QWidget *parent, const char * name = 0 );
00191     QDate date() const { return currDate; }
00192 
00193     bool customWhatsThis() const;
00194 
00195 signals:
00196     void dateSelected( int year, int month, int day );
00197 
00198 public slots:
00199     void setDate( int y, int m, int d );
00200     void setDate( QDate );
00201     void setWeekStartsMonday( int );
00202     void setDateFormat( DateFormat );
00203 
00204 private slots:
00205     void pickDate();
00206     void gotHide();
00207 
00208 private:
00209     bool longFormat;
00210     bool weekStartsMonday;
00211     QDate currDate;
00212     DateFormat df;
00213 };
00214 
00215 // this class is only here for Sharp ROM compatibility
00216 // I have reverse engineered this class and it seems to
00217 // work (only qtmail seems to use it)   - sandman
00218 // DO NOT USE IT IN NEW CODE !!
00219 
00220 class DateBookMonthPopup : public QPopupMenu 
00221 {
00222     Q_OBJECT
00223 public:
00224     DateBookMonthPopup ( QWidget *w );
00225 
00226 private:
00227     DateBookMonth *m_dbm;
00228 };
00229 
00230 #endif
KDE Logo
This file is part of the documentation for OPIE Version 1.5.5.
Documentation copyright © 1997-2003 the KDE developers. 2003 OPIE developers
Generated on Tue Feb 10 20:24:04 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001