public class GoButtonCtrl: GoControl
{
Button button;
public GoButtonCtrl()
{
this.Size = new SizeF(16, 16);
}
public override Control CreateControl(GoView view)
{
if (button == null)
{
button = new Button();
button.Text = "";
}
return button;
}
}
public class ButtonNode : GoBoxNode
{
GoButtonCtrl btn;
protected override GoObject CreateBody()
{
if (btn == null)
btn = new GoButtonCtrl ();
return btn;
}
}
public class View: GoView
{
protected override void OnPropertyChanged(PropertyChangedEventArgs evt)
{
base.OnPropertyChanged(evt);
switch (evt.PropertyName)
{
case "DocScale":
{
HideShowLayers();
break;
}
}
}
protected virtual void HideShowLayers()
{
GoLayer defaultLayer = this.Layers.Default;
foreach (GoLayer layer in this.Layers.CopyArray())
{
if (!layer.IsInView)
{
layer.AllowView = false; // making Invisible
// this.Layers.Remove(layer);
// another option - removing layer from View's Layers - not Document's!!
}
}
foreach (GoLayer layer in this.Document.Layers)
{
layer.AllowView = true;
//this.Layers.InsertDocumentLayerAfter(null, layer); //another option - adding layer
}
}
defaultLayer.AllowView = true;
//this.Layers.InsertDocumentLayerAfter(null, defaultLayer);
}