3 * This program is free software; you can redistribute it and/or modify it
4 * under the terms of the GNU Lesser General Public License as published by
5 * the Free Software Foundation.
7 * This program is distributed in the hope that it will be useful, but
8 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
9 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * You should have received a copy of the GNU Lesser General Public License
13 * along with this program; if not, see <http://www.gnu.org/licenses/>.
17 * Damon Chaplin <damon@ximian.com>
19 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
24 * ECellDateEdit - a subclass of ECellPopup used to show a date with a popup
28 #if !defined (__E_UTIL_H_INSIDE__) && !defined (LIBEUTIL_COMPILATION)
29 #error "Only <e-util/e-util.h> should be included directly."
32 #ifndef _E_CELL_DATE_EDIT_H_
33 #define _E_CELL_DATE_EDIT_H_
37 #include <e-util/e-cell-popup.h>
39 /* Standard GObject macros */
40 #define E_TYPE_CELL_DATE_EDIT \
41 (e_cell_date_edit_get_type ())
42 #define E_CELL_DATE_EDIT(obj) \
43 (G_TYPE_CHECK_INSTANCE_CAST \
44 ((obj), E_TYPE_CELL_DATE_EDIT, ECellDateEdit))
45 #define E_CELL_DATE_EDIT_CLASS(cls) \
46 (G_TYPE_CHECK_CLASS_CAST \
47 ((cls), E_TYPE_CELL_DATE_EDIT, ECellDateEditClass))
48 #define E_IS_CELL_DATE_EDIT(obj) \
49 (G_TYPE_CHECK_INSTANCE_TYPE \
50 ((obj), E_TYPE_CELL_DATE_EDIT))
51 #define E_IS_CELL_DATE_EDIT_CLASS(cls) \
52 (G_TYPE_CHECK_CLASS_TYPE \
53 ((cls), E_TYPE_CELL_DATE_EDIT))
54 #define E_CELL_DATE_EDIT_GET_CLASS(obj) \
55 (G_TYPE_INSTANCE_GET_CLASS \
56 ((obj), E_TYPE_CELL_DATE_EDIT, ECellDateEditClass))
60 typedef struct _ECellDateEdit ECellDateEdit
;
61 typedef struct _ECellDateEditClass ECellDateEditClass
;
63 /* The type of the callback function optionally used to get the current time.
65 typedef struct tm (*ECellDateEditGetTimeCallback
) (ECellDateEdit
*ecde
,
68 struct _ECellDateEdit
{
71 GtkWidget
*popup_window
;
73 GtkWidget
*time_entry
;
74 GtkWidget
*time_tree_view
;
76 GtkWidget
*now_button
;
77 GtkWidget
*today_button
;
78 GtkWidget
*none_button
;
80 /* This is the range of hours we show in the time list. */
84 /* TRUE if we use 24-hour format for the time list and entry. */
85 gboolean use_24_hour_format
;
87 /* This is TRUE if we need to rebuild the list of times. */
88 gboolean need_time_list_rebuild
;
90 /* The freeze count for rebuilding the time list. We only rebuild when
94 ECellDateEditGetTimeCallback time_callback
;
95 gpointer time_callback_data
;
96 GDestroyNotify time_callback_destroy
;
99 struct _ECellDateEditClass
{
100 ECellPopupClass parent_class
;
103 GType
e_cell_date_edit_get_type (void) G_GNUC_CONST
;
104 ECell
* e_cell_date_edit_new (void);
106 /* These freeze and thaw the rebuilding of the time list. They are useful when
107 * setting several properties which result in rebuilds of the list, e.g. the
108 * lower_hour, upper_hour and use_24_hour_format properties. */
109 void e_cell_date_edit_freeze (ECellDateEdit
*ecde
);
110 void e_cell_date_edit_thaw (ECellDateEdit
*ecde
);
112 /* Sets a callback to use to get the current time. This is useful if the
113 * application needs to use its own timezone data rather than rely on the
115 void e_cell_date_edit_set_get_time_callback
116 (ECellDateEdit
*ecde
,
117 ECellDateEditGetTimeCallback cb
,
119 GDestroyNotify destroy
);
123 #endif /* _E_CELL_DATE_EDIT_H_ */