2 * This file is a part of hildon
4 * Copyright (C) 2005, 2008 Nokia Corporation.
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.
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.
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.
21 #ifndef __HILDON_TOUCH_SELECTOR_H__
22 #define __HILDON_TOUCH_SELECTOR_H__
25 #include "hildon-touch-selector-column.h"
29 #define HILDON_TYPE_TOUCH_SELECTOR \
30 (hildon_touch_selector_get_type ())
32 #define HILDON_TOUCH_SELECTOR(obj) \
33 (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
34 HILDON_TYPE_TOUCH_SELECTOR, HildonTouchSelector))
36 #define HILDON_TOUCH_SELECTOR_CLASS(vtable) \
37 (G_TYPE_CHECK_CLASS_CAST ((vtable), \
38 HILDON_TYPE_TOUCH_SELECTOR, HildonTouchSelectorClass))
40 #define HILDON_IS_TOUCH_SELECTOR(obj) \
41 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
42 HILDON_TYPE_TOUCH_SELECTOR))
44 #define HILDON_IS_TOUCH_SELECTOR_CLASS(vtable) \
45 (G_TYPE_CHECK_CLASS_TYPE ((vtable), HILDON_TYPE_TOUCH_SELECTOR))
47 #define HILDON_TOUCH_SELECTOR_GET_CLASS(inst) \
48 (G_TYPE_INSTANCE_GET_CLASS ((inst), \
49 HILDON_TYPE_TOUCH_SELECTOR, HildonTouchSelectorClass))
51 typedef struct _HildonTouchSelector HildonTouchSelector;
52 typedef struct _HildonTouchSelectorClass HildonTouchSelectorClass;
53 typedef struct _HildonTouchSelectorPrivate HildonTouchSelectorPrivate;
55 typedef gchar *(*HildonTouchSelectorPrintFunc) (HildonTouchSelector * selector,
58 struct _HildonTouchSelector
60 GtkVBox parent_instance;
63 HildonTouchSelectorPrivate *priv;
66 struct _HildonTouchSelectorClass
68 GtkVBoxClass parent_class;
71 void (*changed) (HildonTouchSelector *selector,
75 void (*set_model) (HildonTouchSelector *selector,
79 gboolean (*has_multiple_selection) (HildonTouchSelector *selector);
83 * HildonTouchSelectorSelectionMode:
84 * @HILDON_TOUCH_SELECTOR_SELECTION_MODE_SINGLE: Users can select one item
85 * @HILDON_TOUCH_SELECTOR_SELECTION_MODE_MULTIPLE: Users can select one to many items
87 * Describes the selection mode of a #HildonTouchSelector.
91 HILDON_TOUCH_SELECTOR_SELECTION_MODE_SINGLE,
92 HILDON_TOUCH_SELECTOR_SELECTION_MODE_MULTIPLE
93 } HildonTouchSelectorSelectionMode;
97 hildon_touch_selector_get_type (void) G_GNUC_CONST;
100 hildon_touch_selector_new (void);
102 /* Simple (and recommended) API for one-text-column selectors. */
104 hildon_touch_selector_new_text (void);
107 hildon_touch_selector_append_text (HildonTouchSelector *selector,
110 hildon_touch_selector_prepend_text (HildonTouchSelector *selector,
113 hildon_touch_selector_insert_text (HildonTouchSelector *selector,
118 HildonTouchSelectorColumn*
119 hildon_touch_selector_append_text_column (HildonTouchSelector *selector,
120 GtkTreeModel * model,
123 HildonTouchSelectorColumn*
124 hildon_touch_selector_append_column (HildonTouchSelector *selector,
126 GtkCellRenderer *cell_renderer,
128 #ifndef HILDON_DISABLE_DEPRECATED
130 hildon_touch_selector_set_column_attributes (HildonTouchSelector *selector,
132 GtkCellRenderer *cell_renderer,
137 hildon_touch_selector_remove_column (HildonTouchSelector *selector,
141 hildon_touch_selector_get_num_columns (HildonTouchSelector *selector);
144 hildon_touch_selector_set_column_selection_mode (HildonTouchSelector *selector,
145 HildonTouchSelectorSelectionMode mode);
147 HildonTouchSelectorSelectionMode
148 hildon_touch_selector_get_column_selection_mode (HildonTouchSelector *selector);
150 HildonTouchSelectorColumn *
151 hildon_touch_selector_get_column (HildonTouchSelector *selector,
154 /* get/set active item */
156 hildon_touch_selector_set_active (HildonTouchSelector *selector,
160 hildon_touch_selector_get_active (HildonTouchSelector *selector,
164 hildon_touch_selector_get_selected (HildonTouchSelector *selector,
169 hildon_touch_selector_select_iter (HildonTouchSelector *selector,
175 hildon_touch_selector_unselect_iter (HildonTouchSelector *selector,
180 hildon_touch_selector_unselect_all (HildonTouchSelector * selector,
184 hildon_touch_selector_get_selected_rows (HildonTouchSelector *selector,
188 hildon_touch_selector_set_model (HildonTouchSelector *selector,
190 GtkTreeModel *model);
192 hildon_touch_selector_get_model (HildonTouchSelector *selector,
195 /* show the current element selected */
197 hildon_touch_selector_get_current_text (HildonTouchSelector *selector);
200 hildon_touch_selector_set_print_func (HildonTouchSelector *selector,
201 HildonTouchSelectorPrintFunc func);
204 hildon_touch_selector_set_print_func_full (HildonTouchSelector *selector,
205 HildonTouchSelectorPrintFunc func,
207 GDestroyNotify destroy_func);
209 HildonTouchSelectorPrintFunc
210 hildon_touch_selector_get_print_func (HildonTouchSelector *selector);
213 hildon_touch_selector_has_multiple_selection (HildonTouchSelector *selector);
216 hildon_touch_selector_center_on_selected (HildonTouchSelector *selector);
219 hildon_touch_selector_optimal_size_request (HildonTouchSelector *selector,
220 GtkRequisition *requisition);
224 #endif /* __HILDON_TOUCH_SELECTOR_H__ */