2006-09-11 Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
[hildon] / hildon-widgets / hildon-grid.h
1 /*
2  * This file is part of hildon-libs
3  *
4  * Copyright (C) 2005, 2006 Nokia Corporation.
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.
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 /*
26  * @file hildon-grid.h
27  *
28  * This file is a header file for hildon-grid.c, the implementation of
29  * #HildonGrid. #HildonGrid is used in views like Home and Control Panel
30  * which have single-tap activated items.
31  */
32
33 #ifndef __HILDON_GRID_H__
34 #define __HILDON_GRID_H__
35
36 #include <gtk/gtkcontainer.h>
37 #include <hildon-widgets/hildon-grid-item.h>
38
39 G_BEGIN_DECLS
40 #define HILDON_TYPE_GRID            (hildon_grid_get_type ())
41 #define HILDON_GRID(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
42                                             HILDON_TYPE_GRID, \
43                                             HildonGrid))
44 #define HILDON_GRID_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), \
45                                             HILDON_TYPE_GRID, \
46                                             HildonGridClass))
47 #define HILDON_IS_GRID(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
48                                             HILDON_TYPE_GRID))
49 #define HILDON_IS_GRID_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
50                                             HILDON_TYPE_GRID))
51 #define HILDON_GRID_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
52                                             HILDON_TYPE_GRID, \
53                                             HildonGridClass))
54 typedef struct _HildonGrid HildonGrid;
55 typedef struct _HildonGridClass HildonGridClass;
56
57
58
59 struct _HildonGrid {
60     GtkContainer parent;
61 };
62
63 struct _HildonGridClass {
64     GtkContainerClass parent_class;
65
66     void (*activate_child) (HildonGrid * grid, HildonGridItem * item);
67     void (*popup_context_menu) (HildonGrid * grid, HildonGridItem * item);
68 };
69
70 GType hildon_grid_get_type(void);
71 GtkWidget *hildon_grid_new(void);
72
73 /*
74  * Use GtkContainer API:
75  *
76  * void        gtk_container_set_focus_child   (GtkContainer    *container,
77  *                                              GtkWidget       *child);
78  *
79  * GTK_CONTAINER (grid)->focus_child can be used to get focused child.
80  */
81
82 void hildon_grid_set_style(HildonGrid * grid, const gchar * style_name);
83 const gchar *hildon_grid_get_style(HildonGrid * grid);
84
85 void hildon_grid_set_scrollbar_pos(HildonGrid * grid, gint scrollbar_pos);
86 gint hildon_grid_get_scrollbar_pos(HildonGrid * grid);
87
88
89 /*
90  * We are going to use gtk_container_add/remove, so these are internal.
91  * If GridView is not visible, it won't update the view, so it should be
92  * hidden when doing massive modifications.
93  *
94  * 
95  * Use GtkContainer API:
96  *
97  * void        gtk_container_add               (GtkContainer    *container,
98  *                                              GtkWidget       *widget);
99  *
100  * void        gtk_container_remove            (GtkContainer    *container,
101  *                                              GtkWidget       *widget);
102  */
103
104 void hildon_grid_activate_child(HildonGrid * grid, HildonGridItem * item);
105
106 G_END_DECLS
107 #endif /* __HILDON_GRID_H__ */