kdeui Library API Documentation

kdatetbl.h

00001 /*  -*- C++ -*-
00002     This file is part of the KDE libraries
00003     Copyright (C) 1997 Tim D. Gilman (tdgilman@best.org)
00004               (C) 1998-2001 Mirko Boehm (mirko@kde.org)
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public License
00016     along with this library; see the file COPYING.LIB.  If not, write to
00017     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018     Boston, MA 02111-1307, USA.
00019 */
00020 #ifndef KDATETBL_H
00021 #define KDATETBL_H
00022 
00023 #include <qvalidator.h>
00024 #include <qgridview.h>
00025 #include <qlineedit.h>
00026 #include <qdatetime.h>
00027 #include <qcolor.h>
00028 
00029 #include <kdelibs_export.h>
00030 
00031 class KPopupMenu;
00032 
00038 class KDEUI_EXPORT KDateInternalWeekSelector : public QLineEdit
00039 {
00040   Q_OBJECT
00041 protected:
00042   QIntValidator *val;
00043   int result;
00044 public slots:
00045   void weekEnteredSlot();
00046   void setMaxWeek(int max);
00047 signals:
00048   void closeMe(int);
00049 public:
00050   KDateInternalWeekSelector( QWidget* parent=0, const char* name=0);
00051   int getWeek();
00052   void setWeek(int week);
00053 
00054 private:
00055   class KDateInternalWeekPrivate;
00056   KDateInternalWeekPrivate *d;
00057 };
00058 
00065 class KDEUI_EXPORT KDateInternalMonthPicker : public QGridView
00066 {
00067   Q_OBJECT
00068 protected:
00072   int result;
00076   short int activeCol;
00077   short int activeRow;
00081   QRect max;
00082 signals:
00086   void closeMe(int);
00087 public:
00091   KDateInternalMonthPicker(const QDate& date, QWidget* parent, const char* name=0);
00095   ~KDateInternalMonthPicker();
00099   QSize sizeHint() const;
00104   int getResult() const;
00105 protected:
00109   void setupPainter(QPainter *p);
00113   virtual void viewportResizeEvent(QResizeEvent*);
00117   virtual void paintCell(QPainter* painter, int row, int col);
00121   virtual void contentsMousePressEvent(QMouseEvent *e);
00122   virtual void contentsMouseMoveEvent(QMouseEvent *e);
00126   virtual void contentsMouseReleaseEvent(QMouseEvent *e);
00127 
00128 private:
00129   class KDateInternalMonthPrivate;
00130   KDateInternalMonthPrivate *d;
00131 };
00132 
00138 class KDEUI_EXPORT KDateInternalYearSelector : public QLineEdit
00139 {
00140   Q_OBJECT
00141 protected:
00142   QIntValidator *val;
00143   int result;
00144 public slots:
00145   void yearEnteredSlot();
00146 signals:
00147   void closeMe(int);
00148 public:
00149   KDateInternalYearSelector( QWidget* parent=0, const char* name=0);
00150   int getYear();
00151   void setYear(int year);
00152 
00153 private:
00154   class KDateInternalYearPrivate;
00155   KDateInternalYearPrivate *d;
00156 
00157 };
00158 
00164 class KDEUI_EXPORT KPopupFrame : public QFrame
00165 {
00166   Q_OBJECT
00167 protected:
00171   int result;
00175   virtual void keyPressEvent(QKeyEvent* e);
00179   QWidget *main;
00180 public slots:
00185   void close(int r);
00186 public:
00190   KPopupFrame(QWidget* parent=0, const char*  name=0);
00198   void setMainWidget(QWidget* m);
00203   virtual void resizeEvent(QResizeEvent*);
00207   void popup(const QPoint &pos);
00211   int exec(QPoint p);
00215   int exec(int x, int y);
00216 
00217 private:
00218 
00219   virtual bool close(bool alsoDelete) { return QFrame::close(alsoDelete); }
00220 protected:
00221   virtual void virtual_hook( int id, void* data );
00222 private:
00223   class KPopupFramePrivate;
00224   KPopupFramePrivate *d;
00225 };
00226 
00230 class KDEUI_EXPORT KDateValidator : public QValidator
00231 {
00232 public:
00233     KDateValidator(QWidget* parent=0, const char* name=0);
00234     virtual State validate(QString&, int&) const;
00235     virtual void fixup ( QString & input ) const;
00236     State date(const QString&, QDate&) const;
00237 };
00238 
00252 class KDEUI_EXPORT KDateTable : public QGridView
00253 {
00254     Q_OBJECT
00255     Q_PROPERTY( QDate date READ getDate WRITE setDate )
00256     Q_PROPERTY( bool popupMenu READ popupMenuEnabled WRITE setPopupMenuEnabled )
00257 
00258 public:
00262     KDateTable(QWidget *parent=0, QDate date=QDate::currentDate(),
00263            const char* name=0, WFlags f=0);
00264 
00268     ~KDateTable();
00269 
00277     virtual QSize sizeHint() const;
00281     void setFontSize(int size);
00285     bool setDate(const QDate&);
00286     // ### 4.0 rename to date()
00287     const QDate& getDate() const;
00288 
00297     void setPopupMenuEnabled( bool enable );
00298 
00302     bool popupMenuEnabled() const;
00303 
00304     enum BackgroundMode { NoBgMode=0, RectangleMode, CircleMode };
00305 
00312     void setCustomDatePainting( const QDate &date, const QColor &fgColor, BackgroundMode bgMode=NoBgMode, const QColor &bgColor=QColor());
00313 
00319     void unsetCustomDatePainting( const QDate &date );
00320 
00321 protected:
00325     int posFromDate( const QDate &date ); // KDE4: make this virtual, so subclasses can reimplement this and use a different default for the start of the matrix
00330     QDate dateFromPos( int pos ); // KDE4: make this virtual
00331 
00335     virtual void paintCell(QPainter*, int, int);
00339     virtual void viewportResizeEvent(QResizeEvent *);
00343     virtual void contentsMousePressEvent(QMouseEvent *);
00344     virtual void wheelEvent( QWheelEvent * e );
00345     virtual void keyPressEvent( QKeyEvent *e );
00346     virtual void focusInEvent( QFocusEvent *e );
00347     virtual void focusOutEvent( QFocusEvent *e );
00348 
00349     // ### KDE 4.0 make the following private and mark as members
00350 
00354     int fontsize;
00358     QDate date;
00362     int firstday;
00366     int numdays;
00370     int numDaysPrevMonth;
00375     bool unused_hasSelection;
00379     QRect maxCell;
00380 signals:
00384     // ### KDE 4.0 make parameter a const reference
00385     void dateChanged(QDate);
00392     void dateChanged(const QDate& cur, const QDate& old);
00396     void tableClicked();
00397 
00405     void aboutToShowContextMenu( KPopupMenu * menu, const QDate &date);
00406 
00407 protected:
00408   virtual void virtual_hook( int id, void* data );
00409 private:
00410     class KDateTablePrivate;
00411     KDateTablePrivate *d;
00412 };
00413 
00414 #endif // KDATETBL_H
KDE Logo
This file is part of the documentation for kdeui Library Version 3.3.90.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 30 10:11:59 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003