gtkmm 4.10.0

Public Member Functions | Static Public Member Functions | Related Functions | List of all members
Gtk::ListItemFactory Class Reference

Mapping list items to widgets. More...

`#include <gtkmm/listitemfactory.h>`

Inheritance diagram for Gtk::ListItemFactory:
[legend]

## Public Member Functions
| ListItemFactory (ListItemFactory && src) noexcept
ListItemFactory & | operator= (ListItemFactory && src) noexcept
| ~ListItemFactory () noexcept override
GtkListItemFactory * | gobj ()
| Provides access to the underlying C GObject. More...
const GtkListItemFactory * | gobj () const
| Provides access to the underlying C GObject. More...
GtkListItemFactory * | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
Public Member Functions inherited from Glib::Object
| Object (const Object &)=delete
Object & | operator= (const Object &)=delete
| Object (Object &&src) noexcept
Object & | operator= (Object &&src) noexcept
void * | get_data (const QueryQuark &key)
void | set_data (const Quark &key, void *data)
void | set_data (const Quark &key, void *data, DestroyNotify notify)
void | remove_data (const QueryQuark &quark)
void * | steal_data (const QueryQuark &quark)
Glib::RefPtr< Glib::Object > | wrap (GObject *object, bool take_copy=false)
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase &)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
void | set_property (const Glib::ustring &property_name, const PropertyType &value)
void | get_property (const Glib::ustring &property_name, PropertyType &value) const
PropertyType | get_property (const Glib::ustring &property_name) const
sigc::connection | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void()> &slot)
sigc::connection | connect_property_changed (const Glib::ustring &property_name, sigc::slot< void()> &&slot)
void | freeze_notify ()
void | thaw_notify ()
virtual void | reference () const
virtual void | unreference () const
GObject * | gobj ()
const GObject * | gobj () const
GObject * | gobj_copy () const
Public Member Functions inherited from sigc::trackable
| trackable () noexcept
| trackable (const trackable &src) noexcept
| trackable (trackable &&src) noexcept
| ~trackable ()
void | add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src) noexcept
void | remove_destroy_notify_callback (notifiable *data) const

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...

## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gtk::ListItemFactory > | wrap (GtkListItemFactory * object, bool take_copy=false)
| A Glib::wrap() method for this object. More...

## Additional Inherited Members
Public Types inherited from Glib::Object
typedef void(*)(gpointer data | DestroyNotify)
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify
Public Types inherited from sigc::notifiable
typedef internal::func_destroy_notify | func_destroy_notify
Protected Member Functions inherited from Glib::Object
| Object ()
| Object (const Glib::ConstructParams &construct_params)
| Object (GObject *castitem)
| ~Object () noexcept override
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| ObjectBase (const char *custom_type_name)
| ObjectBase (const std::type_info &custom_type_info)
| ObjectBase (ObjectBase &&src) noexcept
ObjectBase & | operator= (ObjectBase &&src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject *castitem)
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)

## Detailed Description

Mapping list items to widgets.

Gtk::ListItemFactory is one of the core concepts of handling list widgets. It is the object tasked with creating widgets for items taken from a Gio::ListModel when the views need them and updating them as the items displayed by the view change.

A view is usually only able to display anything after both a factory and a model have been set on the view. So it is important that you do not skip this step when setting up your first view.

Because views do not display the whole list at once but only a few items, they only need to maintain a few widgets at a time. They will instruct the Gtk::ListItemFactory to create these widgets and bind them to the items that are currently displayed. As the list model changes or the user scrolls to the list, the items will change and the view will instruct the factory to bind the widgets to those new items.

The actual widgets used for displaying those widgets is provided by you.

When the factory needs widgets created, it will create a Gtk::ListItem and hand it to your code to set up a widget for. This list item will provide various properties with information about what item to display and provide you with some opportunities to configure its behavior. See the Gtk::ListItem documentation for further details.

Various implementations of Gtk::ListItemFactory exist to allow you different ways to provide those widgets. The most common implementations are Gtk::BuilderListItemFactory which takes a Gtk::Builder .ui file and then creates widgets and manages everything automatically from the information in that file and Gtk::SignalListItemFactory which allows you to connect to signals with your own code and retain full control over how the widgets are setup and managed.

A Gtk::ListItemFactory is supposed to be final - that means its behavior should not change and the first widget created from it should behave the same way as the last widget created from it. If you intend to do changes to the behavior, it is recommended that you create a new Gtk::ListItemFactory which will allow the views to recreate its widgets.

Once you have chosen your factory and created it, you need to set it on the view widget you want to use it with, such as via Gtk::ListView::set_factory(). Reusing factories across different views is allowed, but very uncommon.

Since gtkmm 3.98:

## Constructor & Destructor Documentation

## ◆ ListItemFactory()

Gtk::ListItemFactory::ListItemFactory | ( | ListItemFactory && | src | ) |
| noexcept

## ◆ ~ListItemFactory()

Gtk::ListItemFactory::~ListItemFactory | ( |  | ) |
| override noexcept

## Member Function Documentation

## ◆ get_type()

static GType Gtk::ListItemFactory::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

## ◆ gobj() [1/2]

GtkListItemFactory* Gtk::ListItemFactory::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## ◆ gobj() [2/2]

const GtkListItemFactory* Gtk::ListItemFactory::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## ◆ gobj_copy()

GtkListItemFactory* Gtk::ListItemFactory::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

## ◆ operator=()

ListItemFactory& Gtk::ListItemFactory::operator= | ( | ListItemFactory && | src | ) |
| noexcept

## Friends And Related Function Documentation

## ◆ wrap()

Glib::RefPtr< Gtk::ListItemFactory > wrap | ( | GtkListItemFactory * | object,
|  | bool | take_copy = `false`
| ) |  |
| related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.