kdeui
kdatetbl.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef KDATETBL_H
00021 #define KDATETBL_H
00022
00023
00024
00025 #include <qvalidator.h>
00026 #include <qgridview.h>
00027 #include <qlineedit.h>
00028 #include <qdatetime.h>
00029 #include <qcolor.h>
00030
00031 #include <kdelibs_export.h>
00032
00033 class KPopupMenu;
00034
00040 class KDEUI_EXPORT KDateInternalWeekSelector : public QLineEdit
00041 {
00042 Q_OBJECT
00043 protected:
00044 QIntValidator *val;
00045 int result;
00046 public slots:
00047 void weekEnteredSlot();
00048 void setMaxWeek(int max);
00049 signals:
00050 void closeMe(int);
00051 public:
00052 KDateInternalWeekSelector( QWidget* parent=0, const char* name=0);
00053 int getWeek();
00054 void setWeek(int week);
00055
00056 private:
00057 class KDateInternalWeekPrivate;
00058 KDateInternalWeekPrivate *d;
00059 };
00060
00067 class KDEUI_EXPORT KDateInternalMonthPicker : public QGridView
00068 {
00069 Q_OBJECT
00070 protected:
00074 int result;
00078 short int activeCol;
00079 short int activeRow;
00083 QRect max;
00084 signals:
00088 void closeMe(int);
00089 public:
00093 KDateInternalMonthPicker(const QDate& date, QWidget* parent, const char* name=0);
00097 ~KDateInternalMonthPicker();
00101 QSize sizeHint() const;
00106 int getResult() const;
00107 protected:
00111 void setupPainter(QPainter *p);
00115 virtual void viewportResizeEvent(QResizeEvent*);
00119 virtual void paintCell(QPainter* painter, int row, int col);
00123 virtual void contentsMousePressEvent(QMouseEvent *e);
00124 virtual void contentsMouseMoveEvent(QMouseEvent *e);
00128 virtual void contentsMouseReleaseEvent(QMouseEvent *e);
00129
00130 private:
00131 class KDateInternalMonthPrivate;
00132 KDateInternalMonthPrivate *d;
00133 };
00134
00140 class KDEUI_EXPORT KDateInternalYearSelector : public QLineEdit
00141 {
00142 Q_OBJECT
00143 protected:
00144 QIntValidator *val;
00145 int result;
00146 public slots:
00147 void yearEnteredSlot();
00148 signals:
00149 void closeMe(int);
00150 public:
00151 KDateInternalYearSelector( QWidget* parent=0, const char* name=0);
00152 int getYear();
00153 void setYear(int year);
00154
00155 private:
00156 class KDateInternalYearPrivate;
00157 KDateInternalYearPrivate *d;
00158
00159 };
00160
00166 class KDEUI_EXPORT KPopupFrame : public QFrame
00167 {
00168 Q_OBJECT
00169 protected:
00173 int result;
00177 virtual void keyPressEvent(QKeyEvent* e);
00181 QWidget *main;
00182 public slots:
00187 void close(int r);
00191 void hide();
00192
00193 public:
00197 KPopupFrame(QWidget* parent=0, const char* name=0);
00201 ~KPopupFrame();
00209 void setMainWidget(QWidget* m);
00214 virtual void resizeEvent(QResizeEvent*);
00218 void popup(const QPoint &pos);
00222 int exec(QPoint p);
00226 int exec(int x, int y);
00227
00228 private:
00229
00230 virtual bool close(bool alsoDelete) { return QFrame::close(alsoDelete); }
00231 protected:
00232 virtual void virtual_hook( int id, void* data );
00233 private:
00234 class KPopupFramePrivate;
00235 KPopupFramePrivate *d;
00236 };
00237
00241 class KDEUI_EXPORT KDateValidator : public QValidator
00242 {
00243 public:
00244 KDateValidator(QWidget* parent=0, const char* name=0);
00245 virtual State validate(QString&, int&) const;
00246 virtual void fixup ( QString & input ) const;
00247 State date(const QString&, QDate&) const;
00248 };
00249
00263 class KDEUI_EXPORT KDateTable : public QGridView
00264 {
00265 Q_OBJECT
00266 Q_PROPERTY( QDate date READ getDate WRITE setDate )
00267 Q_PROPERTY( bool popupMenu READ popupMenuEnabled WRITE setPopupMenuEnabled )
00268
00269 public:
00273 KDateTable(QWidget *parent=0, QDate date=QDate::currentDate(),
00274 const char* name=0, WFlags f=0);
00275
00280 KDateTable(QWidget *parent, const char* name, WFlags f=0);
00281
00285 ~KDateTable();
00286
00294 virtual QSize sizeHint() const;
00298 void setFontSize(int size);
00302 bool setDate(const QDate&);
00303
00304 const QDate& getDate() const;
00305
00314 void setPopupMenuEnabled( bool enable );
00315
00319 bool popupMenuEnabled() const;
00320
00321 enum BackgroundMode { NoBgMode=0, RectangleMode, CircleMode };
00322
00329 void setCustomDatePainting( const QDate &date, const QColor &fgColor, BackgroundMode bgMode=NoBgMode, const QColor &bgColor=QColor());
00330
00336 void unsetCustomDatePainting( const QDate &date );
00337
00338 protected:
00342 int posFromDate( const QDate &date );
00347 QDate dateFromPos( int pos );
00348
00352 virtual void paintCell(QPainter*, int, int);
00353
00357 virtual void paintEmptyArea(QPainter*, int, int, int, int);
00358
00362 virtual void viewportResizeEvent(QResizeEvent *);
00366 virtual void contentsMousePressEvent(QMouseEvent *);
00367 virtual void wheelEvent( QWheelEvent * e );
00368 virtual void keyPressEvent( QKeyEvent *e );
00369 virtual void focusInEvent( QFocusEvent *e );
00370 virtual void focusOutEvent( QFocusEvent *e );
00371
00372
00373
00377 int fontsize;
00381 QDate date;
00385 int firstday;
00389 int numdays;
00393 int numDaysPrevMonth;
00398 bool unused_hasSelection;
00402 QRect maxCell;
00403 signals:
00407
00408 void dateChanged(QDate);
00415 void dateChanged(const QDate& cur, const QDate& old);
00419 void tableClicked();
00420
00428 void aboutToShowContextMenu( KPopupMenu * menu, const QDate &date);
00429
00430 private slots:
00431 void nextMonth();
00432 void previousMonth();
00433 void beginningOfMonth();
00434 void endOfMonth();
00435 void beginningOfWeek();
00436 void endOfWeek();
00437
00438 protected:
00439 virtual void virtual_hook( int id, void* data );
00440 private:
00441 class KDateTablePrivate;
00442 KDateTablePrivate *d;
00443
00444 void initAccels();
00445 };
00446
00447 #endif // KDATETBL_H