• 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 
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 // This macro sets up stack pointers to be used with the ConvertToUnixString
00038 // macro.
00039 #define SETUP_UNIX_STRING   gchar * newstr = NULL;
00040 
00041 // This macro is for use in Unix dialogs where the strings are to
00042 // be stripped of ampersands (Windows accelerator characters).
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 // This macro is for use in Unix dialogs where the accelerator characters
00051 // strings need to be converted to underscores.
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 // This is a very thin message box; only use it for startup errors
00072 // or places where you can't use the message box class (like when
00073 // you don't have a frame yet).
00074 void messageBoxOK(const char * message);
00075 
00076 // Centers a GTK window inside a parent window
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 // creates a GtkDrawingArea, and pushes/pops correct visual and colormap
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 // Returns the root window of the X display, useful for doing
00119 // pointer or coordinate measurement on an absolute scale.
00120 GdkWindow * getRootWindow(GtkWidget * widget);
00121 
00122 void abiSetActivateOnWidgetToActivateButton( GtkWidget* source, GtkWidget* button );
00123 
00124 #endif /* UT_DIALOGHELPER_H */

Generated on Tue Jun 18 2013 for AbiWord by  doxygen 1.7.1