Diabling an entry in TreeView

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Diabling an entry in TreeView

Pramod Patangay
Hi,

I have a treestore and corresponding model and treeview. I would like
to disable a particular entry in the treeview. How can I do this?

Thanks
_______________________________________________
gtk-list mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/gtk-list
Reply | Threaded
Open this post in threaded view
|

Re: Diabling an entry in TreeView

Andrew E. Makeev
Pramod Patangay wrote:

>Hi,
>
>I have a treestore and corresponding model and treeview. I would like
>to disable a particular entry in the treeview. How can I do this?
>
>  
>
If you have access to source codes you may look at gtkcellrenderertext.c
file for function: gtk_cell_renderer_text_render().
There you should see that "state = GTK_STATE_INSENSITIVE" is what you
are looking for.
I guess, the simplest way is to code your CellRenderer derived from
GtkCellRendererText, and reimplement function render, so, it should look
at some CellRenderer::property and decide what state should be set for
current cell.
Actually, you only need to reset "render" function for
GtkCellRedndererClass this way:

static void my_gtk_cell_renderer_text_render(...)
{
...
}

some_function()
{
...
GtkCellRenderer *text_render = gtk_cell_renderer_text_new();
GtkCellRendererClass *render_class = GTK_CELL_RENDERER_GET_CLASS(
text_render );
render_class->render = my_gtk_cell_renderer_text_render;
...
}

Regards,
-andrew

_______________________________________________
gtk-list mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/gtk-list
Reply | Threaded
Open this post in threaded view
|

Re: Diabling an entry in TreeView

Steve Feehan
In reply to this post by Pramod Patangay
On Tue, May 31, 2005 at 12:21:31PM +0530, Pramod Patangay wrote:
> Hi,
>
> I have a treestore and corresponding model and treeview. I would like
> to disable a particular entry in the treeview. How can I do this?
>
> Thanks

I'm going through the tree view tutorial now, so I probably
don't know what I'm talking about :)

Anyways, if by "disable" you mean not allow to be selected, then
you can write your own selection function and set it with
gtk_tree_selection_set_select_function. See section 6.1.3 of the
tutorial:

http://scentric.net/tutorial/sec-sel-click-menus.html#sec-selections-function

--
Steve Feehan
_______________________________________________
gtk-list mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/gtk-list