Gnome User Interface Library Reference Manual | |||
---|---|---|---|
<<< Previous Page | Home | Up | Next Page >>> |
#include <gnome.h> typedef GnomeIconTextItem; void gnome_icon_text_item_configure (GnomeIconTextItem *iti, int x, int y, int width, const char *fontname, const char *text, gboolean is_editable, gboolean is_static); void gnome_icon_text_item_setxy (GnomeIconTextItem *iti, int x, int y); void gnome_icon_text_item_select (GnomeIconTextItem *iti, int sel); char* gnome_icon_text_item_get_text (GnomeIconTextItem *iti); void gnome_icon_text_item_stop_editing (GnomeIconTextItem *iti, gboolean accept); |
"text-changed" gboolean user_function (GnomeIconTextItem *icontextitem, gpointer user_data); "height-changed" void user_function (GnomeIconTextItem *icontextitem, gpointer user_data); "width-changed" void user_function (GnomeIconTextItem *icontextitem, gpointer user_data); "editing-started" void user_function (GnomeIconTextItem *icontextitem, gpointer user_data); "editing-stopped" void user_function (GnomeIconTextItem *icontextitem, gpointer user_data); "selection-started" void user_function (GnomeIconTextItem *icontextitem, gpointer user_data); "selection-stopped" void user_function (GnomeIconTextItem *icontextitem, gpointer user_data); |
The GnomeIconTextItem canvas item provides a specialized, editable text item to be used for the text captions of icons. This item is used by the GnomeIconList widget and by the GNOME file manager.
typedef struct { GnomeCanvasItem canvas_item; /* Size and maximum allowed width */ int x, y; int width; /* Font name */ char *fontname; /* Private data */ gpointer priv; /* was GtkEntry *entry */ gpointer pad1; /* was GtkWidget *entry_top */ gpointer pad2; /* was GdkFont *font */ /* Actual text */ char *text; /* Text layout information */ GnomeIconTextInfo *ti; /* Whether the text is being edited */ unsigned int editing : 1; /* Whether the text item is selected */ unsigned int selected : 1; unsigned int pad3; /* was unsigned int unselected_click : 1 */ /* Whether the user is select-dragging a block of text */ unsigned int selecting : 1; /* Whether the text is editable */ unsigned int is_editable : 1; /* Whether the text is allocated by us (FALSE if allocated by the client) */ unsigned int is_text_allocated : 1; } GnomeIconTextItem; |
All the fields in the GnomeIconTextItem structure should be considered private. When the application needs to know the size and bounds of an icon text item, it should use the gnome_canvas_item_get_bounds() function.
void gnome_icon_text_item_configure (GnomeIconTextItem *iti, int x, int y, int width, const char *fontname, const char *text, gboolean is_editable, gboolean is_static); |
This routine is used to configure a &GnomeIconTextItem.
x and y specify the cordinates where the item is placed inside the canvas. The x coordinate should be the leftmost position that the icon text item can assume at any one time, that is, the left margin of the column in which the icon is to be placed. The y coordinate specifies the top of the icon text item.
width is the maximum width allowed for this icon text item. The coordinates define the upper-left corner of an icon text item with maximum width; this may actually be outside the bounding box of the item if the text is narrower than the maximum width.
If is_static is true, it means that there is no need for the item to allocate memory for the string (it is a guarantee that the text is allocated by the caller and it will not be deallocated during the lifetime of this item). This is an optimization to reduce memory usage for large icon sets.
iti : | An icon text item. |
x : | X position in which to place the item. |
y : | Y position in which to place the item. |
width : | Maximum width allowed for this item, to be used for word wrapping. |
fontname : | Name of the fontset that should be used to display the text. |
text : | Text that is going to be displayed. |
is_editable : | Deprecated. |
is_static : | Whether text points to a static string or not. |
void gnome_icon_text_item_setxy (GnomeIconTextItem *iti, int x, int y); |
Sets the coordinates at which the icon text item should be placed.
See also: gnome_icon_text_item_configure().
void gnome_icon_text_item_select (GnomeIconTextItem *iti, int sel); |
This function is used to control whether an icon text item is displayed as selected or not. Mouse events are ignored by the item when it is unselected; when the user clicks on a selected icon text item, it will start the text editing process.
void gnome_icon_text_item_stop_editing (GnomeIconTextItem *iti, gboolean accept); |
Terminates the editing state of an icon text item. The accept argument controls whether the item's current text should be accepted or discarded. If it is discarded, then the icon's original text will be restored.
gboolean user_function (GnomeIconTextItem *icontextitem, gpointer user_data); |
This signal is emitted when the user has finished editing the text in an icon text item. Typically this happens when the user presses Enter. The application has to decide whether the entered text is valid or not; for example, a file manager may want to test whether it is legal to rename a file to the proposed name or not.
Upon receiving this signal, the application should use gnome_icon_text_item_get_text() to get the text for validation. The return value of this signal indicates whether the proposed text is accepted by the application. 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.
void user_function (GnomeIconTextItem *icontextitem, gpointer user_data); |
This signal is emitted when the height of an icon text item changes, usually due to the user changing the text or the application selecting a different font. Applications can change their layout accordingly.
void user_function (GnomeIconTextItem *icontextitem, gpointer user_data); |
This signal is emitted when the width of an icon text item changes, usually due to the user changing the text or the application selecting a different font. Applications can change their layout accordingly.
void user_function (GnomeIconTextItem *icontextitem, gpointer user_data); |
This signal is emitted when the user begins editing the text in an icon text item, usually by clicking on it while it is selected. Applications can use this information to disable drag and drop signals and update their state accordingly.
void user_function (GnomeIconTextItem *icontextitem, gpointer user_data); |
This signal is emitted when the user terminates editing the text in an icon text item, usually by pressing Enter or Esc. Applications can use this information to enable drag and drop signals and update their state accordingly.
void user_function (GnomeIconTextItem *icontextitem, gpointer user_data); |
This signal is emitted when the user begins a rubberband selection of text with the mouse in an icon text item. Applications can use this information to disable drag and drop signals and update their state accordingly.
void user_function (GnomeIconTextItem *icontextitem, gpointer user_data); |
This signal is emitted when the user terminates a rubberband selection of text with the mouse in an icon text item. Applications can use this information to disable drag and drop signals and update their state accordingly.