1 /********************************************************************\ 2 * gnc-ui.h - High level UI functions for GnuCash * 3 * Copyright (C) 1997 Robin D. Clark * 4 * Copyright (C) 1999, 2000 Rob Browning <rlb@cs.utexas.edu> * 5 * * 6 * This program is free software; you can redistribute it and/or * 7 * modify it under the terms of the GNU General Public License as * 8 * published by the Free Software Foundation; either version 2 of * 9 * the License, or (at your option) any later version. * 10 * * 11 * This program is distributed in the hope that it will be useful, * 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 * GNU General Public License for more details. * 15 * * 16 * You should have received a copy of the GNU General Public License* 17 * along with this program; if not, write to the Free Software * 18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 19 \********************************************************************/ 20 21 22 /** @addtogroup GUI 23 @{ */ 24 25 /** @defgroup Dialogs Dialogs */ 26 /** @defgroup Druids Druids */ 27 28 /** @} */ 29 30 31 #ifndef GNC_UI_H 32 #define GNC_UI_H 33 34 #include <glib.h> 35 36 #include "Account.h" 37 #include "gnc-pricedb.h" 38 #include <gtk/gtk.h> 39 40 41 /** Help Files ******************************************************/ 42 #ifdef G_OS_WIN32 43 # define HF_GUIDE "gnucash-guide.chm" 44 # define HF_HELP "gnucash-help.chm" 45 #elif defined MAC_INTEGRATION 46 # define HF_GUIDE "GnuCash Guide" 47 # define HF_HELP "GnuCash Help" 48 #else 49 # define HF_GUIDE "gnucash-guide" 50 # define HF_HELP "gnucash-help" 51 #endif 52 53 /** Links in the Help Files *****************************************/ 54 #define HL_USAGE_BSNSS "busnss-ar-setup1" 55 #define HL_USAGE_INVOICE "busnss-ar-invoices1" 56 #define HL_USAGE_VOUCHER "busnss-emply-newvchr" 57 #define HL_USAGE_BILL "busnss-ap-bills1" 58 #define HL_USAGE_CUSTOMER "busnss-ar-customers1" 59 #define HL_USAGE_VENDOR "busnss-ap-vendors1" 60 #define HL_USAGE_EMPLOYEE "busnss-emply" 61 #define HL_USAGE_JOB "busnss-ar-jobs1" 62 #define HL_ACC "acct-create" 63 #define HL_ACCEDIT "acct-edit" 64 #define HL_COMMODITY "tool-commodity" 65 #define HL_FIND_TRANSACTIONS "tool-find" 66 #define HL_GLOBPREFS "set-prefs" 67 #define HL_PRINTCHECK "print-check" 68 #define HL_RECNWIN "acct-reconcile" 69 #define HL_SXEDITOR "trans-sched" 70 #define HL_BOOK_OPTIONS "book-options" 71 #define HL_STYLE_SHEET "change-style" 72 #define HL_CLOSE_BOOK "tool-close-book" 73 #define HL_USAGE_CUSTOMREP "report-saving" 74 #define HL_IMPORT_BC "busnss-imp-bills-invoices" 75 #define HL_IMPORT_CUST "busnss-imp-customer-vendor" 76 77 /* GTK Windows - Common Response Codes */ 78 79 #define GNC_RESPONSE_NEW 1 80 #define GNC_RESPONSE_DELETE 2 81 #define GNC_RESPONSE_EDIT 3 82 83 /* Dialog windows ***************************************************/ 84 85 extern gboolean 86 gnc_verify_dialog (GtkWindow *parent, 87 gboolean yes_is_default, 88 const char *format, ...) G_GNUC_PRINTF (3, 4); 89 90 extern gint 91 gnc_ok_cancel_dialog (GtkWindow *parent, 92 gint default_result, 93 const char *format, ...) G_GNUC_PRINTF (3, 4); 94 95 extern void 96 gnc_warning_dialog (GtkWindow *parent, 97 const char *format, ...) G_GNUC_PRINTF (2, 3); 98 99 extern void 100 gnc_info_dialog (GtkWindow *parent, 101 const char *format, ...) G_GNUC_PRINTF (2, 3); 102 103 extern void 104 gnc_error_dialog (GtkWindow *parent, 105 const char *format, ...) G_GNUC_PRINTF (2, 3); 106 107 108 extern void 109 gnc_gnome_help (GtkWindow *parent, const char *file_name, const char *target_link); 110 111 int gnc_choose_radio_option_dialog (GtkWidget *parent, 112 const char *title, 113 const char *msg, 114 const char *button_name, 115 int default_value, 116 GList *radio_list); 117 118 void gnc_tax_info_dialog (GtkWidget *parent, Account *account); 119 void gnc_stock_split_dialog (GtkWidget *parent, Account * initial); 120 121 typedef enum 122 { 123 GNC_PRICE_EDIT, 124 GNC_PRICE_NEW, 125 } GNCPriceEditType; 126 127 void gnc_price_edit_dialog (GtkWidget *parent, QofSession *session, 128 GNCPrice *price, GNCPriceEditType type); 129 GNCPrice* gnc_price_edit_by_guid (GtkWidget * parent, const GncGUID * guid); 130 void gnc_prices_dialog (GtkWidget *parent); 131 void gnc_commodities_dialog (GtkWidget *parent); 132 133 /* Open a dialog asking for username and password. The heading and 134 * either 'initial_*' arguments may be NULL. If the dialog returns 135 * TRUE, the user pressed OK and the entered strings are stored in the 136 * output variables. They should be g_freed when no longer needed. If 137 * the dialog returns FALSE, the user pressed CANCEL and NULL was 138 * stored in username and password. */ 139 gboolean gnc_get_username_password (GtkWidget *parent, 140 const char *heading, 141 const char *initial_username, 142 const char *initial_password, 143 char **username, 144 char **password); 145 146 /* Managing the GUI Windows *****************************************/ 147 148 /** Get a pointer to the widget's immediate top level GtkWindow. This can be a dialog 149 * window or a GncMainWindow. If the widget is not a child of 150 * a GtkWindow (yet), NULL is returned. 151 * 152 * @param widget the widget to find a GtkWindow for. 153 * @return A pointer to a GtkWindow object or NULL if no toplevel was found. */ 154 GtkWindow *gnc_ui_get_gtk_window (GtkWidget *widget); 155 156 /** Get a pointer to the final GncMainWindow widget is rooted 157 * in. If widget is a child of a GncMainWindow return that window. 158 * If it's a child of a dialog window recursively query the 159 * dialog's transient parent until the first parent that's a GncMainWindow 160 * and return that. If widget is NULL or not part of any GtkWindow, 161 * get a pointer to the first active top level window. If there is 162 * none, return the first mapped window. If there's no mapped window 163 * return NULL. 164 * 165 * An example of why searching for a GncMainWindow makes sense: suppose 166 * a user has opened a search dialog for vendors and in that dialog has 167 * clicked "View vendor invoices". This opens another search window in 168 * which the user can click "View/Edit bill". Clicking that button should 169 * open a new tab in the GncMainWindow from which the first search dialog 170 * was opened. 171 * 172 * @param widget the widget to find a GncMainWindow for. 173 * @return A pointer to a GtkWindow object. */ 174 175 GtkWindow *gnc_ui_get_main_window (GtkWidget *widget); 176 177 /* Changing the GUI Cursor ******************************************/ 178 179 void gnc_set_busy_cursor(GtkWidget *w, gboolean update_now); 180 void gnc_unset_busy_cursor(GtkWidget *w); 181 182 183 #endif 184