Debian Codegraph @

hiro/gtk/widget/combo-button-item.cpp

raw
1 #if defined(Hiro_ComboButton)
2
3 namespace hiro {
4
5 auto pComboButtonItem::construct() -> void {
6 if(auto parent = _parent()) parent->_append(self());
7 }
8
9 auto pComboButtonItem::destruct() -> void {
10 }
11
12 auto pComboButtonItem::setIcon(const image& icon) -> void {
13 if(auto parent = _parent()) {
14 auto pixbuf = CreatePixbuf(icon, true);
15 gtk_list_store_set(parent->gtkListStore, &gtkIter, 0, pixbuf, -1);
16 }
17 }
18
19 auto pComboButtonItem::setSelected() -> void {
20 if(auto parent = _parent()) {
21 parent->lock();
22 gtk_combo_box_set_active(parent->gtkComboBox, self().offset());
23 parent->unlock();
24 }
25 }
26
27 auto pComboButtonItem::setText(const string& text) -> void {
28 if(auto parent = _parent()) {
29 gtk_list_store_set(parent->gtkListStore, &gtkIter, 1, text.data(), -1);
30 }
31 }
32
33 auto pComboButtonItem::_parent() -> maybe<pComboButton&> {
34 if(auto parent = self().parentComboButton()) {
35 if(auto self = parent->self()) return *self;
36 }
37 return {};
38 }
39
40 }
41
42 #endif