Mercurial > projects > dynamin
changeset 67:419e38206522
Move visible from Control to Window
author | Jordan Miner <jminer7@gmail.com> |
---|---|
date | Mon, 10 Aug 2009 02:46:42 -0500 |
parents | 4c095424a9ab |
children | 6580fabb7dce |
files | dynamin/gui/control.d dynamin/gui/window.d |
diffstat | 2 files changed, 15 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/dynamin/gui/control.d Mon Aug 10 01:44:29 2009 -0500 +++ b/dynamin/gui/control.d Mon Aug 10 02:46:42 2009 -0500 @@ -80,7 +80,6 @@ */ class Control { protected: - bool _visible; bool _focusable; bool _focused; int _tabIndex; @@ -272,7 +271,6 @@ _focusable = false; _focused = false; _tabIndex = 0; - _visible = true; _cursor = Cursor.Arrow; _elasticX = false; _elasticY = false; @@ -482,13 +480,6 @@ } /** - * Gets or sets whether is control is visible. The default is true, except - * on top-level windows. - */ - //void visible(bool b) { visible = b; } - bool visible() { return _visible; } - - /** * Gets or sets the location of this control in its parent's content * coordinates. * Examples:
--- a/dynamin/gui/window.d Mon Aug 10 01:44:29 2009 -0500 +++ b/dynamin/gui/window.d Mon Aug 10 02:46:42 2009 -0500 @@ -173,6 +173,7 @@ } protected: mixin WindowBackend; + bool _visible; BorderSize _borderSize; Window _owner; package bool _active; @@ -255,6 +256,11 @@ //}}} public: + /// Override this method in a subclass to handle the visibleChanged event. + protected void whenVisibleChanged(EventArgs e) { } + /// This event occurs after this control is shown or hidden. + Event!(whenVisibleChanged) visibleChanged; + /// Override this method in a subclass to handle the activated event. protected void whenActivated(EventArgs e) { setFocusedControl(_focusedControl is null ? content : _focusedControl); @@ -273,6 +279,7 @@ * */ this() { + visibleChanged.mainHandler = &whenVisibleChanged; activated.mainHandler = &whenActivated; deactivated.mainHandler = &whenDeactivated; @@ -397,10 +404,17 @@ } Window owner() { return _owner; } - alias Control.visible visible; + /** + * Gets or sets whether this window is visible. The default is false. + */ + bool visible() { return _visible; } + /// ditto void visible(bool b) { _visible = b; backend_visible = b; + + scope e = new EventArgs; + visibleChanged(e); } /**