Gnome User Interface Library Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# GnomeIconTextItem

## Name

GnomeIconTextItem -- Canvas item for editable text captions in icon lists.

## Synopsis

    #include <gnome.h>

    struct      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);

## Object Hierarchy

      GtkObject
       +----GnomeCanvasItem
             +----GnomeIconTextItem

## Description

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.

## Details

### struct GnomeIconTextItem

    struct 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.

### gnome_icon_text_item_configure ()

    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.

### gnome_icon_text_item_setxy ()

    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().

`iti` : | An icon text item.
`x` : | X position.
`y` : | Y position.

### gnome_icon_text_item_select ()

    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.

`iti` : | An icon text item
`sel` : | Whether the icon text item should be displayed as selected.

### gnome_icon_text_item_get_text ()

    char*       gnome_icon_text_item_get_text   (GnomeIconTextItem *iti);

`iti` : | An icon text item.
Returns : | the current text string in an icon text item. The client should not free this string, as it is internal to the icon text item.

### gnome_icon_text_item_stop_editing ()

    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.

`iti` : | An icon text item.
`accept` : | Whether to accept the current text or to discard it.

## See Also

GnomeIconList, GnomeCanvas. GnomeIconTextInfo.

<<< Previous Page | Home | Up | Next Page >>>
GnomeIconEntry | GnomeIconList