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 #if !GTK_CHECK_VERSION(3,0,0)
00080 GtkStyle * get_ensured_style (GtkWidget * w);
00081 #endif
00082
00083
00084 GtkWidget *createDrawingArea ();
00085
00086 void abiSetupModalDialog(GtkDialog * me, XAP_Frame *pFrame, XAP_Dialog * pDlg, gint dfl_id);
00087 gint abiRunModalDialog(GtkDialog * me, bool destroyDialog, AtkRole role = ATK_ROLE_DIALOG);
00088 gint abiRunModalDialog(GtkDialog * me, XAP_Frame *pFrame, XAP_Dialog * pDlg, gint dfl_id, bool destroyDialog, AtkRole role = ATK_ROLE_DIALOG);
00089 void abiSetupModelessDialog(GtkDialog * me, XAP_Frame * pFrame, XAP_Dialog * pDlg, gint dfl_id, bool abi_modeless = true, AtkRole role = ATK_ROLE_DIALOG);
00090 void abiDestroyWidget(GtkWidget * me);
00091
00092 GtkWidget* abiAddStockButton (GtkDialog * me, const gchar * btn_id,
00093 gint response_id) ;
00094 GtkWidget* abiAddButton(GtkDialog * me, const gchar * btn_id,
00095 gint response_id);
00096
00097 GtkWidget * abiDialogNew(const char * role, gboolean resizable = FALSE);
00098 GtkWidget * abiDialogNew(const char * role, gboolean resizable, const char * title, ...);
00099 GtkWidget * abiGtkMenuFromCStrVector(const UT_GenericVector<const char*> & vec, GCallback cb, gpointer data);
00100
00101 void abiDialogSetTitle(GtkWidget * dlg, const char * title, ...)
00102 ABI_PRINTF_FORMAT(2,3);
00103
00104 void convertMnemonics(gchar * s);
00105 std::string & convertMnemonics(std::string & s);
00106
00107 void localizeLabel(GtkWidget * widget, const XAP_StringSet * pSS, XAP_String_Id id);
00108 void localizeLabelUnderline(GtkWidget * widget, const XAP_StringSet * pSS, XAP_String_Id id);
00109 void localizeLabelMarkup(GtkWidget * widget, const XAP_StringSet * pSS, XAP_String_Id id);
00110 void localizeButton(GtkWidget * widget, const XAP_StringSet * pSS, XAP_String_Id id);
00111 void localizeButtonUnderline(GtkWidget * widget, const XAP_StringSet * pSS, XAP_String_Id id);
00112 void localizeButtonMarkup(GtkWidget * widget, const XAP_StringSet * pSS, XAP_String_Id id);
00113 void localizeMenu(GtkWidget * widget, const XAP_StringSet * pSS, XAP_String_Id id);
00114 void localizeMenuItem(GtkWidget * widget, const XAP_StringSet * pSS, XAP_String_Id id);
00115 void setLabelMarkup(GtkWidget * widget, const gchar * str);
00116
00117
00118
00119
00120 GdkWindow * getRootWindow(GtkWidget * widget);
00121
00122 void abiSetActivateOnWidgetToActivateButton( GtkWidget* source, GtkWidget* button );
00123
00124 #endif