2006-11-08 Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
[hildon] / hildon-widgets / 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/gtkcontainer.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
41 typedef enum
42 {
43   NO_TIME_ERROR = -1,
44   MAX_HOURS,
45   MAX_MINS,
46   MAX_SECS,
47   MIN_HOURS,
48   MIN_MINS,
49   MIN_SECS,
50   EMPTY_HOURS,
51   EMPTY_MINS,
52   EMPTY_SECS,
53   MIN_DUR,
54   MAX_DUR,
55   INVALID_TIME,
56   INVALID_CHAR
57 } HildonTimeEditorErrorType;
58
59 typedef struct _HildonTimeEditor      HildonTimeEditor;
60 typedef struct _HildonTimeEditorClass HildonTimeEditorClass;
61
62 struct _HildonTimeEditor {
63     GtkContainer parent;
64 };
65
66 struct _HildonTimeEditorClass {
67     GtkContainerClass parent_class;
68
69     gboolean (*time_error) (HildonTimeEditor          *editor,
70                             HildonTimeEditorErrorType  type);
71 };
72
73 GType      hildon_time_editor_get_type(void) G_GNUC_CONST;
74 GtkWidget *hildon_time_editor_new(void);
75
76
77 void       hildon_time_editor_set_time           (HildonTimeEditor * editor,
78                                                   guint              hours,
79                                                   guint              minutes,
80                                                   guint              seconds);
81
82 void       hildon_time_editor_get_time           (HildonTimeEditor * editor,
83                                                   guint            * hours,
84                                                   guint            * minutes,
85                                                   guint            * seconds);
86
87 #ifndef HILDON_DISABLE_DEPRECATED
88 void       hildon_time_editor_show_seconds         (HildonTimeEditor * editor, gboolean enable);
89 void       hildon_time_editor_enable_duration_mode (HildonTimeEditor * editor, gboolean enable);
90 #endif /* HILDON_DISABLE_DEPRECATED */
91
92
93 void       hildon_time_editor_set_duration_range (HildonTimeEditor * editor,
94                                                   guint              min_seconds,
95                                                   guint              max_seconds);
96
97 void       hildon_time_editor_get_duration_range (HildonTimeEditor * editor,
98                                                   guint            * min_seconds,
99                                                   guint            * max_seconds);
100
101 void       hildon_time_editor_set_ticks          (HildonTimeEditor * editor, guint    ticks);
102 guint      hildon_time_editor_get_ticks          (HildonTimeEditor * editor);
103
104 void       hildon_time_editor_set_show_seconds   (HildonTimeEditor * editor, gboolean show_seconds);
105 gboolean   hildon_time_editor_get_show_seconds   (HildonTimeEditor * editor);
106
107 void       hildon_time_editor_set_show_hours     (HildonTimeEditor * editor, gboolean show_hours);
108 gboolean   hildon_time_editor_get_show_hours     (HildonTimeEditor * editor);
109
110 void       hildon_time_editor_set_duration_mode  (HildonTimeEditor * editor, gboolean duration_mode);
111 gboolean   hildon_time_editor_get_duration_mode  (HildonTimeEditor * editor);
112
113 void       hildon_time_editor_set_duration_min   (HildonTimeEditor * editor, guint    duration_min);
114 guint      hildon_time_editor_get_duration_min   (HildonTimeEditor * editor);
115
116 void       hildon_time_editor_set_duration_max   (HildonTimeEditor * editor, guint    duration_max);
117 guint      hildon_time_editor_get_duration_max   (HildonTimeEditor * editor);
118
119
120 G_END_DECLS
121 #endif /* __HILDON_TIME_EDITOR_H__ */