2 * Copyright (C) 2002, 2003 Sebastian Rittau <srittau@jroger.in-berlin.de>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with the Gnome Library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
21 #ifndef __EGG_DATETIME_H__
22 #define __EGG_DATETIME_H__
28 #include <gtk/gtkhbox.h>
34 /* don't use the following values for now... */
35 EGG_DATETIME_DISPLAY_YEAR
= 1 << 0,
36 EGG_DATETIME_DISPLAY_MONTH
= 1 << 1,
37 EGG_DATETIME_DISPLAY_DAY
= 1 << 2,
38 EGG_DATETIME_DISPLAY_HOUR
= 1 << 3,
39 EGG_DATETIME_DISPLAY_MINUTE
= 1 << 4,
40 EGG_DATETIME_DISPLAY_SECOND
= 1 << 5,
41 EGG_DATETIME_DISPLAY_YEAR_OPT
= 1 << 6,
42 EGG_DATETIME_DISPLAY_MONTH_OPT
= 1 << 7,
43 EGG_DATETIME_DISPLAY_DAY_OPT
= 1 << 8,
44 EGG_DATETIME_DISPLAY_HOUR_OPT
= 1 << 9,
45 EGG_DATETIME_DISPLAY_MINUTE_OPT
= 1 << 10,
46 EGG_DATETIME_DISPLAY_SECOND_OPT
= 1 << 11
47 } EggDateTimeDisplayMode
;
49 /* ... use these instead */
50 #define EGG_DATETIME_DISPLAY_DATE (EGG_DATETIME_DISPLAY_YEAR | EGG_DATETIME_DISPLAY_MONTH | EGG_DATETIME_DISPLAY_DAY)
51 #define EGG_DATETIME_DISPLAY_TIME (EGG_DATETIME_DISPLAY_HOUR | EGG_DATETIME_DISPLAY_MINUTE)
52 #define EGG_DATETIME_DISPLAY_TIME_SECONDS (EGG_DATETIME_DISPLAY_HOUR | EGG_DATETIME_DISPLAY_MINUTE | EGG_DATETIME_DISPLAY_SECOND)
54 #define EGG_DATETIME_INVALID_DATE (0)
55 #define EGG_DATETIME_INVALID_TIME (0xff)
58 #define EGG_TYPE_DATETIME (egg_datetime_get_type ())
59 #define EGG_DATETIME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_DATETIME, EggDateTime))
60 #define EGG_DATETIME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_DATETIME, EggDateTimeClass))
61 #define EGG_IS_DATETIME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_DATETIME))
62 #define EGG_IS_DATETIME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_DATETIME))
63 #define EGG_DATETIME_GET_CLASS(obj) (G_TYPE_CHECK_GET_CLASS ((obj), EGG_TYPE_DATETIME, EggDateTimeClass))
65 typedef struct _EggDateTime EggDateTime
;
66 typedef struct _EggDateTimeClass EggDateTimeClass
;
67 typedef struct _EggDateTimePrivate EggDateTimePrivate
;
73 EggDateTimePrivate
*priv
;
76 struct _EggDateTimeClass
78 GtkHBoxClass parent_class
;
82 void (*date_changed
) (EggDateTime
*edt
);
83 void (*time_changed
) (EggDateTime
*edt
);
88 GtkType
egg_datetime_get_type (void);
89 GtkWidget
*egg_datetime_new (void);
90 GtkWidget
*egg_datetime_new_from_time_t (time_t t
);
91 GtkWidget
*egg_datetime_new_from_struct_tm (struct tm
*tm
);
92 GtkWidget
*egg_datetime_new_from_gdate (GDate
*date
);
93 GtkWidget
*egg_datetime_new_from_datetime (GDateYear year
, GDateMonth month
, GDateDay day
, guint8 hour
, guint8 minute
, guint8 second
);
96 void egg_datetime_set_none (EggDateTime
*edt
);
97 void egg_datetime_set_from_time_t (EggDateTime
*edt
, time_t t
);
98 gboolean
egg_datetime_get_as_time_t (EggDateTime
*edt
, time_t *t
);
99 void egg_datetime_set_from_struct_tm (EggDateTime
*edt
, struct tm
*tm
);
100 gboolean
egg_datetime_get_as_struct_tm (EggDateTime
*edt
, struct tm
*tm
);
101 void egg_datetime_set_from_gdate (EggDateTime
*edt
, GDate
*date
);
102 gboolean
egg_datetime_get_as_gdate (EggDateTime
*edt
, GDate
*date
);
103 void egg_datetime_set_date (EggDateTime
*edt
, GDateYear year
, GDateMonth month
, GDateDay day
);
104 gboolean
egg_datetime_get_date (EggDateTime
*edt
, GDateYear
*year
, GDateMonth
*month
, GDateDay
*day
);
105 void egg_datetime_set_time (EggDateTime
*edt
, gint hour
, gint minute
, guint8 second
);
106 gboolean
egg_datetime_get_time (EggDateTime
*edt
, gint
*hour
, gint
*minute
, gint
*second
);
108 void egg_datetime_set_lazy (EggDateTime
*edt
, gboolean lazy
);
109 gboolean
egg_datetime_get_lazy (EggDateTime
*edt
);
110 void egg_datetime_set_display_mode (EggDateTime
*edt
, EggDateTimeDisplayMode mode
);
111 EggDateTimeDisplayMode
egg_datetime_get_display_mode (EggDateTime
*edt
);
113 void egg_datetime_set_clamp_date (EggDateTime
*edt
, GDateYear minyear
, GDateMonth minmonth
, GDateDay minday
, GDateYear maxyear
, GDateMonth maxmonth
, GDateDay maxday
);
114 void egg_datetime_set_clamp_time (EggDateTime
*edt
, guint8 minhour
, guint8 minminute
, guint8 minsecond
, guint8 maxhour
, guint8 maxminute
, guint8 maxsecond
);
115 void egg_datetime_set_clamp_time_t (EggDateTime
*edt
);
116 void egg_datetime_get_clamp_date (EggDateTime
*edt
, GDateYear
*minyear
, GDateMonth
*minmonth
, GDateDay
*minday
, GDateYear
*maxyear
, GDateMonth
*maxmonth
, GDateDay
*maxday
);
117 void egg_datetime_get_clamp_time (EggDateTime
*edt
, guint8
*minhour
, guint8
*minminute
, guint8
*minsecond
, guint8
*maxhour
, guint8
*maxminute
, guint8
*maxsecond
);
119 PangoLayout
*egg_datetime_get_date_layout (EggDateTime
*edt
);
120 PangoLayout
*egg_datetime_get_time_layout (EggDateTime
*edt
);
122 void egg_set_nodate(EggDateTime
*edt
, gboolean val
);
123 gboolean
egg_get_nodate(EggDateTime
*edt
);
125 #endif /* __EGG_DATETIME_H__ */