Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

icon-list.h

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

Generated on Tue Aug 17 23:46:31 2004 for libgnomeuimm by doxygen 1.3.7