libgnomeuimm  2.28.0
icon-list.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _LIBGNOMEUIMM_ICON_LIST_H
4 #define _LIBGNOMEUIMM_ICON_LIST_H
5 
6 
7 #include <glibmm.h>
8 
9 // -*- C++ -*- // this is for the .hg, I realize gensig puts one in
10 /* $Id: icon-list.hg,v 1.18 2004/06/06 21:13:08 murrayc Exp $ */
11 
12 /* icon-list.hg
13  *
14  * Copyright (C) 1998 EMC Capital Management Inc.
15  * Developed by Havoc Pennington <hp@pobox.com>
16  *
17  * Copyright (C) 1999 The Gtk-- Development Team
18  *
19  * This library is free software; you can redistribute it and/or
20  * modify it under the terms of the GNU Lesser General Public
21  * License as published by the Free Software Foundation; either
22  * version 2.1 of the License, or (at your option) any later version.
23  *
24  * This library is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27  * Lesser General Public License for more details.
28  *
29  * You should have received a copy of the GNU Lesser General Public
30  * License along with this library; if not, write to the Free
31  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
32  */
33 
35 #include <libgnomecanvasmm/canvas.h>
36 #include <libgnomecanvasmm/pixbuf.h>
37 #include <gtkmm/container.h>
38 #include <glibmm/helperlist.h>
39 #include <libgnomeui/gnome-icon-list.h>
40 
41 
42 #ifndef DOXYGEN_SHOULD_SKIP_THIS
43 typedef struct _GnomeIconList GnomeIconList;
44 typedef struct _GnomeIconListClass GnomeIconListClass;
45 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
46 
47 
48 namespace Gnome
49 {
50 
51 namespace UI
52 { class IconList_Class; } // namespace UI
53 
54 } // namespace Gnome
55 namespace Gnome
56 {
57 
58 namespace UI
59 {
60 
61 namespace IconList_Helpers
62 {
63 
64 
65 class SelectionList : public Glib::HelperList< int, int, Glib::List_Iterator< int > >
66 {
67 public:
68  SelectionList();
69  explicit SelectionList(GnomeIconList* gparent);
70  SelectionList(const SelectionList& src);
71  virtual ~SelectionList() {}
72 
74 
75  typedef Glib::HelperList< int, int, Glib::List_Iterator< int > > type_base;
76 
77  GnomeIconList* gparent();
78  const GnomeIconList* gparent() const;
79 
80  virtual GList*& glist() const; // front of list
81 
82  virtual void erase(iterator start, iterator stop);
83  virtual iterator erase(iterator); //Implented as custom or by LIST_CONTAINER_REMOVE
84  virtual void remove(const_reference); //Implented as custom or by LIST_CONTAINER_REMOVE
85 
87  reference operator[](size_type l) const;
88 
89 public:
90  iterator insert(iterator position, element_type& e); //custom-implemented.
91 
92  template <class InputIterator>
93  inline void insert(iterator position, InputIterator first, InputIterator last)
94  {
95  for(;first != last; ++first)
96  position = insert(position, *first);
97  }
98 
99  inline void push_front(element_type& e)
100  { insert(begin(), e); }
101  inline void push_back(element_type& e)
102  { insert(end(), e); }
103 
104 
105 protected:
106  mutable GList* glist_;
107  };
108 
109 
110 } /* namespace IconList_Helpers */
111 
112 
113 class Group;
114 
115 
116 class IconList : public Gnome::Canvas::Canvas
117 {
118  public:
119 #ifndef DOXYGEN_SHOULD_SKIP_THIS
120  typedef IconList CppObjectType;
121  typedef IconList_Class CppClassType;
122  typedef GnomeIconList BaseObjectType;
123  typedef GnomeIconListClass BaseClassType;
124 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
125 
126  virtual ~IconList();
127 
128 #ifndef DOXYGEN_SHOULD_SKIP_THIS
129 
130 private:
131  friend class IconList_Class;
132  static CppClassType iconlist_class_;
133 
134  // noncopyable
135  IconList(const IconList&);
136  IconList& operator=(const IconList&);
137 
138 protected:
139  explicit IconList(const Glib::ConstructParams& construct_params);
140  explicit IconList(GnomeIconList* castitem);
141 
142 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
143 
144 public:
145 #ifndef DOXYGEN_SHOULD_SKIP_THIS
146  static GType get_type() G_GNUC_CONST;
147 
148 
149  static GType get_base_type() G_GNUC_CONST;
150 #endif
151 
153  GnomeIconList* gobj() { return reinterpret_cast<GnomeIconList*>(gobject_); }
154 
156  const GnomeIconList* gobj() const { return reinterpret_cast<GnomeIconList*>(gobject_); }
157 
158 
159 public:
160  //C++ methods used to invoke GTK+ virtual functions:
161 #ifdef GLIBMM_VFUNCS_ENABLED
162 #endif //GLIBMM_VFUNCS_ENABLED
163 
164 protected:
165  //GTK+ Virtual Functions (override these to change behaviour):
166 #ifdef GLIBMM_VFUNCS_ENABLED
167 #endif //GLIBMM_VFUNCS_ENABLED
168 
169  //Default Signal Handlers::
170 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
171  virtual void on_select_icon(int num, GdkEvent* event);
172  virtual void on_unselect_icon(int num, GdkEvent* event);
173  virtual void on_focus_icon(int num);
174  virtual bool on_text_changed(int num, const char* new_text);
175  virtual void on_move_cursor(Gtk::DirectionType dir, bool clear_selection);
176  virtual void on_toggle_cursor_selection();
177 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
178 
179 
180 private:
181 
182 
183 public:
184  //TODO: add missing ctor args
185  explicit IconList(guint icon_width = 80, bool is_editable = false);
186 
187 
188  void set_hadjustment(Gtk::Adjustment& hadj);
189 
190  void set_vadjustment(Gtk::Adjustment& vadj);
191 
192  void freeze();
193 
194  void thaw();
195 
196  void insert(int pos, const Glib::ustring& icon_filename, const Glib::ustring& text);
197 
198  void insert(int idx, const Glib::RefPtr<Gdk::Pixbuf>& im, const Glib::ustring& icon_filename, const Glib::ustring& text);
199 
200  int append(const Glib::ustring& icon_filename, const Glib::ustring& text);
201 
202  int append(const Glib::RefPtr<Gdk::Pixbuf>& im, const Glib::ustring& icon_filename, const Glib::ustring& text);
203 
204  void clear();
205 
206  void remove(int pos);
207 
208  guint get_num_icons() const;
209 
210  Gtk::SelectionMode get_selection_mode() const;
211 
212  void set_selection_mode(Gtk::SelectionMode mode);
213 
214  void select_icon(int idx);
215 
216  void unselect_icon(int idx);
217 
218  int select_all();
219 
220  int unselect_all();
221 
222  void focus_icon(gint idx);
223 
224  void set_icon_width (int w);
225 
226  void set_row_spacing(int spacing);
227 
228  void set_col_spacing(int spacing);
229 
230  void set_text_spacing(int spacing);
231 
232  void set_icon_border(int spacing);
233 
234  void set_separators(const Glib::ustring& sep);
235 
236  Glib::ustring get_icon_filename(int idx) const;
237 
238  int find_icon_from_filename(const Glib::ustring& filename) const;
239 
240  void set_icon_data(int pos, gpointer data);
241 
242 
243  int find_icon_from_data(gpointer data) const;
244 
245  gpointer get_icon_data(int pos);
246 
247  void moveto(int pos, double yalign);
248 
249  Gtk::Visibility icon_is_visible(int pos);
250 
251  int get_icon_at(int x, int y) const;
252 
253  int get_items_per_line() const;
254 
255 
257 
258  Gnome::Canvas::Pixbuf* get_icon_pixbuf_item(int idx);
259 
262  const SelectionList& selection() const;
263 
264 
270  Glib::SignalProxy2< void,int,GdkEvent* > signal_select_icon();
271 ;
272 
278  Glib::SignalProxy2< void,int,GdkEvent* > signal_unselect_icon();
279 ;
280 
281 
287  Glib::SignalProxy1< void,int > signal_focus_icon();
288 ;
289 
290 
296  Glib::SignalProxy2< bool,int,const char* > signal_text_changed();
297 ;
298 
299  /* Key Binding signals */
300 
306  Glib::SignalProxy2< void,Gtk::DirectionType,bool > signal_move_cursor();
307 
308 
314  Glib::SignalProxy0< void > signal_toggle_cursor_selection();
315 
316 
317 protected:
318 #ifndef DOXYGEN_SHOULD_SKIP_THIS
319  mutable SelectionList selection_proxy_;
320 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
321 
322 
323 };
324 
325 } /* namespace UI */
326 } /* namespace Gnome */
327 
328 
329 namespace Glib
330 {
339  Gnome::UI::IconList* wrap(GnomeIconList* object, bool take_copy = false);
340 } //namespace Glib
341 
342 
343 #endif /* _LIBGNOMEUIMM_ICON_LIST_H */
344