GnuCash c935c2f+
Loading...
Searching...
No Matches
gnc-gtk-utils.h
Go to the documentation of this file.
1/********************************************************************\
2 * gnc-gtk-utils.h -- utility functions based on glib functions *
3 * Copyright (C) 2006 David Hampton <hampton@employees.org> *
4 * *
5 * This program is free software; you can redistribute it and/or *
6 * modify it under the terms of the GNU General Public License as *
7 * published by the Free Software Foundation; either version 2 of *
8 * the License, or (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License*
16 * along with this program; if not, contact: *
17 * *
18 * Free Software Foundation Voice: +1-617-542-5942 *
19 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
20 * Boston, MA 02110-1301, USA gnu@gnu.org *
21 * *
22\********************************************************************/
23
35#ifndef GNC_GTK_UTILS_H
36#define GNC_GTK_UTILS_H
37
38#include <gtk/gtk.h>
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
48#define GNC_MENU_ATTRIBUTE_ACCELERATOR "accel"
49#define GNC_MENU_ATTRIBUTE_TOOLTIP "tooltip"
50#define GNC_MENU_ATTRIBUTE_TEMPORARY "temp"
51
52void gnc_cbwe_set_by_string(GtkComboBox *cbwe, const gchar *text);
53void gnc_cbwe_add_completion (GtkComboBox *cbwe);
54void gnc_cbwe_require_list_item (GtkComboBox *cbwe);
55
56gboolean gnc_is_dark_theme (GdkRGBA *fg_color);
57void gnc_style_context_get_background_color (GtkStyleContext *context,
58 GtkStateFlags state,
59 GdkRGBA *color);
60void gnc_style_context_get_border_color (GtkStyleContext *context,
61 GtkStateFlags state,
62 GdkRGBA *color);
63
64GtkWidget *gnc_get_dialog_widget_from_id (GtkDialog *dialog, const gchar *id);
65
66void gnc_disable_all_actions_in_group (GSimpleActionGroup *action_group);
67
68void gnc_add_accelerator_keys_for_menu (GtkWidget *menu, GMenuModel *model, GtkAccelGroup *accel_group);
69
70GtkWidget *gnc_find_menu_item_by_action_name (GtkWidget *menu, const gchar *action_name);
71GtkWidget *gnc_find_menu_item_by_action_label (GtkWidget *menu, const gchar *action_label);
72GList *gnc_menu_get_items (GtkWidget *menu);
73
74GtkWidget *gnc_find_toolbar_item (GtkWidget *toolbar, const gchar *action_name);
75
77 GtkWidget *statusbar);
78
80 GtkWidget *statusbar);
81
83{
84 const gchar *search_action_name;
85 const gchar *search_action_label;
86 const gchar *search_action_target;
87 const gchar *tooltip;
88 GMenuModel *model;
89 gint index;
90};
91
92typedef struct _GncMenuModelSearch GncMenuModelSearch;
93
94gboolean gnc_menubar_model_find_item (GMenuModel *menu_model, GncMenuModelSearch *gsm);
95GtkWidget *gnc_menubar_model_find_menu_item (GMenuModel *menu_model, GtkWidget *menu, const gchar *action_name);
96
97gboolean gnc_menubar_model_update_item (GMenuModel *menu_model, const gchar *action_name,
98 const gchar *target, const gchar *label,
99 const gchar *accel_name, const gchar *tooltip);
100
101void gnc_menubar_model_remove_items_with_attrib (GMenuModel *menu_model, const gchar *attrib);
102
105#ifdef __cplusplus
106}
107#endif
108
109#endif /* GNC_GTK_UTILS_H */
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.
void gnc_disable_all_actions_in_group(GSimpleActionGroup *action_group)
Disable all the actions in a simple action group.
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...
GtkWidget * gnc_find_toolbar_item(GtkWidget *toolbar, const gchar *action_name)
Search the toolbar for the tool item based on the action name.
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.
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.
GtkWidget * gnc_get_dialog_widget_from_id(GtkDialog *dialog, const gchar *id)
Find the Widget defined by 'id' in the dialog.
gboolean gnc_menubar_model_find_item(GMenuModel *menu_model, GncMenuModelSearch *gsm)
Find a GtkMenu item from the action name.
GList * gnc_menu_get_items(GtkWidget *menu)
Return a list of GtkMenuItems.
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.
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 inserti...
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.
gboolean gnc_is_dark_theme(GdkRGBA *fg_color)
Return whether the current gtk theme is a dark one.
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.
GtkWidget * gnc_menubar_model_find_menu_item(GMenuModel *menu_model, GtkWidget *menu, const gchar *action_name)
Find a GtkMenu item from the action name.
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.
void gnc_add_accelerator_keys_for_menu(GtkWidget *menu, GMenuModel *model, GtkAccelGroup *accel_group)
Add accelerator keys for menu item widgets.