GnuCash c935c2f+
Loading...
Searching...
No Matches
Public Member Functions
RelativeDateEntry Class Reference
Inheritance diagram for RelativeDateEntry:
GncDateEntry

Public Member Functions

 RelativeDateEntry (GncOption &option)
 
void set_entry_from_option (GncOption &option) override
 
void set_option_from_entry (GncOption &option) override
 
GtkWidget * get_widget () override
 
GtkWidget * get_entry () override
 
void block_signals (bool) override
 
- Public Member Functions inherited from GncDateEntry
virtual void toggle_relative (bool)
 

Detailed Description

Definition at line 501 of file gnc-option-gtk-ui.cpp.

Constructor & Destructor Documentation

◆ RelativeDateEntry()

RelativeDateEntry::RelativeDateEntry ( GncOption option)

Definition at line 517 of file gnc-option-gtk-ui.cpp.

518{
519
520 auto renderer = gtk_cell_renderer_text_new();
521 auto store = gtk_list_store_new(1, G_TYPE_STRING);
522 /* Add values to the list store, entry and tooltip */
523 auto num = option.num_permissible_values();
524 for (decltype(num) index = 0; index < num; ++index)
525 {
526 GtkTreeIter iter;
527 gtk_list_store_append (store, &iter);
528 gtk_list_store_set (store, &iter, 0,
529 _(option.permissible_value_name(index)), -1);
530 }
531
532 /* Create the new Combo with tooltip and add the store */
533 m_entry = GTK_WIDGET(gtk_combo_box_new_with_model(GTK_TREE_MODEL(store)));
534 gtk_combo_box_set_active(GTK_COMBO_BOX(m_entry), 0);
535 gtk_cell_layout_pack_start (GTK_CELL_LAYOUT(m_entry), renderer, TRUE);
536 gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT(m_entry),
537 renderer, "text", 0);
538
539 g_object_unref(store);
540
541 m_handler_id = g_signal_connect(G_OBJECT(m_entry), "changed",
542 G_CALLBACK(gnc_option_changed_widget_cb),
543 &option);
544}
const char * permissible_value_name(uint16_t index) const
Implemented only for GncOptionMultiselectValue.
uint16_t num_permissible_values() const
Implemented only for GncOptionMultiselectValue.

Member Function Documentation

◆ block_signals()

void RelativeDateEntry::block_signals ( bool  block)
overridevirtual

Implements GncDateEntry.

Definition at line 559 of file gnc-option-gtk-ui.cpp.

560{
561 if (block)
562 g_signal_handler_block(m_entry, m_handler_id);
563 else
564 g_signal_handler_unblock(m_entry, m_handler_id);
565}

◆ get_entry()

GtkWidget * RelativeDateEntry::get_entry ( )
inlineoverridevirtual

Implements GncDateEntry.

Definition at line 509 of file gnc-option-gtk-ui.cpp.

509{ return m_entry; }

◆ get_widget()

GtkWidget * RelativeDateEntry::get_widget ( )
inlineoverridevirtual

Implements GncDateEntry.

Definition at line 508 of file gnc-option-gtk-ui.cpp.

508{ return m_entry; }

◆ set_entry_from_option()

void RelativeDateEntry::set_entry_from_option ( GncOption option)
overridevirtual

Implements GncDateEntry.

Definition at line 547 of file gnc-option-gtk-ui.cpp.

548{
549 gtk_combo_box_set_active(GTK_COMBO_BOX(m_entry), option.get_value<uint16_t>());
550}

◆ set_option_from_entry()

void RelativeDateEntry::set_option_from_entry ( GncOption option)
overridevirtual

Implements GncDateEntry.

Definition at line 553 of file gnc-option-gtk-ui.cpp.

554{
555 option.set_value<uint16_t>(gtk_combo_box_get_active(GTK_COMBO_BOX(m_entry)));
556}

The documentation for this class was generated from the following file: