d98314c61ee616a6d2b0ec71fc0db02dff30527b
[pspp-builds.git] / lib / gtksheet / gtkiconlist.h
1 /* gtkiconlist - gtkiconlist widget for gtk+
2  * Copyright 1999-2001  Adrian E. Feiguin <feiguin@ifir.edu.ar>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #ifndef __GTK_ICON_LIST_H__
21 #define __GTK_ICON_LIST_H__
22
23
24 #include <gdk/gdk.h>
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif /* __cplusplus */
29
30 typedef enum
31 {
32   GTK_ICON_LIST_ICON,
33   GTK_ICON_LIST_TEXT_RIGHT,
34   GTK_ICON_LIST_TEXT_BELOW,
35 } GtkIconListMode;
36
37 #define GTK_ICON_LIST(obj)        GTK_CHECK_CAST (obj, gtk_icon_list_get_type (), GtkIconList)
38 #define GTK_ICON_LIST_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_icon_list_get_type, GtkIconListClass)
39 #define GTK_IS_ICON_LIST(obj)     GTK_CHECK_TYPE (obj, gtk_icon_list_get_type ())
40 #define GTK_TYPE_ICON_LIST (gtk_icon_list_get_type ())
41 #define GTK_TYPE_ICON_LIST_ITEM (gtk_icon_list_item_get_type ())
42
43
44 typedef struct _GtkIconList     GtkIconList;
45 typedef struct _GtkIconListClass        GtkIconListClass;
46 typedef struct _GtkIconListItem GtkIconListItem;
47
48 struct _GtkIconListItem
49 {
50   guint x, y;
51
52   gint state;
53
54   gchar *entry_label;
55   gchar *label;
56  
57   GtkWidget *pixmap;
58   GtkWidget *entry;
59
60   gpointer link;
61 };
62
63 struct _GtkIconList
64 {
65   GtkFixed fixed;
66
67   GtkIconListMode mode;
68   GtkSelectionMode selection_mode;
69
70   guint freeze_count;
71
72   guint icon_width;
73
74   guint text_space;   /* entry width */
75   guint row_spacing;  /* space between rows */ 
76   guint col_spacing;  /* space between columns */
77   guint icon_border;  /* space between icon and entry */
78   
79   gboolean is_editable;
80
81   GtkIconListItem *active_icon;
82
83   GdkColor background;
84
85   gint num_icons;
86   GList *icons;
87
88   GList *selection;
89
90   GCompareFunc compare_func;
91 };
92
93 struct _GtkIconListClass
94 {
95   GtkFixedClass parent_class;
96
97   gboolean (*select_icon)       (GtkIconList *iconlist,
98                                  GtkIconListItem *icon,
99                                  GdkEvent *event);
100   void (*unselect_icon)         (GtkIconList *iconlist,
101                                  GtkIconListItem *icon,
102                                  GdkEvent *event);
103   gboolean (*text_changed)      (GtkIconList *iconlist,
104                                  GtkIconListItem *icon,
105                                  gchar *new_text);
106   gboolean (*activate_icon)     (GtkIconList *iconlist,
107                                  GtkIconListItem *icon);
108   gboolean (*deactivate_icon)   (GtkIconList *iconlist,
109                                  GtkIconListItem *icon);
110   void (*click_event)           (GtkIconList *iconlist,
111                                  GdkEvent *event);
112 };
113
114
115 GtkType         gtk_icon_list_get_type  (void);
116 GtkType         gtk_icon_list_item_get_type     (void);
117 GtkWidget*      gtk_icon_list_new               (guint icon_width,
118                                                  GtkIconListMode mode);
119 void            gtk_icon_list_construct         (GtkIconList *icon_list,
120                                                  guint icon_width,
121                                                  GtkIconListMode mode);
122 void            gtk_icon_list_set_mode          (GtkIconList *iconlist,
123                                                  GtkIconListMode mode);
124 GtkIconListMode gtk_icon_list_get_mode          (GtkIconList *iconlist);
125 void            gtk_icon_list_set_editable      (GtkIconList *iconlist,
126                                                  gboolean editable);
127 gboolean        gtk_icon_list_is_editable       (GtkIconList *iconlist);
128 void            gtk_icon_list_set_row_spacing   (GtkIconList *iconlist,
129                                                  guint spacing);
130 guint           gtk_icon_list_get_row_spacing   (GtkIconList *iconlist);
131 void            gtk_icon_list_set_col_spacing   (GtkIconList *iconlist,
132                                                  guint spacing);
133 guint           gtk_icon_list_get_col_spacing   (GtkIconList *iconlist);
134 void            gtk_icon_list_set_text_space    (GtkIconList *iconlist,
135                                                  guint space);
136 guint           gtk_icon_list_get_text_space    (GtkIconList *iconlist);
137 void            gtk_icon_list_set_icon_border   (GtkIconList *iconlist,
138                                                  guint space);
139 guint           gtk_icon_list_get_icon_border   (GtkIconList *iconlist);
140 void            gtk_icon_list_set_icon_width    (GtkIconList *iconlist,
141                                                  guint space);
142 guint           gtk_icon_list_get_icon_width    (GtkIconList *iconlist);
143 void            gtk_icon_list_freeze            (GtkIconList *icon_list);
144 void            gtk_icon_list_thaw              (GtkIconList *icon_list);
145 void            gtk_icon_list_set_background    (GtkIconList *icon_list,
146                                                  GdkColor *color);
147 GtkIconListItem *gtk_icon_list_add_from_pixmap  (GtkIconList *icon_list,
148                                                  GdkPixmap *pixmap,
149                                                  GdkBitmap *bitmap,
150                                                  const gchar *label,
151                                                  gpointer link);
152 GtkIconListItem *gtk_icon_list_add_from_data    (GtkIconList *icon_list,
153                                                  gchar **data,
154                                                  const gchar *label,
155                                                  gpointer link);
156 GtkIconListItem *gtk_icon_list_add              (GtkIconList *icon_list,
157                                                  const gchar *pixmap_file,
158                                                  const gchar *label,
159                                                  gpointer link);
160 GtkIconListItem *gtk_icon_list_get_nth          (GtkIconList *iconlist,
161                                                  guint n);
162 gint            gtk_icon_list_get_index         (GtkIconList *iconlist,
163                                                  GtkIconListItem *item);
164 void            gtk_icon_list_remove            (GtkIconList *iconlist,
165                                                  GtkIconListItem *item);
166 void            gtk_icon_list_set_active_icon   (GtkIconList *iconlist,
167                                                  GtkIconListItem *icon);
168 void            gtk_icon_list_remove_nth        (GtkIconList *iconlist,
169                                                  guint n);
170 void            gtk_icon_list_update            (GtkIconList *iconlist);
171 void            gtk_icon_list_clear             (GtkIconList *iconlist);
172 void            gtk_icon_list_link              (GtkIconListItem *item,
173                                                  gpointer data);
174 gpointer        gtk_icon_list_get_link          (GtkIconListItem *item);
175 GtkIconListItem *gtk_icon_list_get_icon_from_link(GtkIconList *iconlist,
176                                                  gpointer data);
177 GtkIconListItem *gtk_icon_list_get_icon_at      (GtkIconList *iconlist,
178                                                  gint x, gint y);
179 GtkIconListItem *gtk_icon_list_get_active_icon  (GtkIconList *iconlist);
180 GtkWidget       *gtk_icon_list_get_entry        (GtkIconListItem *item);
181 GtkWidget       *gtk_icon_list_get_pixmap       (GtkIconListItem *item);
182 void            gtk_icon_list_set_pixmap        (GtkIconListItem *item,
183                                                  GdkPixmap *pixmap,
184                                                  GdkBitmap *bitmap);
185 void            gtk_icon_list_set_label         (GtkIconList *iconlist,
186                                                  GtkIconListItem *item, 
187                                                  const gchar *label);
188 void            gtk_icon_list_set_selection_mode(GtkIconList *iconlist, 
189                                                  gint mode);
190 void            gtk_icon_list_select_icon       (GtkIconList *iconlist, 
191                                                  GtkIconListItem *item);
192 void            gtk_icon_list_unselect_icon     (GtkIconList *iconlist, 
193                                                  GtkIconListItem *item);
194 void            gtk_icon_list_unselect_all      (GtkIconList *iconlist);
195
196 #ifdef __cplusplus
197 }
198 #endif /* __cplusplus */
199
200
201 #endif /* __GTK_ICON_LIST_H__ */