GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Fri Oct 24, 2014 12:47 pm

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: how get a gtkcellrenderer?
PostPosted: Mon May 23, 2011 3:02 pm 
Offline
Familiar Face

Joined: Sat Jun 07, 2008 2:31 pm
Posts: 34
Location: Hangzhou, ZheJiang, China
i want to get a gtkcellrenderer after creating a GtkTreeView. how do that´╝č
i have read the gtk api reference manual, but i do not found relational functions.
thanks


Top
 Profile  
 
 Post subject: Re: how get a gtkcellrenderer?
PostPosted: Tue May 24, 2011 4:58 pm 
Offline
Never Seen the Sunlight

Joined: Wed Jul 23, 2008 10:31 am
Posts: 2406
Location: Slovenia
Hi.

You can get your cell renderers using gtk_cell_layout_get_cells() function.

Tadej


Top
 Profile  
 
 Post subject: Re: how get a gtkcellrenderer?
PostPosted: Wed May 25, 2011 5:10 am 
Offline
Familiar Face

Joined: Sat Jun 07, 2008 2:31 pm
Posts: 34
Location: Hangzhou, ZheJiang, China
thanks.
but i don't know the parameter of gtk_cell_layout_get_cells (). the parameter of this function is GtkCellLayout *cell_layout, but i don't find the definition of GtkCellLayout structure. In .h file there is a statement: typedef struct _GtkCellLayout GtkCellLayout; /* dummy typedef */
by reading the reference, i think the way:
GtkTreeViewColumn column;
GList *list = NULL;
column = gtk_tree_view_get_column(GTK_TREE_VIEW(treeview), column_id);
list = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column));
but it seems to do not work. The treeview has 6 lines. by debugging, i found list->next is NULL, list->prev also, just list->data is allocated memory. but i do not know the content of list->data.
i do not know if the upper two lines codes are correct.


Top
 Profile  
 
 Post subject: Re: how get a gtkcellrenderer?
PostPosted: Wed May 25, 2011 5:54 pm 
Offline
Never Seen the Sunlight

Joined: Wed Jul 23, 2008 10:31 am
Posts: 2406
Location: Slovenia
Hi.

gtkguan wrote:
but i don't know the parameter of gtk_cell_layout_get_cells (). the parameter of this function is GtkCellLayout *cell_layout, but i don't find the definition of GtkCellLayout structure. In .h file there is a statement: typedef struct _GtkCellLayout GtkCellLayout; /* dummy typedef */

GtkCellLayout is an interface, implemented by widgets that can render content using cell renderers. GtkTreeViewColumn, GtkCellView and GtkComboBox implement GtkCellLayout.

gtkguan wrote:
by reading the reference, i think the way:
GtkTreeViewColumn column;
GList *list = NULL;
column = gtk_tree_view_get_column(GTK_TREE_VIEW(treeview), column_id);
list = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column));
but it seems to do not work. The treeview has 6 lines. by debugging, i found list->next is NULL, list->prev also, just list->data is allocated memory. but i do not know the content of list->data.
i do not know if the upper two lines codes are correct.

This is all correct. And based on results, you only have one GtkCellRenderer packed inside this column (this cell renderer is pointed to by list->data parameter). What do you expect to get here?

Tadej


Top
 Profile  
 
 Post subject: how get a gtkcellrenderer
PostPosted: Sat May 28, 2011 11:09 pm 
Offline

Joined: Tue Apr 12, 2011 10:27 pm
Posts: 2
Location: Ireland
Afternoon all, I am a new member joined last year only posted twice and just starting serious training this year.....will be posting pics later....anyway Im trying to change my password and duhh cant find the profile page I know its a blanko momento could someone help with directions of how to navigate to profile page please...thanks

_________________
- memories from CPJ


Top
 Profile  
 
 Post subject: Re: how get a gtkcellrenderer?
PostPosted: Tue May 31, 2011 2:46 pm 
Offline
Familiar Face

Joined: Sat Jun 07, 2008 2:31 pm
Posts: 34
Location: Hangzhou, ZheJiang, China
tadeboro wrote:
Hi.

gtkguan wrote:
but i don't know the parameter of gtk_cell_layout_get_cells (). the parameter of this function is GtkCellLayout *cell_layout, but i don't find the definition of GtkCellLayout structure. In .h file there is a statement: typedef struct _GtkCellLayout GtkCellLayout; /* dummy typedef */

GtkCellLayout is an interface, implemented by widgets that can render content using cell renderers. GtkTreeViewColumn, GtkCellView and GtkComboBox implement GtkCellLayout.

gtkguan wrote:
by reading the reference, i think the way:
GtkTreeViewColumn column;
GList *list = NULL;
column = gtk_tree_view_get_column(GTK_TREE_VIEW(treeview), column_id);
list = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(column));
but it seems to do not work. The treeview has 6 lines. by debugging, i found list->next is NULL, list->prev also, just list->data is allocated memory. but i do not know the content of list->data.
i do not know if the upper two lines codes are correct.

This is all correct. And based on results, you only have one GtkCellRenderer packed inside this column (this cell renderer is pointed to by list->data parameter). What do you expect to get here?

Tadej


Thank you!
I think list->data includes all the cells of the column specified.
I add GtkCellRendererToggle in GtkTreeView. And set the GtkCellRenderer TRUE or FALSE according to the data from a file. If a GtkCellRenderer is set to TRUE, then this GtkCellRenderer emits a "toggled" signal (use function: gtk_cell_renderer_activate()).
So now I have solved the problem refered.
Thank you very much again!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group