Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef ABI_GTK_COMMON_H
00022 #define ABI_GTK_COMMON_H
00023
00024 #include <string>
00025 #include <list>
00026 #include <gtk/gtk.h>
00027 #include "xap_Gtk2Compat.h"
00028 #include "ut_types.h"
00029
00030 std::string tostr( long v );
00031 std::string tostr( GtkTextView* tv );
00032 std::string tostr( GtkEntry* e );
00033 std::string getSelectedText( GtkTreeView* tv, int colnum = 0 );
00034 UT_uint32 getSelectedUInt( GtkTreeView* tv, int colnum = 0 );
00035 void selectNext( GtkTreeView* tv );
00036 void selectPrev( GtkTreeView* tv );
00037 void append( GtkComboBoxText* combo, const std::list< std::string >& data );
00038 std::string tostr( GtkComboBox* combo );
00039 void setEntry( GtkWidget* w, const std::string& v );
00040 void setEntry( GtkEntry* w, const std::string& v );
00041 void setEntry( GtkEntry* w, time_t v );
00042 void setEntry( GtkEntry* w, double v );
00043
00044 typedef std::list< GtkTreeIter > list_gtktreeiter_t;
00049 list_gtktreeiter_t getIterList( GtkWidget* w_treeview, bool useSelection = false );
00050
00051 void clearSelection( GtkTreeView* tv );
00052 void selectIter( GtkTreeView* tv, GtkTreeIter* iter );
00053 void scrollToIter( GtkTreeView* tv, GtkTreeIter* iter, int colnum = -1, gboolean start_editing = false );
00054
00055
00056
00057 #include "xap_Dlg_FileOpenSaveAs.h"
00058 #include "ie_types.h"
00059
00060 class UT_runDialog_AskForPathname
00061 {
00062 public:
00063
00064 struct Filetype
00065 {
00066 std::string m_desc;
00067 std::string m_ext;
00068 UT_sint32 m_number;
00069 Filetype( std::string desc, std::string ext, UT_sint32 number )
00070 : m_desc(desc), m_ext(ext), m_number(number)
00071 {
00072 }
00073 };
00074 typedef std::list< Filetype > FiletypeList_t;
00075
00076
00077 UT_runDialog_AskForPathname( XAP_Dialog_Id id,
00078 const std::string& suggestedName = "" );
00079
00080 int appendFiletype( const std::string desc,
00081 const std::string ext,
00082 UT_sint32 n = 0 );
00083 void setDefaultFiletype( const std::string desc,
00084 const std::string ext = "" );
00085 bool run( XAP_Frame * pFrame = 0 );
00086
00087 std::string getPath();
00088 IEFileType getType();
00089
00090
00091
00092 private:
00093 std::string m_pathname;
00094 IEFileType m_ieft;
00095 XAP_Dialog_Id m_dialogId;
00096 bool m_saveAs;
00097 std::string m_suggestedName;
00098 FiletypeList_t m_filetypes;
00099 UT_sint32 m_defaultFiletype;
00100
00101 std::string appendDefaultSuffixFunctor( std::string dialogFilename, UT_sint32 n );
00102
00103 };
00104
00105
00106 #endif