20 #include <tqpopupmenu.h>
21 #include <tqcombobox.h>
23 #include <tqlineedit.h>
25 #include "knuminput.h"
26 #include "tdeglobal.h"
28 #include "kcalendarsystem.h"
32 #include "kdatewidget.h"
34 class KDateWidgetSpinBox :
public TQSpinBox
37 KDateWidgetSpinBox(
int min,
int max, TQWidget *parent)
38 : TQSpinBox(min, max, 1, parent)
40 editor()->setAlignment(TQt::AlignRight);
44 class KDateWidget::KDateWidgetPrivate
47 KDateWidgetSpinBox *m_day;
49 KDateWidgetSpinBox *m_year;
55 : TQWidget( parent, name )
64 : TQWidget( parent, name )
72 void KDateWidget::init()
74 d =
new KDateWidgetPrivate;
77 layout->setAutoAdd(
true);
78 d->m_day =
new KDateWidgetSpinBox(1, 1,
this);
79 d->m_month =
new TQComboBox(
false,
this);
80 for (
int i = 1; ; ++i)
84 if (str.isNull())
break;
85 d->m_month->insertItem(str);
91 connect(d->m_day, TQ_SIGNAL(valueChanged(
int)),
this, TQ_SLOT(slotDateChanged()));
92 connect(d->m_month, TQ_SIGNAL(activated(
int)),
this, TQ_SLOT(slotDateChanged()));
93 connect(d->m_year, TQ_SIGNAL(valueChanged(
int)),
this, TQ_SLOT(slotDateChanged()));
96 void KDateWidget::init(
const TQDate& date)
98 d =
new KDateWidgetPrivate;
101 layout->setAutoAdd(
true);
102 d->m_day =
new KDateWidgetSpinBox(1, 1,
this);
103 d->m_month =
new TQComboBox(
false,
this);
104 for (
int i = 1; ; ++i)
108 if (str.isNull())
break;
109 d->m_month->insertItem(str);
115 connect(d->m_day, TQ_SIGNAL(valueChanged(
int)),
this, TQ_SLOT(slotDateChanged()));
116 connect(d->m_month, TQ_SIGNAL(activated(
int)),
this, TQ_SLOT(slotDateChanged()));
117 connect(d->m_year, TQ_SIGNAL(valueChanged(
int)),
this, TQ_SLOT(slotDateChanged()));
130 d->m_day->blockSignals(
true);
131 d->m_month->blockSignals(
true);
132 d->m_year->blockSignals(
true);
135 d->m_day->setValue(calendar->
day(
date));
136 d->m_month->setCurrentItem(calendar->
month(
date)-1);
137 d->m_year->setValue(calendar->
year(
date));
139 d->m_day->blockSignals(
false);
140 d->m_month->blockSignals(
false);
141 d->m_year->blockSignals(
false);
152 void KDateWidget::slotDateChanged( )
159 y = d->m_year->value();
163 m = d->m_month->currentItem()+1;
167 day = d->m_day->value();
174 void KDateWidget::virtual_hook(
int,
void* )
177 #include "kdatewidget.moc"
virtual int maxValidYear() const=0
virtual int monthsInYear(const TQDate &date) const=0
virtual int daysInMonth(const TQDate &date) const=0
virtual int day(const TQDate &date) const=0
virtual int month(const TQDate &date) const=0
virtual int minValidYear() const=0
virtual TQString monthName(int month, int year, bool shortName=false) const=0
virtual bool setYMD(TQDate &date, int y, int m, int d) const=0
virtual int year(const TQDate &date) const=0
static int spacingHint()
Return the number of pixels you shall use between widgets inside a dialog according to the KDE standa...
static TDELocale * locale()
const KCalendarSystem * calendar() const