# kdeui Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# 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 // KDE4: rename this file to kdatetable.h
    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);
    00188 public:
    00192   KPopupFrame(QWidget* parent=0, const char*  name=0);
    00200   void setMainWidget(QWidget* m);
    00205   virtual void resizeEvent(QResizeEvent*);
    00209   void popup(const QPoint &pos);
    00213   int exec(QPoint p); // KDE4: const QPoint&
    00217   int exec(int x, int y);
    00218
    00219 private:
    00220
    00221   virtual bool close(bool alsoDelete) { return QFrame::close(alsoDelete); }
    00222 protected:
    00223   virtual void virtual_hook( int id, void* data );
    00224 private:
    00225   class KPopupFramePrivate;
    00226   KPopupFramePrivate *d;
    00227 };
    00228
    00232 class KDEUI_EXPORT KDateValidator : public QValidator
    00233 {
    00234 public:
    00235     KDateValidator(QWidget* parent=0, const char* name=0);
    00236     virtual State validate(QString&, int&) const;
    00237     virtual void fixup ( QString & input ) const;
    00238     State date(const QString&, QDate&) const;
    00239 };
    00240
    00254 class KDEUI_EXPORT KDateTable : public QGridView
    00255 {
    00256     Q_OBJECT
    00257     Q_PROPERTY( QDate date READ getDate WRITE setDate )
    00258     Q_PROPERTY( bool popupMenu READ popupMenuEnabled WRITE setPopupMenuEnabled )
    00259
    00260 public:
    00264     KDateTable(QWidget *parent=0, QDate date=QDate::currentDate(),
    00265            const char* name=0, WFlags f=0);
    00266
    00271     KDateTable(QWidget *parent, const char* name, WFlags f=0);
    00272
    00276     ~KDateTable();
    00277
    00285     virtual QSize sizeHint() const;
    00289     void setFontSize(int size);
    00293     bool setDate(const QDate&);
    00294     // ### KDE 4.0 rename to date()
    00295     const QDate& getDate() const;
    00296
    00305     void setPopupMenuEnabled( bool enable );
    00306
    00310     bool popupMenuEnabled() const;
    00311
    00312     enum BackgroundMode { NoBgMode=0, RectangleMode, CircleMode };
    00313
    00320     void setCustomDatePainting( const QDate &date, const QColor &fgColor, BackgroundMode bgMode=NoBgMode, const QColor &bgColor=QColor());
    00321
    00327     void unsetCustomDatePainting( const QDate &date );
    00328
    00329 protected:
    00333     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
    00338     QDate dateFromPos( int pos ); // KDE4: make this virtual
    00339
    00343     virtual void paintCell(QPainter*, int, int);
    00347     virtual void viewportResizeEvent(QResizeEvent *);
    00351     virtual void contentsMousePressEvent(QMouseEvent *);
    00352     virtual void wheelEvent( QWheelEvent * e );
    00353     virtual void keyPressEvent( QKeyEvent *e );
    00354     virtual void focusInEvent( QFocusEvent *e );
    00355     virtual void focusOutEvent( QFocusEvent *e );
    00356
    00357     // ### KDE 4.0 make the following private and mark as members
    00358
    00362     int fontsize;
    00366     QDate date;
    00370     int firstday;
    00374     int numdays;
    00378     int numDaysPrevMonth;
    00383     bool unused_hasSelection;
    00387     QRect maxCell;
    00388 signals:
    00392     // ### KDE 4.0 make parameter a const reference
    00393     void dateChanged(QDate);
    00400     void dateChanged(const QDate& cur, const QDate& old);
    00404     void tableClicked();
    00405
    00413     void aboutToShowContextMenu( KPopupMenu * menu, const QDate &date);
    00414
    00415 private slots:
    00416   void nextMonth();
    00417   void previousMonth();
    00418   void beginningOfMonth();
    00419   void endOfMonth();
    00420   void beginningOfWeek();
    00421   void endOfWeek();
    00422
    00423 protected:
    00424   virtual void virtual_hook( int id, void* data );
    00425 private:
    00426     class KDateTablePrivate;
    00427     KDateTablePrivate *d;
    00428
    00429   void initAccels();
    00430 };
    00431
    00432 #endif // KDATETBL_H

This file is part of the documentation for kdeui Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:20:15 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003