2008-07-30 Alberto Garcia <agarcia@igalia.com>
[hildon] / src / hildon-touch-picker.h
1 /*
2  * This file is a part of hildon
3  *
4  * Copyright (C) 2005, 2008 Nokia Corporation.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version. or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free
18  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  */
20
21 #ifndef __HILDON_TOUCH_PICKER_H__
22 #define __HILDON_TOUCH_PICKER_H__
23
24 #include <gtk/gtk.h>
25
26 G_BEGIN_DECLS
27
28 #define HILDON_TYPE_TOUCH_PICKER             (hildon_touch_picker_get_type ())
29 #define HILDON_TOUCH_PICKER(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), HILDON_TYPE_TOUCH_PICKER, HildonTouchPicker))
30 #define HILDON_TOUCH_PICKER_CLASS(vtable)    (G_TYPE_CHECK_CLASS_CAST ((vtable), HILDON_TYPE_TOUCH_PICKER, HildonTouchPickerClass))
31 #define HILDON_IS_TOUCH_PICKER(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), HILDON_TYPE_TOUCH_PICKER))
32 #define HILDON_IS_TOUCH_PICKER_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), HILDON_TYPE_TOUCH_PICKER))
33 #define HILDON_TOUCH_PICKER_GET_CLASS(inst)  (G_TYPE_INSTANCE_GET_CLASS ((inst), HILDON_TYPE_TOUCH_PICKER, HildonTouchPickerClass))
34
35 typedef struct _HildonTouchPicker HildonTouchPicker;
36 typedef struct _HildonTouchPickerClass HildonTouchPickerClass;
37 typedef struct _HildonTouchPickerPrivate HildonTouchPickerPrivate;
38
39 typedef gchar *(*HildonTouchPickerPrintFunc) (HildonTouchPicker * picker);
40
41 struct _HildonTouchPicker
42 {
43   GtkHBox parent_instance;
44
45   /*< private > */
46   HildonTouchPickerPrivate *priv;
47 };
48
49 struct _HildonTouchPickerClass
50 {
51   GtkHBoxClass parent_class;
52
53   /* signals */
54   void (*changed) (HildonTouchPicker * picker, gint column);
55 };
56
57 typedef enum
58 {
59   HILDON_TOUCH_PICKER_SELECTION_MODE_SINGLE,
60   HILDON_TOUCH_PICKER_SELECTION_MODE_MULTIPLE
61 } HildonTouchPickerSelectionMode;
62
63 /* construction */
64 GType      hildon_touch_picker_get_type (void) G_GNUC_CONST;
65 GtkWidget *hildon_touch_picker_new      (void);
66
67 /* column related  */
68 gboolean hildon_touch_picker_append_text_column     (HildonTouchPicker * picker,
69                                                      GtkTreeModel * model);
70
71 gboolean hildon_touch_picker_append_column          (HildonTouchPicker * picker,
72                                                      GtkTreeModel * model,
73                                                      GtkCellRenderer * cell_renderer,
74                                                      ...);
75
76 void hildon_touch_picker_set_column_attributes      (HildonTouchPicker * picker,
77                                                      gint column,
78                                                      GtkCellRenderer * cell_renderer,
79                                                      ...);
80
81 gboolean hildon_touch_picker_remove_column          (HildonTouchPicker * picker,
82                                                      gint column);
83
84 gint hildon_touch_picker_get_num_columns            (HildonTouchPicker * picker);
85
86 void hildon_touch_picker_set_column_selection_mode  (HildonTouchPicker * picker,
87                                                      HildonTouchPickerSelectionMode mode);
88
89 HildonTouchPickerSelectionMode
90 hildon_touch_picker_get_column_selection_mode       (HildonTouchPicker * picker);
91
92 /* get/set active item */
93 gboolean hildon_touch_picker_get_active_iter  (HildonTouchPicker * picker,
94                                                gint column,
95                                                GtkTreeIter * iter);
96 void hildon_touch_picker_set_active_iter      (HildonTouchPicker * picker,
97                                                gint column,
98                                                GtkTreeIter * iter,
99                                                gboolean scroll_to);
100 GList *hildon_touch_picker_get_selected_rows  (HildonTouchPicker * picker,
101                                                gint column);
102 /* model  */
103 void hildon_touch_picker_set_model            (HildonTouchPicker * picker,
104                                                gint column, GtkTreeModel * model);
105 GtkTreeModel *hildon_touch_picker_get_model   (HildonTouchPicker * picker,
106                                                gint column);
107
108 /* show the current element selected */
109 gchar *hildon_touch_picker_get_current_text (HildonTouchPicker * picker);
110
111 void hildon_touch_picker_set_print_func     (HildonTouchPicker * picker,
112                                              HildonTouchPickerPrintFunc func);
113
114 HildonTouchPickerPrintFunc
115 hildon_touch_picker_get_print_func          (HildonTouchPicker * picker);
116
117 G_END_DECLS
118
119 #endif /* __HILDON_TOUCH_PICKER_H__ */