The GNOME icon list widget can hold a number of icons with
captions. The icons on the list can be selected (various
selection methods are supported). The programmer can enable
caption-editing for the icons. This parameters is configured when
you create the icon list widget.
All fields in the GnomeIconList structure
are private, except for the selection
field which you must query to get information about which icons
are currently selected in the icon list.
The selection field of the
GnomeIconList structure is a linked list
that holds the indices of the icons that are selected at any one
time. The data pointer in each link of
the list can be casted to an integer, preferably using the
GPOINTER_TO_INT() macro, to get the index of
the icon represented by that link:
static void
print_selected_icons (GnomeIconList *gil)
{
GList *l;
int i;
for (l = gil->selection; l; l = l->next) {
i = GPOINTER_TO_INT (l->data)
printf ("Icon number %d is selected\n", i);
}
}
GNOME_ICON_LIST_IS_EDITABLE
#define GNOME_ICON_LIST_IS_EDITABLE 1
This macro is a flag passed to the constructor functions. It is
used to specify that the icon list should have editable text
captions.
GNOME_ICON_LIST_STATIC_TEXT
#define GNOME_ICON_LIST_STATIC_TEXT 2
This macro is a flag passed to the constructor functions. It is
used to specify whether an icon list makes copies of the text in
the icon captions or whether it just keeps pointers to the text
strings supplied by the application. If this flag is specified,
then the icon list will just store pointers to the original text
strings specified by the application, which must then guarantee
that they will not be freed or changed until the icon list no
longer needs them. If it is not specified, then the icon list
will make copies of the text strings specified by the application.
Applications with very big icon lists can save memory by
specifying this flag and being careful about when to free the text
strings that are used for the icon captions.
The use of this enumeration is currently not implemented.
gnome_icon_list_new ()
GtkWidget* gnome_icon_list_new (guint icon_width,
GtkAdjustment *adj,
int flags);
This function is kept for binary compatibility with old applications. It is
similar in purpose to gnome_icon_list_new_flags(), but it will always turn on
the GNOME_ICON_LIST_IS_EDITABLE flag.
icon_width :
Width for the icon columns.
adj :
Adjustment to be used for vertical scrolling.
flags :
A combination of GNOME_ICON_LIST_IS_EDITABLE and GNOME_ICON_LIST_STATIC_TEXT.
Returns :
a newly-created icon list widget
gnome_icon_list_new_flags ()
GtkWidget* gnome_icon_list_new_flags (guint icon_width,
GtkAdjustment *adj,
int flags);
Creates a new icon list widget. The icon columns are allocated a width of
icon_width pixels. Icon captions will be word-wrapped to this width as
well.
The adjustment is used to pass an existing adjustment to be used to control
the icon list's vertical scrolling. Normally NULL can be passed here; if the
icon list is inserted into a &GtkScrolledWindow, it will handle scrolling
automatically.
If flags has the GNOME_ICON_LIST_IS_EDITABLE flag set, then the user will be
able to edit the text in the icon captions, and the "text_changed" signal
will be emitted when an icon's text is changed.
If flags has the GNOME_ICON_LIST_STATIC_TEXT flags set, then the text
for the icon captions will not be copied inside the icon list; it will only
store the pointers to the original text strings specified by the application.
This is intended to save memory. If this flag is not set, then the text
strings will be copied and managed internally.
icon_width :
Width for the icon columns.
adj :
Adjustment to be used for vertical scrolling.
flags :
A combination of GNOME_ICON_LIST_IS_EDITABLE and GNOME_ICON_LIST_STATIC_TEXT.
Returns :
a newly-created icon list widget
gnome_icon_list_construct ()
void gnome_icon_list_construct (GnomeIconList *gil,
guint icon_width,
GtkAdjustment *adj,
int flags);
Constructor for the icon list, to be used by derived classes.
gil :
An icon list.
icon_width :
Width for the icon columns.
adj :
Adjustment to be used for vertical scrolling.
flags :
A combination of GNOME_ICON_LIST_IS_EDITABLE and GNOME_ICON_LIST_STATIC_TEXT.
Sets the adjustment to be used for horizontal scrolling. This is normally
not required, as the icon list can be simply inserted in a &GtkScrolledWindow
and scrolling will be handled automatically.
Sets the adjustment to be used for vertical scrolling. This is normally not
required, as the icon list can be simply inserted in a &GtkScrolledWindow and
scrolling will be handled automatically.
Freezes an icon list so that any changes made to it will not be
reflected on the screen until it is thawed with gnome_icon_list_thaw().
It is recommended to freeze the icon list before inserting or deleting
many icons, for example, so that the layout process will only be executed
once, when the icon list is finally thawed.
You can call this function multiple times, but it must be balanced with the
same number of calls to gnome_icon_list_thaw() before the changes will take
effect.
Clears the contents for the icon list by removing all the icons. If destroy
handlers were specified for any of the icons, they will be called with the
appropriate data.
gil :
An icon list.
gnome_icon_list_remove ()
void gnome_icon_list_remove (GnomeIconList *gil,
int pos);
Removes the icon at index position pos. If a destroy handler was specified
for that icon, it will be called with the appropriate data.
Sets the characters that can be used as word separators when doing
word-wrapping in the icon text captions.
gil :
An icon list.
sep :
String with characters to be used as word separators.
gnome_icon_list_set_icon_data ()
void gnome_icon_list_set_icon_data (GnomeIconList *gil,
int pos,
gpointer data);
gil :
pos :
data :
gnome_icon_list_set_icon_data_full ()
void gnome_icon_list_set_icon_data_full
(GnomeIconList *gil,
int pos,
gpointer data,
GtkDestroyNotify destroy);
Associates the data pointer to the icon at the index specified by pos. The
destroy argument points to a function that will be called when the icon is
destroyed, or NULL if no function is to be called when this happens.
gil :
An icon list.
pos :
Index of an icon.
data :
User data to set on the icon.
destroy :
Destroy notification handler for the icon.
gnome_icon_list_find_icon_from_data ()
int gnome_icon_list_find_icon_from_data
(GnomeIconList *gil,
gpointer data);
gil :
An icon list.
data :
Data pointer associated to an icon.
Returns :
the index of the icon whose user data has been set to data,
or -1 if no icon has this data associated to it.
gnome_icon_list_get_icon_data ()
gpointer gnome_icon_list_get_icon_data (GnomeIconList *gil,
int pos);
gil :
An icon list.
pos :
Index of an icon.
Returns :
the user data pointer associated to the icon at the index specified
by pos.
gnome_icon_list_moveto ()
void gnome_icon_list_moveto (GnomeIconList *gil,
int pos,
double yalign);
Makes the icon whose index is pos be visible on the screen. The icon list
gets scrolled so that the icon is visible. An alignment of 0.0 represents
the top of the visible part of the icon list, and 1.0 represents the bottom.
An icon can be centered on the icon list.
gil :
An icon list.
pos :
Index of an icon.
yalign :
Vertical alignment of the icon.
gnome_icon_list_icon_is_visible ()
GtkVisibility gnome_icon_list_icon_is_visible
(GnomeIconList *gil,
int pos);
gil :
pos :
Returns :
gnome_icon_list_get_icon_at ()
int gnome_icon_list_get_icon_at (GnomeIconList *gil,
int x,
int y);
gil :
An icon list.
x :
X position in the icon list window.
y :
Y position in the icon list window.
Returns :
the index of the icon that is under the specified coordinates, which
are relative to the icon list's window. If there is no icon in that
position, -1 is returned.
gnome_icon_list_get_items_per_line ()
int gnome_icon_list_get_items_per_line
(GnomeIconList *gil);