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 "ut_compiler.h"
00027 ABI_W_NO_CONST_QUAL
00028 #include <gtk/gtk.h>
00029 ABI_W_POP
00030 #include "ut_types.h"
00031
00032 std::string tostr( long v );
00033 std::string tostr( GtkTextView* tv );
00034 std::string tostr( GtkEntry* e );
00035 std::string getSelectedText( GtkTreeView* tv, int colnum = 0 );
00036 UT_uint32 getSelectedUInt( GtkTreeView* tv, int colnum = 0 );
00037 void selectNext( GtkTreeView* tv );
00038 void selectPrev( GtkTreeView* tv );
00039 void append( GtkComboBoxText* combo, const std::list< std::string >& data );
00040 std::string tostr( GtkComboBox* combo );
00041 void setEntry( GtkWidget* w, const std::string& v );
00042 void setEntry( GtkEntry* w, const std::string& v );
00043 void setEntry( GtkEntry* w, time_t v );
00044 void setEntry( GtkEntry* w, double v );
00045
00046 typedef std::list< GtkTreeIter > list_gtktreeiter_t;
00051 list_gtktreeiter_t getIterList( GtkWidget* w_treeview, bool useSelection = false );
00052
00053 void clearSelection( GtkTreeView* tv );
00054 void selectIter( GtkTreeView* tv, GtkTreeIter* iter );
00055 void scrollToIter( GtkTreeView* tv, GtkTreeIter* iter, int colnum = -1, gboolean start_editing = false );
00056
00057
00058
00059 #include "xap_Dlg_FileOpenSaveAs.h"
00060 #include "ie_types.h"
00061
00062 class UT_runDialog_AskForPathname
00063 {
00064 public:
00065
00066 struct Filetype
00067 {
00068 std::string m_desc;
00069 std::string m_ext;
00070 UT_sint32 m_number;
00071 Filetype( std::string desc, std::string ext, UT_sint32 number )
00072 : m_desc(desc), m_ext(ext), m_number(number)
00073 {
00074 }
00075 };
00076 typedef std::list< Filetype > FiletypeList_t;
00077
00078
00079 UT_runDialog_AskForPathname( XAP_Dialog_Id id,
00080 const std::string& suggestedName = "" );
00081
00082 int appendFiletype( const std::string desc,
00083 const std::string ext,
00084 UT_sint32 n = 0 );
00085 void setDefaultFiletype( const std::string desc,
00086 const std::string ext = "" );
00087 bool run( XAP_Frame * pFrame = 0 );
00088
00089 const std::string & getPath() const;
00090 IEFileType getType();
00091
00092
00093
00094 private:
00095 std::string m_pathname;
00096 IEFileType m_ieft;
00097 XAP_Dialog_Id m_dialogId;
00098 bool m_saveAs;
00099 std::string m_suggestedName;
00100 FiletypeList_t m_filetypes;
00101 UT_sint32 m_defaultFiletype;
00102
00103 std::string appendDefaultSuffixFunctor( std::string dialogFilename, UT_sint32 n );
00104
00105 };
00106
00107
00108 #endif