public virtual void SetHidden(bool flag)
{
NSView view;
if (_is_hidden == flag)
return;
_is_hidden = flag;
if (_is_hidden)
{
if (_window != null)
{
for (view = (NSView)_window.FirstResponder;
view != null && view.RespondsToSelector(new SEL("superview"));
view = (NSView)view.Superview)
{
if (view == this)
{
//_window.MakeFirstResponder(this.NextValidKeyView());
break;
}
}
}
if (_rFlags.has_draginfo != 0)
{
if (_window != null)
{
//NSArray t = GSGetDragTypes(self);
//[GSDisplayServer removeDragTypes: t fromWindow: _window];
}
}
if (Superview != null)
((NSView)this.Superview).SetNeedsDisplay(true);
}
else
{
if (_rFlags.has_draginfo != 0)
{
if (_window != null)
{
//NSArray t = GSGetDragTypes(this);
//[GSDisplayServer addDragTypes: t toWindow: _window];
}
}
if (_rFlags.has_subviews != 0)
{
// The _visibleRect of subviews will be NSZeroRect, because when they
// were calculated in -[_rebuildCoordinates], they were intersected
// with the result of calling -[visibleRect] on the hidden superview,
// which returns NSZeroRect for hidden views.
//
// So, recalculate the subview coordinates now to make them correct.
//[_sub_views makeObjectsPerformSelector: @selector(_invalidateCoordinates)];
}
this.SetNeedsDisplay(true);
}
}