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__
28 #define HILDON_TYPE_TOUCH_SELECTOR (hildon_touch_selector_get_type ())
29 #define HILDON_TOUCH_SELECTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), HILDON_TYPE_TOUCH_SELECTOR, HildonTouchSelector))
30 #define HILDON_TOUCH_SELECTOR_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), HILDON_TYPE_TOUCH_SELECTOR, HildonTouchSelectorClass))
31 #define HILDON_IS_TOUCH_SELECTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), HILDON_TYPE_TOUCH_SELECTOR))
32 #define HILDON_IS_TOUCH_SELECTOR_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), HILDON_TYPE_TOUCH_SELECTOR))
33 #define HILDON_TOUCH_SELECTOR_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), HILDON_TYPE_TOUCH_SELECTOR, HildonTouchSelectorClass))
35 typedef struct _HildonTouchSelector HildonTouchSelector;
36 typedef struct _HildonTouchSelectorClass HildonTouchSelectorClass;
37 typedef struct _HildonTouchSelectorPrivate HildonTouchSelectorPrivate;
39 typedef gchar *(*HildonTouchSelectorPrintFunc) (HildonTouchSelector * selector);
41 struct _HildonTouchSelector
43 GtkHBox parent_instance;
46 HildonTouchSelectorPrivate *priv;
49 struct _HildonTouchSelectorClass
51 GtkHBoxClass parent_class;
54 void (*changed) (HildonTouchSelector * selector, gint column);
57 void (*set_model) (HildonTouchSelector *selector, gint column, GtkTreeModel *model);
59 gboolean (*has_multiple_selection) (HildonTouchSelector *selector);
64 HILDON_TOUCH_SELECTOR_SELECTION_MODE_SINGLE,
65 HILDON_TOUCH_SELECTOR_SELECTION_MODE_MULTIPLE
66 } HildonTouchSelectorSelectionMode;
69 GType hildon_touch_selector_get_type (void) G_GNUC_CONST;
70 GtkWidget *hildon_touch_selector_new (void);
72 /* Simple (and recommended) API for one-text-column selectors. */
73 GtkWidget *hildon_touch_selector_new_text (void);
75 void hildon_touch_selector_append_text (HildonTouchSelector * selector,
77 void hildon_touch_selector_prepend_text (HildonTouchSelector * selector,
79 void hildon_touch_selector_insert_text (HildonTouchSelector * selector,
80 gint position, const gchar * text);
83 gboolean hildon_touch_selector_append_text_column (HildonTouchSelector * selector,
84 GtkTreeModel * model, gboolean center);
86 gboolean hildon_touch_selector_append_column (HildonTouchSelector * selector,
88 GtkCellRenderer * cell_renderer,
91 void hildon_touch_selector_set_column_attributes (HildonTouchSelector * selector,
93 GtkCellRenderer * cell_renderer,
96 gboolean hildon_touch_selector_remove_column (HildonTouchSelector * selector,
99 gint hildon_touch_selector_get_num_columns (HildonTouchSelector * selector);
101 void hildon_touch_selector_set_column_selection_mode (HildonTouchSelector * selector,
102 HildonTouchSelectorSelectionMode mode);
104 HildonTouchSelectorSelectionMode
105 hildon_touch_selector_get_column_selection_mode (HildonTouchSelector * selector);
107 /* get/set active item */
108 void hildon_touch_selector_set_active (HildonTouchSelector *selector,
111 gint hildon_touch_selector_get_active (HildonTouchSelector * selector,
113 gboolean hildon_touch_selector_get_selected (HildonTouchSelector * selector,
116 void hildon_touch_selector_select_iter (HildonTouchSelector * selector,
120 void hildon_touch_selector_unselect_iter (HildonTouchSelector * selector,
123 GList *hildon_touch_selector_get_selected_rows (HildonTouchSelector * selector,
126 void hildon_touch_selector_set_model (HildonTouchSelector * selector,
127 gint column, GtkTreeModel * model);
128 GtkTreeModel *hildon_touch_selector_get_model (HildonTouchSelector * selector,
131 /* show the current element selected */
132 gchar *hildon_touch_selector_get_current_text (HildonTouchSelector * selector);
134 void hildon_touch_selector_set_print_func (HildonTouchSelector * selector,
135 HildonTouchSelectorPrintFunc func);
137 HildonTouchSelectorPrintFunc
138 hildon_touch_selector_get_print_func (HildonTouchSelector * selector);
141 hildon_touch_selector_has_multiple_selection (HildonTouchSelector * selector);
145 #endif /* __HILDON_TOUCH_SELECTOR_H__ */