00001 /* -*- mode: C++ -*- 00002 * 00003 * $Id: qmcdatenav.h,v 1.1 2005/01/31 00:08:31 tborras Exp $ 00004 * 00005 * Copyright (c) 1998 - 2000, Michael van der Westhuizen. 00006 * All rights reserved. 00007 * 00008 * See LICENSE.BSD for details. 00009 * 00010 * If this file is being built with or linked against any part of the 00011 * K Desktop Environment, KOffice Office Suite, KDE Libraries or KDE core 00012 * applications, the licensing model that may, at the developers 00013 * discretion, apply is LGPL. 00014 */ 00015 #ifndef QmcDATENAV_H 00016 #define QmcDATENAV_H 00017 00018 #include <qwidget.h> 00019 #include <qdatetime.h> 00020 #include <qptrlist.h> 00021 00022 class QPopupMenu; 00023 00024 00025 class QmcDateNav : public QWidget 00026 { 00027 Q_OBJECT 00028 00029 public: 00030 QmcDateNav( class QWidget * parent = 0, const char * name = 0 ); 00031 QmcDateNav( const class QDate &, class QWidget * parent = 0, const char * name = 0 ); 00032 ~QmcDateNav(); 00033 00034 virtual QSizePolicy sizePolicy() const; 00035 virtual QSize sizeHint() const; 00036 virtual QSize minimumSizeHint() const; 00037 00038 bool frame() const; 00039 void setFrame( bool ); 00040 00041 QPtrList<QDate> selectedDates() const; 00042 bool setDate( const QDate d ); 00043 00044 bool outlook() const; 00045 void setOutlook( bool ); 00046 00047 void installEventDayList( QPtrList<QDate> * ); 00048 void removeEventDayList(); 00049 00050 void installNonWorkingDayList( QPtrList<QDate> * ); 00051 void removeNonWorkingDayList(); 00052 00053 public slots: 00054 void forceUpdate(); 00055 00056 signals: 00057 void dateChanged(); 00058 void yearChanged( int ); 00059 void close(); 00060 00061 private slots: 00062 void monthMenuClicked( int ); 00063 void rbMenuClicked( int ); 00064 00065 private: 00066 QDate currentMonth; 00067 QPopupMenu *sevenMonthPopup; 00068 QPopupMenu *rbPopup; 00069 bool pmDirty; 00070 bool doFrame; 00071 QPixmap *pm; 00072 void init(); 00073 void makePixmap(); 00074 void drawArrows( QPainter & ); 00075 QRect * drawCaptionText( QPainter & ); 00076 void drawCaption( QPainter & ); 00077 void drawFrame( QPainter & ); 00078 void drawDays( QPainter & ); 00079 void drawDates( QPainter & ); 00080 void drawSelectedDate( int, bool pe = false ); 00081 void undrawSelectedDate( int ); 00082 int numSelected(); 00083 void drawToday( int ); 00084 void drawSelections(); 00085 void clear(); 00086 void changeMonth( bool forward, int steps ); 00087 QString monthName( int ); 00088 int fixDays( int, int, int ); 00089 void prepPopup(); 00090 void prepRBPopup(); 00091 bool hasEvent( const QDate & ); 00092 bool isNonWorkingDay( const QDate & ); 00093 int findIndex( QRect & ); 00094 int findIndex( QDate & ); 00095 00096 protected: 00097 virtual void paintEvent( QPaintEvent * ); 00098 virtual void mousePressEvent( QMouseEvent * ); 00099 virtual void mouseDoubleClickEvent( QMouseEvent * ); 00100 virtual void mouseMoveEvent( QMouseEvent * ); 00101 virtual void keyPressEvent(QKeyEvent * ); 00102 00103 }; 00104 00105 #endif //QmcDATENAV_H