GnuCash
5.6-150-g038405b370+
|
The API in this file is designed to provide support functions that wrap the base gtk functions and make them easier to use. More...
Files | |
file | gnc-gtk-utils.h |
gtk helper routines. | |
Data Structures | |
struct | GncMenuModelSearch |
gtk Miscellaneous Functions | |
void | gnc_cbwe_set_by_string (GtkComboBox *cbwe, const gchar *text) |
Find an entry in the GtkComboBox by its text value, and set the widget to that value. More... | |
void | gnc_cbwe_add_completion (GtkComboBox *cbwe) |
void | gnc_cbwe_require_list_item (GtkComboBox *cbwe) |
gboolean | gnc_is_dark_theme (GdkRGBA *fg_color) |
Return whether the current gtk theme is a dark one. More... | |
void | gnc_style_context_get_background_color (GtkStyleContext *context, GtkStateFlags state, GdkRGBA *color) |
Wrapper to get the background color of a widget for a given state. More... | |
void | gnc_style_context_get_border_color (GtkStyleContext *context, GtkStateFlags state, GdkRGBA *color) |
Wrapper to get the border color of a widget for a given state. More... | |
GtkWidget * | gnc_get_dialog_widget_from_id (GtkDialog *dialog, const gchar *id) |
Find the Widget defined by 'id' in the dialog. More... | |
void | gnc_disable_all_actions_in_group (GSimpleActionGroup *action_group) |
Disable all the actions in a simple action group. More... | |
void | gnc_add_accelerator_keys_for_menu (GtkWidget *menu, GMenuModel *model, GtkAccelGroup *accel_group) |
Add accelerator keys for menu item widgets. More... | |
GtkWidget * | gnc_find_menu_item_by_action_name (GtkWidget *menu, const gchar *action_name) |
Search the menu for the menu item based on action name. More... | |
GtkWidget * | gnc_find_menu_item_by_action_label (GtkWidget *menu, const gchar *action_label) |
Search the menu for the menu item based on the action label. More... | |
GList * | gnc_menu_get_items (GtkWidget *menu) |
Return a list of GtkMenuItems. More... | |
GtkWidget * | gnc_find_toolbar_item (GtkWidget *toolbar, const gchar *action_name) |
Search the toolbar for the tool item based on the action name. More... | |
void | gnc_menu_item_setup_tooltip_to_statusbar_callback (GtkWidget *menu_item, GtkWidget *statusbar) |
Setup the callbacks for menu bar items so the tooltip can be displayed in the status bar. More... | |
void | gnc_tool_item_setup_tooltip_to_statusbar_callback (GtkWidget *tool_item, GtkWidget *statusbar) |
Setup the callbacks for tool bar items so the tooltip can be displayed in the status bar. More... | |
gboolean | gnc_menubar_model_find_item (GMenuModel *menu_model, GncMenuModelSearch *gsm) |
Find a GtkMenu item from the action name. More... | |
GtkWidget * | gnc_menubar_model_find_menu_item (GMenuModel *menu_model, GtkWidget *menu, const gchar *action_name) |
Find a GtkMenu item from the action name. More... | |
gboolean | gnc_menubar_model_update_item (GMenuModel *menu_model, const gchar *action_name, const gchar *target, const gchar *label, const gchar *accel_name, const gchar *tooltip) |
Update the GMenuModel item based on the action name by copying existing item, removing it and inserting a new one in same location. More... | |
void | gnc_menubar_model_remove_items_with_attrib (GMenuModel *menu_model, const gchar *attrib) |
Remove GMenuModel entries based on having an attribute value equal to attrib, it does not matter what the value is. More... | |
#define | GNC_MENU_ATTRIBUTE_ACCELERATOR "accel" |
#define | GNC_MENU_ATTRIBUTE_TOOLTIP "tooltip" |
#define | GNC_MENU_ATTRIBUTE_TEMPORARY "temp" |
The API in this file is designed to provide support functions that wrap the base gtk functions and make them easier to use.
void gnc_add_accelerator_keys_for_menu | ( | GtkWidget * | menu, |
GMenuModel * | model, | ||
GtkAccelGroup * | accel_group | ||
) |
Add accelerator keys for menu item widgets.
menu | The menu widget. |
model | The menu bar model. |
accel_group | The accelerator group to use. |
Definition at line 431 of file gnc-gtk-utils.c.
void gnc_cbwe_set_by_string | ( | GtkComboBox * | cbwe, |
const gchar * | text | ||
) |
Find an entry in the GtkComboBox by its text value, and set the widget to that value.
This function also records the index of that text value for use when the user leaves the widget.
cbwe | A pointer to a GtkComboBox with entry widget. |
text | The entry text to find in the model of the combo box entry. |
Definition at line 41 of file gnc-gtk-utils.c.
void gnc_disable_all_actions_in_group | ( | GSimpleActionGroup * | action_group | ) |
Disable all the actions in a simple action group.
action_group | The GSimpleActionGroup |
Definition at line 342 of file gnc-gtk-utils.c.
GtkWidget* gnc_find_menu_item_by_action_label | ( | GtkWidget * | menu, |
const gchar * | action_label | ||
) |
Search the menu for the menu item based on the action label.
menu | The menu widget. |
action_label | The GtkMenuItem label. |
Definition at line 528 of file gnc-gtk-utils.c.
GtkWidget* gnc_find_menu_item_by_action_name | ( | GtkWidget * | menu, |
const gchar * | action_name | ||
) |
Search the menu for the menu item based on action name.
menu | The menu widget. |
action_name | The GAction name. |
Definition at line 500 of file gnc-gtk-utils.c.
GtkWidget* gnc_find_toolbar_item | ( | GtkWidget * | toolbar, |
const gchar * | action_name | ||
) |
Search the toolbar for the tool item based on the action name.
toolbar | The toolbar widget. |
action_name | The GAction name. |
Definition at line 613 of file gnc-gtk-utils.c.
GtkWidget* gnc_get_dialog_widget_from_id | ( | GtkDialog * | dialog, |
const gchar * | id | ||
) |
Find the Widget defined by 'id' in the dialog.
dialog | The dialog to search for 'id'. |
id | The widget name to find in the dialog. |
Definition at line 330 of file gnc-gtk-utils.c.
gboolean gnc_is_dark_theme | ( | GdkRGBA * | fg_color | ) |
Return whether the current gtk theme is a dark one.
A theme is considered "dark" if it has a dark background color with a light foreground color (used for text and so on). We only test on the foreground color assuming a sane theme chooses enough contrast between foreground and background colors.
fg_color | The foreground color to test. |
Definition at line 236 of file gnc-gtk-utils.c.
GList* gnc_menu_get_items | ( | GtkWidget * | menu | ) |
Return a list of GtkMenuItems.
menu | The menu widget. |
Definition at line 571 of file gnc-gtk-utils.c.
void gnc_menu_item_setup_tooltip_to_statusbar_callback | ( | GtkWidget * | menu_item, |
GtkWidget * | statusbar | ||
) |
Setup the callbacks for menu bar items so the tooltip can be displayed in the status bar.
menu_item | The menubar menu item widget. |
statusbar | The statusbar widget to display the tooltip. |
Definition at line 1053 of file gnc-gtk-utils.c.
gboolean gnc_menubar_model_find_item | ( | GMenuModel * | menu_model, |
GncMenuModelSearch * | gsm | ||
) |
Find a GtkMenu item from the action name.
This is done by first finding the action name in the GMenuModel and then doing a search for the label text in the GtkMenu.
NOTE: This is done this way as the action_name field of the GtkMenuItem is not populated from the model.
menu_model | The GMenuModel of the menu. |
gsm | The GncMenuModelSearch structure. |
Definition at line 745 of file gnc-gtk-utils.c.
GtkWidget* gnc_menubar_model_find_menu_item | ( | GMenuModel * | menu_model, |
GtkWidget * | menu, | ||
const gchar * | action_name | ||
) |
Find a GtkMenu item from the action name.
This is done by first finding the action name in the GMenuModel and then doing a search for the label text in the GtkMenu.
NOTE: This is done this way as the action_name field of the GtkMenuItem is not populated from the model.
menu_model | The GMenuModel of the menu. |
menu | The GtkMenu built from the model. |
action_name | The action name of the menu item to find. |
Definition at line 778 of file gnc-gtk-utils.c.
void gnc_menubar_model_remove_items_with_attrib | ( | GMenuModel * | menu_model, |
const gchar * | attrib | ||
) |
Remove GMenuModel entries based on having an attribute value equal to attrib, it does not matter what the value is.
menu_model | The GMenuModel of the menu. |
attrib | The attribute to look for. |
Definition at line 987 of file gnc-gtk-utils.c.
gboolean gnc_menubar_model_update_item | ( | GMenuModel * | menu_model, |
const gchar * | action_name, | ||
const gchar * | target, | ||
const gchar * | label, | ||
const gchar * | accel_name, | ||
const gchar * | tooltip | ||
) |
Update the GMenuModel item based on the action name by copying existing item, removing it and inserting a new one in same location.
menu_model | The GMenuModel of the menu. |
action_name | The action name to update. |
target | The action target if required, else NULL. |
label | The new menu label text. |
accel_name | The accelerator string |
tooltip | The new tooltip text if any. |
Definition at line 819 of file gnc-gtk-utils.c.
void gnc_style_context_get_background_color | ( | GtkStyleContext * | context, |
GtkStateFlags | state, | ||
GdkRGBA * | color | ||
) |
Wrapper to get the background color of a widget for a given state.
context | Style context of widget. |
state | The stateflag of the widget. |
color | The returned background color of the widget. |
Definition at line 258 of file gnc-gtk-utils.c.
void gnc_style_context_get_border_color | ( | GtkStyleContext * | context, |
GtkStateFlags | state, | ||
GdkRGBA * | color | ||
) |
Wrapper to get the border color of a widget for a given state.
context | Style context of widget. |
state | The stateflag of the widget. |
color | The returned border color of the widget. |
Definition at line 284 of file gnc-gtk-utils.c.
void gnc_tool_item_setup_tooltip_to_statusbar_callback | ( | GtkWidget * | tool_item, |
GtkWidget * | statusbar | ||
) |
Setup the callbacks for tool bar items so the tooltip can be displayed in the status bar.
tool_item | The toolbar tool item widget. |
statusbar | The statusbar widget to display the tooltip. |
Definition at line 1101 of file gnc-gtk-utils.c.