Re: Attributes clarification ?



El vie, 06-11-2009 a las 12:13 +0530, Siddu escribiÃ:
Hi All,

Can some one please clarify what does attributes mean ?

Basically, attributes are properties of a single cell in the tree view.
With gtk_tree_view_column_new_with_attributes you can connect cell
attributes to columns of the underlying model.

For example, given the following model:
"this is an example" | #red
"hello, world!"      | #green

the code below connects the "text" attribute to the first model column
(TEXT_COLUMN) and the "foreground" attribute to the second one
(COLOR_COLUMN) - note that these are not valid color values. The
resulting tree view should look like this:

Title
-------------------
this is an example
hello, world!

The first row should be printed in red letters, the second one in green
ones.


The below code seems to confuse me

what does it mean by foreground taking the value of COLOR_COLUMN (which is 1)

enum { TEXT_COLUMN, COLOR_COLUMN, N_COLUMNS };
 ...
 {
   GtkTreeViewColumn *column;
   GtkCellRenderer   *renderer = gtk_cell_renderer_text_new ();

   column = gtk_tree_view_column_new_with_attributes ("Title",
                                                      renderer,
                                                      "text", TEXT_COLUMN,
                                                      "foreground",
COLOR_COLUMN,
                                                      NULL);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]