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

# Xfc::Gtk::CellColumnAttributes Class Reference

A C++ wrapper for setting multiple attributes on a column of cells. More...

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

Inheritance diagram for Xfc::Gtk::CellColumnAttributes:

List of all members.

## Public Member Functions

Constructors

- CellColumnAttributes ()
    Constructs an empty CellColumnAttributes object.
- CellColumnAttributes (const String &attribute, int column)
    Constructs a new CellColumnAttributes object and adds the attribute entry for column.
- ~CellColumnAttributes ()
    Destructor.

Accessors

- const std::vector< String > & get_attributes () const
    Returns a const reference to the vector of attributes added.
- const std::vector< int > & get_columns () const
    Returns a const reference to the vector of columns added.
- bool empty () const
    Determines if the tree column attributes object is empty.
- int size () const
    Gets the number of entries added to the CellColumnAttributes object.

Methods

- void add (const String &attribute, int column)
    Adds an attribute entry for column to the CellColumnAttributes object.
- void clear ()
    Removes all entries from the CellColumnAttributes object.

## Detailed Description

A C++ wrapper for setting multiple attributes on a column of cells.

CellColumnAttributes is a convenience class that is used to set multiple attributes on a column of cells at one time. It is dervied from Xfc::StackObject so it cannot be created dynamically. CellColumnAttributes is used instead the variable argument lists found in the GTK+ C API.

To add entries to a CellColumnAttributes object call add(). There is no remove() function but you can call clear() to remove all entries. You can call clear() when you want to reuse a CellColumnAttributes object.

The CellColumnAttributes object is used in the Gtk::CellLayout and Gtk::TreeViewColumn API's.

Here's a simple TreeViewColumn 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);

## Constructor & Destructor Documentation

Xfc::Gtk::CellColumnAttributes::CellColumnAttributes | ( | const String & | attribute,
|  | int | column
| ) |

  | Constructs a new CellColumnAttributes object and adds the attribute entry for column. Parameters:
  | attribute | An attribute on a cell renderer.
  | column | The column position in a tree model to get the attribute from.

## Member Function Documentation

void Xfc::Gtk::CellColumnAttributes::add | ( | const String & | attribute,
|  | int | column
| ) |

  | Adds an attribute entry for column to the CellColumnAttributes object. Parameters:
  | attribute | An attribute on a cell renderer.
  | column | The column position in a tree model to get the attribute from.

bool Xfc::Gtk::CellColumnAttributes::empty | ( |  | ) | const

| Determines if the tree column attributes object is empty. Returns: true if the CellColumnAttributes object is empty.

const std::vector<String>& Xfc::Gtk::CellColumnAttributes::get_attributes | ( |  | ) | const

| Returns a const reference to the vector of attributes added. Returns: A vector of String.

const std::vector<int>& Xfc::Gtk::CellColumnAttributes::get_columns | ( |  | ) | const

| Returns a const reference to the vector of columns added. Returns: A vector of int.

int Xfc::Gtk::CellColumnAttributes::size | ( |  | ) | const

| Gets the number of entries added to the CellColumnAttributes object. Returns: The number of entries added.

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

- celllayout.hh

Xfce Foundation Classes

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