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

Public Member Functions

 BothDateEntry (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 toggle_relative (bool use_absolute) override
 
void block_signals (bool) override
 

Detailed Description

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

Constructor & Destructor Documentation

◆ BothDateEntry()

BothDateEntry::BothDateEntry ( GncOption option)

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

595 :
596 m_widget{gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5)},
597 m_abs_button{gtk_radio_button_new(NULL)},
598 m_abs_entry{std::make_unique<AbsoluteDateEntry>(option)},
599 m_rel_button{
600 gtk_radio_button_new_from_widget(GTK_RADIO_BUTTON(m_abs_button))},
601 m_rel_entry{std::make_unique<RelativeDateEntry>(option)}
602{
603 gtk_box_set_homogeneous (GTK_BOX(m_widget), FALSE);
604 m_abs_hdlr = g_signal_connect(G_OBJECT(m_abs_button), "toggled",
605 G_CALLBACK(date_set_absolute_cb), &option);
606 m_rel_hdlr = g_signal_connect(G_OBJECT(m_rel_button), "toggled",
607 G_CALLBACK(date_set_relative_cb), &option);
608
609 gtk_box_pack_start(GTK_BOX(m_widget),
610 m_abs_button, FALSE, FALSE, 0);
611 gtk_box_pack_start(GTK_BOX(m_widget),
612 m_abs_entry->get_entry(), FALSE, FALSE, 0);
613 gtk_box_pack_start(GTK_BOX(m_widget),
614 m_rel_button, FALSE, FALSE, 0);
615 gtk_box_pack_start(GTK_BOX(m_widget),
616 m_rel_entry->get_entry(), FALSE, FALSE, 0);
617
618}

Member Function Documentation

◆ block_signals()

void BothDateEntry::block_signals ( bool  block)
overridevirtual

Implements GncDateEntry.

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

665{
666 if (block)
667 {
668 g_signal_handler_block(m_abs_button, m_abs_hdlr);
669 g_signal_handler_block(m_rel_button, m_rel_hdlr);
670 }
671 else
672 {
673 g_signal_handler_unblock(m_abs_button, m_abs_hdlr);
674 g_signal_handler_unblock(m_rel_button, m_rel_hdlr);
675 }
676 m_abs_entry->block_signals(block);
677 m_rel_entry->block_signals(block);
678}

◆ get_entry()

GtkWidget * BothDateEntry::get_entry ( )
overridevirtual

Implements GncDateEntry.

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

622{
623 return m_use_absolute ? m_abs_entry->get_entry() : m_rel_entry->get_entry();
624}

◆ get_widget()

GtkWidget * BothDateEntry::get_widget ( )
inlineoverridevirtual

Implements GncDateEntry.

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

577{ return m_widget; }

◆ set_entry_from_option()

void BothDateEntry::set_entry_from_option ( GncOption option)
overridevirtual

Implements GncDateEntry.

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

639{
640 m_use_absolute =
641 option.get_value<RelativeDatePeriod>() == RelativeDatePeriod::ABSOLUTE;
642 if (m_use_absolute)
643 m_abs_entry->set_entry_from_option(option);
644 else
645 m_rel_entry->set_entry_from_option(option);
646 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_rel_button),
647 !m_use_absolute);
648 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_abs_button),
649 m_use_absolute);
650
651 toggle_relative(m_use_absolute);
652}
RelativeDatePeriod
Reporting periods relative to the current date.

◆ set_option_from_entry()

void BothDateEntry::set_option_from_entry ( GncOption option)
overridevirtual

Implements GncDateEntry.

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

656{
657 if (m_use_absolute)
658 m_abs_entry->set_option_from_entry(option);
659 else
660 m_rel_entry->set_option_from_entry(option);
661}

◆ toggle_relative()

void BothDateEntry::toggle_relative ( bool  use_absolute)
overridevirtual

Reimplemented from GncDateEntry.

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

628{
629 m_use_absolute = use_absolute;
630
631 gtk_widget_set_sensitive(GTK_WIDGET(m_abs_entry->get_widget()),
632 m_use_absolute);
633 gtk_widget_set_sensitive(GTK_WIDGET(m_rel_entry->get_widget()),
634 !m_use_absolute);
635}

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