Xfce Foundation Classes
Main Page | Index | Namespace List | Alphabetical List | Class List | File List

# Xfc::Gtk::IconView Class Reference

A GtkIconView C++ wrapper class. More...

`#include <xfc/gtk/iconview.hh>`

Inheritance diagram for Xfc::Gtk::IconView:

List of all members.

## Signal Prototypes

- const SetScrollAdjustmentsSignalType set_scroll_adjustments_signal
    Set scroll adjustments signal (see signal_set_scroll_adjustments()).
- const ItemActivatedSignalType item_activated_signal
    Item activated signal (see signal_item_activated()).
- const SelectionChangedSignalType selection_changed_signal
    Selection changed signal (see signal_selection_changed()).

## Public Types

- typedef sigc::slot< void,
  const TreePath & > ForeachSlot
    Signature of the callback slot to be called by selected_foreach() to map all selected rows.

## Public Member Functions

Constructors

- IconView ()
    Constructs a new IconView widget.
- IconView (TreeModel &model)
    Constructs a new IconView widget with the model model.
- virtual ~IconView ()
    Destructor.

Accessors

- GtkIconView * gtk_icon_view () const
    Get a pointer to the GtkIconView structure.
- operator GtkIconView * () const
    Conversion operator; safely converts an IconView to a GtkIconView pointer.
- TreeModel * get_model () const
    Gets the model the icon view is based on.
- int get_text_column () const
    Gets the column with text for icon view.
- int get_markup_column () const
    Gets the column with markup text for the icon view.
- int get_pixbuf_column () const
    Gets the column with pixbufs for the icon view.
- Orientation get_orientation () const
    Gets the value of the "orientation" property which determines whether the labels are drawn beside the icons instead of below.
- int get_columns () const
    Gets the number of columns to displayed in the icon view.
- int get_item_width () const
    Gets the current width used for each item in the icon view.
- int get_spacing () const
    Gets the space which is inserted between cells of an item.
- int get_row_spacing () const
    Gets the space between grid rows in the icon view.
- int get_column_spacing () const
    Gets the space between grid columns in the icon view.
- int get_margin () const
    Gets the space at the edges of the icon view.
- Pointer< TreePath > get_path_at_pos (int x, int y) const
    Finds the path at the point (x, y), relative to widget coordinates.
- SelectionMode get_selection_mode () const
    Gets the selection mode of the icon view.
- bool path_is_selected (const TreePath &path) const
    Determines whether the icon pointed to by path is currently selected.
- bool get_selected_items (std::vector< TreePath > &items) const
    Fills a vector of TreePath with a list of the paths of all selected items.

Methods

- void set_model (TreeModel *model)
    Sets the model for the icon view.
- void set_text_column (int column)
    Sets the column with text for the icon view to be column.
- void set_markup_column (int column)
    Sets the column with markup information for the icon view to be column.
- void set_pixbuf_column (int column)
    Sets the column with pixbufs for the icon view to be column.
- void set_orientation (Orientation orientation)
    Sets the "orientation" property which determines whether the labels are drawn beside the icons instead of below.
- void set_columns (int columns)
    Sets the number of columns to display in the icon view.
- void set_item_width (int item_width)
    Sets the width used for each item in the icon view.
- void set_spacing (int spacing)
    Sets the space which is inserted between the cells of an item in the icon view.
- void set_row_spacing (int row_spacing)
    Sets the space which is inserted between grid rows in the icon view.
- void set_column_spacing (int column_spacing)
    Sets the space which is inserted between grid columns in the icon view.
- void set_margin (int margin)
    Sets the space which is inserted at the edges of the icon view.
- void selected_foreach (const ForeachSlot &each)
    Calls the ForeachSlot for each selected icon.
- void set_selection_mode (SelectionMode mode)
    Sets the selection mode of the icon view.
- void select_path (const TreePath &path)
    Selects the row at path.
- void unselect_path (const TreePath &path)
    Unselects the row at path.
- void select_all ()
    Selects all the icons. The icon view must have its selection mode set to Gtk::SELECTION_MULTIPLE.
- void unselect_all ()
    Unselects all the icons.
- void item_activated (const TreePath &path)
    Activates the item determined by path.

Signal Proxies

- const SetScrollAdjustmentsSignalProxy signal_set_scroll_adjustments ()
    Connect to the set_scroll_adjustments_signal; emitted when an icon view is added to a scrolling aware parent.
- const ItemActivatedSignalProxy signal_item_activated ()
    Connect to the item_activated_signal; emitted when an item is activated.
- const SelectionChangedSignalProxy signal_selection_changed ()
    Connect to the selection_changed_signal; emitted when the selection in the icon view changes.

## Protected Member Functions

Constructors

- IconView (GtkIconView *icon_view, bool owns_reference=false)
    Construct a new IconView from an existing GtkIconView.

## Detailed Description

A GtkIconView C++ wrapper class.

IconView provides an alternative view on a list model. It displays the model as a grid of icons with labels. Like TreeView, it allows to select one or multiple items (depending on the selection mode, see set_selection_mode()). In addition to selection with the arrow keys, IconView supports rubberband selection, which is controlled by dragging the pointer.

## Member Typedef Documentation

typedef sigc::slot<void, const TreePath&> Xfc::Gtk::IconView::ForeachSlot

| Signature of the callback slot to be called by selected_foreach() to map all selected rows. Example: Method signature for ForeachSlot.
                 void method(const Gtk::TreePath& path);
                 // path: The TreePath of a selected row.
The slot is called on every selected row in the icon view. Reimplemented from Xfc::Gtk::Container.

## Constructor & Destructor Documentation

Xfc::Gtk::IconView::IconView | ( | GtkIconView * | icon_view,
|  | bool | owns_reference = `false`
| ) | `[explicit, protected]`

  | Construct a new IconView from an existing GtkIconView. Parameters:
  | icon_view | A pointer to a GtkIconView.
  | owns_reference | Set false if the initial reference count is floating, set true if it's not.
The icon_view can be a newly created GtkIconView or an existing GtkIconView. (see G::Object::Object).

Xfc::Gtk::IconView::IconView | ( | TreeModel & | model | ) |

  | Constructs a new IconView widget with the model model. Parameters:
  | model | The model.

## Member Function Documentation

int Xfc::Gtk::IconView::get_column_spacing | ( |  | ) | const

| Gets the space between grid columns in the icon view. Returns: The space to between grid columns.

int Xfc::Gtk::IconView::get_columns | ( |  | ) | const

| Gets the number of columns to displayed in the icon view. Returns: The number of columns.

int Xfc::Gtk::IconView::get_item_width | ( |  | ) | const

| Gets the current width used for each item in the icon view. Returns: The item width to use.

int Xfc::Gtk::IconView::get_margin | ( |  | ) | const

| Gets the space at the edges of the icon view. Returns: The space at the edges of the icon view.

int Xfc::Gtk::IconView::get_markup_column | ( |  | ) | const

| Gets the column with markup text for the icon view. Returns: The markup column, or -1 if it's unset.

TreeModel* Xfc::Gtk::IconView::get_model | ( |  | ) | const

| Gets the model the icon view is based on. Returns: A Gtk::TreeModel, or null if none is currently being used.

Orientation Xfc::Gtk::IconView::get_orientation | ( |  | ) | const

| Gets the value of the "orientation" property which determines whether the labels are drawn beside the icons instead of below. Returns: The relative position of texts and icons.

Pointer<TreePath> Xfc::Gtk::IconView::get_path_at_pos | ( | int | x,
|  | int | y
| ) | const

  | Finds the path at the point (x, y), relative to widget coordinates. Parameters:
  | x | The x position to be identified.
  | y | The y position to be identified.
Returns: The TreePath corresponding to the icon, or null if no icon exists at that position.

int Xfc::Gtk::IconView::get_pixbuf_column | ( |  | ) | const

| Gets the column with pixbufs for the icon view. Returns: The pixbuf column, or -1 if it's unset.

int Xfc::Gtk::IconView::get_row_spacing | ( |  | ) | const

| Gets the space between grid rows in the icon view. Returns: The space to between grid rows.

bool Xfc::Gtk::IconView::get_selected_items | ( | std::vector< TreePath > & | items | ) | const

  | Fills a vector of TreePath with a list of the paths of all selected items. Parameters:
  | items | The vector of TreePath that will hold the list of paths.
Returns: true if the vector is not empty. Additionally, if you are planning on modifying the model after calling this function, you may want to convert the returned list into a list of Gtk::TreeRowReferences. To do this use the constructor TreeRowReference(G::Object&, TreeModel&, const TreePath&).

SelectionMode Xfc::Gtk::IconView::get_selection_mode | ( |  | ) | const

| Gets the selection mode of the icon view. Returns: The current selection mode.

int Xfc::Gtk::IconView::get_spacing | ( |  | ) | const

| Gets the space which is inserted between cells of an item. Returns: The space between cells of an item (e.g. pixbuf and text).

int Xfc::Gtk::IconView::get_text_column | ( |  | ) | const

| Gets the column with text for icon view. Returns: The text column, or -1 if it's unset.

void Xfc::Gtk::IconView::item_activated | ( | const TreePath & | path | ) |

  | Activates the item determined by path. Parameters:
  | path | The TreePath to be activated.

bool Xfc::Gtk::IconView::path_is_selected | ( | const TreePath & | path | ) | const

  | Determines whether the icon pointed to by path is currently selected. Parameters:
  | path | A TreePath to check selection on.
Returns: true if the path is selected. If icon does not point to a valid location, false is returned.

void Xfc::Gtk::IconView::select_path | ( | const TreePath & | path | ) |

  | Selects the row at path. Parameters:
  | path | The TreePath to be selected.

void Xfc::Gtk::IconView::selected_foreach | ( | const ForeachSlot & | each | ) |

  | Calls the ForeachSlot for each selected icon. Parameters:
  | each | The callback slot to call for each selected icon.
Note that the model or selection cannot be modified from within this function.

void Xfc::Gtk::IconView::set_column_spacing | ( | int | column_spacing | ) |

  | Sets the space which is inserted between grid columns in the icon view. Parameters:
  | column_spacing | The space to insert between grid columns.

void Xfc::Gtk::IconView::set_columns | ( | int | columns | ) |

  | Sets the number of columns to display in the icon view. Parameters:
  | columns | The number of columns.

void Xfc::Gtk::IconView::set_item_width | ( | int | item_width | ) |

  | Sets the width used for each item in the icon view. Parameters:
  | item_width | The item width to use.

void Xfc::Gtk::IconView::set_margin | ( | int | margin | ) |

  | Sets the space which is inserted at the edges of the icon view. Parameters:
  | margin | The space inserted at the edges of the icon view

void Xfc::Gtk::IconView::set_markup_column | ( | int | column | ) |

  | Sets the column with markup information for the icon view to be column. Parameters:
  | column | A column in the currently used model.
The markup column must be of type G_TYPE_STRING. If the markup column is set to something, it overrides the text column set by set_text_column().

void Xfc::Gtk::IconView::set_model | ( | TreeModel * | model | ) |

  | Sets the model for the icon view. Parameters:
  | model | The model.
If the icon view already has a model set, it will remove it before setting the new model. If model is null, then it will unset the old model.

void Xfc::Gtk::IconView::set_orientation | ( | Orientation | orientation | ) |

  | Sets the "orientation" property which determines whether the labels are drawn beside the icons instead of below. Parameters:
  | orientation | The relative position of texts and icons.

void Xfc::Gtk::IconView::set_pixbuf_column | ( | int | column | ) |

  | Sets the column with pixbufs for the icon view to be column. Parameters:
  | column | A column in the currently used model.
The pixbuf column must be of type GDK_TYPE_PIXBUF.

void Xfc::Gtk::IconView::set_row_spacing | ( | int | row_spacing | ) |

  | Sets the space which is inserted between grid rows in the icon view. Parameters:
  | row_spacing | The space to insert between grid rows.

void Xfc::Gtk::IconView::set_selection_mode | ( | SelectionMode | mode | ) |

  | Sets the selection mode of the icon view. Parameters:
  | mode | The selection mode.

void Xfc::Gtk::IconView::set_spacing | ( | int | spacing | ) |

  | Sets the space which is inserted between the cells of an item in the icon view. Parameters:
  | spacing | The space to insert between cells (e.g. pixbuf and text).

void Xfc::Gtk::IconView::set_text_column | ( | int | column | ) |

  | Sets the column with text for the icon view to be column. Parameters:
  | column | A column in the currently used model.
The text column must be of type G_TYPE_STRING.

void Xfc::Gtk::IconView::unselect_path | ( | const TreePath & | path | ) |

  | Unselects the row at path. Parameters:
  | path | The TreePath to be unselected.

## Member Data Documentation

const ItemActivatedSignalType Xfc::Gtk::IconView::item_activated_signal`[static, protected]`

| Item activated signal (see signal_item_activated()). Calls a slot with the signature:
                 void function(const TreePath& path);
                 // path: The TreePath of the item being activated.

const SelectionChangedSignalType Xfc::Gtk::IconView::selection_changed_signal`[static, protected]`

| Selection changed signal (see signal_selection_changed()). Calls a slot with the signature:
                 void function();

const SetScrollAdjustmentsSignalType Xfc::Gtk::IconView::set_scroll_adjustments_signal`[static, protected]`

| Set scroll adjustments signal (see signal_set_scroll_adjustments()). Calls a slot with the signature:
                 void function(Adjustment *hadjustment, Adjustment *vadjustment);
                 // hadjustment: The horizontal adjustment.
                 // vadjustment: The vertical adjustment.

The documentation for this class was generated from the following file:

- iconview.hh

Xfce Foundation Classes

Copyright © 2004-2005 The XFC Development Team | XFC 4.3