Gnome User Interface Library Reference Manual | |||
---|---|---|---|
<<< Previous Page | Home | Up | Next Page >>> |
GtkObject +----GtkWidget +----GtkContainer +----GtkLayout +----GnomeCanvas +----GnomeIconList |
"select-icon" void user_function (GnomeIconList *iconlist, gint arg1, GdkEvent *event, gpointer user_data); "unselect-icon" void user_function (GnomeIconList *iconlist, gint arg1, GdkEvent *event, gpointer user_data); "text-changed" gboolean user_function (GnomeIconList *iconlist, gint arg1, gpointer arg2, gpointer user_data); |
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.
You can control the type of selection mode you desire by using the gnome_icon_list_set_selection_mode() function.
typedef struct { GnomeCanvas canvas; /* Scroll adjustments */ GtkAdjustment *adj; GtkAdjustment *hadj; /* Number of icons in the list */ int icons; /* Private data */ gpointer priv; /* was GList *icon_list */ int pad3; /* was int frozen */ int pad4; /* was int dirty */ int pad5; /* was int row_spacing */ int pad6; /* was int col_spacing */ int pad7; /* was int text_spacing */ int pad8; /* was int icon_border */ gpointer pad9; /* was char *separators */ GnomeIconListMode pad10; /* was GnomeIconListMode mode */ GtkSelectionMode pad11; /* was GtkSelectionMode selection_mode */ /* A list of integers with the indices of the currently selected icons */ GList *selection; gpointer pad12; /* was GList *preserve_selection */ int pad13; /* was int icon_width */ unsigned int pad14 : 1; /* was unsigned int is_editable : 1 */ unsigned int pad15 : 1; /* was unsigned int static_text : 1 */ int pad16; /* was int last_selected */ gpointer pad17; /* was void *last_clicked */ int pad18; /* was int timer_tag */ int pad19; /* was int value_diff */ gdouble pad20; /* was gdouble event_last_x */ gdouble pad21; /* was gdouble event_last_y */ gpointer pad22; /* was GList *lines */ int pad23; /* was int total_height */ double pad24; /* was double sel_start_x */ double pad25; /* was double sel_start_y */ gpointer pad26; /* was GnomeCanvasItem *sel_rect */ } GnomeIconList; |
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); } } |
#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.
#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.
typedef enum { GNOME_ICON_LIST_ICONS, GNOME_ICON_LIST_TEXT_BELOW, GNOME_ICON_LIST_TEXT_RIGHT } GnomeIconListMode; |
The use of this enumeration is currently not implemented.
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.
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.
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.
void gnome_icon_list_set_hadjustment (GnomeIconList *gil, GtkAdjustment *hadj); |
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.
void gnome_icon_list_set_vadjustment (GnomeIconList *gil, GtkAdjustment *vadj); |
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.
void gnome_icon_list_freeze (GnomeIconList *gil); |
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.
void gnome_icon_list_thaw (GnomeIconList *gil); |
Thaws the icon list and performs any pending layout operations. This is to be used in conjunction with gnome_icon_list_freeze().
void gnome_icon_list_insert (GnomeIconList *gil, int pos, const char *icon_filename, const char *text); |
Inserts an icon in the specified icon list. The icon's image is loaded from the specified file, and it is inserted at the pos index.
void gnome_icon_list_insert_imlib (GnomeIconList *gil, int pos, GdkImlibImage *im, const char *text); |
Inserts an icon in the specified icon list. The icon is created from the specified Imlib image, and it is inserted at the pos index.
int gnome_icon_list_append (GnomeIconList *gil, const char *icon_filename, const char *text); |
Appends an icon to the specified icon list. The icon's image is loaded from the specified file, and it is inserted at the pos index.
int gnome_icon_list_append_imlib (GnomeIconList *gil, GdkImlibImage *im, const char *text); |
Appends an icon to the specified icon list. The icon is created from the specified Imlib image.
void gnome_icon_list_clear (GnomeIconList *gil); |
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.
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.
void gnome_icon_list_set_selection_mode (GnomeIconList *gil, GtkSelectionMode mode); |
Sets the selection mode for an icon list. The GTK_SELECTION_MULTIPLE and GTK_SELECTION_EXTENDED modes are considered equivalent.
void gnome_icon_list_select_icon (GnomeIconList *gil, int idx); |
Selects the icon at the index specified by pos.
void gnome_icon_list_unselect_icon (GnomeIconList *gil, int pos); |
Unselects the icon at the index specified by pos.
int gnome_icon_list_unselect_all (GnomeIconList *gil, GdkEvent *event, gpointer keep); |
Unselects all the icons in the icon list. The event and keep parameters must be NULL, since they are used only internally.
void gnome_icon_list_set_icon_width (GnomeIconList *gil, int w); |
Sets the amount of horizontal space allocated to the icons, i.e. the column width of the icon list.
void gnome_icon_list_set_row_spacing (GnomeIconList *gil, int pixels); |
Sets the spacing to be used between rows of icons.
void gnome_icon_list_set_col_spacing (GnomeIconList *gil, int pixels); |
Sets the spacing to be used between columns of icons.
void gnome_icon_list_set_text_spacing (GnomeIconList *gil, int pixels); |
Sets the spacing to be used between an icon's image and its text caption.
void gnome_icon_list_set_icon_border (GnomeIconList *gil, int pixels); |
Sets the width of the border to be displayed around an icon's image. This is currently not implemented.
void gnome_icon_list_set_separators (GnomeIconList *gil, const char *sep); |
Sets the characters that can be used as word separators when doing word-wrapping in the icon text captions.
void gnome_icon_list_set_icon_data (GnomeIconList *gil, int pos, gpointer data); |
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.
int gnome_icon_list_find_icon_from_data (GnomeIconList *gil, gpointer data); |
gpointer gnome_icon_list_get_icon_data (GnomeIconList *gil, int pos); |
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.
GtkVisibility gnome_icon_list_icon_is_visible (GnomeIconList *gil, int pos); |
This is a GtkHAdjustment that is used internally to support the GtkScrolledWindow scrolling interface.
This is a GtkVAdjustment that is used internally to support the GtkScrolledWindow scrolling interface.
void user_function (GnomeIconList *iconlist, gint arg1, GdkEvent *event, gpointer user_data); |
This signal is emitted when an icon becomes selected. If the event argument is NULL, then it means the icon became selected due to a range or rubberband selection. If it is non-NULL, it means the icon became selected due to an user-initiated event such as a mouse button press. The event can be examined to get this information.
Important: You should not insert or delete icons, or otherwise change the selection in the icon list, from within a callback to this signal.
void user_function (GnomeIconList *iconlist, gint arg1, GdkEvent *event, gpointer user_data); |
This signal is emitted when an icon becomes unselected. The meaning of the event argument is the same as for the select-icon signal.
Important: You should not insert or delete icons, or otherwise change the selection in the icon list, from within a callback to this signal.
gboolean user_function (GnomeIconList *iconlist, gint arg1, gpointer arg2, gpointer user_data); |
This signal is emitted when the user has finished editing the text of an icon's caption. Typically this happens when the user presses Enter. The application must then decide whether the text is valid or not.
The return value of this signal indicates whether the proposed text is accepted by the application. For example, an application may need to check whether the user can rename a file to the proposed name or not. If the proposed text is valid, then a signal handler should return TRUE, otherwise it should return FALSE. If the change is not accepted, the text is automatically reset to its original state.