Xfce Foundation Classes
Main Page  | IndexNamespace List  |  Alphabetical List  |  Class List  |  File List


Xfc::Gtk::TreeViewColumn Class Reference

A GtkTreeViewColumn C++ wrapper class. More...

#include <xfc/gtk/treeviewcolumn.hh>

Inheritance diagram for Xfc::Gtk::TreeViewColumn:

Xfc::Gtk::Object Xfc::Gtk::CellLayout Xfc::G::Object Xfc::G::TypeInterface Xfc::G::TypeInstance Xfc::G::TypeInstance Xfc::Trackable Xfc::Trackable List of all members.

Signal Prototypes

Public Member Functions

Accessors
Methods
Signal Proxies

Detailed Description

A GtkTreeViewColumn C++ wrapper class.

A TreeViewColumn is the object that TreeView uses to organize the vertical columns in the tree view. It needs to know the name of the column to label for the user, what type of cell renderer to use, and which piece of data to retrieve from the model for a given row.

See also: the TreeView Widget HOWTO and example.


Constructor & Destructor Documentation

Xfc::Gtk::TreeViewColumn::TreeViewColumn ( GtkTreeViewColumn *  tree_column,
bool  owns_reference = false 
) [explicit, protected]

Construct a new TreeViewColumn from an existing GtkTreeViewColumn.

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

Xfc::Gtk::TreeViewColumn::TreeViewColumn ( const String title  ) 

Construct a new tree column and sets the title.

Parameters:
title The title to set the header to.

Xfc::Gtk::TreeViewColumn::TreeViewColumn ( const String title,
CellRenderer cell,
const String attribute,
int  column 
)

Construct a new tree column with a number of default values (see add_attribute()).

Parameters:
title The title to set the header to.
cell The CellRenderer.
attribute An attribute on the renderer.
column The column position on the model to get the attribute from.
This is equivalent constructing an empty column and calling set_title(), pack_start(), and add_attributes().

Here's a simple example:

< enum { TEXT_COLUMN, N_COLUMNS };
< ...
< Gtk::CellRendererText  *cell = new Gtk::CellRendererText();
< Gtk::TreeViewColumn *column = new Gtk::TreeViewColumn("Title", cell, "text", TEXT_COLUMN);
<

Xfc::Gtk::TreeViewColumn::TreeViewColumn ( const String title,
CellRenderer cell,
const CellColumnAttributes attributes 
)

Construct a new tree column with a number of default values.

Parameters:
title The title to set the header to.
cell The CellRenderer.
attributes The tree column attributes to set.
This is equivalent constructing an empty column and calling set_title(), pack_start(), and add_attributes().

Here's a simple example:

< enum { TEXT_COLUMN, COLOR_COLUMN, N_COLUMNS };
< ...
< Gtk::CellRendererText  *cell = new Gtk::CellRendererText();
<
< CellColumnAttributes attributes;
< attributes.add("text", TEXT_COLUMN);
< attributes.add("foreground", COLOR_COLUMN);
< Gtk::TreeViewColumn *column = new Gtk::TreeViewColumn("Title", cell, attributes);
<

Xfc::Gtk::TreeViewColumn::TreeViewColumn ( GtkTreeViewColumn *  tree_column,
bool  owns_reference = false 
) [explicit, protected]

Construct a new TreeViewColumn from an existing GtkTreeViewColumn.

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

Xfc::Gtk::TreeViewColumn::TreeViewColumn ( const String title  ) 

Construct a new tree column and sets the title.

Parameters:
title The title to set the header to.

Xfc::Gtk::TreeViewColumn::TreeViewColumn ( const String title,
CellRenderer cell,
const String attribute,
int  column 
)

Construct a new tree column with a number of default values (see add_attribute()).

Parameters:
title The title to set the header to.
cell The CellRenderer.
attribute An attribute on the renderer.
column The column position on the model to get the attribute from.
This is equivalent constructing an empty column and calling set_title(), pack_start(), and add_attributes().

Here's a simple example:

< enum { TEXT_COLUMN, N_COLUMNS };
< ...
< Gtk::CellRendererText  *cell = new Gtk::CellRendererText();
< Gtk::TreeViewColumn *column = new Gtk::TreeViewColumn("Title", cell, "text", TEXT_COLUMN);
<

Xfc::Gtk::TreeViewColumn::TreeViewColumn ( const String title,
CellRenderer cell,
const CellColumnAttributes attributes 
)

Construct a new tree column with a number of default values.

Parameters:
title The title to set the header to.
cell The CellRenderer.
attributes The tree column attributes to set.
This is equivalent constructing an empty column and calling set_title(), pack_start(), and add_attributes().

Here's a simple example:

< enum { TEXT_COLUMN, COLOR_COLUMN, N_COLUMNS };
< ...
< Gtk::CellRendererText  *cell = new Gtk::CellRendererText();
<
< CellColumnAttributes attributes;
< attributes.add("text", TEXT_COLUMN);
< attributes.add("foreground", COLOR_COLUMN);
< Gtk::TreeViewColumn *column = new Gtk::TreeViewColumn("Title", cell, attributes);
<


Member Function Documentation

bool Xfc::Gtk::TreeViewColumn::get_visible (  )  const

Returns true if the tree column is visible.

Returns:
Whether the column is visible or not.
If the tree column is visible, then the tree will show the column.

int Xfc::Gtk::TreeViewColumn::get_fixed_width (  )  const

Gets the fixed width of the column.

This value may not be the actual width of the column on the screen, just what is requested.

bool Xfc::Gtk::TreeViewColumn::get_expand (  )  const

Determines whether the column expands to take any of the available space.

Returns:
true if the column expands.

Widget* Xfc::Gtk::TreeViewColumn::get_widget (  )  const

Returns the Widget in the button on the column header.

Returns:
The Widget in the column header, or null.
If a custom widget has not been set then null is returned.

int Xfc::Gtk::TreeViewColumn::get_sort_column_id (  )  const

Gets the logical sort_column_id that the model sorts on when this column is selected for sorting (see set_sort_column_id()).

Returns:
The current sort_column_id for this column, or -1 if this column can't be used for sorting.

bool Xfc::Gtk::TreeViewColumn::get_sort_indicator (  )  const

Gets the value set by set_sort_indicator().

Returns:
Whether the sort indicator arrow is displayed.

SortType Xfc::Gtk::TreeViewColumn::get_sort_order (  )  const

Gets the value set by set_sort_order().

Returns:
The sort order the sort indicator is indicating.

bool Xfc::Gtk::TreeViewColumn::get_cell_renderers ( std::vector< CellRenderer * > &  cell_list  )  const

Gets a list of all the cell renderers in the column, in no particular order.

Parameters:
cell_list A reference to a vector of CellRenderer* to hold the list of cell renderers.
Returns:
true if cell_list is not empty.

void Xfc::Gtk::TreeViewColumn::cell_get_size ( const Gdk::Rectangle cell_area,
int *  x_offset,
int *  y_offset,
int *  width,
int *  height 
) const

Obtains the width and height needed to render the column.

Parameters:
cell_area The area a cell in the column will be allocated, or null.
x_offset The location to return X offset of a cell relative to cell_area, or null.
y_offset The location to return Y offset of a cell relative to cell_area, or null.
width The location to return width needed to render a cell, or null.
height The location to return height needed to render a cell, or null.
This is used primarily by the Gtk::TreeView.

bool Xfc::Gtk::TreeViewColumn::cell_is_visible (  )  const

Returns true if any of the cells packed into the tree column are visible.

Returns:
true if any of the cells packed into the tree_column are currently visible.
For this to be meaningful, you must first initialize the cells with cell_set_cell_data().

void Xfc::Gtk::TreeViewColumn::pack_start ( CellRenderer cell,
bool  expand = true 
)

Packs the cell into the beginning of the column.

Parameters:
cell The CellRenderer.
expand true if cell is to be given extra space allocated to box.
If expand is false, then the cell is allocated no more space than it needs. Any unused space is divided evenly between cells for which expand is true.

Reimplemented from Xfc::Gtk::CellLayout.

void Xfc::Gtk::TreeViewColumn::pack_end ( CellRenderer cell,
bool  expand = true 
)

Adds the cell to end of the column.

Parameters:
cell The CellRenderer.
expand true if cell is to be given extra space allocated to box.
If expand is false, then the cell is allocated no more space than it needs. Any unused space is divided evenly between cells for which expand is true.

Reimplemented from Xfc::Gtk::CellLayout.

void Xfc::Gtk::TreeViewColumn::add_attribute ( CellRenderer cell,
const String attribute,
int  column 
)

Adds an attribute mapping to the list in the tree column.

Parameters:
cell The CellRenderer to set attributes on.
attribute An attribute on the renderer.
column The column position on the model to get the attribute from.
The column is the column of the model to get a value from, and the attribute is the parameter on cell to be set from the value. So for example if column 2 of the model contains strings, you could have the "text" attribute of a CellRendererText get its values from column 2.

Reimplemented from Xfc::Gtk::CellLayout.

void Xfc::Gtk::TreeViewColumn::set_attributes ( CellRenderer cell,
const CellColumnAttributes attributes 
)

Sets the attributes in the list as the attributes of the tree column.

Parameters:
cell The CellRenderer.
attributes The tree column attributes to set.

Reimplemented from Xfc::Gtk::CellLayout.

void Xfc::Gtk::TreeViewColumn::set_cell_data_func ( CellRenderer cell,
const CellDataSlot slot 
)

Sets the CellDataSlot to use for the column.

Parameters:
cell A CellRenderer.
slot The CellDataSlot to use.
The CellDataSlot is used instead of the standard attributes mapping for setting the column value, and should set the value of the tree column's cell renderer as appropriate. slot may be null to remove an older one.

void Xfc::Gtk::TreeViewColumn::remove_cell_data_func ( CellRenderer cell  ) 

Removes the current CellDataSlot used for the column.

Parameters:
cell A CellRenderer.

Reimplemented from Xfc::Gtk::CellLayout.

void Xfc::Gtk::TreeViewColumn::clear_attributes ( CellRenderer cell  ) 

Clears all existing attributes previously set with set_attributes().

Parameters:
cell A CellRenderer to clear the attribute mapping on.

Reimplemented from Xfc::Gtk::CellLayout.

void Xfc::Gtk::TreeViewColumn::set_spacing ( int  spacing  ) 

Sets the spacing field of the tree column, which is the number of pixels to place between cell renderers packed into it.

Parameters:
spacing The distance between cell renderers in pixels.

void Xfc::Gtk::TreeViewColumn::set_visible ( bool  visible  ) 

Sets the visibility of the tree column.

Parameters:
visible true if the tree column is visible.

void Xfc::Gtk::TreeViewColumn::set_resizable ( bool  resizable  ) 

If resizable is true, then the user can explicitly resize the column by grabbing the outer edge of the column button.

Parameters:
resizable true if the column can be resized.
If resizable is true and sizing mode of the column is TREE_VIEW_COLUMN_AUTOSIZE, then the sizing mode is changed to TREE_VIEW_COLUMN_GROW_ONLY.

void Xfc::Gtk::TreeViewColumn::set_sizing ( TreeViewColumnSizing  type  ) 

Sets the growth behavior of the tree column to type.

Parameters:
type The TreeViewColumnSizing.

void Xfc::Gtk::TreeViewColumn::set_fixed_width ( int  fixed_width  ) 

Sets the size of the column in pixels.

Parameters:
fixed_width The size to set tree_column to. Must be greater than 0.
This is only meaningful if the sizing type is TREE_VIEW_COLUMN_FIXED. The size of the column is clamped to the min/max width for the column. Please note that the min/max width of the column doesn't actually affect the "fixed_width" property of the widget, just the actual size when displayed.

void Xfc::Gtk::TreeViewColumn::set_min_width ( int  min_width  ) 

Sets the minimum width of the tree column.

Parameters:
min_width The minimum width of the column in pixels, or -1.
If min_width is -1, then the minimum width is unset.

void Xfc::Gtk::TreeViewColumn::set_max_width ( int  max_width  ) 

Sets the maximum width of the tree column.

Parameters:
max_width The maximum width of the column in pixels, or -1.
If max_width is -1, then the maximum width is unset. Note, the column can actually be wider than max_width if it's the last column in a view. In this case, the column expands to fill any extra space.

void Xfc::Gtk::TreeViewColumn::set_title ( const String title  ) 

Sets the title of the tree column.

Parameters:
title The title of the tree column.
If a custom widget has been set, then this value is ignored.

void Xfc::Gtk::TreeViewColumn::set_expand ( bool  expand  ) 

Sets the column to take available extra space.

Parameters:
expand Set true if the column should expand.
This space is shared equally amongst all columns that have expand set to true. If no column has this option set, then the last column gets all extra space. By default, every column is created with this false.

void Xfc::Gtk::TreeViewColumn::clicked (  ) 

Emits the "clicked" signal on the column.

This method will only work if the tree column is clickable.

void Xfc::Gtk::TreeViewColumn::set_clickable ( bool  active  ) 

Sets the header to be active if active is true.

Parameters:
active true if the header is active.
When the header is active, then it can take keyboard focus, and can be clicked.

void Xfc::Gtk::TreeViewColumn::set_widget ( Widget widget  ) 

Sets the widget in the header to be widget.

Parameters:
widget A child Widget, or null.
If widget is null, then the header button is set with a Label set to the title of tree_column.

void Xfc::Gtk::TreeViewColumn::set_alignment ( float  xalign  ) 

Sets the alignment of the title or custom widget inside the column header.

Parameters:
xalign The alignment, which is between [0.0 and 1.0] inclusive.
The alignment determines its location inside the button - 0.0 for left, 0.5 for center, 1.0 for right.

void Xfc::Gtk::TreeViewColumn::set_reorderable ( bool  reorderable  ) 

If reorderable is true, then the column can be reordered by the end user dragging the header.

Parameters:
reorderable true if the column can be reordered.

void Xfc::Gtk::TreeViewColumn::set_sort_column_id ( int  sort_column_id  ) 

Sets the logical sort_column_id that this column sorts on when this column is selected for sorting.

Parameters:
sort_column_id The sort_column_id of the model to sort on.
Setting the logical sort_column_id makes the column header clickable. You probably only want to use set_sort_column_id(). The other sorting methods exist to allow for custom sorting.

void Xfc::Gtk::TreeViewColumn::set_sort_indicator ( bool  setting  ) 

Call this method with a setting of true to display an arrow in the header button indicating the column is sorted.

Parameters:
setting true to display an indicator that the column is sorted.
Call set_sort_order() to change the direction of the arrow.

void Xfc::Gtk::TreeViewColumn::set_sort_order ( SortType  order  ) 

Changes the appearance of the sort indicator.

Parameters:
order The sort order that the sort indicator should indicate.
This does not actually sort the model. Use set_sort_column_id() if you want automatic sorting support. This method is primarily for custom sorting behavior, and should be used in conjunction with Gtk::TreeSortable::set_sort_column() to do that. For custom models, the mechanism will vary.

The sort indicator changes direction to indicate normal sort or reverse sort. Note that you must have the sort indicator enabled to see anything when calling this method; see set_sort_indicator().

void Xfc::Gtk::TreeViewColumn::cell_set_cell_data ( const TreeModel model,
const TreeIter iter,
bool  is_expander,
bool  is_expanded 
)

Sets the cell renderer based on the tree model and iter.

Parameters:
model The TreeModel to to get the cell renderers attributes from.
iter The TreeIter to to get the cell renderer's attributes from.
is_expander Set true if the row has children.
is_expanded Set true if the row has visible children.
That is, for every attribute mapping in the tree column, it will get a value from the set column on the iter, and use that value to set the attribute on the cell renderer. This is used primarily by the Gtk::TreeView.

void Xfc::Gtk::TreeViewColumn::focus_cell ( CellRenderer cell  ) 

Sets the current keyboard focus to be at cell, if the column contains 2 or more editable and activatable cells.

Parameters:
cell A CellRenderer.


Member Data Documentation

const ClickedSignalType Xfc::Gtk::TreeViewColumn::clicked_signal [static, protected]

Clicked signal (see signal_clicked()).

Calls a slot with the signature:

< void function();
<


The documentation for this class was generated from the following file: Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC 4.3