kdatetbl.h
/* -*- C++ -*-
This file is part of the KDE libraries
Copyright (C) 1997 Tim D. Gilman (tdgilman@best.org)
(C) 1998-2001 Mirko Boehm (mirko@kde.org)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KDATETBL_H
#define KDATETBL_H
// KDE4: rename this file to kdatetable.h
#include <qvalidator.h>
#include <qgridview.h>
#include <qlineedit.h>
#include <qdatetime.h>
#include <qcolor.h>
#include <kdelibs_export.h>
class KPopupMenu;
class KDEUI_EXPORT KDateInternalWeekSelector : public QLineEdit
{
Q_OBJECT
protected:
QIntValidator *val;
int result;
public slots:
void weekEnteredSlot();
void setMaxWeek(int max);
signals:
void closeMe(int);
public:
KDateInternalWeekSelector( QWidget* parent=0, const char* name=0);
int getWeek();
void setWeek(int week);
private:
class KDateInternalWeekPrivate;
KDateInternalWeekPrivate *d;
};
class KDEUI_EXPORT KDateInternalMonthPicker : public QGridView
{
Q_OBJECT
protected:
int result;
short int activeCol;
short int activeRow;
QRect max;
signals:
void closeMe(int);
public:
KDateInternalMonthPicker(const QDate& date, QWidget* parent, const char* name=0);
~KDateInternalMonthPicker();
QSize sizeHint() const;
int getResult() const;
protected:
void setupPainter(QPainter *p);
virtual void viewportResizeEvent(QResizeEvent*);
virtual void paintCell(QPainter* painter, int row, int col);
virtual void contentsMousePressEvent(QMouseEvent *e);
virtual void contentsMouseMoveEvent(QMouseEvent *e);
virtual void contentsMouseReleaseEvent(QMouseEvent *e);
private:
class KDateInternalMonthPrivate;
KDateInternalMonthPrivate *d;
};
class KDEUI_EXPORT KDateInternalYearSelector : public QLineEdit
{
Q_OBJECT
protected:
QIntValidator *val;
int result;
public slots:
void yearEnteredSlot();
signals:
void closeMe(int);
public:
KDateInternalYearSelector( QWidget* parent=0, const char* name=0);
int getYear();
void setYear(int year);
private:
class KDateInternalYearPrivate;
KDateInternalYearPrivate *d;
};
class KDEUI_EXPORT KPopupFrame : public QFrame
{
Q_OBJECT
protected:
int result;
virtual void keyPressEvent(QKeyEvent* e);
QWidget *main;
public slots:
void close(int r);
void hide();
public:
KPopupFrame(QWidget* parent=0, const char* name=0);
~KPopupFrame();
void setMainWidget(QWidget* m);
virtual void resizeEvent(QResizeEvent*);
void popup(const QPoint &pos);
int exec(QPoint p); // KDE4: const QPoint&
int exec(int x, int y);
private:
virtual bool close(bool alsoDelete) { return QFrame::close(alsoDelete); }
protected:
virtual void virtual_hook( int id, void* data );
private:
class KPopupFramePrivate;
KPopupFramePrivate *d;
};
class KDEUI_EXPORT KDateValidator : public QValidator
{
public:
KDateValidator(QWidget* parent=0, const char* name=0);
virtual State validate(QString&, int&) const;
virtual void fixup ( QString & input ) const;
State date(const QString&, QDate&) const;
};
class KDEUI_EXPORT KDateTable : public QGridView
{
Q_OBJECT
Q_PROPERTY( QDate date READ getDate WRITE setDate )
Q_PROPERTY( bool popupMenu READ popupMenuEnabled WRITE setPopupMenuEnabled )
public:
KDateTable(QWidget *parent=0, QDate date=QDate::currentDate(),
const char* name=0, WFlags f=0);
KDateTable(QWidget *parent, const char* name, WFlags f=0);
~KDateTable();
virtual QSize sizeHint() const;
void setFontSize(int size);
bool setDate(const QDate&);
// ### KDE 4.0 rename to date()
const QDate& getDate() const;
void setPopupMenuEnabled( bool enable );
bool popupMenuEnabled() const;
enum BackgroundMode { NoBgMode=0, RectangleMode, CircleMode };
void setCustomDatePainting( const QDate &date, const QColor &fgColor, BackgroundMode bgMode=NoBgMode, const QColor &bgColor=QColor());
void unsetCustomDatePainting( const QDate &date );
protected:
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
QDate dateFromPos( int pos ); // KDE4: make this virtual
virtual void paintCell(QPainter*, int, int);
virtual void paintEmptyArea(QPainter*, int, int, int, int);
virtual void viewportResizeEvent(QResizeEvent *);
virtual void contentsMousePressEvent(QMouseEvent *);
virtual void wheelEvent( QWheelEvent * e );
virtual void keyPressEvent( QKeyEvent *e );
virtual void focusInEvent( QFocusEvent *e );
virtual void focusOutEvent( QFocusEvent *e );
// ### KDE 4.0 make the following private and mark as members
int fontsize;
QDate date;
int firstday;
int numdays;
int numDaysPrevMonth;
bool unused_hasSelection;
QRect maxCell;
signals:
// ### KDE 4.0 make parameter a const reference
void dateChanged(QDate);
void dateChanged(const QDate& cur, const QDate& old);
void tableClicked();
void aboutToShowContextMenu( KPopupMenu * menu, const QDate &date);
private slots:
void nextMonth();
void previousMonth();
void beginningOfMonth();
void endOfMonth();
void beginningOfWeek();
void endOfWeek();
protected:
virtual void virtual_hook( int id, void* data );
private:
class KDateTablePrivate;
KDateTablePrivate *d;
void initAccels();
};
#endif // KDATETBL_H
KPopupFrame::result
int result
The result.
Definition: kdatetbl.h:173
KDateTable::numdays
int numdays
The number of days in the current month.
Definition: kdatetbl.h:389
KDateTable::maxCell
QRect maxCell
Save the size of the largest used cell content.
Definition: kdatetbl.h:402
KDateTable
Date selection table.
Definition: kdatetbl.h:263
KDateInternalMonthPicker::result
int result
Store the month that has been clicked [1..12].
Definition: kdatetbl.h:74
KDateInternalMonthPicker
A table containing month names.
Definition: kdatetbl.h:67
KDateInternalMonthPicker::activeCol
short int activeCol
the cell under mouse cursor when LBM is pressed
Definition: kdatetbl.h:78
KDateTable::numDaysPrevMonth
int numDaysPrevMonth
The number of days in the previous month.
Definition: kdatetbl.h:393
KDateInternalWeekSelector
Week selection widget.
Definition: kdatetbl.h:40
KDateValidator
Validates user-entered dates.
Definition: kdatetbl.h:241
KDateInternalYearSelector
Year selection widget.
Definition: kdatetbl.h:140
KPopupFrame::main
QWidget * main
The only subwidget that uses the whole dialog window.
Definition: kdatetbl.h:181
KPopupFrame
Frame with popup menu behavior.
Definition: kdatetbl.h:166
KDateTable::firstday
int firstday
The day of the first day in the month [1..7].
Definition: kdatetbl.h:385
KDateInternalMonthPicker::max
QRect max
Contains the largest rectangle needed by the month names.
Definition: kdatetbl.h:83
KDateTable::unused_hasSelection
bool unused_hasSelection
unused remove in KDE 4.0
Definition: kdatetbl.h:398
KDateTable::fontsize
int fontsize
The font size of the displayed text.
Definition: kdatetbl.h:377

KDE Home | KDE Accessibility Home | Description of Access Keys