kmymoneydatetbl.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 #ifndef KMYMONEYDATETBL_H
00045 #define KMYMONEYDATETBL_H
00046
00047
00048
00049 #include <qgridview.h>
00050 #include <qdatetime.h>
00051
00052
00053
00054
00055 #include "kdecompat.h"
00056
00057
00058
00059
00060
00061
00065 class kMyMoneyDateTbl : public QGridView {
00066 Q_OBJECT
00067 public:
00068 enum calendarType { WEEKLY,
00069 MONTHLY,
00070 QUARTERLY };
00071
00072 public:
00076 kMyMoneyDateTbl(QWidget *parent=0,
00077 QDate date=QDate::currentDate(),
00078 const char* name=0, WFlags f=0);
00086 virtual QSize sizeHint() const;
00090 virtual void setFontSize(int size);
00094 virtual bool setDate(const QDate&);
00095 virtual const QDate& getDate() const;
00096
00097 virtual void setType(calendarType type);
00098 virtual calendarType type(void) const { return m_type; }
00099
00100 signals:
00104 void dateChanged(QDate);
00108 void tableClicked();
00109
00113 virtual void hoverDate(QDate);
00114
00115 protected:
00119 virtual void paintCell(QPainter*, int, int);
00123 virtual void viewportResizeEvent(QResizeEvent *);
00127 virtual void contentsMouseReleaseEvent(QMouseEvent *);
00128 virtual void wheelEvent( QWheelEvent * e );
00129 virtual void keyPressEvent( QKeyEvent *e );
00130 virtual void focusInEvent( QFocusEvent *e );
00131 virtual void focusOutEvent( QFocusEvent *e );
00132
00133 virtual void drawCellContents(QPainter *painter, int row, int col, const QDate& theDate) = 0;
00134
00135 virtual void contentsMouseMoveEvent(QMouseEvent* e);
00136
00140 int fontsize;
00144 QDate date;
00148 int firstday;
00152 int numdays;
00156 int numDaysPrevMonth;
00161 bool unused_hasSelection;
00165 QRect maxCell;
00166
00170 calendarType m_type;
00171 int m_colCount;
00172 int m_rowCount;
00173
00175 QDate m_drawDateOrig;
00176
00177 private:
00178 #if QT_VERSION <= 0x030005
00179 int weekNumber(const QDate&, int *yr) const;
00180 #endif
00181
00182 #if KDE_IS_VERSION(3,2,0)
00183 #define WEEK_DAY_NAME(a,b) KGlobal::locale()->calendar()->weekDayName(a,b)
00184 #else
00185 #define WEEK_DAY_NAME(a,b) KGlobal::locale()->weekDayName(a,b)
00186 #endif
00187 };
00188
00189 #endif