GnuCash c935c2f+
Loading...
Searching...
No Matches
dialog-utils.h
1/********************************************************************\
2 * dialog-utils.h -- utility functions for creating dialogs *
3 * for GnuCash *
4 * Copyright (C) 1999-2000 Linas Vepstas *
5 * Copyright (C) 2005 David Hampton <hampton@employees.org> *
6 * *
7 * This program is free software; you can redistribute it and/or *
8 * modify it under the terms of the GNU General Public License as *
9 * published by the Free Software Foundation; either version 2 of *
10 * the License, or (at your option) any later version. *
11 * *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License*
18 * along with this program; if not, contact: *
19 * *
20 * Free Software Foundation Voice: +1-617-542-5942 *
21 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
22 * Boston, MA 02110-1301, USA gnu@gnu.org *
23 * *
24\********************************************************************/
25
26#ifndef DIALOG_UTILS_H
27#define DIALOG_UTILS_H
28
29#include <gtk/gtk.h>
30#include "qof.h"
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36#define GNC_PREF_GRID_LINES_HORIZONTAL "grid-lines-horizontal"
37#define GNC_PREF_GRID_LINES_VERTICAL "grid-lines-vertical"
38
39void gnc_set_label_color (GtkWidget *label, gnc_numeric value);
40
41/********************************************************************\
42 * Returns the window size to use for the given option prefix, *
43 * if window sizes are being saved, otherwise returns 0 for both. *
44 * *
45 * Args: prefix - the option name prefix *
46 * window - the window being restored *
47 * parent - the parent window for first use alignment *
48 * Returns: nothing *
49 \*******************************************************************/
50void gnc_restore_window_size (const char *prefix, GtkWindow *window,
51 GtkWindow *parent);
52
53/********************************************************************\
54 * Save the window size into options whose names are determined *
55 * by the string prefix. *
56 * *
57 * Args: prefix - determines the options used to save the values *
58 * window - the window being saved *
59 * Returns: nothing *
60\********************************************************************/
61void gnc_save_window_size (const char *section, GtkWindow *window);
62
63/********************************************************************\
64 * Adjust the window size if it is bigger than the screen size. *
65 * *
66 * Args: window - the window to adjust *
67 * Returns: nothing *
68\********************************************************************/
69void gnc_window_adjust_for_screen (GtkWindow * window);
70
71/********************************************************************\
72 * Sets the alignment of a Label Widget, GTK3 version specific. *
73 * *
74 * Args: widget - the label widget to set alignment on *
75 * xalign - x alignment *
76 * yalign - y alignment *
77 * Returns: nothing *
78\********************************************************************/
79void gnc_label_set_alignment (GtkWidget *widget, gfloat xalign, gfloat yalign);
80
81/********************************************************************\
82 * Get the preference for showing tree view grid lines *
83 * *
84 * Args: none *
85 * Returns: GtkTreeViewGridLines setting *
86\********************************************************************/
87GtkTreeViewGridLines gnc_tree_view_get_grid_lines_pref (void);
88
89/********************************************************************\
90 * Add a style context to a Widget so it can be altered with css *
91 * *
92 * Args: widget - widget to add css style too *
93 * gnc_class - character string for css class name *
94 * Returns: nothing *
95\********************************************************************/
96void gnc_widget_style_context_add_class (GtkWidget *widget, const char *gnc_class);
97
98/********************************************************************\
99 * Remove a style context class from a Widget *
100 * *
101 * Args: widget - widget to remove style class from *
102 * gnc_class - character string for css class name *
103 * Returns: nothing *
104\********************************************************************/
105void gnc_widget_style_context_remove_class (GtkWidget *widget, const char *gnc_class);
106
107/********************************************************************\
108 * Draw an arrow on a Widget so it can be altered with css *
109 * *
110 * Args: widget - widget to add arrow to in the draw callback *
111 * cr - cairo context for the draw callback *
112 * direction - 0 for up, 1 for down *
113 * Returns: TRUE, stop other handlers being invoked for the event *
114\********************************************************************/
115gboolean gnc_draw_arrow_cb (GtkWidget *widget, cairo_t *cr, gpointer direction);
116
117gboolean gnc_gdate_in_valid_range (GDate *test_date, gboolean warn);
118
119gboolean gnc_handle_date_accelerator (GdkEventKey *event,
120 struct tm *tm,
121 const char *date_str);
122
123gboolean gnc_builder_add_from_file (GtkBuilder *builder, const char *filename, const char *root);
124
125void gnc_builder_connect_full_func (GtkBuilder *builder,
126 GObject *signal_object,
127 const gchar *signal_name,
128 const gchar *handler_name,
129 GObject *connect_object,
130 GConnectFlags flags,
131 gpointer user_data);
132
146void gnc_gtk_dialog_add_button (GtkWidget *dialog,
147 const gchar *label,
148 const gchar *icon_name,
149 guint response);
150
153gint
154gnc_dialog_run(GtkDialog *dialog, const gchar *pref_key);
155
156/* If this is a new book, this function can be used to display book options
157 * dialog so user can specify options, before any transactions can be
158 * imported/entered, since the book options can affect how transactions are
159 * created. Note: This dialog is modal! */
160gboolean gnc_new_book_option_display (GtkWidget *parent);
161
164GtkWidget *
165gnc_cost_policy_select_new (void);
166
170gchar* gnc_get_negative_color (void);
171
172
173
175void gnc_owner_window_set_title (GtkWindow*, const char*, GtkWidget*, GtkWidget*);
176
177
178#ifdef __cplusplus
179}
180#endif
181
182#endif /* DIALOG_UTILS_H */