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

GTKCommon.h

Go to the documentation of this file.
00001 /* some common code to make GTK+ less of a PITA.
00002  *
00003  * Copyright (C) 2011 AbiSource, Inc.
00004  * Copyright (C) 2011 Ben Martin
00005  * 
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  * 
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  * 
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  
00019  * 02111-1307, USA.
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 
00028 std::string tostr( long v );
00029 std::string tostr( GtkTextView* tv );
00030 std::string tostr( GtkEntry* e );
00031 std::string getSelectedText( GtkTreeView* tv, int colnum = 0 );
00032 void selectNext( GtkTreeView* tv );
00033 void selectPrev( GtkTreeView* tv );
00034 void append( GtkComboBox* combo, const std::list< std::string >& data );
00035 std::string tostr( GtkComboBox* combo );
00036 
00037 
00038 typedef std::list< GtkTreeIter > list_gtktreeiter_t;
00043 list_gtktreeiter_t getIterList( GtkWidget* w_treeview, bool useSelection = false );
00044 
00045 void clearSelection( GtkTreeView* tv );
00046 void selectIter( GtkTreeView* tv, GtkTreeIter* iter );
00047 void scrollToIter( GtkTreeView* tv, GtkTreeIter* iter, int colnum = -1, gboolean start_editing = false );
00048 
00049 
00050 
00051 #include "xap_Dlg_FileOpenSaveAs.h"
00052 #include "ie_types.h"
00053 
00054 class UT_runDialog_AskForPathname
00055 {
00056 public:
00057 
00058     struct Filetype
00059     {
00060         std::string m_desc;
00061         std::string m_ext;
00062         UT_sint32   m_number;
00063         Filetype( std::string desc, std::string ext, UT_sint32 number )
00064         : m_desc(desc), m_ext(ext), m_number(number)
00065         {
00066         }
00067     };
00068     typedef std::list< Filetype > FiletypeList_t;
00069     
00070     
00071     UT_runDialog_AskForPathname( XAP_Dialog_Id id,
00072                                  const std::string& suggestedName = "" );
00073 
00074     int appendFiletype( const std::string desc,
00075                         const std::string ext,
00076                         UT_sint32 n = 0 );
00077     void setDefaultFiletype( const std::string desc,
00078                              const std::string ext = "" );
00079     bool run( XAP_Frame * pFrame = 0 );
00080 
00081     std::string getPath();
00082     IEFileType getType();
00083 
00084 
00085   
00086   private:
00087     std::string m_pathname;
00088     IEFileType m_ieft;
00089     XAP_Dialog_Id m_dialogId;
00090     bool m_saveAs;
00091     std::string m_suggestedName;
00092     FiletypeList_t m_filetypes;
00093     UT_sint32      m_defaultFiletype;
00094 
00095     std::string appendDefaultSuffixFunctor( std::string dialogFilename, UT_sint32 n );
00096     
00097 };
00098 
00099 
00100 #endif

Generated on Sat Dec 3 2011 for AbiWord by  doxygen 1.7.1