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 
00033 class KDateInternalWeekSelector : public QLineEdit
00034 {
00035   Q_OBJECT
00036 protected:
00037   QIntValidator *val;
00038   int result;
00039 public slots:
00040   void weekEnteredSlot();
00041 signals:
00042   void closeMe(int);
00043 public:
00044   KDateInternalWeekSelector(int fontsize,
00045                             QWidget* parent=0,
00046                             const char* name=0);
00047   int getWeek();
00048   void setWeek(int week);
00049 
00050 private:
00051   class KDateInternalWeekPrivate;
00052   KDateInternalWeekPrivate *d;
00053 };
00054 
00061 class KDateInternalMonthPicker : public QGridView
00062 {
00063   Q_OBJECT
00064 protected:
00068   int result;
00072   short int activeCol;
00073   short int activeRow;
00077   QRect max;
00078 signals:
00082   void closeMe(int);
00083 public:
00087   KDateInternalMonthPicker(int fontsize, QWidget* parent, const char* name=0);
00091   QSize sizeHint() const;
00096   int getResult() const;
00097 protected:
00101   void setupPainter(QPainter *p);
00105   virtual void viewportResizeEvent(QResizeEvent*);
00109   virtual void paintCell(QPainter* painter, int row, int col);
00113   virtual void contentsMousePressEvent(QMouseEvent *e);
00114   virtual void contentsMouseMoveEvent(QMouseEvent *e);
00118   virtual void contentsMouseReleaseEvent(QMouseEvent *e);
00119 
00120 private:
00121   class KDateInternalMonthPrivate;
00122   KDateInternalMonthPrivate *d;
00123 };
00124 
00130 class KDateInternalYearSelector : public QLineEdit
00131 {
00132   Q_OBJECT
00133 protected:
00134   QIntValidator *val;
00135   int result;
00136 public slots:
00137   void yearEnteredSlot();
00138 signals:
00139   void closeMe(int);
00140 public:
00141   KDateInternalYearSelector(int fontsize,
00142                             QWidget* parent=0,
00143                             const char* name=0);
00144   int getYear();
00145   void setYear(int year);
00146 
00147 private:
00148   class KDateInternalYearPrivate;
00149   KDateInternalYearPrivate *d;
00150 };
00151 
00157 class KPopupFrame : public QFrame
00158 {
00159   Q_OBJECT
00160 protected:
00164   int result;
00168   virtual void keyPressEvent(QKeyEvent* e);
00172   QWidget *main;
00173 public slots:
00178   void close(int r);
00179 public:
00183   KPopupFrame(QWidget* parent=0, const char*  name=0);
00191   void setMainWidget(QWidget* m);
00196   virtual void resizeEvent(QResizeEvent*);
00200   void popup(const QPoint &pos);
00204   int exec(QPoint p);
00208   int exec(int x, int y);
00209 
00210 private:
00211 
00212   virtual bool close(bool alsoDelete) { return QFrame::close(alsoDelete); }
00213 protected:
00214   virtual void virtual_hook( int id, void* data );
00215 private:
00216   class KPopupFramePrivate;
00217   KPopupFramePrivate *d;
00218 };
00219 
00223 class KDateValidator : public QValidator
00224 {
00225 public:
00226     KDateValidator(QWidget* parent=0, const char* name=0);
00227     virtual State validate(QString&, int&) const;
00228     virtual void fixup ( QString & input ) const;
00229     State date(const QString&, QDate&) const;
00230 };
00231 
00245 class KDateTable : public QGridView
00246 {
00247     Q_OBJECT
00248 public:
00252     KDateTable(QWidget *parent=0,
00253                QDate date=QDate::currentDate(),
00254                const char* name=0, WFlags f=0);
00262     virtual QSize sizeHint() const;
00266     void setFontSize(int size);
00270     bool setDate(const QDate&);
00271     const QDate& getDate() const;
00272 
00273 
00274 protected:
00278     virtual void paintCell(QPainter*, int, int);
00282     virtual void viewportResizeEvent(QResizeEvent *);
00286     virtual void contentsMousePressEvent(QMouseEvent *);
00287     virtual void wheelEvent( QWheelEvent * e );
00288     virtual void keyPressEvent( QKeyEvent *e );
00289     virtual void focusInEvent( QFocusEvent *e );
00290     virtual void focusOutEvent( QFocusEvent *e );
00294     int fontsize;
00298     QDate date;
00302     int firstday;
00306     int numdays;
00310     int numDaysPrevMonth;
00315     bool unused_hasSelection;
00319     QRect maxCell;
00320 signals:
00324     void dateChanged(QDate);
00328     void tableClicked();
00329 
00330 protected:
00331   virtual void virtual_hook( int id, void* data );
00332 private:
00333     class KDateTablePrivate;
00334     KDateTablePrivate *d;
00335 };
00336 
00337 #endif // KDATETBL_H
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:56:26 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001