Method

GtkListBoxset_header_func

Declaration [src]

void
gtk_list_box_set_header_func (
  GtkListBox* box,
  GtkListBoxUpdateHeaderFunc update_header,
  gpointer user_data,
  GDestroyNotify destroy
)

Description [src]

Sets a header function.

By setting a header function on the box one can dynamically add headers in front of rows, depending on the contents of the row and its position in the list.

For instance, one could use it to add headers in front of the first item of a new kind, in a list sorted by the kind.

The update_header can look at the current header widget using gtk_list_box_row_get_header() and either update the state of the widget as needed, or set a new one using gtk_list_box_row_set_header(). If no header is needed, set the header to NULL.

Note that you may get many calls update_header to this for a particular row when e.g. changing things that don’t affect the header. In this case it is important for performance to not blindly replace an existing header with an identical one.

The update_header function will be called for each row after the call, and it will continue to be called each time a row changes (via gtk_list_box_row_changed()) and when the row before changes (either by gtk_list_box_row_changed() on the previous row, or when the previous row becomes a different row). It is also called for all rows when gtk_list_box_invalidate_headers() is called.

Parameters

update_header

Type: GtkListBoxUpdateHeaderFunc

Callback that lets you add row headers.

The argument can be NULL.
user_data

Type: gpointer

User data passed to update_header.

The argument can be NULL.
The data is owned by the caller of the method.
destroy

Type: GDestroyNotify

Destroy notifier for user_data.