calendarsystem Library API Documentation

mkdatetbl.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 MKDATETBL_H
00021 #define MKDATETBL_H
00022 
00023 #include <qvalidator.h>
00024 #include <qgridview.h>
00025 #include <qlineedit.h>
00026 #include <qdatetime.h>
00027 #include "kcalendarsystem.h"
00034 class KDateInternalMonthPicker : public QGridView
00035 {
00036   Q_OBJECT
00037 protected:
00041   int result;
00045   short int activeCol;
00046   short int activeRow;
00050   QRect max;
00051 signals:
00055   void closeMe(int);
00056 public:
00057 
00061   // CALSYS Added optional parameter calendarsystem for different calendar types support
00062   KDateInternalMonthPicker(int fontsize, QWidget* parent, int year = 2000,
00063       KCalendarSystem* cSystem = KCalendarSystemFactory::create(),
00064       const char* name = 0 );
00065 
00069   QSize sizeHint() const;
00074   int getResult() const;
00075 protected:
00079   void setupPainter(QPainter *p);
00083   void viewportResizeEvent(QResizeEvent*);
00087   virtual void paintCell(QPainter* painter, int row, int col);
00091   void contentsMousePressEvent(QMouseEvent *e);
00092   void contentsMouseMoveEvent(QMouseEvent *e);
00096   void contentsMouseReleaseEvent(QMouseEvent *e);
00097 
00098 private:
00099   class KDateInternalMonthPrivate;
00100   KDateInternalMonthPrivate *d;
00101   // CALSYS
00102   KCalendarSystem* calendarSystem;
00103 };
00104 
00110 class KDateInternalYearSelector : public QLineEdit
00111 {
00112   Q_OBJECT
00113 protected:
00114   QIntValidator *val;
00115   int result;
00116 public slots:
00117   void yearEnteredSlot();
00118 signals:
00119   void closeMe(int);
00120 public:
00121   // CALSYS added calendarSystem support
00122   KDateInternalYearSelector(int fontsize,
00123                             KCalendarSystem* cSystem,
00124                             QWidget* parent=0,
00125                             const char* name=0);
00126   int getYear();
00127   void setYear(int year);
00128 
00129 private:
00130   class KDateInternalYearPrivate;
00131   KDateInternalYearPrivate *d;
00132   // CALSYS
00133   KCalendarSystem* calendarSystem;
00134 };
00135 
00141 class KPopupFrame : public QFrame
00142 {
00143   Q_OBJECT
00144 protected:
00148   int result;
00152   void keyPressEvent(QKeyEvent* e);
00156   QWidget *main;
00157 public slots:
00162   void close(int r);
00163 public:
00167   KPopupFrame(QWidget* parent=0, const char*  name=0);
00175   void setMainWidget(QWidget* m);
00180   void resizeEvent(QResizeEvent*);
00184   void popup(const QPoint &pos);
00188   int exec(QPoint p);
00192   int exec(int x, int y);
00193 
00194 private:
00195 
00196   virtual bool close(bool alsoDelete) { return QFrame::close(alsoDelete); }
00197 protected:
00198   virtual void virtual_hook( int id, void* data );
00199 private:
00200   class KPopupFramePrivate;
00201   KPopupFramePrivate *d;
00202 };
00203 
00207 class KDateValidator : public QValidator
00208 {
00209 private:
00210     // CALSYS: support for different calendar types
00211     KCalendarSystem* calendarSystem;
00212 // CALSYS: added optional calType parameter for different validator calendar types support
00213 public:
00214     KDateValidator(const QString& calType = "gregorian", QWidget* parent=0, const char* name=0);
00215     virtual State validate(QString&, int&) const;
00216     virtual void fixup ( QString & input ) const;
00217     State date(const QString&, QDate&) const;
00218 };
00219 
00233 class KDateTable : public QGridView
00234 {
00235     Q_OBJECT
00236 public:
00240     // CALSYS: added optional calType parameter for different datetable calendar types support
00241     KDateTable(const QString& calType = "gregorian",
00242                QWidget *parent=0,
00243                QDate date=QDate::currentDate(),
00244                const char* name=0, WFlags f=0);
00252     virtual QSize sizeHint() const;
00256     void setFontSize(int size);
00260     bool setDate(const QDate&);
00261     const QDate& getDate() const;
00262 
00263 
00264 protected:
00268     virtual void paintCell(QPainter*, int, int);
00272     virtual void viewportResizeEvent(QResizeEvent *);
00276     virtual void contentsMousePressEvent(QMouseEvent *);
00277     virtual void keyPressEvent( QKeyEvent *e );
00278     virtual void focusInEvent( QFocusEvent *e );
00279     virtual void focusOutEvent( QFocusEvent *e );
00283     int fontsize;
00287     QDate date;
00291     int firstday;
00295     int numdays;
00299     int numDaysPrevMonth;
00303     bool unused_hasSelection;
00307     QRect maxCell;
00308 signals:
00312     void dateChanged(QDate);
00316     void tableClicked();
00317 
00318 protected:
00319   virtual void virtual_hook( int id, void* data );
00320 private:
00321     class KDateTablePrivate;
00322     KDateTablePrivate *d;
00323     // CALSYS: support for different calendar types
00324     KCalendarSystem* calendarSystem;
00325 };
00326 
00327 #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 Sun Feb 15 11:40:08 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001