TeplWidgetListItem: Tepl 6 Reference Manual

## TeplWidgetListItem

TeplWidgetListItem — Contains a GtkWidget plus additional infos

## Functions

TeplWidgetListItem * | tepl_widget_list_item_new ()
void | tepl_widget_list_item_free ()
void | tepl_widget_list_item_set_widget ()
GtkWidget * | tepl_widget_list_item_get_widget ()
void | tepl_widget_list_item_set_displayed ()
gboolean | tepl_widget_list_item_get_displayed ()
void | tepl_widget_list_item_set_infos ()
void | tepl_widget_list_item_get_infos ()

## Types and Values

| TeplWidgetListItem

## Includes

    #include <tepl/tepl.h>

## Description

TeplWidgetListItem contains a GtkWidget plus additional pieces of information.

All the values are controlled by the owner of the TeplWidgetListItem object. The only exception is when receiving the “destroy” signal of the currently associated widget, the "widget" property becomes `NULL`.

### The semantics of the different properties

- "widget": The main content, as a GtkWidget.

- "displayed": Whether the "widget" is currently displayed in the UI.

- "name": An ID as a string. Not displayed in the UI. Uniquely identifies an item within a list.

- "title": A human-readable title that can be shown in the UI to choose this item.

- "icon-name": An icon-name representing this item, can be shown in the UI to choose this item. Can be used for “icon-name”.

### Relation to GtkStack

TeplWidgetListItem is similar to the GtkStack child properties. Some differences:

- This class is more abstract. It can be used in combination with GtkStack but also other types of GtkContainer's.

- This class contains the "displayed" property, which permits to have several items displayed at the same time. Use-cases: split-views, or showing several documents side-by-side, or showing several components in a side panel, etc.

- This class has maximum flexibility with regards to the GtkWidget: the usual case is to set it just after calling `tepl_widget_list_item_new()`, and to show/hide it when displayed/undisplayed. But lazy initialization is possible too, or destroying/re-creating the widget when needed, while still having the other infos available and the item present in a list.

- GtkStack emits signals when child properties change, while this class defer the responsibility of updating the state of other objects to the owner of the TeplWidgetListItem.

## Functions

### tepl_widget_list_item_new ()

    TeplWidgetListItem *
    tepl_widget_list_item_new (void);

[skip]

#### Returns

a new TeplWidgetListItem. Free with `tepl_widget_list_item_free()`.

Since: 6.4

### tepl_widget_list_item_free ()

    void
    tepl_widget_list_item_free (TeplWidgetListItem *item);

#### Parameters

item | the TeplWidgetListItem to free. | [nullable]

Since: 6.4

### tepl_widget_list_item_set_widget ()

    void
    tepl_widget_list_item_set_widget (TeplWidgetListItem *item,
                                      GtkWidget *widget);

Sets the "widget" property.

#### Parameters

item | a TeplWidgetListItem. |
widget | a GtkWidget, or `NULL` to unset. | [nullable]

Since: 6.4

### tepl_widget_list_item_get_widget ()

    GtkWidget *
    tepl_widget_list_item_get_widget (const TeplWidgetListItem *item);

#### Parameters

item | a TeplWidgetListItem. |

#### Returns

the "widget" property. Is `NULL` when the property isn't set, or if the widget has been destroyed (see the “destroy” signal).

[transfer none][nullable]

Since: 6.4

### tepl_widget_list_item_set_displayed ()

    void
    tepl_widget_list_item_set_displayed (TeplWidgetListItem *item,
                                         gboolean displayed);

Sets the "displayed" property.

#### Parameters

item | a TeplWidgetListItem. |
displayed | the new value. |

Since: 6.4

### tepl_widget_list_item_get_displayed ()

    gboolean
    tepl_widget_list_item_get_displayed (const TeplWidgetListItem *item);

#### Parameters

item | a TeplWidgetListItem. |

#### Returns

the "displayed" property.

Since: 6.4

### tepl_widget_list_item_set_infos ()

    void
    tepl_widget_list_item_set_infos (TeplWidgetListItem *item,
                                     const gchar *name,
                                     const gchar *title,
                                     const gchar *icon_name);

Sets some pieces of information to `item` .

#### Parameters

item | a TeplWidgetListItem. |
name | for the "name" property. | [nullable]
title | for the "title" property. | [nullable]
icon_name | for the "icon-name" property. | [nullable]

Since: 6.4

### tepl_widget_list_item_get_infos ()

    void
    tepl_widget_list_item_get_infos (const TeplWidgetListItem *item,
                                     const gchar **name,
                                     const gchar **title,
                                     const gchar **icon_name);

Gets some pieces of information from `item` .

#### Parameters

item | a TeplWidgetListItem. |
name | the "name" property. | [out][transfer none][optional]
title | the "title" property. | [out][transfer none][optional]
icon_name | the "icon-name" property. | [out][transfer none][optional]

Since: 6.4

## Types and Values

### TeplWidgetListItem

    typedef struct _TeplWidgetListItem TeplWidgetListItem;