mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Add flag for evaluation after a plain 'Return' press.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2830 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
58e0f71949
commit
a70bbac696
@ -124,6 +124,7 @@ gnc_amount_edit_init (GNCAmountEdit *gae)
|
||||
gae->amount = 0.0;
|
||||
gae->print_flags = 0;
|
||||
gae->currency = NULL;
|
||||
gae->evaluate_on_enter = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -179,6 +180,8 @@ amount_entry_key_press(GtkWidget *widget, GdkEventKey *event, gpointer data)
|
||||
switch (event->keyval)
|
||||
{
|
||||
case GDK_Return:
|
||||
if (gae->evaluate_on_enter)
|
||||
break;
|
||||
if (event->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK | GDK_SHIFT_MASK))
|
||||
break;
|
||||
return FALSE;
|
||||
@ -372,3 +375,21 @@ gnc_amount_edit_gtk_entry (GNCAmountEdit *gae)
|
||||
|
||||
return gae->amount_entry;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gnc_amount_edit_set_evaluate_on_enter:
|
||||
* @gae: The GNCAmountEdit widget
|
||||
* @evaluate_on_enter: The flag value to set
|
||||
*
|
||||
* Returns nothing.
|
||||
*/
|
||||
void
|
||||
gnc_amount_edit_set_evaluate_on_enter (GNCAmountEdit *gae,
|
||||
gboolean evaluate_on_enter)
|
||||
{
|
||||
g_return_if_fail(gae != NULL);
|
||||
g_return_if_fail(GNC_IS_AMOUNT_EDIT(gae));
|
||||
|
||||
gae->evaluate_on_enter = evaluate_on_enter;
|
||||
}
|
||||
|
@ -51,6 +51,8 @@ typedef struct
|
||||
|
||||
double amount;
|
||||
|
||||
gboolean evaluate_on_enter;
|
||||
|
||||
} GNCAmountEdit;
|
||||
|
||||
typedef struct
|
||||
@ -77,6 +79,9 @@ void gnc_amount_edit_set_print_flags (GNCAmountEdit *gae,
|
||||
void gnc_amount_edit_set_currency (GNCAmountEdit *gae,
|
||||
const char * currency);
|
||||
|
||||
void gnc_amount_edit_set_evaluate_on_enter (GNCAmountEdit *gae,
|
||||
gboolean evaluate_on_enter);
|
||||
|
||||
END_GNOME_DECLS
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user