kmymoneydatetbl.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           kmymoneydatetbl.h  -  description
00003                              -------------------
00004     begin                : Thu Jul 3 2003
00005     copyright            : (C) 2000-2003 by Michael Edwardes
00006     email                : mte@users.sourceforge.net
00007                            Javier Campos Morales <javi_c@users.sourceforge.net>
00008                            Felix Rodriguez <frodriguez@users.sourceforge.net>
00009                            John C <thetacoturtle@users.sourceforge.net>
00010                            Thomas Baumgart <ipwizard@users.sourceforge.net>
00011                            Kevin Tambascio <ktambascio@users.sourceforge.net>
00012  ***************************************************************************/
00013 
00014 /****************************************************************************
00015  Contains code from the KDateTable class ala kdelibs-3.1.2.  Original license:
00016 
00017     This file is part of the KDE libraries
00018     Copyright (C) 1997 Tim D. Gilman (tdgilman@best.org)
00019               (C) 1998-2001 Mirko Boehm (mirko@kde.org)
00020     This library is free software; you can redistribute it and/or
00021     modify it under the terms of the GNU Library General Public
00022     License as published by the Free Software Foundation; either
00023     version 2 of the License, or (at your option) any later version.
00024 
00025     This library is distributed in the hope that it will be useful,
00026     but WITHOUT ANY WARRANTY; without even the implied warranty of
00027     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00028     Library General Public License for more details.
00029 
00030     You should have received a copy of the GNU Library General Public License
00031     along with this library; see the file COPYING.LIB.  If not, write to
00032     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00033     Boston, MA 02111-1307, USA.
00034 */
00035 
00036 /***************************************************************************
00037  *                                                                         *
00038  *   This program is free software; you can redistribute it and/or modify  *
00039  *   it under the terms of the GNU General Public License as published by  *
00040  *   the Free Software Foundation; either version 2 of the License, or     *
00041  *   (at your option) any later version.                                   *
00042  *                                                                         *
00043  ***************************************************************************/
00044 #ifndef KMYMONEYDATETBL_H
00045 #define KMYMONEYDATETBL_H
00046 
00047 // ----------------------------------------------------------------------------
00048 // QT Includes
00049 #include <qgridview.h>
00050 #include <qdatetime.h>
00051 
00052 // ----------------------------------------------------------------------------
00053 // KDE Includes
00054 
00055 #include "kdecompat.h"
00056 
00057 // ----------------------------------------------------------------------------
00058 // Project Includes
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

Generated on Wed Jan 26 13:03:17 2011 for KMyMoney by  doxygen 1.5.6