aboutsummaryrefslogtreecommitdiffstats
path: root/composer/e-icon-list.h
blob: 7cdaf6e85f809907b49439b0d8cbed441900d43a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/*
 * Copyright (C) 1998, 1999 Free Software Foundation
 * Copyright (C) 2000 Red Hat, Inc.
 * All rights reserved.
 *
 * This file is part of the Gnome Library.
 *
 * The Gnome Library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * The Gnome Library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with the Gnome Library; see the file COPYING.LIB.  If not,
 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */
/*
  @NOTATION@
 */

/* GnomeIconList widget - scrollable icon list
 *
 *
 * Authors:
 *   Federico Mena   <federico@ximian.com>
 *   Miguel de Icaza <miguel@ximian.com>
 */

#ifndef _E_ICON_LIST_H_
#define _E_ICON_LIST_H_

#include <libgnome/gnome-defs.h>
#include <libgnomeui/gnome-canvas.h>
#include <gdk-pixbuf/gdk-pixbuf.h>

BEGIN_GNOME_DECLS

#define E_TYPE_ICON_LIST            (e_icon_list_get_type ())
#define E_ICON_LIST(obj)            (GTK_CHECK_CAST ((obj), E_TYPE_ICON_LIST, EIconList))
#define E_ICON_LIST_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_ICON_LIST, EIconListClass))
#define E_IS_ICON_LIST(obj)         (GTK_CHECK_TYPE ((obj), E_TYPE_ICON_LIST))
#define E_IS_ICON_LIST_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_ICON_LIST))
#define E_ICON_LIST_GET_CLASS(obj)  (GTK_CHECK_GET_CLASS ((obj), E_TYPE_ICON_LIST, EIconListClass))

typedef struct _EIconList        EIconList;
typedef struct _EIconListPrivate EIconListPrivate;
typedef struct _EIconListClass   EIconListClass;

typedef enum {
    E_ICON_LIST_ICONS,
    E_ICON_LIST_TEXT_BELOW,
    E_ICON_LIST_TEXT_RIGHT
} EIconListMode;

/* This structure has been converted to use public and private parts.  To avoid
 * breaking binary compatibility, the slots for private fields have been
 * replaced with padding.  Please remove these fields when gnome-libs has
 * reached another major version and it is "fine" to break binary compatibility.
 */
struct _EIconList {
    GnomeCanvas canvas;

    /*< private >*/
    EIconListPrivate * _priv;
};

struct _EIconListClass {
    GnomeCanvasClass parent_class;

    void     (*select_icon)    (EIconList *gil, gint num, GdkEvent *event);
    void     (*unselect_icon)  (EIconList *gil, gint num, GdkEvent *event);
    gboolean (*text_changed)   (EIconList *gil, gint num, const char *new_text);
};

enum {
    E_ICON_LIST_IS_EDITABLE = 1 << 0,
    E_ICON_LIST_STATIC_TEXT = 1 << 1
};

guint          e_icon_list_get_type            (void) G_GNUC_CONST;

GtkWidget     *e_icon_list_new                 (guint         icon_width,
                        int           flags);
void           e_icon_list_construct           (EIconList *gil,
                        guint icon_width,
                        int flags);


/* To avoid excesive recomputes during insertion/deletion */
void           e_icon_list_freeze              (EIconList *gil);
void           e_icon_list_thaw                (EIconList *gil);


void           e_icon_list_insert              (EIconList *gil,
                        int idx,
                        const char *icon_filename,
                        const char *text);
void           e_icon_list_insert_pixbuf       (EIconList *gil,
                        int idx,
                        GdkPixbuf *im,
                        const char *icon_filename,
                        const char *text);

int            e_icon_list_append              (EIconList *gil,
                        const char *icon_filename,
                        const char *text);
int            e_icon_list_append_pixbuf       (EIconList *gil,
                        GdkPixbuf *im,
                        const char *icon_filename,
                        const char *text);

void           e_icon_list_clear               (EIconList *gil);
void           e_icon_list_remove              (EIconList *gil,
                        int idx);

guint          e_icon_list_get_num_icons       (EIconList *gil);


/* Managing the selection */
void           e_icon_list_set_selection_mode  (EIconList *gil,
                        GtkSelectionMode mode);
void           e_icon_list_select_icon         (EIconList *gil,
                        int idx);
void           e_icon_list_unselect_icon       (EIconList *gil,
                        int idx);
int            e_icon_list_unselect_all        (EIconList *gil);
GList *        e_icon_list_get_selection       (EIconList *gil);

/* Setting the spacing values */
void           e_icon_list_set_icon_width      (EIconList *gil,
                        int w);
void           e_icon_list_set_row_spacing     (EIconList *gil,
                        int pixels);
void           e_icon_list_set_col_spacing     (EIconList *gil,
                        int pixels);
void           e_icon_list_set_text_spacing    (EIconList *gil,
                        int pixels);
void           e_icon_list_set_icon_border     (EIconList *gil,
                        int pixels);
void           e_icon_list_set_separators      (EIconList *gil,
                        const char *sep);
/* Icon filename. */
gchar *        e_icon_list_get_icon_filename   (EIconList *gil,
                        int idx);
int            e_icon_list_find_icon_from_filename (EIconList *gil,
                            const char *filename);

/* Attaching information to the icons */
void           e_icon_list_set_icon_data       (EIconList *gil,
                        int idx, gpointer data);
void           e_icon_list_set_icon_data_full  (EIconList *gil,
                        int idx, gpointer data,
                        GtkDestroyNotify destroy);
int            e_icon_list_find_icon_from_data (EIconList *gil,
                        gpointer data);
gpointer       e_icon_list_get_icon_data       (EIconList *gil,
                        int idx);

/* Visibility */
void           e_icon_list_moveto              (EIconList *gil,
                        int idx, double yalign);
GtkVisibility  e_icon_list_icon_is_visible     (EIconList *gil,
                        int idx);

int            e_icon_list_get_icon_at         (EIconList *gil,
                        int x, int y);

int            e_icon_list_get_items_per_line  (EIconList *gil);

END_GNOME_DECLS

#endif /* _GNOME_ICON_LIST_H_ */