2006-09-12 Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
[hildon] / hildon-widgets / hildon-date-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 or any later version.
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_DATE_EDITOR_H__
26 #define __HILDON_DATE_EDITOR_H__
27
28 #include <gtk/gtkcontainer.h>
29
30 G_BEGIN_DECLS
31 /**
32  * HILDON_TYPE_DATE_EDITOR:
33  *
34  * Macro for getting type of date editor.
35  * Since: 0.12.10
36  */
37 #define HILDON_TYPE_DATE_EDITOR ( hildon_date_editor_get_type() )
38
39
40 /**
41  * HILDON_DATE_EDITOR_TYPE:
42  *
43  * Deprecated: use #HILDON_TYPE_DATE_EDITOR instead
44  */
45 #define HILDON_DATE_EDITOR_TYPE HILDON_TYPE_DATE_EDITOR
46
47 #define HILDON_DATE_EDITOR(obj) (GTK_CHECK_CAST (obj,\
48   HILDON_TYPE_DATE_EDITOR, HildonDateEditor))
49 #define HILDON_DATE_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass),\
50   HILDON_TYPE_DATE_EDITOR, HildonDateEditorClass))
51 #define HILDON_IS_DATE_EDITOR(obj) (GTK_CHECK_TYPE (obj,\
52   HILDON_TYPE_DATE_EDITOR))
53 #define HILDON_IS_DATE_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass),\
54   HILDON_TYPE_DATE_EDITOR))
55
56 /**
57  * HildonDateEditor:
58  *
59  * Internal struct for date editor.
60  */
61 typedef struct _HildonDateEditor HildonDateEditor;
62 typedef struct _HildonDateEditorClass HildonDateEditorClass;
63
64 typedef enum
65 {
66   NO_ERROR = -1,
67   MAX_DAY,
68   MAX_MONTH,
69   MAX_YEAR,
70   MIN_DAY,
71   MIN_MONTH,
72   MIN_YEAR,
73   EMPTY_DAY,
74   EMPTY_MONTH,
75   EMPTY_YEAR,
76   INVALID_DATE
77     
78 }HildonDateEditorErrorType;
79
80 struct _HildonDateEditor {
81     GtkContainer par;
82 };
83
84 struct _HildonDateEditorClass {
85     GtkContainerClass parent_class;
86
87     gboolean (*date_error) (HildonDateEditor *editor, 
88                             HildonDateEditorErrorType type);
89 };
90
91 GType hildon_date_editor_get_type(void) G_GNUC_CONST;
92
93 GtkWidget *hildon_date_editor_new(void);
94
95 void hildon_date_editor_set_date(HildonDateEditor * date,
96                                  guint year, guint month, guint day);
97
98 void hildon_date_editor_get_date(HildonDateEditor * date,
99                                  guint * year, guint * month, guint * day);
100
101 gboolean hildon_date_editor_set_year(HildonDateEditor *editor, guint year);
102 gboolean hildon_date_editor_set_month(HildonDateEditor *editor, guint month);
103 gboolean hildon_date_editor_set_day(HildonDateEditor *editor, guint day);
104
105 guint hildon_date_editor_get_year(HildonDateEditor *editor);
106 guint hildon_date_editor_get_month(HildonDateEditor *editor);
107 guint hildon_date_editor_get_day(HildonDateEditor *editor);
108
109 G_END_DECLS
110 #endif /* __HILDON_DATE_EDITOR_H__ */