Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

datebookweek.h

Go to the documentation of this file.
00001 /*
00002                              This file is part of the Opie Project
00003 
00004                              Copyright (C) Opie Team <opie-devel@handhelds.org>
00005               =.
00006             .=l.
00007            .>+-=
00008  _;:,     .>    :=|.         This program is free software; you can
00009 .> <`_,   >  .   <=          redistribute it and/or  modify it under
00010 :`=1 )Y*s>-.--   :           the terms of the GNU Library General Public
00011 .="- .-=="i,     .._         License as published by the Free Software
00012  - .   .-<_>     .<>         Foundation; either version 2 of the License,
00013      ._= =}       :          or (at your option) any later version.
00014     .%`+i>       _;_.
00015     .i_,=:_.      -<s.       This program is distributed in the hope that
00016      +  .  -:.       =       it will be useful,  but WITHOUT ANY WARRANTY;
00017     : ..    .:,     . . .    without even the implied warranty of
00018     =_        +     =;=|`    MERCHANTABILITY or FITNESS FOR A
00019   _.=:.       :    :=>`:     PARTICULAR PURPOSE. See the GNU
00020 ..}^=.=       =       ;      Library General Public License for more
00021 ++=   -.     .`     .:       details.
00022 :     =  ...= . :.=-
00023  -.   .:....=;==+<;          You should have received a copy of the GNU
00024   -_. . .   )=.  =           Library General Public License along with
00025     --        :-=`           this library; see the file COPYING.LIB.
00026                              If not, write to the Free Software Foundation,
00027                              Inc., 59 Temple Place - Suite 330,
00028                              Boston, MA 02111-1307, USA.
00029 */
00030 
00031 #ifndef DATEBOOKWEEK
00032 #define DATEBOOKWEEK
00033 
00034 #include <qpe/event.h>
00035 
00036 #include <qlist.h>
00037 #include <qscrollview.h>
00038 #include <qstring.h>
00039 #include <qvaluelist.h>
00040 
00041 class DateBookDB;
00042 class DateBookDBHoliday;
00043 class DateBookWeekHeader;
00044 class QDate;
00045 class QLabel;
00046 class QResizeEvent;
00047 class QSpinBox;
00048 class QTimer;
00049 class QHeader;
00050 
00051 class DateBookWeekItem
00052 {
00053 public:
00054     DateBookWeekItem( const EffectiveEvent e );
00055 
00056     void setGeometry( int x, int y, int w, int h );
00057     QRect geometry() const { return r; }
00058 
00059     const QColor &color() const { return c; }
00060     const EffectiveEvent event() const { return ev; }
00061 
00062 private:
00063     const EffectiveEvent ev;
00064     QRect r;
00065     QColor c;
00066 };
00067 
00068 class DateBookWeekView : public QScrollView
00069 {
00070     Q_OBJECT
00071 public:
00072     DateBookWeekView( bool ampm, bool weekOnMonday, QWidget *parent = 0,
00073               const char *name = 0 );
00074 
00075     bool whichClock() const;
00076     void showEvents( QValueList<EffectiveEvent> &ev );
00077     void moveToHour( int h );
00078     void setStartOfWeek( bool bOnMonday );
00079 
00080 signals:
00081     void showDay( int d );
00082     void signalShowEvent( const EffectiveEvent & );
00083     void signalHideEvent();
00084 
00085 protected slots:
00086     void keyPressEvent(QKeyEvent *);
00087 
00088 private slots:
00089     void slotChangeClock( bool );
00090     void alterDay( int );
00091 
00092 private:
00093     void positionItem( DateBookWeekItem *i );
00094     DateBookWeekItem *intersects( const DateBookWeekItem * );
00095     void drawContents( QPainter *p, int cx, int cy, int cw, int ch );
00096     void contentsMousePressEvent( QMouseEvent * );
00097     void contentsMouseReleaseEvent( QMouseEvent * );
00098     void resizeEvent( QResizeEvent * );
00099     void initNames();
00100 
00101 private:
00102     bool ampm;
00103     bool bOnMonday;
00104     QHeader *header;
00105     QList<DateBookWeekItem> items;
00106     int rowHeight;
00107     bool showingEvent;
00108 };
00109 
00110 class DateBookWeek : public QWidget
00111 {
00112     Q_OBJECT
00113 
00114 public:
00115     DateBookWeek( bool ampm, bool weekOnMonday, DateBookDBHoliday *newDB,
00116           QWidget *parent = 0, const char *name = 0 );
00117     void setDate( int y, int m, int d );
00118     void setDate( QDate d );
00119     QDate date() const;
00120     DateBookWeekView *weekView() const { return view; }
00121     void setStartViewTime( int startHere );
00122     int startViewTime() const;
00123     int week() const { return _week; };
00124     QDate weekDate() const;
00125 
00126 public slots:
00127     void redraw();
00128     void slotWeekChanged( bool bStartOnMonday );
00129     void slotClockChanged( bool a );
00130 
00131 signals:
00132     void showDate( int y, int m, int d );
00133 
00134 protected slots:
00135     void keyPressEvent(QKeyEvent *);
00136 
00137 private slots:
00138     void showDay( int day );
00139     void dateChanged( QDate &newdate );
00140     void slotShowEvent( const EffectiveEvent & );
00141     void slotHideEvent();
00142     void slotYearChanged( int );
00143 
00144 private:
00145     void getEvents();
00146 
00154     void generateAllDayTooltext( QString& text );
00155 
00160     void generateNormalTooltext( QString& text,
00161                                  const EffectiveEvent &ev);
00162     int year;
00163     int _week;
00164     int dow;
00165     QDate bdate;
00166     DateBookWeekHeader *header;
00167     DateBookWeekView *view;
00168     DateBookDBHoliday *db;
00169     QLabel *lblDesc;
00170     QTimer *tHide;
00171     int startTime;
00172     bool ampm;
00173     bool bStartOnMonday;
00174 };
00175 
00176 
00177 bool calcWeek( const QDate &d, int &week, int &year, bool startOnMonday = false );
00178 #endif

Generated on Sat Nov 5 16:15:48 2005 for OPIE by  doxygen 1.4.2