Attributes clarification ?

View: New views
2 Messages — Rating Filter:   Alert me  

Attributes clarification ?

by g_siddu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi All,

Can some one please clarify what does attributes mean ?

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);
 }


--
Regards,
~Sid~
I have never met a man so ignorant that i couldn't learn something from him
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@...
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Attributes clarification ?

by Florian Müllner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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);
>  }

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@...
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list