Eneboo - Documentación para desarrolladores
src/advance/vdatetable.h
Ir a la documentación de este archivo.
00001 /***************************************************************************
00002                         vdatetable.h  -  description
00003                            -------------------
00004   begin                : Tue Apr 2 2002
00005   copyright            : (C) 2002 by Bryan Brunton
00006   email                : bryanbrun@yahoo.com
00007 ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef VDATETABLE_H
00019 #define VDATETABLE_H
00020 
00021 #include <qapplication.h>
00022 #include <qwidget.h>
00023 #include <qvalidator.h>
00024 #include <qgridview.h>
00025 #include <qlineedit.h>
00026 #include <qdatetime.h>
00027 
00034 class VDateInternalMonthPicker: public QGridView {
00035         Q_OBJECT
00036 
00037 protected:
00041         int result;
00045         short int activeCol;
00046         short int activeRow;
00050         QRect max;
00051 
00052 signals:
00056         void closeMe( int );
00057 
00058 public:
00062         VDateInternalMonthPicker( int fontsize, QWidget * parent, const char *name = 0 );
00066         QSize sizeHint() const;
00071         int getResult() const;
00072 
00073 protected:
00077         void setupPainter( QPainter * p );
00081         void viewportResizeEvent( QResizeEvent * );
00085         virtual void paintCell( QPainter * painter, int row, int col );
00089         void contentsMousePressEvent( QMouseEvent * e );
00090         void contentsMouseMoveEvent( QMouseEvent * e );
00094         void contentsMouseReleaseEvent( QMouseEvent * e );
00095 
00096 private:
00097         class VDateInternalMonthPrivate;
00098         VDateInternalMonthPrivate *d;
00099 };
00100 
00106 class VDateInternalYearSelector: public QLineEdit {
00107         Q_OBJECT
00108 
00109 protected:
00110         QIntValidator * val;
00111         int result;
00112 
00113         public slots:
00114         void yearEnteredSlot();
00115 
00116 signals:
00117         void closeMe( int );
00118 
00119 public:
00120         VDateInternalYearSelector( int fontsize, QWidget * parent = 0, const char *name = 0 );
00121         int getYear();
00122         void setYear( int year );
00123 
00124 private:
00125         class VDateInternalYearPrivate;
00126         VDateInternalYearPrivate *d;
00127 };
00128 
00134 class VPopupFrame: public QFrame {
00135         Q_OBJECT
00136 
00137 protected:
00141         int result;
00145         void keyPressEvent( QKeyEvent * e );
00149         QWidget *main;
00150 
00151         public slots:
00156         void close( int r );
00157 
00158 public:
00162         VPopupFrame( QWidget * parent = 0, const char *name = 0 );
00170         void setMainWidget( QWidget * m );
00175         void resizeEvent( QResizeEvent * );
00179         void popup( const QPoint & pos );
00183         int exec( QPoint p );
00187         int exec( int x, int y );
00188 
00189 private:
00190 
00191         virtual bool close( bool alsoDelete ) {
00192                 return QFrame::close( alsoDelete );
00193         }
00194 protected:
00195         virtual void virtual_hook( int id, void *data );
00196 private:
00197         class VPopupFramePrivate;
00198         VPopupFramePrivate *d;
00199 };
00200 
00201 class VDateValidator: public QValidator {
00202 public:
00203         VDateValidator( QWidget * parent = 0, const char *name = 0 );
00204         virtual State validate( QString &, int & ) const;
00205         virtual void fixup( QString & input ) const;
00206         State date( const QString &, QDate & ) const;
00207 };
00208 
00209 class VDateTable: public QGridView {
00210         Q_OBJECT
00211 
00212 public:
00213         VDateTable( QWidget * parent = 0, QDate date = QDate::currentDate(), const char *name = 0, WFlags f = 0 );
00214         ~VDateTable();
00215         virtual QSize sizeHint() const;
00216 
00220         bool setDate( const QDate & );
00221         const QDate & getDate() const;
00222 
00223 
00224 protected:
00228         virtual void paintCell( QPainter *, int, int );
00232         virtual void viewportResizeEvent( QResizeEvent * );
00236         virtual void contentsMousePressEvent( QMouseEvent * );
00237         virtual void keyPressEvent( QKeyEvent * e );
00238         virtual void focusInEvent( QFocusEvent * e );
00239         virtual void focusOutEvent( QFocusEvent * e );
00240 
00244         QDate date;
00248         int firstday;
00252         int numdays;
00256         int numDaysPrevMonth;
00260         bool unused_hasSelection;
00264         QRect maxCell;
00265 
00266 signals:
00270         void dateChanged( QDate );
00274         void tableClicked();
00275 
00276 protected:
00277         virtual void virtual_hook( int id, void *data );
00278 
00279 private:
00280         class VDateTablePrivate;
00281         VDateTablePrivate *d;
00282 };
00283 
00284 #endif
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'