GnuCash 2.4.99
dialog-options.h
00001 /********************************************************************\
00002  * dialog-options.h -- GNOME option handling                        *
00003  * Copyright (C) 1998-2000 Linas Vepstas                            *
00004  *                                                                  *
00005  * This program is free software; you can redistribute it and/or    *
00006  * modify it under the terms of the GNU General Public License as   *
00007  * published by the Free Software Foundation; either version 2 of   *
00008  * the License, or (at your option) any later version.              *
00009  *                                                                  *
00010  * This program is distributed in the hope that it will be useful,  *
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
00013  * GNU General Public License for more details.                     *
00014  *                                                                  *
00015  * You should have received a copy of the GNU General Public License*
00016  * along with this program; if not, contact:                        *
00017  *                                                                  *
00018  * Free Software Foundation           Voice:  +1-617-542-5942       *
00019  * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
00020  * Boston, MA  02110-1301,  USA       gnu@gnu.org                   *
00021 \********************************************************************/
00022 
00023 #ifndef OPTIONS_DIALOG_H
00024 #define OPTIONS_DIALOG_H
00025 
00026 #include <libguile.h>
00027 #include "option-util.h"
00028 #include <gtk/gtk.h>
00029 
00032 GtkWidget *gnc_option_get_gtk_widget (GNCOption *option);
00033 
00034 typedef struct gnc_option_win GNCOptionWin;
00035 
00036 typedef void (* GNCOptionWinCallback)(GNCOptionWin *, gpointer data);
00037 
00038 GNCOptionWin * gnc_options_dialog_new(gchar *title);
00039 GNCOptionWin * gnc_options_dialog_new_w_dialog(gchar *title, GtkWidget *dialog);
00040 void gnc_options_dialog_destroy(GNCOptionWin * win);
00041 void gnc_options_register_stocks (void);
00042 
00043 GtkWidget * gnc_options_dialog_widget(GNCOptionWin * win);
00044 GtkWidget * gnc_options_page_list(GNCOptionWin * win);
00045 GtkWidget * gnc_options_dialog_notebook(GNCOptionWin * win);
00046 
00047 void gnc_options_dialog_changed (GNCOptionWin *win);
00048 void gnc_option_changed_widget_cb(GtkWidget *widget, GNCOption *option);
00049 void gnc_option_changed_option_cb(GtkWidget *dummy, GNCOption *option);
00050 
00051 void gnc_options_dialog_set_apply_cb(GNCOptionWin * win,
00052                                      GNCOptionWinCallback thunk,
00053                                      gpointer cb_data);
00054 void gnc_options_dialog_set_help_cb(GNCOptionWin * win,
00055                                     GNCOptionWinCallback thunk,
00056                                     gpointer cb_data);
00057 void gnc_options_dialog_set_close_cb(GNCOptionWin * win,
00058                                      GNCOptionWinCallback thunk,
00059                                      gpointer cb_data);
00060 
00061 void gnc_options_dialog_set_global_help_cb(GNCOptionWinCallback thunk,
00062         gpointer cb_data);
00063 
00064 void gnc_options_dialog_build_contents(GNCOptionWin *win,
00065                                        GNCOptionDB  *odb);
00066 
00067 /* Both apply_cb and close_cb should be scheme functions with 0 arguments.
00068  * References to these functions will be held until the close_cb is called
00069  */
00070 void gnc_options_dialog_set_scm_callbacks (GNCOptionWin *win,
00071         SCM apply_cb,
00072         SCM close_cb);
00073 
00074 /*****************************************************************/
00075 /* Option Registration                                           */
00076 
00077 /* Function to set the UI widget based upon the option */
00078 typedef GtkWidget *
00079 (*GNCOptionUISetWidget) (GNCOption *option, GtkBox *page_box,
00080                          char *name, char *documentation,
00081                          /* Return values */
00082                          GtkWidget **enclosing, gboolean *packed);
00083 
00084 /* Function to set the UI Value for a particular option */
00085 typedef gboolean
00086 (*GNCOptionUISetValue)  (GNCOption *option, gboolean use_default,
00087                          GtkWidget *widget, SCM value);
00088 
00089 /* Function to get the UI Value for a particular option */
00090 typedef SCM
00091 (*GNCOptionUIGetValue)  (GNCOption *option, GtkWidget *widget);
00092 
00093 
00094 typedef struct gnc_option_def
00095 {
00096     const char *         option_name;
00097     GNCOptionUISetWidget set_widget;
00098     GNCOptionUISetValue  set_value;
00099     GNCOptionUIGetValue  get_value;
00100 } GNCOptionDef_t;
00101 
00102 
00103 /* Register a new option type in the UI */
00104 void gnc_options_ui_initialize (void);
00105 void gnc_options_ui_register_option (GNCOptionDef_t *option);
00106 GNCOptionDef_t * gnc_options_ui_get_option (const char *option_name);
00107 
00108 #endif /* OPTIONS_DIALOG_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines