00001 00002 // Name: gtk.h 00003 // Author: Joe Yates 00004 // Purpose: Gtk Library wrapper class 00005 // Created: 2005-11-06 00006 // Copyright: (c) Joe Yates 00007 // License: BSD license (see the file 'LICENSE.txt') 00009 00010 #ifndef __wxGtk_h__ 00011 #define __wxGtk_h__ 00012 00013 #include "wx/defs.h" 00014 #include "wx/dynlib.h" 00015 #include "wx/string.h" 00016 00017 #include <vector> 00018 #include <wx/gtk/glib.h> 00019 #include <gtk/gtkicontheme.h> 00020 00021 /* 00022 GtkIconInfo * gtk_icon_theme_lookup_icon 00023 ( 00024 GtkIconTheme* icon_theme, 00025 const gchar* icon_name, 00026 gint size, 00027 GtkIconLookupFlags flags 00028 ); 00029 */ 00030 00031 class wxGtk 00032 { 00033 public: 00034 // constructors 00035 wxGtk(); 00036 ~wxGtk() {} 00037 00038 // Methods 00039 public: 00040 std::vector<long> GetIconSizes(const wxString& sIconName) const; 00041 wxString GetIconPath(const wxString& sIconName, int nSize) const; 00042 00043 // Typedefs 00044 private: 00045 // Main Event Loop 00046 typedef void (* gtk_initType)(int * argc, char *** argv); 00047 00048 typedef GtkIconTheme * (* gtk_icon_theme_get_defaultType)(); 00049 typedef GtkIconInfo * (* gtk_icon_theme_lookup_iconType)(GtkIconTheme * icon_theme, const gchar * icon_name, gint size, GtkIconLookupFlags flags); 00050 typedef void (* gtk_icon_info_freeType)(GtkIconInfo * icon_info); 00051 typedef const gchar * (* gtk_icon_info_get_filenameType)(GtkIconInfo * icon_info); 00052 typedef gint * (* gtk_icon_theme_get_icon_sizesType)(GtkIconTheme * icon_theme, const gchar * icon_name); 00053 00054 private: 00055 bool LoadGtk(); 00056 00057 private: 00058 bool m_bLoaded; 00059 wxGlib libglib; 00060 wxDynamicLibrary libgtkx11; 00061 00062 // Function pointers 00063 gtk_initType gtk_init; 00064 gtk_icon_theme_get_defaultType gtk_icon_theme_get_default; 00065 gtk_icon_theme_lookup_iconType gtk_icon_theme_lookup_icon; 00066 gtk_icon_info_freeType gtk_icon_info_free; 00067 gtk_icon_info_get_filenameType gtk_icon_info_get_filename; 00068 gtk_icon_theme_get_icon_sizesType gtk_icon_theme_get_icon_sizes; 00069 }; 00070 00071 #endif // ndef __wxGtk_h__