3118a2cb49675b6dd6880c20aa7cdc8046905e34
[hildon] / src / hildon-time-editor.h
1 /*
2  * This file is part of hildon-libs
3  *
4  * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
5  *
6  * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation; version 2.1 of
11  * the License.
12  *
13  * This library is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21  * 02110-1301 USA
22  *
23  */
24
25 #ifndef __HILDON_TIME_EDITOR_H__
26 #define __HILDON_TIME_EDITOR_H__
27
28 #include <gtk/gtk.h>
29
30 G_BEGIN_DECLS
31
32 #define HILDON_TYPE_TIME_EDITOR            (hildon_time_editor_get_type())
33
34 #define HILDON_TIME_EDITOR(obj)            (GTK_CHECK_CAST (obj,           HILDON_TYPE_TIME_EDITOR, HildonTimeEditor))
35 #define HILDON_TIME_EDITOR_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), HILDON_TYPE_TIME_EDITOR, HildonTimeEditorClass))
36
37 #define HILDON_IS_TIME_EDITOR(obj)         (GTK_CHECK_TYPE       (obj,     HILDON_TYPE_TIME_EDITOR))
38 #define HILDON_IS_TIME_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), HILDON_TYPE_TIME_EDITOR))
39
40 typedef enum 
41 {
42   HILDON_DATE_TIME_ERROR_NO_ERROR = -1,
43   HILDON_DATE_TIME_ERROR_MAX_HOURS,
44   HILDON_DATE_TIME_ERROR_MAX_MINS,
45   HILDON_DATE_TIME_ERROR_MAX_SECS,
46   HILDON_DATE_TIME_ERROR_MAX_DAY,
47   HILDON_DATE_TIME_ERROR_MAX_MONTH,
48   HILDON_DATE_TIME_ERROR_MAX_YEAR,
49   HILDON_DATE_TIME_ERROR_MIN_HOURS,
50   HILDON_DATE_TIME_ERROR_MIN_MINS,
51   HILDON_DATE_TIME_ERROR_MIN_SECS,
52   HILDON_DATE_TIME_ERROR_MIN_DAY,
53   HILDON_DATE_TIME_ERROR_MIN_MONTH,
54   HILDON_DATE_TIME_ERROR_MIN_YEAR,
55   HILDON_DATE_TIME_ERROR_EMPTY_HOURS,
56   HILDON_DATE_TIME_ERROR_EMPTY_MINS,
57   HILDON_DATE_TIME_ERROR_EMPTY_SECS,
58   HILDON_DATE_TIME_ERROR_EMPTY_DAY,
59   HILDON_DATE_TIME_ERROR_EMPTY_MONTH,
60   HILDON_DATE_TIME_ERROR_EMPTY_YEAR,
61   HILDON_DATE_TIME_ERROR_MIN_DURATION,
62   HILDON_DATE_TIME_ERROR_MAX_DURATION,
63   HILDON_DATE_TIME_ERROR_INVALID_CHAR,
64   HILDON_DATE_TIME_ERROR_INVALID_DATE,
65   HILDON_DATE_TIME_ERROR_INVALID_TIME
66 } HildonDateTimeEditorError;
67
68 typedef struct _HildonTimeEditor      HildonTimeEditor;
69 typedef struct _HildonTimeEditorClass HildonTimeEditorClass;
70
71 struct _HildonTimeEditor {
72     GtkContainer parent;
73 };
74
75 struct _HildonTimeEditorClass {
76     GtkContainerClass parent_class;
77
78     gboolean (*time_error) (HildonTimeEditor          *editor,
79                             HildonDateTimeEditorError type);
80 };
81
82 GType      hildon_time_editor_get_type(void) G_GNUC_CONST;
83 GtkWidget *hildon_time_editor_new(void);
84
85
86 void       hildon_time_editor_set_time           (HildonTimeEditor * editor,
87                                                   guint              hours,
88                                                   guint              minutes,
89                                                   guint              seconds);
90
91 void       hildon_time_editor_get_time           (HildonTimeEditor * editor,
92                                                   guint            * hours,
93                                                   guint            * minutes,
94                                                   guint            * seconds);
95
96 void       hildon_time_editor_set_duration_range (HildonTimeEditor * editor,
97                                                   guint              min_seconds,
98                                                   guint              max_seconds);
99
100 void       hildon_time_editor_get_duration_range (HildonTimeEditor * editor,
101                                                   guint            * min_seconds,
102                                                   guint            * max_seconds);
103
104 void       hildon_time_editor_set_ticks          (HildonTimeEditor * editor, guint    ticks);
105 guint      hildon_time_editor_get_ticks          (HildonTimeEditor * editor);
106
107 void       hildon_time_editor_set_show_seconds   (HildonTimeEditor * editor, gboolean show_seconds);
108 gboolean   hildon_time_editor_get_show_seconds   (HildonTimeEditor * editor);
109
110 void       hildon_time_editor_set_show_hours     (HildonTimeEditor * editor, gboolean show_hours);
111 gboolean   hildon_time_editor_get_show_hours     (HildonTimeEditor * editor);
112
113 void       hildon_time_editor_set_duration_mode  (HildonTimeEditor * editor, gboolean duration_mode);
114 gboolean   hildon_time_editor_get_duration_mode  (HildonTimeEditor * editor);
115
116 void       hildon_time_editor_set_duration_min   (HildonTimeEditor * editor, guint    duration_min);
117 guint      hildon_time_editor_get_duration_min   (HildonTimeEditor * editor);
118
119 void       hildon_time_editor_set_duration_max   (HildonTimeEditor * editor, guint    duration_max);
120 guint      hildon_time_editor_get_duration_max   (HildonTimeEditor * editor);
121
122 G_END_DECLS
123 #endif /* __HILDON_TIME_EDITOR_H__ */