NAME
Gtk2::Ex::DateSpinner -- year/month/day date entry using SpinButtons
SYNOPSIS
use Gtk2::Ex::DateSpinner;
my $ds = Gtk2::Ex::DateSpinner->new (value => '2008-06-14');
WIDGET HIERARCHY
Gtk2::Ex::DateSpinner
is (currently) a subclass of Gtk2::HBox
, though it's probably not a good idea to rely on that.
Gtk2::Widget
Gtk2::Container
Gtk2::Box
Gtk2::HBox
Gtk2::Ex::DateSpinner
DESCRIPTION
Gtk2::Ex::DateSpinner
displays and changes a date in year, month, day format using three Gtk2::SpinButton
fields. The day of the week is shown to the right.
+------+ +----+ +----+
| 2008 |^ | 6 |^ | 14 |^ Sat
+------+v +----+v +----+v
There's lots ways to enter/display a date. This style is good for clicking to a nearby date, but also allows a date to be typed in if a long way away.
If a click or entered value takes the day outside the range 1 to however many days in the month then it wraps around to the next or previous month. Likewise the month wraps around to the next or previous year. The day of the week display updates once you press enter or tab when typing in a number.
Day of the week and date normalization calculations use Date::Calc
so they're not limited to system time_t
(which may be as little as 1970 to 2038 on a 32-bit system). The day name uses POSIX::strftime
and gets the usual localizations at Perl startup.
FUNCTIONS
$ds = Gtk2::Ex::DateSpinner->new (key=>value,...)
-
Create and return a new DateSpinner widget. Optional key/value pairs set initial properties per
Glib::Object->new
. Eg.my $ds = Gtk2::Ex::DateSpinner->new (value => '2008-06-14');
$ds->set_today
-
Set the
value
in$ds
to today's date (today in the local timezone).
PROPERTIES
value
(string, default "2000-01-01")-
The current date value, as an ISO format "YYYY-MM-DD" string. When you read this the day and month are always "normalized", so MM is 01 to 12 and DD is 01 to 28,29,30,31, however many days in the particular month.
The default 1 January 2000 is meant to be fairly useless and you should set it to something that makes sense for the particular application.
There's very limited validation on the
value
string, so don't set garbage.
SEE ALSO
Gtk2::SpinButton, Date::Calc, Gtk2::Calendar, Gtk2::Ex::CalendarButton, Gtk2::Ex::DateRange
HOME PAGE
http://www.geocities.com/user42_kevin/gtk2-ex-datespinner/index.html
LICENSE
Gtk2-Ex-DateSpinner is Copyright 2008, 2009 Kevin Ryde
Gtk2-Ex-DateSpinner is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
Gtk2-Ex-DateSpinner 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 General Public License for more details.
You should have received a copy of the GNU General Public License along with Gtk2-Ex-DateSpinner. If not, see <http://www.gnu.org/licenses/>.