Update Spanish translation
[gnumeric.git] / src / gui-util.h
blob785879810372acedcf06100e0179f91b67351c72
1 #ifndef _GNM_GUI_UTIL_H_
2 # define _GNM_GUI_UTIL_H_
4 #include <gnumeric-fwd.h>
5 #include <goffice/goffice.h>
6 #include <numbers.h>
8 G_BEGIN_DECLS
10 #define GNM_ACTION_DEF(name) \
11 void name (GtkAction *a, WBCGtk *wbcg)
13 GtkWidget* gnm_go_error_info_dialog_create (GOErrorInfo *error);
14 void gnm_go_error_info_dialog_show (GtkWindow *parent,
15 GOErrorInfo *error);
16 void gnm_go_error_info_list_dialog_show (GtkWindow *parent,
17 GSList *errs);
18 void gnm_restore_window_geometry (GtkWindow *dialog,
19 const char *key);
20 void gnm_keyed_dialog (WBCGtk *wbcg,
21 GtkWindow *dialog,
22 char const *key);
23 gpointer gnm_dialog_raise_if_exists (WBCGtk *wbcg,
24 char const *key);
25 void gnm_editable_enters (GtkWindow *window, GtkWidget *editable);
27 /* Utility routine as Gtk does not have any decent routine to do this */
28 int gnm_gtk_radio_group_get_selected (GSList *radio_group);
29 /* Utility routine as libglade does not have any decent routine to do this */
30 int gnm_gui_group_value (gpointer gui, char const * const group[]);
32 /* Use this on menus that are popped up */
33 void gnumeric_popup_menu (GtkMenu *menu, GdkEvent *event);
36 * Pseudo-tooltip support code.
38 void gnm_position_tooltip (GtkWidget *tip, int px, int py,
39 gboolean horizontal);
40 GtkWidget *gnm_create_tooltip (GtkWidget *ref_widget);
41 GtkWidget *gnm_convert_to_tooltip (GtkWidget *ref_widget,
42 GtkWidget *widget);
44 GtkBuilder *gnm_gtk_builder_load (char const *uifile, char const *domain,
45 GOCmdContext *cc);
47 typedef struct {
48 char const *name;
49 char const *pixmap;
50 int display_filter;
51 int sensitive_filter;
53 int index;
55 char *allocated_name;
56 } GnmPopupMenuElement;
58 typedef void (*GnmPopupMenuHandler) (GnmPopupMenuElement const *e,
59 gpointer user_data);
61 void gnm_create_popup_menu (GnmPopupMenuElement const *elements,
62 GnmPopupMenuHandler handler,
63 gpointer user_data,
64 GDestroyNotify notify,
65 int display_filter,
66 int sensitive_filter,
67 GdkEvent *event);
69 #define gnm_filter_modifiers(a) ((a) & (GDK_MODIFIER_MASK & (~(GDK_LOCK_MASK|GDK_MOD2_MASK|GDK_MOD5_MASK))))
71 void gnm_init_help_button (GtkWidget *w, char const *lnk);
73 char *gnm_textbuffer_get_text (GtkTextBuffer *buf);
74 char *gnm_textview_get_text (GtkTextView *text_view);
75 void gnm_textview_set_text (GtkTextView *text_view, char const *txt);
76 void gnm_load_pango_attributes_into_buffer (PangoAttrList *markup,
77 GtkTextBuffer *buffer,
78 gchar const *str);
79 PangoAttrList *gnm_get_pango_attributes_from_buffer (GtkTextBuffer *buffer);
81 void focus_on_entry (GtkEntry *entry);
83 /* WARNING : These do not handle dates correctly
84 * We should be passing in a DateConvention */
85 #define entry_to_float(entry, the_float, update) \
86 entry_to_float_with_format (entry, the_float, update, NULL)
87 gboolean entry_to_float_with_format (GtkEntry *entry,
88 gnm_float *the_float,
89 gboolean update,
90 GOFormat const *format);
91 gboolean entry_to_float_with_format_default (GtkEntry *entry,
92 gnm_float *the_float,
93 gboolean update,
94 GOFormat const *format,
95 gnm_float num);
96 gboolean entry_to_int (GtkEntry *entry, gint *the_int, gboolean update);
97 void float_to_entry (GtkEntry *entry, gnm_float the_float);
98 void int_to_entry (GtkEntry *entry, gint the_int);
100 void gnm_link_button_and_entry (GtkWidget *button, GtkWidget *entry);
102 void gnm_widget_set_cursor_type (GtkWidget *w, GdkCursorType ct);
103 void gnm_widget_set_cursor (GtkWidget *w, GdkCursor *ct);
105 int gnm_widget_measure_string (GtkWidget *w, const char *s);
107 GtkWidget * gnm_message_dialog_create (GtkWindow * parent,
108 GtkDialogFlags flags,
109 GtkMessageType type,
110 char const *primary_message,
111 char const *secondary_message);
113 typedef gboolean (*gnm_iter_search_t) (GtkTreeModel *model, GtkTreeIter* iter);
115 typedef enum {
116 GNM_DIALOG_DESTROY_SHEET_ADDED = 0x01,
117 GNM_DIALOG_DESTROY_SHEET_REMOVED = 0x02,
118 GNM_DIALOG_DESTROY_SHEET_RENAMED = 0x04,
119 GNM_DIALOG_DESTROY_SHEETS_REORDERED = 0x08,
120 GNM_DIALOG_DESTROY_CURRENT_SHEET_REMOVED = 0x100,
121 GNM_DIALOG_DESTROY_CURRENT_SHEET_RENAMED = 0x200
122 } GnmDialogDestroyOptions;
124 void gnm_dialog_setup_destroy_handlers (GtkDialog *dialog,
125 WBCGtk *wbcg,
126 GnmDialogDestroyOptions what);
128 void gnm_canvas_get_position (GocCanvas *canvas, int *x, int *y,
129 gint64 px, gint64 py);
130 void gnm_canvas_get_screen_position (GocCanvas *canvas,
131 double x, double y,
132 int *ix, int *iy);
134 gboolean gnm_check_for_plugins_missing (char const **ids, GtkWindow *parent);
136 void
137 gnm_cell_renderer_text_copy_background_to_cairo (GtkCellRendererText *crt,
138 cairo_t *cr);
142 * These macros exist to replace the old gtk+ stock items. Note, that these only
143 * cover strings with mnemonics. I.e., you must handle icons and accelerators
144 * in some other way. (So why do we have them in the first place? To ensure
145 * the user interface is as consistent as possible.)
147 #define GNM_STOCK_LABEL_CONTEXT "Stock label"
149 #define GNM_STOCK_OPEN g_dpgettext2(GETTEXT_PACKAGE, "Stock label", GNM_N_STOCK_OPEN)
150 #define GNM_N_STOCK_OPEN NC_("Stock label", "_Open")
152 #define GNM_STOCK_SAVE g_dpgettext2(GETTEXT_PACKAGE, "Stock label", GNM_N_STOCK_SAVE)
153 #define GNM_N_STOCK_SAVE NC_("Stock label", "_Save")
155 #define GNM_STOCK_SAVE_AS g_dpgettext2(GETTEXT_PACKAGE, "Stock label", GNM_N_STOCK_SAVE_AS)
156 #define GNM_N_STOCK_SAVE_AS NC_("Stock label", "Save _As")
158 #define GNM_STOCK_CANCEL g_dpgettext2(GETTEXT_PACKAGE, "Stock label", GNM_N_STOCK_CANCEL)
159 #define GNM_N_STOCK_CANCEL NC_("Stock label", "_Cancel")
161 #define GNM_STOCK_OK g_dpgettext2(GETTEXT_PACKAGE, "Stock label", GNM_N_STOCK_OK)
162 #define GNM_N_STOCK_OK NC_("Stock label", "_OK")
165 typedef struct
167 const gchar *name;
168 const gchar *icon;
169 const gchar *label;
170 const gchar *label_context;
171 const gchar *accelerator;
172 const gchar *tooltip;
173 GCallback callback;
175 /* Fields for toggles. */
176 guint toggle : 1;
177 guint is_active : 1;
178 } GnmActionEntry;
180 void gnm_action_group_add_actions (GtkActionGroup *group,
181 GnmActionEntry const *actions, size_t n,
182 gpointer user);
183 void gnm_action_group_add_action (GtkActionGroup *group, GtkAction *act);
185 void gnm_style_context_get_color (GtkStyleContext *context,
186 GtkStateFlags state,
187 GdkRGBA *color);
189 void gnm_get_link_color (GtkWidget *widget, GdkRGBA *res);
191 G_END_DECLS
193 #endif /* _GNM_GUI_UTIL_H_ */