Defines | Functions

xap_UnixDialogHelper.h File Reference

#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <functional>
#include "ut_types.h"
#include "xap_Strings.h"

Go to the source code of this file.

Defines

#define SETUP_UNIX_STRING   gchar * newstr = NULL;
#define CONVERT_TO_UNIX_STRING(str, id, newstr)
#define CONVERT_TO_ACC_STRING(str, id, newstr)

Functions

GtkBuilder * newDialogBuilder (const char *name)
 load a GtkBuilder for a dialog using the standard path.
void connectFocus (GtkWidget *widget, const XAP_Frame *frame)
void connectFocusModeless (GtkWidget *widget, const XAP_App *pApp)
void connectFocusModelessOther (GtkWidget *widget, const XAP_App *pApp, std::pointer_to_unary_function< int, gboolean > *other_function)
bool isTransientWindow (GtkWindow *window, GtkWindow *parent)
void messageBoxOK (const char *message)
void centerDialog (GtkWidget *parent, GtkWidget *child, bool set_transient_for=true)
GtkStyle * get_ensured_style (GtkWidget *w)
GtkWidget * createDrawingArea ()
void abiSetupModalDialog (GtkDialog *me, XAP_Frame *pFrame, XAP_Dialog *pDlg, gint dfl_id)
gint abiRunModalDialog (GtkDialog *me, bool destroyDialog, AtkRole role=ATK_ROLE_DIALOG)
gint abiRunModalDialog (GtkDialog *me, XAP_Frame *pFrame, XAP_Dialog *pDlg, gint dfl_id, bool destroyDialog, AtkRole role=ATK_ROLE_DIALOG)
void abiSetupModelessDialog (GtkDialog *me, XAP_Frame *pFrame, XAP_Dialog *pDlg, gint dfl_id, bool abi_modeless=true, AtkRole role=ATK_ROLE_DIALOG)
void abiDestroyWidget (GtkWidget *me)
GtkWidget * abiAddStockButton (GtkDialog *me, const gchar *btn_id, gint response_id)
GtkWidget * abiAddButton (GtkDialog *me, const gchar *btn_id, gint response_id)
GtkWidget * abiDialogNew (const char *role, gboolean resizable=FALSE)
GtkWidget * abiDialogNew (const char *role, gboolean resizable, const char *title,...)
GtkWidget * abiGtkMenuFromCStrVector (const UT_GenericVector< const char * > &vec, GCallback cb, gpointer data)
void abiDialogSetTitle (GtkWidget *dlg, const char *title,...) ABI_PRINTF_FORMAT(2
void void convertMnemonics (gchar *s)
std::string & convertMnemonics (std::string &s)
void localizeLabel (GtkWidget *widget, const XAP_StringSet *pSS, XAP_String_Id id)
void localizeLabelUnderline (GtkWidget *widget, const XAP_StringSet *pSS, XAP_String_Id id)
void localizeLabelMarkup (GtkWidget *widget, const XAP_StringSet *pSS, XAP_String_Id id)
void localizeButton (GtkWidget *widget, const XAP_StringSet *pSS, XAP_String_Id id)
void localizeButtonUnderline (GtkWidget *widget, const XAP_StringSet *pSS, XAP_String_Id id)
void localizeButtonMarkup (GtkWidget *widget, const XAP_StringSet *pSS, XAP_String_Id id)
void localizeMenu (GtkWidget *widget, const XAP_StringSet *pSS, XAP_String_Id id)
void localizeMenuItem (GtkWidget *widget, const XAP_StringSet *pSS, XAP_String_Id id)
void setLabelMarkup (GtkWidget *widget, const gchar *str)
GdkWindow * getRootWindow (GtkWidget *widget)
void abiSetActivateOnWidgetToActivateButton (GtkWidget *source, GtkWidget *button)
 When the source widget gets the activate signal, sent activate to the button.

Define Documentation

#define CONVERT_TO_ACC_STRING (   str,
  id,
  newstr 
)
Value:
do { \
                                                    FREEP(newstr); \
                                                    std::string _s;           \
                                                    pSS->getValueUTF8(id,_s); \
                                                    UT_XML_cloneConvAmpersands(newstr, _s.c_str()); \
                            } while (0);

Referenced by AP_UnixDialog_Replace::_constructWindow().

#define CONVERT_TO_UNIX_STRING (   str,
  id,
  newstr 
)
Value:
do { \
                                                    FREEP(newstr); \
                                                    std::string _s;           \
                                                    pSS->getValueUTF8(id,_s); \
                                                    UT_XML_cloneNoAmpersands(newstr, _s.c_str()); \
                            } while (0);

Referenced by AP_UnixDialog_Replace::_constructWindow().

#define SETUP_UNIX_STRING   gchar * newstr = NULL;

Function Documentation

GtkWidget* abiAddButton ( GtkDialog *  me,
const gchar *  btn_id,
gint  response_id 
)
GtkWidget* abiAddStockButton ( GtkDialog *  me,
const gchar *  btn_id,
gint  response_id 
)
void abiDestroyWidget ( GtkWidget *  me  ) 

Calls gtk_widget_destroy on if is non-null and GTK_IS_WIDGET(me)

Referenced by abiRunModalDialog(), AP_UnixDialog_Lists::closeClicked(), AP_UnixDialog_Replace::destroy(), AP_UnixDialog_Lists::destroy(), AP_UnixDialog_Options::event_ChooseTransparentColor(), GDA_execSQL(), AP_UnixDialog_Styles::modifyRunModal(), XAP_UnixDialog_Zoom::runModal(), XAP_UnixDialog_WindowMore::runModal(), XAP_UnixDialog_Password::runModal(), XAP_UnixDialog_ListDocuments::runModal(), XAP_UnixDialog_Language::runModal(), XAP_UnixDialog_Image::runModal(), XAP_UnixDialog_HTMLOptions::runModal(), XAP_UnixDialog_History::runModal(), XAP_UnixDialog_Encoding::runModal(), XAP_UnixDialog_DocComparison::runModal(), XAP_UnixDialog_ClipArt::runModal(), AP_UnixDialog_Stylist::runModal(), AP_UnixDialog_Styles::runModal(), AP_UnixDialog_Spell::runModal(), AP_UnixDialog_Paragraph::runModal(), AP_UnixDialog_PageSetup::runModal(), AP_UnixDialog_PageNumbers::runModal(), AP_UnixDialog_Options::runModal(), AP_UnixDialog_New::runModal(), AP_UnixDialog_MetaData::runModal(), AP_UnixDialog_MarkRevisions::runModal(), AP_UnixDialog_Lists::runModal(), AP_UnixDialog_ListRevisions::runModal(), AP_UnixDialog_InsertXMLID::runModal(), AP_UnixDialog_InsertTable::runModal(), AP_UnixDialog_InsertHyperlink::runModal(), AP_UnixDialog_InsertBookmark::runModal(), AP_UnixDialog_Insert_DateTime::runModal(), AP_UnixDialog_GenericProgress::runModal(), AP_UnixDialog_GenericInput::runModal(), AP_UnixDialog_Field::runModal(), AP_UnixDialog_EpubExportOptions::runModal(), AP_UnixDialog_Columns::runModal(), AP_UnixDialog_CollaborationShare::runModal(), AP_UnixDialog_CollaborationJoin::runModal(), AP_UnixDialog_CollaborationEditAccount::runModal(), AP_UnixDialog_CollaborationAddBuddy::runModal(), AP_UnixDialog_CollaborationAddAccount::runModal(), AP_UnixDialog_CollaborationAccounts::runModal(), AP_UnixDialog_Break::runModal(), AP_UnixDialog_Annotation::runModal(), s_delete_clicked(), s_dlg_response(), AP_UnixDialog_WordCount::s_response(), s_response(), AP_UnixDialog_Replace::s_response_triggered(), and s_response_triggered().

GtkWidget* abiDialogNew ( const char *  role,
gboolean  resizable 
)
GtkWidget* abiDialogNew ( const char *  role,
gboolean  resizable,
const char *  title,
  ... 
)

Create a new GtkDialog with this title

References abiDialogNew(), UT_String::c_str(), and UT_String_vprintf().

void abiDialogSetTitle ( GtkWidget *  dlg,
const char *  title,
  ... 
)
GtkWidget* abiGtkMenuFromCStrVector ( const UT_GenericVector< const char * > &  vec,
GCallback  cb,
gpointer  data 
)

Returns a GtkMenu with items having label fetched from UTF-8 CStr from UT_Vector. All menu item will have the index of the item stored in its user-data

References UT_GenericVector< T >::getItemCount().

gint abiRunModalDialog ( GtkDialog *  me,
bool  destroyDialog,
AtkRole  role = ATK_ROLE_DIALOG 
)

References abiDestroyWidget().

Referenced by abiRunModalDialog(), AP_UnixDialog_Options::event_ChooseTransparentColor(), GDA_execSQL(), AP_UnixDialog_Styles::modifyRunModal(), XAP_UnixDialog_Zoom::runModal(), XAP_UnixDialog_WindowMore::runModal(), XAP_UnixDialog_PluginManager::runModal(), XAP_UnixDialog_Password::runModal(), XAP_UnixDialog_MessageBox::runModal(), XAP_UnixDialog_ListDocuments::runModal(), XAP_UnixDialog_Language::runModal(), XAP_UnixDialog_Image::runModal(), XAP_UnixDialog_HTMLOptions::runModal(), XAP_UnixDialog_History::runModal(), XAP_UnixDialog_FontChooser::runModal(), XAP_UnixDialog_Encoding::runModal(), XAP_UnixDialog_DocComparison::runModal(), XAP_UnixDialog_ClipArt::runModal(), AP_UnixDialog_ToggleCase::runModal(), AP_UnixDialog_Tab::runModal(), AP_UnixDialog_Stylist::runModal(), AP_UnixDialog_Styles::runModal(), AP_UnixDialog_Spell::runModal(), AP_UnixDialog_Paragraph::runModal(), AP_UnixDialog_PageSetup::runModal(), AP_UnixDialog_PageNumbers::runModal(), AP_UnixDialog_Options::runModal(), AP_UnixDialog_New::runModal(), AP_UnixDialog_MetaData::runModal(), AP_UnixDialog_MarkRevisions::runModal(), AP_UnixDialog_Lists::runModal(), AP_UnixDialog_ListRevisions::runModal(), AP_UnixDialog_InsertXMLID::runModal(), AP_UnixDialog_InsertTable::runModal(), AP_UnixDialog_InsertHyperlink::runModal(), AP_UnixDialog_InsertBookmark::runModal(), AP_UnixDialog_Insert_DateTime::runModal(), AP_UnixDialog_HdrFtr::runModal(), AP_UnixDialog_GenericProgress::runModal(), AP_UnixDialog_GenericInput::runModal(), AP_UnixDialog_FormatFootnotes::runModal(), AP_UnixDialog_Field::runModal(), AP_UnixDialog_EpubExportOptions::runModal(), AP_UnixDialog_Columns::runModal(), AP_UnixDialog_CollaborationShare::runModal(), AP_UnixDialog_CollaborationJoin::runModal(), AP_UnixDialog_CollaborationEditAccount::runModal(), AP_UnixDialog_CollaborationAddBuddy::runModal(), AP_UnixDialog_CollaborationAddAccount::runModal(), AP_UnixDialog_CollaborationAccounts::runModal(), AP_UnixDialog_Break::runModal(), AP_UnixDialog_Background::runModal(), and AP_UnixDialog_Annotation::runModal().

gint abiRunModalDialog ( GtkDialog *  me,
XAP_Frame pFrame,
XAP_Dialog pDlg,
gint  defaultResponse,
bool  destroyDialog,
AtkRole  role 
)

Runs the dialog as a modal dialog 1) Connect focus to toplevel frame 2) Centers dialog over toplevel window 3) Connects F1 to help system 4) Makes dialog modal 5) Sets the default button to defaultResponse, sets ESC to close 6) Returns value of gtk_dialog_run(me) 7) If is true, destroys the dialog, else you have to call abiDestroyWidget()

References abiRunModalDialog(), abiSetupModalDialog(), and XAP_Dialog::maybeReallowPopupPreviewBubbles().

void abiSetActivateOnWidgetToActivateButton ( GtkWidget *  source,
GtkWidget *  button 
)

When the source widget gets the activate signal, sent activate to the button.

This allows GtkEntry widgets to explicitly close the dialog with the OK button when the user presses return while leaving the default dialog action to be CANCEL.

References activate_button().

Referenced by AP_UnixDialog_MarkRevisions::constructWindow().

void abiSetupModalDialog ( GtkDialog *  me,
XAP_Frame pFrame,
XAP_Dialog pDlg,
gint  dfl_id 
)
void abiSetupModelessDialog ( GtkDialog *  me,
XAP_Frame pFrame,
XAP_Dialog pDlg,
gint  defaultResponse,
bool  abi_modeless,
AtkRole   
)
void centerDialog ( GtkWidget *  parent,
GtkWidget *  child,
bool  set_transient_for 
)
void connectFocus ( GtkWidget *  widget,
const XAP_Frame frame 
)
void connectFocusModeless ( GtkWidget *  widget,
const XAP_App pApp 
)
void connectFocusModelessOther ( GtkWidget *  widget,
const XAP_App pApp,
std::pointer_to_unary_function< int, gboolean > *  other_function 
)
void void convertMnemonics ( gchar *  s  ) 
std::string& convertMnemonics ( std::string &  s  ) 
GtkWidget* createDrawingArea (  ) 
GtkStyle* get_ensured_style ( GtkWidget *  w  ) 

For a parented/displayed widget, this will just return gtk_widget_ensure_style(w). For a non-displayed widgets, This will return a valid GtkStyle for that widget

References style, and UT_ASSERT.

Referenced by AP_UnixTopRuler::setView(), and AP_UnixLeftRuler::setView().

GdkWindow* getRootWindow ( GtkWidget *  widget  ) 

References UT_return_val_if_fail.

bool isTransientWindow ( GtkWindow *  window,
GtkWindow *  parent 
)
void localizeButton ( GtkWidget *  widget,
const XAP_StringSet pSS,
XAP_String_Id  id 
)
void localizeButtonMarkup ( GtkWidget *  widget,
const XAP_StringSet pSS,
XAP_String_Id  id 
)

Localizes a button given the string id It formats its label using the current button label as a format string. It is assumed to be something like "<span size="larger">%s</span>". Note that in addition to doing markup, ampersands will be converted to underscores/mnemonic since this makes sense for buttons

References UT_String::c_str(), convertMnemonics(), FREEP, gchar, XAP_StringSet::getValueUTF8(), s, UT_ASSERT, UT_String_sprintf(), and UT_UTF8String::utf8_str().

Referenced by AP_UnixDialog_FormatTOC::_constructWindow(), and AP_UnixDialog_Options::_constructWindowContents().

void localizeButtonUnderline ( GtkWidget *  widget,
const XAP_StringSet pSS,
XAP_String_Id  id 
)
void localizeLabel ( GtkWidget *  widget,
const XAP_StringSet pSS,
XAP_String_Id  id 
)
void localizeLabelMarkup ( GtkWidget *  widget,
const XAP_StringSet pSS,
XAP_String_Id  id 
)

Localizes the label of a widget given the string id It formats the label using the current label of the widget as a format string. The current label is assumed to be something like "<span size="larger">%s</span>".

References FREEP, gchar, XAP_StringSet::getValueUTF8(), s, UT_String_sprintf(), UT_XML_cloneNoAmpersands(), and UT_UTF8String::utf8_str().

Referenced by XAP_UnixDialog_Zoom::_constructWindow(), XAP_UnixDialog_WindowMore::_constructWindow(), XAP_UnixDialog_PluginManager::_constructWindow(), XAP_UnixDialog_Image::_constructWindow(), XAP_UnixDialog_Encoding::_constructWindow(), AP_UnixDialog_Tab::_constructWindow(), AP_UnixDialog_Styles::_constructWindow(), AP_UnixDialog_PageNumbers::_constructWindow(), AP_UnixDialog_MailMerge::_constructWindow(), AP_UnixDialog_InsertTable::_constructWindow(), AP_UnixDialog_Insert_DateTime::_constructWindow(), AP_UnixDialog_HdrFtr::_constructWindow(), AP_UnixDialog_FormatTOC::_constructWindow(), AP_UnixDialog_FormatTable::_constructWindow(), AP_UnixDialog_FormatFrame::_constructWindow(), AP_UnixDialog_FormatFootnotes::_constructWindow(), AP_UnixDialog_Field::_constructWindow(), AP_UnixDialog_Break::_constructWindow(), AP_UnixDialog_Border_Shading::_constructWindow(), AP_UnixDialog_Options::_constructWindowContents(), AP_UnixDialog_Lists::_constructWindowContents(), XAP_UnixDialog_History::_populateWindowData(), XAP_UnixDialog_DocComparison::_populateWindowData(), AP_UnixDialog_Latex::constructDialog(), and XAP_UnixDialog_Language::constructWindow().

void localizeLabelUnderline ( GtkWidget *  widget,
const XAP_StringSet pSS,
XAP_String_Id  id 
)

Localizes the label of a widget given the string id Ampersands will be converted to underscores/mnemonics

References convertMnemonics(), FREEP, gchar, XAP_StringSet::getValueUTF8(), s, UT_ASSERT, and UT_UTF8String::utf8_str().

Referenced by AP_UnixDialog_Spell::_constructWindow(), AP_UnixDialog_FormatTOC::_constructWindow(), and AP_UnixDialog_Options::_constructWindowContents().

void localizeMenu ( GtkWidget *  widget,
const XAP_StringSet pSS,
XAP_String_Id  id 
)

Localizes the label of a Menu widget given the string id

References FREEP, gchar, XAP_StringSet::getValueUTF8(), s, UT_XML_cloneNoAmpersands(), and UT_UTF8String::utf8_str().

void localizeMenuItem ( GtkWidget *  widget,
const XAP_StringSet pSS,
XAP_String_Id  id 
)

Localizes the label of a Menu Item widget given the string id

References FREEP, gchar, XAP_StringSet::getValueUTF8(), s, UT_XML_cloneConvAmpersands(), and UT_UTF8String::utf8_str().

Referenced by AP_UnixDialog_RDFEditor::_constructWindow().

void messageBoxOK ( const char *  message  ) 

This is a small message box for startup warnings and/or errors. Please do NOT use this for normal system execution user messages; use the XAP_UnixDialog_MessageBox class for that. We can't use that here because there is no parent frame, etc.

Referenced by AP_UnixDialog_Styles::_populateModify(), and AP_UnixDialog_Styles::new_styleName().

GtkBuilder* newDialogBuilder ( const char *  name  ) 

load a GtkBuilder for a dialog using the standard path.

Parameters:
name the filename of the dialog (no path)
Returns:
the GtkBuilder or NULL. The returned object my be freed as usual.

References abicollab::service::error(), XAP_App::getApp(), UT_ASSERT, and UT_DEBUGMSG.

Referenced by XAP_UnixDialog_Zoom::_constructWindow(), XAP_UnixDialog_WindowMore::_constructWindow(), XAP_UnixDialog_PluginManager::_constructWindow(), XAP_UnixDialog_Password::_constructWindow(), XAP_UnixDialog_ListDocuments::_constructWindow(), XAP_UnixDialog_Image::_constructWindow(), XAP_UnixDialog_History::_constructWindow(), XAP_UnixDialog_Encoding::_constructWindow(), AP_UnixDialog_Tab::_constructWindow(), AP_UnixDialog_Stylist::_constructWindow(), AP_UnixDialog_Styles::_constructWindow(), AP_UnixDialog_Spell::_constructWindow(), AP_UnixDialog_Replace::_constructWindow(), AP_UnixDialog_RDFQuery::_constructWindow(), AP_UnixDialog_RDFEditor::_constructWindow(), AP_UnixDialog_PageSetup::_constructWindow(), AP_UnixDialog_PageNumbers::_constructWindow(), AP_UnixDialog_Options::_constructWindow(), AP_UnixDialog_New::_constructWindow(), AP_UnixDialog_MetaData::_constructWindow(), AP_UnixDialog_MailMerge::_constructWindow(), AP_UnixDialog_InsertTable::_constructWindow(), AP_UnixDialog_Insert_DateTime::_constructWindow(), AP_UnixDialog_HdrFtr::_constructWindow(), AP_UnixDialog_Goto::_constructWindow(), AP_UnixDialog_GenericProgress::_constructWindow(), AP_UnixDialog_GenericInput::_constructWindow(), AP_UnixDialog_FormatTOC::_constructWindow(), AP_UnixDialog_FormatTable::_constructWindow(), AP_UnixDialog_FormatFrame::_constructWindow(), AP_UnixDialog_FormatFootnotes::_constructWindow(), AP_UnixDialog_Field::_constructWindow(), AP_UnixDialog_CollaborationShare::_constructWindow(), AP_UnixDialog_CollaborationJoin::_constructWindow(), AP_UnixDialog_CollaborationEditAccount::_constructWindow(), AP_UnixDialog_CollaborationAddBuddy::_constructWindow(), AP_UnixDialog_CollaborationAddAccount::_constructWindow(), AP_UnixDialog_CollaborationAccounts::_constructWindow(), AP_UnixDialog_Break::_constructWindow(), AP_UnixDialog_Border_Shading::_constructWindow(), AP_UnixDialog_Annotation::_constructWindow(), AP_UnixDialog_WordCount::constructDialog(), AP_UnixDialog_Latex::constructDialog(), XAP_UnixDialog_Language::constructWindow(), XAP_UnixDialog_DocComparison::constructWindow(), AP_RDFLocationGTK::createEditor(), AP_RDFEventGTK::createEditor(), AP_RDFContactGTK::createEditor(), AP_UnixDialog_Options::event_ChooseTransparentColor(), PD_RDFDialogsGTK::runInsertReferenceDialog(), and PD_RDFDialogsGTK::runSemanticStylesheetsDialog().

void setLabelMarkup ( GtkWidget *  widget,
const gchar *  str 
)

Sets the label of "widget" to "str". It formats the label using the current label of the widget as a format string. The current label is assumed to be something like "<span size="larger">%s</span>".

References UT_String::c_str(), and UT_String_sprintf().

Referenced by XAP_UnixDialog_ListDocuments::_constructWindow(), and XAP_UnixDialog_History::_populateWindowData().