33 lines
1016 B
C++
33 lines
1016 B
C++
//
|
|
// Created by selim on 13.11.22.
|
|
//
|
|
|
|
#include "ListItemFactory.h"
|
|
|
|
namespace gtkpp {
|
|
|
|
void setupListItemCallback(GtkListItemFactory* factory, GtkListItem* list_item, void* data) {
|
|
auto self = reinterpret_cast<ListItemFactory*>(data);
|
|
auto widget = self->setup();
|
|
gtk_list_item_set_child(list_item, widget);
|
|
}
|
|
|
|
void bindListItemCallback(GtkListItemFactory* factory, GtkListItem* list_item, void* data) {
|
|
auto self = reinterpret_cast<ListItemFactory*>(data);
|
|
auto widget = gtk_list_item_get_child(list_item);
|
|
auto item = gtk_list_item_get_item (list_item);
|
|
self->bind(widget);
|
|
}
|
|
|
|
ListItemFactory::ListItemFactory() {
|
|
_factory = gtk_signal_list_item_factory_new();
|
|
g_signal_connect(_factory, "setup", G_CALLBACK(setupListItemCallback), this);
|
|
g_signal_connect(_factory, "bind", G_CALLBACK(bindListItemCallback), this);
|
|
}
|
|
|
|
GtkListItemFactory *ListItemFactory::gobj() const {
|
|
return _factory;
|
|
}
|
|
|
|
}
|