• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

xap_UnixDialogHelper.h

Go to the documentation of this file.
00001 /* AbiSource Program Utilities
00002  * Copyright (C) 1998 AbiSource, Inc.
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00017  * 02110-1301 USA.
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 // This macro sets up stack pointers to be used with the ConvertToUnixString
00040 // macro.
00041 #define SETUP_UNIX_STRING   gchar * newstr = NULL;
00042 
00043 // This macro is for use in Unix dialogs where the strings are to
00044 // be stripped of ampersands (Windows accelerator characters).
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 // This macro is for use in Unix dialogs where the accelerator characters
00053 // strings need to be converted to underscores.
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 // This is a very thin message box; only use it for startup errors
00074 // or places where you can't use the message box class (like when
00075 // you don't have a frame yet).
00076 void messageBoxOK(const char * message);
00077 
00078 // Centers a GTK window inside a parent window
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 // Returns the root window of the X display, useful for doing
00110 // pointer or coordinate measurement on an absolute scale.
00111 GdkWindow * getRootWindow(GtkWidget * widget);
00112 
00113 void abiSetActivateOnWidgetToActivateButton( GtkWidget* source, GtkWidget* button );
00114 
00115 #endif /* UT_DIALOGHELPER_H */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1