00001
00002
00003
#ifndef _LIBGNOMEUIMM_ICON_LIST_H
00004
#define _LIBGNOMEUIMM_ICON_LIST_H
00005
00006
#include <glibmm.h>
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
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
00045
00046
00047
namespace Gnome
00048 {
00049
00050
namespace UI
00051 {
class IconList_Class; }
00052
00053 }
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;
00080
00081 virtual
void erase(iterator start, iterator stop);
00082 virtual iterator erase(iterator);
00083 virtual
void remove(const_reference);
00084
00086 reference operator[](size_type l) const;
00087
00088 public:
00089 iterator insert(iterator position, element_type& e);
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 }
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
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
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
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
00158
00159
protected:
00160
00161
00162
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
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
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
00304
00305
00306 };
00307
00308 }
00309 }
00310
00311 namespace Glib
00312 {
00314
Gnome::UI::IconList*
wrap(GnomeIconList* object,
bool take_copy =
false);
00315 }
00316
#endif
00317