GnuCash 2.4.99
dialog-utils.h
00001 /********************************************************************\
00002  * dialog-utils.h -- utility functions for creating dialogs         *
00003  *                   for GnuCash                                    *
00004  * Copyright (C) 1999-2000 Linas Vepstas                            *
00005  * Copyright (C) 2005 David Hampton <hampton@employees.org>         *
00006  *                                                                  *
00007  * This program is free software; you can redistribute it and/or    *
00008  * modify it under the terms of the GNU General Public License as   *
00009  * published by the Free Software Foundation; either version 2 of   *
00010  * the License, or (at your option) any later version.              *
00011  *                                                                  *
00012  * This program is distributed in the hope that it will be useful,  *
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
00015  * GNU General Public License for more details.                     *
00016  *                                                                  *
00017  * You should have received a copy of the GNU General Public License*
00018  * along with this program; if not, contact:                        *
00019  *                                                                  *
00020  * Free Software Foundation           Voice:  +1-617-542-5942       *
00021  * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
00022  * Boston, MA  02110-1301,  USA       gnu@gnu.org                   *
00023  *                                                                  *
00024 \********************************************************************/
00025 
00026 #ifndef DIALOG_UTILS_H
00027 #define DIALOG_UTILS_H
00028 
00029 #include <gtk/gtk.h>
00030 #include "qof.h"
00031 
00032 /* option button callback function */
00033 #ifdef GTKCOMBOBOX_TOOLTIPS_WORK
00034 typedef void (*GNCOptionCallback) (GtkWidget *,
00035                                    gpointer user_data);
00036 #else
00037 typedef void (*GNCOptionCallback) (GtkWidget *, gint index,
00038                                    gpointer user_data);
00039 #endif
00040 
00041 /* Structure for building option buttons */
00042 typedef struct _GNCOptionInfo GNCOptionInfo;
00043 struct _GNCOptionInfo
00044 {
00045     char *name;
00046     char *tip;
00047     GNCOptionCallback callback;
00048     gpointer user_data;
00049 };
00050 
00051 
00052 /**** PROTOTYPES *************************************************/
00053 
00054 GtkWidget * gnc_build_option_menu (GNCOptionInfo *option_info,
00055                                    gint num_options);
00056 
00057 
00058 GtkToolbarStyle gnc_get_toolbar_style (void);
00059 void gnc_get_deficit_color (GdkColor *color);
00060 void gnc_set_label_color (GtkWidget *label, gnc_numeric value);
00061 
00062 
00063 /********************************************************************\
00064  * Returns the window size to use for the given option prefix,      *
00065  * if window sizes are being saved, otherwise returns 0 for both.   *
00066  *                                                                  *
00067  * Args: prefix - the option name prefix                            *
00068  *       width  - pointer to width                                  *
00069  *       height - pointer to height                                 *
00070  * Returns: nothing                                                 *
00071  \*******************************************************************/
00072 void gnc_restore_window_size (const char *prefix, GtkWindow *window);
00073 
00074 /********************************************************************\
00075  * Save the window size into options whose names are determined     *
00076  * by the string prefix.                                            *
00077  *                                                                  *
00078  * Args: prefix - determines the options used to save the values    *
00079  *       width  - width of the window to save                       *
00080  *       height - height of the window to save                      *
00081  * Returns: nothing                                                 *
00082 \********************************************************************/
00083 void gnc_save_window_size (const char *section, GtkWindow *window);
00084 
00085 
00086 void gnc_option_menu_init (GtkWidget * option_menu);
00087 void gnc_option_menu_init_w_signal(GtkWidget * w,
00088                                    GCallback f,
00089                                    gpointer cb_data);
00090 int  gnc_option_menu_get_active (GtkWidget * option_menu);
00091 
00092 /********************************************************************\
00093  * Adjust the window size if it is bigger than the screen size.     *
00094  *                                                                  *
00095  * Args: window - the window to adjust                              *
00096  * Returns: nothing                                                 *
00097 \********************************************************************/
00098 void gnc_window_adjust_for_screen (GtkWindow * window);
00099 
00100 
00101 gboolean gnc_handle_date_accelerator (GdkEventKey *event,
00102                                       struct tm *tm,
00103                                       const char *date_str);
00104 
00105 
00106 /* This function sets a pixmap of a set or cleared check mark in a
00107  * cell of a GtkCList row.
00108  *
00109  * There are some restrictions on using this function. If you mix
00110  * this function with gtk_clist_{insert, prepend, remove} before
00111  * the clist is realized, then the checks may appear in the wrong
00112  * place. Stick to gtk_clist_append, or use gnc_clist_set_check
00113  * after you have built the list. This only applies to unrealized
00114  * widgets. */
00115 #ifdef __GTK_CLIST_H__
00116 void gnc_clist_set_check (GtkCList *list, int row, int col,
00117                           gboolean checked);
00118 #endif
00119 
00120 gboolean gnc_builder_add_from_file (GtkBuilder *builder, const char *filename, const char *root);
00121 void gnc_builder_connect_full_func (GtkBuilder *builder,
00122                                     GObject *signal_object,
00123                                     const gchar *signal_name,
00124                                     const gchar *handler_name,
00125                                     GObject *connect_object,
00126                                     GConnectFlags flags,
00127                                     gpointer user_data);
00128 
00129 
00143 void gnc_gtk_dialog_add_button (GtkWidget *dialog,
00144                                 const gchar *label,
00145                                 const gchar *stock_id,
00146                                 guint response);
00147 
00148 
00151 gint
00152 gnc_dialog_run(GtkDialog *dialog, const gchar *gconf_key);
00153 
00154 #endif
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines