GnuCash c935c2f+
Loading...
Searching...
No Matches
Public Member Functions
PageStockAmount Class Reference

Stock Amount page. More...

Public Member Functions

 PageStockAmount (GtkBuilder *builder, Account *account)
 
void prepare (StockTransactionEntry *)
 
gnc_numeric get_stock_amount ()
 
void set_stock_amount (std::string new_amount_str)
 
void connect (StockTransactionEntry *entry)
 

Detailed Description

Stock Amount page.

Display and the amount entered depend on the type of the transaction. It always displays the balanance on the transaction date before the transaction. For buy and sell transactions it collects the number of units bought or sold (always as a positive number) and displays the new balance. For split and reverse-split transactions it collects the balance after the transaction and computes the change in the amount of shares and the split ratio, displaying the latter.

Definition at line 1887 of file assistant-stock-transaction.cpp.

Constructor & Destructor Documentation

◆ PageStockAmount()

PageStockAmount::PageStockAmount ( GtkBuilder *  builder,
Account account 
)

Definition at line 1905 of file assistant-stock-transaction.cpp.

1905 :
1906 m_page (get_widget (builder, "stock_amount_page")),
1907 m_title (get_widget (builder, "stock_amount_title")),
1908 m_prev_amount (get_widget (builder, "prev_balance_amount")),
1909 m_next_amount (get_widget (builder, "next_balance_amount")),
1910 m_next_amount_label (get_widget (builder, "next_balance_label")),
1911 m_amount (builder, xaccAccountGetCommodity(account)),
1912 m_amount_label (get_widget (builder, "stock_amount_label"))
1913{
1914 m_amount.attach (builder, "stock_amount_table", "stock_amount_label", 1);
1915}
gnc_commodity * xaccAccountGetCommodity(const Account *acc)
Get the account's commodity
Definition Account.cpp:3408

Member Function Documentation

◆ connect()

void PageStockAmount::connect ( StockTransactionEntry entry)

Definition at line 1947 of file assistant-stock-transaction.cpp.

1948{
1949 m_amount.connect(G_CALLBACK (page_stock_amount_changed_cb), entry);
1950 m_amount.set_owner(static_cast<gpointer>(this));
1951}

◆ get_stock_amount()

gnc_numeric PageStockAmount::get_stock_amount ( )
inline

Definition at line 1900 of file assistant-stock-transaction.cpp.

1900{ return m_amount.get(); }

◆ prepare()

void PageStockAmount::prepare ( StockTransactionEntry entry)

Definition at line 1918 of file assistant-stock-transaction.cpp.

1919{
1920 gtk_label_set_text_with_mnemonic
1921 (GTK_LABEL (m_amount_label),
1922 entry->input_new_balance() ? _("Ne_w Balance") : _("_Shares"));
1923 gtk_label_set_text
1924 (GTK_LABEL (m_next_amount_label),
1925 entry->input_new_balance() ? _("Ratio") : _("Next Balance"));
1926 gtk_label_set_text
1927 (GTK_LABEL (m_title),
1928 entry->input_new_balance() ?
1929 _("Enter the new balance of shares after the stock split.") :
1930 _("Enter the number of shares you gained or lost in the transaction."));
1931 gtk_label_set_text (GTK_LABEL (m_prev_amount), entry->print_amount(entry->get_balance()));
1932 if (!gnc_numeric_check(get_stock_amount()))
1933 entry->set_amount(get_stock_amount());
1934 set_stock_amount(entry->amount_str_for_display());
1935 g_signal_connect(m_page, "focus", G_CALLBACK(assistant_page_set_focus), m_amount.widget());
1936}
virtual const char * print_amount(gnc_numeric amt) const
virtual std::string amount_str_for_display() const
Generate a string representation of the value.
GNCNumericErrorCode gnc_numeric_check(gnc_numeric in)
Check for error signal in value.

◆ set_stock_amount()

void PageStockAmount::set_stock_amount ( std::string  new_amount_str)

Definition at line 1954 of file assistant-stock-transaction.cpp.

1955{
1956 gtk_label_set_text (GTK_LABEL(m_next_amount), new_amount_str.c_str());
1957}

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