libgnomeuimm 2.28.0
|
00001 // -*- c++ -*- 00002 // Generated by gtkmmproc -- DO NOT MODIFY! 00003 #ifndef _LIBGNOMEUIMM_ICON_LIST_H 00004 #define _LIBGNOMEUIMM_ICON_LIST_H 00005 00006 00007 #include <glibmm.h> 00008 00009 // -*- C++ -*- // this is for the .hg, I realize gensig puts one in 00010 /* $Id: icon-list.hg,v 1.18 2004/06/06 21:13:08 murrayc Exp $ */ 00011 00012 /* icon-list.hg 00013 * 00014 * Copyright (C) 1998 EMC Capital Management Inc. 00015 * Developed by Havoc Pennington <hp@pobox.com> 00016 * 00017 * Copyright (C) 1999 The Gtk-- Development Team 00018 * 00019 * This library is free software; you can redistribute it and/or 00020 * modify it under the terms of the GNU Lesser General Public 00021 * License as published by the Free Software Foundation; either 00022 * version 2.1 of the License, or (at your option) any later version. 00023 * 00024 * This library is distributed in the hope that it will be useful, 00025 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00026 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00027 * Lesser General Public License for more details. 00028 * 00029 * You should have received a copy of the GNU Lesser General Public 00030 * License along with this library; if not, write to the Free 00031 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00032 */ 00033 00034 #include <libgnomeuimm/icon-textitem.h> 00035 #include <libgnomecanvasmm/canvas.h> 00036 #include <libgnomecanvasmm/pixbuf.h> 00037 #include <gtkmm/container.h> 00038 #include <glibmm/helperlist.h> 00039 #include <libgnomeui/gnome-icon-list.h> 00040 00041 00042 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00043 typedef struct _GnomeIconList GnomeIconList; 00044 typedef struct _GnomeIconListClass GnomeIconListClass; 00045 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 00046 00047 00048 namespace Gnome 00049 { 00050 00051 namespace UI 00052 { class IconList_Class; } // namespace UI 00053 00054 } // namespace Gnome 00055 namespace Gnome 00056 { 00057 00058 namespace UI 00059 { 00060 00061 namespace IconList_Helpers 00062 { 00063 00064 00065 class SelectionList : public Glib::HelperList< int, int, Glib::List_Iterator< int > > 00066 { 00067 public: 00068 SelectionList(); 00069 explicit SelectionList(GnomeIconList* gparent); 00070 SelectionList(const SelectionList& src); 00071 virtual ~SelectionList() {} 00072 00073 SelectionList& operator=(const SelectionList& src); 00074 00075 typedef Glib::HelperList< int, int, Glib::List_Iterator< int > > type_base; 00076 00077 GnomeIconList* gparent(); 00078 const GnomeIconList* gparent() const; 00079 00080 virtual GList*& glist() const; // front of list 00081 00082 virtual void erase(iterator start, iterator stop); 00083 virtual iterator erase(iterator); //Implented as custom or by LIST_CONTAINER_REMOVE 00084 virtual void remove(const_reference); //Implented as custom or by LIST_CONTAINER_REMOVE 00085 00087 reference operator[](size_type l) const; 00088 00089 public: 00090 iterator insert(iterator position, element_type& e); //custom-implemented. 00091 00092 template <class InputIterator> 00093 inline void insert(iterator position, InputIterator first, InputIterator last) 00094 { 00095 for(;first != last; ++first) 00096 position = insert(position, *first); 00097 } 00098 00099 inline void push_front(element_type& e) 00100 { insert(begin(), e); } 00101 inline void push_back(element_type& e) 00102 { insert(end(), e); } 00103 00104 00105 protected: 00106 mutable GList* glist_; 00107 }; 00108 00109 00110 } /* namespace IconList_Helpers */ 00111 00112 00113 class Group; 00114 00115 00116 class IconList : public Gnome::Canvas::Canvas 00117 { 00118 public: 00119 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00120 typedef IconList CppObjectType; 00121 typedef IconList_Class CppClassType; 00122 typedef GnomeIconList BaseObjectType; 00123 typedef GnomeIconListClass BaseClassType; 00124 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 00125 00126 virtual ~IconList(); 00127 00128 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00129 00130 private: 00131 friend class IconList_Class; 00132 static CppClassType iconlist_class_; 00133 00134 // noncopyable 00135 IconList(const IconList&); 00136 IconList& operator=(const IconList&); 00137 00138 protected: 00139 explicit IconList(const Glib::ConstructParams& construct_params); 00140 explicit IconList(GnomeIconList* castitem); 00141 00142 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 00143 00144 public: 00145 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00146 static GType get_type() G_GNUC_CONST; 00147 00148 00149 static GType get_base_type() G_GNUC_CONST; 00150 #endif 00151 00153 GnomeIconList* gobj() { return reinterpret_cast<GnomeIconList*>(gobject_); } 00154 00156 const GnomeIconList* gobj() const { return reinterpret_cast<GnomeIconList*>(gobject_); } 00157 00158 00159 public: 00160 //C++ methods used to invoke GTK+ virtual functions: 00161 #ifdef GLIBMM_VFUNCS_ENABLED 00162 #endif //GLIBMM_VFUNCS_ENABLED 00163 00164 protected: 00165 //GTK+ Virtual Functions (override these to change behaviour): 00166 #ifdef GLIBMM_VFUNCS_ENABLED 00167 #endif //GLIBMM_VFUNCS_ENABLED 00168 00169 //Default Signal Handlers:: 00170 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED 00171 virtual void on_select_icon(int num, GdkEvent* event); 00172 virtual void on_unselect_icon(int num, GdkEvent* event); 00173 virtual void on_focus_icon(int num); 00174 virtual bool on_text_changed(int num, const char* new_text); 00175 virtual void on_move_cursor(Gtk::DirectionType dir, bool clear_selection); 00176 virtual void on_toggle_cursor_selection(); 00177 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED 00178 00179 00180 private: 00181 00182 00183 public: 00184 //TODO: add missing ctor args 00185 explicit IconList(guint icon_width = 80, bool is_editable = false); 00186 00187 00188 void set_hadjustment(Gtk::Adjustment& hadj); 00189 00190 void set_vadjustment(Gtk::Adjustment& vadj); 00191 00192 void freeze(); 00193 00194 void thaw(); 00195 00196 void insert(int pos, const Glib::ustring& icon_filename, const Glib::ustring& text); 00197 00198 void insert(int idx, const Glib::RefPtr<Gdk::Pixbuf>& im, const Glib::ustring& icon_filename, const Glib::ustring& text); 00199 00200 int append(const Glib::ustring& icon_filename, const Glib::ustring& text); 00201 00202 int append(const Glib::RefPtr<Gdk::Pixbuf>& im, const Glib::ustring& icon_filename, const Glib::ustring& text); 00203 00204 void clear(); 00205 00206 void remove(int pos); 00207 00208 guint get_num_icons() const; 00209 00210 Gtk::SelectionMode get_selection_mode() const; 00211 00212 void set_selection_mode(Gtk::SelectionMode mode); 00213 00214 void select_icon(int idx); 00215 00216 void unselect_icon(int idx); 00217 00218 int select_all(); 00219 00220 int unselect_all(); 00221 00222 void focus_icon(gint idx); 00223 00224 void set_icon_width (int w); 00225 00226 void set_row_spacing(int spacing); 00227 00228 void set_col_spacing(int spacing); 00229 00230 void set_text_spacing(int spacing); 00231 00232 void set_icon_border(int spacing); 00233 00234 void set_separators(const Glib::ustring& sep); 00235 00236 Glib::ustring get_icon_filename(int idx) const; 00237 00238 int find_icon_from_filename(const Glib::ustring& filename) const; 00239 00240 void set_icon_data(int pos, gpointer data); 00241 00242 00243 int find_icon_from_data(gpointer data) const; 00244 00245 gpointer get_icon_data(int pos); 00246 00247 void moveto(int pos, double yalign); 00248 00249 Gtk::Visibility icon_is_visible(int pos); 00250 00251 int get_icon_at(int x, int y) const; 00252 00253 int get_items_per_line() const; 00254 00255 00256 IconTextItem* get_icon_text_item(int idx); 00257 00258 Gnome::Canvas::Pixbuf* get_icon_pixbuf_item(int idx); 00259 00260 typedef IconList_Helpers::SelectionList SelectionList; 00261 SelectionList& selection(); 00262 const SelectionList& selection() const; 00263 00264 00270 Glib::SignalProxy2< void,int,GdkEvent* > signal_select_icon(); 00271 ; 00272 00278 Glib::SignalProxy2< void,int,GdkEvent* > signal_unselect_icon(); 00279 ; 00280 00281 00287 Glib::SignalProxy1< void,int > signal_focus_icon(); 00288 ; 00289 00290 00296 Glib::SignalProxy2< bool,int,const char* > signal_text_changed(); 00297 ; 00298 00299 /* Key Binding signals */ 00300 00306 Glib::SignalProxy2< void,Gtk::DirectionType,bool > signal_move_cursor(); 00307 00308 00314 Glib::SignalProxy0< void > signal_toggle_cursor_selection(); 00315 00316 00317 protected: 00318 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00319 mutable SelectionList selection_proxy_; 00320 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 00321 00322 00323 }; 00324 00325 } /* namespace UI */ 00326 } /* namespace Gnome */ 00327 00328 00329 namespace Glib 00330 { 00339 Gnome::UI::IconList* wrap(GnomeIconList* object, bool take_copy = false); 00340 } //namespace Glib 00341 00342 00343 #endif /* _LIBGNOMEUIMM_ICON_LIST_H */ 00344