Contents of /trunk/src/list.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 322 - (hide annotations)
Mon Dec 21 16:13:51 2009 UTC (14 years, 5 months ago) by harbaum
File MIME type: text/plain
File size: 3277 byte(s)
List handling improved
1 harbaum 146 /*
2     * Copyright (C) 2008 Till Harbaum <till@harbaum.org>.
3     *
4     * This file is part of OSM2Go.
5     *
6     * OSM2Go is free software: you can redistribute it and/or modify
7     * it under the terms of the GNU General Public License as published by
8     * the Free Software Foundation, either version 3 of the License, or
9     * (at your option) any later version.
10     *
11     * OSM2Go 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
14     * GNU General Public License for more details.
15     *
16     * You should have received a copy of the GNU General Public License
17     * along with OSM2Go. If not, see <http://www.gnu.org/licenses/>.
18     */
19    
20     #ifndef LIST_H
21     #define LIST_H
22    
23     typedef enum {
24     LIST_BUTTON_NEW = 0,
25     LIST_BUTTON_EDIT,
26     LIST_BUTTON_REMOVE,
27     LIST_BUTTON_USER0,
28     LIST_BUTTON_USER1,
29     LIST_BUTTON_USER2
30     } list_button_t;
31    
32 harbaum 266 #define LIST_BTN_NEW (1<<0) // use "new" instead of "add" button
33 harbaum 315 #define LIST_BTN_WIDE (1<<1) // use "wide" button layout on maemo5
34 harbaum 266
35 harbaum 146 /* list item flags */
36 harbaum 148 #define LIST_FLAG_EXPAND (1<<0) /* column expands with dialog size */
37     #define LIST_FLAG_ELLIPSIZE (1<<1) /* column expands and text is ellipsized */
38     #define LIST_FLAG_CAN_HIGHLIGHT (1<<2) /* column can be highlighted */
39     #define LIST_FLAG_STOCK_ICON (1<<3) /* column contains stock icons */
40     #define LIST_FLAG_TOGGLE (1<<4) /* column contains a toggle item */
41 harbaum 146
42 harbaum 148 #ifdef USE_HILDON
43    
44     /* on hildon a list may be system default (LIST_HILDON_WITHOUT_HEADERS), */
45     /* forced to have headers (LIST_HILDON_WITH_HEADERS) or only be forced */
46     /* on MAEMO5 (LIST_HILDON_WITH_HEADERS_ON_MAEMO5) */
47    
48     #define LIST_HILDON_WITH_HEADERS TRUE
49     #define LIST_HILDON_WITHOUT_HEADERS FALSE
50    
51     #if MAEMO_VERSION_MAJOR <= 4
52     #define LIST_HILDON_WITH_HEADERS_ON_MAEMO5 FALSE
53     #else
54     #define LIST_HILDON_WITH_HEADERS_ON_MAEMO5 TRUE
55     #endif
56    
57     GtkWidget *list_new(gboolean show_headers);
58     #else
59     #define LIST_HILDON_WITH_HEADERS
60     #define LIST_HILDON_WITHOUT_HEADERS
61     #define LIST_HILDON_WITH_HEADERS_ON_MAEMO5
62     GtkWidget *list_new(void);
63     #endif
64    
65 harbaum 146 GtkWidget *list_get_view(GtkWidget *list);
66     void list_set_user_buttons(GtkWidget *list, ...);
67     void list_set_columns(GtkWidget *list, ...);
68     void list_button_connect(GtkWidget *list, list_button_t id,
69     GCallback cb, gpointer data);
70     void list_set_custom_user_button(GtkWidget *list, list_button_t id,
71     GtkWidget *widget);
72     GtkTreeSelection *list_get_selection(GtkWidget *list);
73     void list_button_enable(GtkWidget *list, list_button_t id, gboolean enable);
74     void list_set_store(GtkWidget *list, GtkListStore *store);
75     void list_set_selection_function(GtkWidget *list, GtkTreeSelectionFunc func,
76     gpointer data);
77 harbaum 266 void list_set_static_buttons(GtkWidget *list, int flags,
78 harbaum 218 GCallback cb_new, GCallback cb_edit, GCallback cb_remove,
79 harbaum 146 gpointer data);
80     GtkTreeModel *list_get_model(GtkWidget *list);
81 harbaum 148 void list_pre_inplace_edit_tweak (GtkTreeModel *model);
82     void list_focus_on(GtkWidget *list, GtkTreeIter *iter, gboolean highlight);
83 harbaum 262 gboolean list_get_selected(GtkWidget *list, GtkTreeModel **model,
84     GtkTreeIter *iter);
85 harbaum 322 void list_override_changed_event(GtkWidget *list, void(*handler)(GtkTreeSelection*,gpointer), gpointer data);
86 harbaum 146
87     #endif // LIST_H