GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
dialog-options.h
1 /********************************************************************\
2  * dialog-options.h -- GNOME option handling *
3  * Copyright (C) 1998-2000 Linas Vepstas *
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 [email protected] *
21 \********************************************************************/
22 
23 #ifndef OPTIONS_DIALOG_H
24 #define OPTIONS_DIALOG_H
25 
26 #include <libguile.h>
27 #include "app-utils/option-util.h"
28 #include <gtk/gtk.h>
29 
32 GtkWidget *gnc_option_get_gtk_widget (GNCOption *option);
33 
34 typedef struct gnc_option_win GNCOptionWin;
35 
36 typedef void (* GNCOptionWinCallback)(GNCOptionWin *, gpointer data);
37 
38 GNCOptionWin * gnc_options_dialog_new_modal(gboolean modal, gchar *title);
39 GNCOptionWin * gnc_options_dialog_new(gchar *title);
40 GNCOptionWin * gnc_options_dialog_new_w_dialog(gchar *title, GtkWidget *dialog);
41 void gnc_options_dialog_destroy(GNCOptionWin * win);
42 void gnc_options_register_stocks (void);
43 
44 GtkWidget * gnc_options_dialog_widget(GNCOptionWin * win);
45 GtkWidget * gnc_options_page_list(GNCOptionWin * win);
46 GtkWidget * gnc_options_dialog_notebook(GNCOptionWin * win);
47 
48 void gnc_options_dialog_changed (GNCOptionWin *win);
49 
50 void gnc_option_changed_widget_cb(GtkWidget *widget, GNCOption *option);
51 void gnc_option_changed_option_cb(GtkWidget *dummy, GNCOption *option);
52 
53 void gnc_options_dialog_set_apply_cb(GNCOptionWin * win,
54  GNCOptionWinCallback thunk,
55  gpointer cb_data);
56 void gnc_options_dialog_set_help_cb(GNCOptionWin * win,
57  GNCOptionWinCallback thunk,
58  gpointer cb_data);
59 void gnc_options_dialog_set_close_cb(GNCOptionWin * win,
60  GNCOptionWinCallback thunk,
61  gpointer cb_data);
62 
63 void gnc_options_dialog_set_global_help_cb(GNCOptionWinCallback thunk,
64  gpointer cb_data);
65 
66 void gnc_options_dialog_build_contents(GNCOptionWin *win,
67  GNCOptionDB *odb);
68 
69 void gnc_options_dialog_build_contents_full(GNCOptionWin *win,
70  GNCOptionDB *odb,
71  gboolean show_dialog);
72 
73 /* Both apply_cb and close_cb should be scheme functions with 0 arguments.
74  * References to these functions will be held until the close_cb is called
75  */
76 void gnc_options_dialog_set_scm_callbacks (GNCOptionWin *win,
77  SCM apply_cb,
78  SCM close_cb);
79 
80 /*****************************************************************/
81 /* Option Registration */
82 
83 /* Function to set the UI widget based upon the option */
84 typedef GtkWidget *
85 (*GNCOptionUISetWidget) (GNCOption *option, GtkBox *page_box,
86  char *name, char *documentation,
87  /* Return values */
88  GtkWidget **enclosing, gboolean *packed);
89 
90 /* Function to set the UI Value for a particular option */
91 typedef gboolean
92 (*GNCOptionUISetValue) (GNCOption *option, gboolean use_default,
93  GtkWidget *widget, SCM value);
94 
95 /* Function to get the UI Value for a particular option */
96 typedef SCM
97 (*GNCOptionUIGetValue) (GNCOption *option, GtkWidget *widget);
98 
99 
100 typedef struct gnc_option_def
101 {
102  const char * option_name;
103  GNCOptionUISetWidget set_widget;
104  GNCOptionUISetValue set_value;
105  GNCOptionUIGetValue get_value;
107 
108 
109 /* Register a new option type in the UI */
110 void gnc_options_ui_initialize (void);
111 void gnc_options_ui_register_option (GNCOptionDef_t *option);
112 GNCOptionDef_t * gnc_options_ui_get_option (const char *option_name);
113 
114 #endif /* OPTIONS_DIALOG_H */