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