00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef UT_DIALOGHELPER_H
00021 #define UT_DIALOGHELPER_H
00022
00023
00024 #include <gtk/gtk.h>
00025 #include <gdk/gdk.h>
00026
00027 #include <functional>
00028
00029 #include "ut_types.h"
00030 #include "xap_Strings.h"
00031
00032 class XAP_Frame;
00033 class XAP_FrameHelper;
00034 class XAP_App;
00035 class XAP_Dialog;
00036
00037
00038
00039 #define SETUP_UNIX_STRING gchar * newstr = NULL;
00040
00041
00042
00043 #define CONVERT_TO_UNIX_STRING(str, id, newstr) do { \
00044 FREEP(newstr); \
00045 std::string _s; \
00046 pSS->getValueUTF8(id,_s); \
00047 UT_XML_cloneNoAmpersands(newstr, _s.c_str()); \
00048 } while (0);
00049
00050
00051
00052 #define CONVERT_TO_ACC_STRING(str, id, newstr) do { \
00053 FREEP(newstr); \
00054 std::string _s; \
00055 pSS->getValueUTF8(id,_s); \
00056 UT_XML_cloneConvAmpersands(newstr, _s.c_str()); \
00057 } while (0);
00058
00059
00064 GtkBuilder * newDialogBuilder(const char * name);
00065 void connectFocus(GtkWidget *widget,const XAP_Frame *frame);
00066 void connectFocusModeless(GtkWidget *widget,const XAP_App *pApp);
00067 void connectFocusModelessOther(GtkWidget *widget, const XAP_App *pApp,
00068 std::pointer_to_unary_function<int, gboolean> *other_function);
00069 bool isTransientWindow(GtkWindow *window,GtkWindow *parent);
00070
00071
00072
00073
00074 void messageBoxOK(const char * message);
00075
00076
00077 void centerDialog(GtkWidget * parent, GtkWidget * child, bool set_transient_for = true);
00078
00079 GtkStyle * get_ensured_style (GtkWidget * w);
00080
00081
00082 GtkWidget *createDrawingArea ();
00083
00084 void abiSetupModalDialog(GtkDialog * me, XAP_Frame *pFrame, XAP_Dialog * pDlg, gint dfl_id);
00085 gint abiRunModalDialog(GtkDialog * me, bool destroyDialog, AtkRole role = ATK_ROLE_DIALOG);
00086 gint abiRunModalDialog(GtkDialog * me, XAP_Frame *pFrame, XAP_Dialog * pDlg, gint dfl_id, bool destroyDialog, AtkRole role = ATK_ROLE_DIALOG);
00087 void abiSetupModelessDialog(GtkDialog * me, XAP_Frame * pFrame, XAP_Dialog * pDlg, gint dfl_id, bool abi_modeless = true, AtkRole role = ATK_ROLE_DIALOG);
00088 void abiDestroyWidget(GtkWidget * me);
00089
00090 GtkWidget* abiAddStockButton (GtkDialog * me, const gchar * btn_id,
00091 gint response_id) ;
00092 GtkWidget* abiAddButton(GtkDialog * me, const gchar * btn_id,
00093 gint response_id);
00094
00095 GtkWidget * abiDialogNew(const char * role, gboolean resizable = FALSE);
00096 GtkWidget * abiDialogNew(const char * role, gboolean resizable, const char * title, ...);
00097 GtkWidget * abiGtkMenuFromCStrVector(const UT_GenericVector<const char*> & vec, GCallback cb, gpointer data);
00098
00099 void abiDialogSetTitle(GtkWidget * dlg, const char * title, ...)
00100 ABI_PRINTF_FORMAT(2,3);
00101
00102 void convertMnemonics(gchar * s);
00103 std::string & convertMnemonics(std::string & s);
00104
00105 void localizeLabel(GtkWidget * widget, const XAP_StringSet * pSS, XAP_String_Id id);
00106 void localizeLabelUnderline(GtkWidget * widget, const XAP_StringSet * pSS, XAP_String_Id id);
00107 void localizeLabelMarkup(GtkWidget * widget, const XAP_StringSet * pSS, XAP_String_Id id);
00108 void localizeButton(GtkWidget * widget, const XAP_StringSet * pSS, XAP_String_Id id);
00109 void localizeButtonUnderline(GtkWidget * widget, const XAP_StringSet * pSS, XAP_String_Id id);
00110 void localizeButtonMarkup(GtkWidget * widget, const XAP_StringSet * pSS, XAP_String_Id id);
00111 void localizeMenu(GtkWidget * widget, const XAP_StringSet * pSS, XAP_String_Id id);
00112 void setLabelMarkup(GtkWidget * widget, const gchar * str);
00113
00114
00115
00116
00117 GdkWindow * getRootWindow(GtkWidget * widget);
00118
00119 void abiSetActivateOnWidgetToActivateButton( GtkWidget* source, GtkWidget* button );
00120
00121 #endif