[MonoDevelop] Task Class Wizard
Christian Hoff
christian_hoff at gmx.net
Sun Sep 21 08:47:23 EDT 2008
I forgot to look at you link before I sent this Mail; your ClassWizard
is really nice!
But it might be better to hide the CellRendererToggle when interface or
class paths/rows are renderered. Just use the same code to get the
selected path and then "ask" your model(probably you used a TreeStore; a
custom model would be much prettier but is only supported in Gtk# 2.12
and higher and since MD requires only 2.8 you cannot use it) if this
path is an interface or a class(path.Depth == 1 should work).
Christian Hoff schrieb:
> You normally shouldn't do that. CellRenderers are designed to be used in
> various contexts, not just in TreeViews.
>
> If you really want to do so, try to subclass CellRendererToggle and
> override the Render method with something like:
>
> protected override void Render (Gdk.Drawable drawable, Gtk.Widget
> widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area,
> Gdk.Rectangle expose_area, Gtk.CellRendererState flags)
> {
> if (widget is Gtk.TreeView) {
> Gtk.TreePath CurrPath;
> Gtk.TreeViewColumn CurrColumn;
> if (!this.GetPathAtPos (cell_area.X, cell_area.Y, out CurrPath,
> out CurrColumn))
> // This should not occur
> throw (new System.ApplicationException ());
>
> if ((widget as Gtk.TreeView).Selection == null || (widget as
> Gtk.TreeView).Selection.PathIsSelected (CurrPath))
> base.Render (drawable, widget, background_area, cell_area,
> expose_area, flags);
> else { /* Do nothing; row is selected */ }
> } else
> base.Render (drawable, widget, background_area, cell_area,
> expose_area, flags);
>
> dave schrieb:
>
>> At last I have a question about TreeView.
>> In http://www.student.tugraz.at/monichi/mono/form_version_4_5.png
>> I marked the toggleBoxes in row 1 and row 3. Is it possible to hide
>> the marked ToggleBoxes and let visible the other boxes?
>>
>> My code for the toggle boxes is:
>>
>> ---------------------------------------%<---------------------------------------------------
>> // create column
>> TreeViewColumn col_3 = new TreeViewColumn();
>> col_3.Title = "implement";
>> CellRendererToggle renderer_3 = new CellRendererToggle();
>> renderer_3.Xalign = 0.0f;
>> renderer_3.Xpad = 5;
>> renderer_3.Activatable = true;
>> renderer_3.Toggled +=new ToggledHandler(rendererToggle_Toggled);
>> renderer_3.Mode = CellRendererMode.Activatable;
>> col_3.PackStart(renderer_3, true);
>>
>> treeview.AppendColumn(col_3);
>> col_3.AddAttribute (renderer_3, "active", 2);
>> ---------------------------------------%<---------------------------------------------------
>>
>> maybe someone knows how to do this
>>
>> thx in advance
>>
>> cheers,
>>
>> david
>>
>>
>
> _______________________________________________
> Monodevelop-list mailing list
> Monodevelop-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monodevelop-list
>
>
More information about the Monodevelop-list
mailing list