Package | com.ghostwire.ui.containers |
Class | public class uiWindow |
Inheritance | uiWindow ![]() ![]() |
Subclasses | uiDialog |
uiWindow
container contains a title bar and a content area for its child. It can also
optionally display a menu bar and a status bar.
The container can be set to be closeable/maximizable/minimizable (by pressing respective buttons on the
title bar), and/or resizable (by dragging edges of the window) by end-users. The window can also be set
to be modal (while it is active, other parts of the application will not be interactive). The type of
window created depends on the mode
specified when the instance is created (this
mode
cannot be modified after instantiation).
To use uiWindow
containers in your application, you must initialize the
uiWindow
class at the beginning of your application:
// initialize the uiWindow class (just once) uiWindow.initialize(stage);
A uiWindow
instance is created using the new
operator as with any
other DisplayObject
, but you do not add it to the display list manually. To
show a uiWindow
instance, call its open()
method:
// creates a new normal window var win1:uiWindow = new uiWindow(); win1.title = "Window 1 Title"; // shows the window at stage coordinates 50,50 win1.open(50,50); // creates a new window that can be closed but not resized var win2:uiWindow = new uiWindow(WINDOW.CAN_CLOSE); win2.title = "Window 2 Title"; // shows the window at stage coordinates 50,100 win2.open(50,100); // creates a new window that can be closed and resized but not minimized/maximized var win3:uiWindow = new uiWindow(WINDOW.CAN_CLOSE|WINDOW.CAN_RESIZE); win3.title = "Window 3 Title"; // shows the window at the center of the stage win3.open();
Custom Cursors
If the com.ghostwire.ui.managers.uiCursors
manager is initialized, the
uiWindow
class recognizes it and will take advantage of the feature automatically.
Custom cursors are used when end-users resize the window by dragging the edges of the window.
The assets used are:
SIZE_EW.png
SIZE_NESW.png
SIZE_NS.png
SIZE_NWSE.png
As of v1.2.0, preloading of the assets begins once uiWindow.initialize()
is called.
~ This class is available in Aspire UI Components Standard Edition ~
See also
Property | Defined by | ||
---|---|---|---|
![]() | alignX : Number
Indicates how the component would like to be aligned horizontally within its allocated space.
| uiComponent | |
![]() | alignY : Number
Indicates how the component would like to be aligned vertically within its allocated space.
| uiComponent | |
alwaysOnTop : Boolean
Indicates if this
uiWindow instance is always on top of other sibling
uiWindow instances. | uiWindow | ||
![]() | background : Object
Indicates the style of the background for this component.
| uiComponent | |
![]() | container : uiComponent
Indicates the
uiComponent instance that contains this instance. | uiComponent | |
content : uiForm
Returns the
uiForm instance that is used as the content container. | uiWindow | ||
contentPadding : Object
Indicates the
padding to apply to the content (uiForm child). | uiWindow | ||
![]() | depth : int
Indicates how deep the component is in the containment hierarchy.
| uiComponent | |
![]() | desiredAllocationHeight : int
Indicates the vertical space this component would like to be allocated.
| uiComponent | |
![]() | desiredAllocationWidth : int
Indicates the horizontal space this component would like to be allocated.
| uiComponent | |
![]() | enabled : Boolean
Indicates whether the component is enabled for user interaction.
| uiComponent | |
![]() | fillX : Boolean
Indicates whether or not the component should automatically expand or shrink to fill its allocated
horizontal space.
| uiComponent | |
![]() | fillY : Boolean
Indicates whether or not the component should automatically expand or shrink to fill its allocated
vertical space.
| uiComponent | |
![]() | focusPadding : Object
Indicates the thickness of the interior space from the edge of the component to the focus
rectangle.
| uiComponent | |
![]() | focusRect : Object
Indicates the class to use when rendering the rectangle around the component to indicate that it
is in focus.
| uiComponent | |
![]() | height : Number
Indicates the current
height of the component. | uiComponent | |
icon : String
Indicates the source of the image to display in the title bar of this
uiWindow
instance. | uiWindow | ||
liveDragging : Boolean
Indicates whether the
uiWindow instance should resize itself (and its contents)
immediately when the end-user drags the edges of the window. | uiWindow | ||
![]() | margin : Object
Indicates the thickness of the space surrounding the component.
| uiComponent | |
![]() | maxHeight : int
Indicates the upper limit for
height . | uiComponent | |
maximized : Boolean
Indicates whether this
uiWindow instance is currently maximized. | uiWindow | ||
![]() | maxWidth : int
Indicates the upper limit for
width . | uiComponent | |
menuModel : uiModel
Indicates the
uiModel object to use to populate the menu bar of this
uiWindow instance. | uiWindow | ||
![]() | minHeight : int
Indicates the lower limit for
height . | uiComponent | |
minimized : Boolean
Indicates whether this
uiWindow instance is currently minimized/collapsed. | uiWindow | ||
![]() | minWidth : int
Indicates the lower limit for
width . | uiComponent | |
modalAlpha : Number [static]
Indicates the transparency level of the background when a modal window is displayed.
| uiWindow | ||
modalColor : Number [static]
Indicates the color of the background when a modal window is displayed.
| uiWindow | ||
mode : int [read-only]
Indicates whether the
uiWindow instance is modal and/or can be closed,
maximized, minimized or resized by end-users. | uiWindow | ||
owner : uiWindow
[read-only]
Indicates the parent
uiWindow instance. | uiWindow | ||
![]() | padding : Object
Indicates the thickness of the interior space from the edge of the component to the content area,
which is where child components, if any, are contained.
| uiComponent | |
![]() | skin : String
Indicates the name of the skin to use for this component instance.
| uiComponent | |
status : Object
Indicates the text to display in the status bar of this
uiWindow instance. | uiWindow | ||
![]() | stretch : Boolean
Indicates whether surplus space available in the parent container should be allocated to this
component.
| uiComponent | |
![]() | textStyle : String
Indicates the style to use for
uiText instances contained in this component. | uiComponent | |
title : String
Indicates the text to display in the title bar of this
uiWindow instance. | uiWindow | ||
![]() | toolTip : Object
Indicates the content (text) of the tooltip that should be shown when the mouse hovers
over this control.
| uiComponent | |
uimenubar : uiMenuBar
[read-only]
Returns the embedded
uiMenuBar instance, if any - for advanced users only. | uiWindow | ||
![]() | uiskin : uiBitmapImage
Returns the
uiBitmapImage rendered as the skin - for advanced users only. | uiComponent | |
![]() | visible : Boolean
Indicates whether or not the component is visible within its container.
| uiComponent | |
![]() | width : Number
Indicates the current
width of the component. | uiComponent |
Method | Defined by | ||
---|---|---|---|
Constructor - creates a new
uiWindow container instance. | uiWindow | ||
close():Boolean
Closes this
uiWindow instance (and its child windows if any). | uiWindow | ||
[static]
Returns a reference to the
uiWindow container within which the specified
child is contained. | uiWindow | ||
initialize(stage:Stage):void
[static]
Initializes the
uiWindow class, registering the stage of the document
(so that we know where to place the windows). | uiWindow | ||
![]() |
invalidate(type:String):void
Invalidates this component's "size", "display", "layout" or "textstyle".
| uiComponent | |
![]() |
move(x:Number, y:Number, noEvent:Boolean = false):void
Moves the component to the specified position, disregarding its allocation.
| uiComponent | |
open(x:int = -1, y:int = -1):void
Opens this
uiWindow instance, making it the current active window, giving it focus
and bringing it to the front of its peer windows (if any). | uiWindow | ||
![]() |
removeAllChildren(all:Boolean = false):void
Removes all children from this component.
| uiComponent | |
![]() |
setFocus(flag:Boolean = true):void
Gives this component instance the focus; the component must be on the display list and has its
tabEnabled property set to true , otherwise this method will fail
silently. | uiComponent | |
![]() |
setSize(width:Number, height:Number, noEvent:Boolean = false):void
Sets this component's size to the specified
width and height . | uiComponent | |
![]() |
setVisible(value:Boolean, noEvent:Boolean = false):void
Sets the visibility of this component instance, dispatching a "show" or "hide" event accordingly.
| uiComponent | |
![]() |
validateNow():void
Validates and render the component instance, and any component instances with
depth higher than itself in the validation queue, immediately. | uiComponent |
Event | Summary | Defined by | ||
---|---|---|---|---|
Dispatched when the uiWindow container is about to be closed. | uiWindow | |||
![]() |
Dispatched when the component's visible property is changed from true to
false via calling the setVisible() method. | uiComponent | ||
Dispatched when the end-user selects an enabled menu item from the menu bar. | uiWindow | |||
![]() |
Dispatched when the component's position within its parent container has changed via calling the
move() method. | uiComponent | ||
Dispatched when the uiWindow container is opened. | uiWindow | |||
![]() |
Dispatched when the component's size has changed via calling the setSize() method. | uiComponent | ||
![]() |
Dispatched when the component's visible property is changed from false to
true via calling the setVisible() method. | uiComponent |
alwaysOnTop | property |
alwaysOnTop:Boolean
[read-write]
Indicates if this uiWindow
instance is always on top of other sibling
uiWindow
instances. uiWindow
instances are siblings if
they have the same owner
.
If more than one sibling uiWindow
instance has this property set to
true
, only the last opened instance will have this property honored.
Note: setting this property to true
will not make the window appear
on top of modal windows, which are always on top of all other windows on the stage.
public function get alwaysOnTop():Boolean
public function set alwaysOnTop(value:Boolean):void
content | property |
content:uiForm
[read-write]
Returns the uiForm
instance that is used as the content container. Note that this
uiForm
is the actual container, not the uiWindow
itself. Therefore,
all DisplayObjectContainer
operations must be done via this content
property.
You may also set this property to a uiForm
instance of your choice thereby replacing
the existing embedded instance.
public function get content():uiForm
public function set content(value:uiForm):void
See also
contentPadding | property |
contentPadding:Object
[read-write]
Indicates the padding
to apply to the content (uiForm
child).
public function get contentPadding():Object
public function set contentPadding(value:Object):void
icon | property |
icon:String
[read-write]
Indicates the source of the image to display in the title bar of this uiWindow
instance.
public function get icon():String
public function set icon(value:String):void
See also
liveDragging | property |
public var liveDragging:Boolean
Indicates whether the uiWindow
instance should resize itself (and its contents)
immediately when the end-user drags the edges of the window. It is recommended that this property
be left as false
(default value) if the contents are complex.
The default value is false
.
maximized | property |
maximized:Boolean
[read-write]
Indicates whether this uiWindow
instance is currently maximized. When
maximized, the instance fills the whole area of the stage.
The default value is false
.
public function get maximized():Boolean
public function set maximized(value:Boolean):void
menuModel | property |
menuModel:uiModel
[read-write]
Indicates the uiModel
object to use to populate the menu bar of this
uiWindow
instance.
By default, a uiWindow
instance will not embed a menu bar unless this
property is set.
Setting this property to null
removes the menu (if one currently exists).
The default value is null
.
public function get menuModel():uiModel
public function set menuModel(value:uiModel):void
See also
minimized | property |
minimized:Boolean
[read-write]
Indicates whether this uiWindow
instance is currently minimized/collapsed.
When minimized, it is resized to a minimal size, and its contents and any child
windows are hidden.
The default value is false
.
public function get minimized():Boolean
public function set minimized(value:Boolean):void
modalAlpha | property |
public static var modalAlpha:Number
Indicates the transparency level of the background when a modal window is displayed. This value should be between 0.0 (totally transparent) and 1.0 (totally opaque).
modalColor | property |
public static var modalColor:Number
Indicates the color of the background when a modal window is displayed. Applicable only if the
modalAlpha
property has a non-zero and non-NaN value.
mode | property |
mode:int
[read-only]
Indicates whether the uiWindow
instance is modal and/or can be closed,
maximized, minimized or resized by end-users. This is a read-only property - the
value must be specified when the uiWindow
instance is created and stays
the same throughout the life of the instance.
Note: regardless of the mode
specified, the uiWindow
instance will still be closeable/maximizable/minimizable/resizable programmatically.
public function get mode():int
See also
owner | property |
owner:uiWindow
[read-only]
Indicates the parent uiWindow
instance.
Returns null
if this uiWindow
instance is a top-level window.
uiWindow
instances with the same owner
are referred to
as peers or siblings.
public function get owner():uiWindow
status | property |
status:Object
[read-write]
Indicates the text to display in the status bar of this uiWindow
instance.
Setting this property to null
removes the status bar (if one currently exists).
If you want to retain the status bar without showing any text, set this property to an empty
string ""
.
The default value is null
.
public function get status():Object
public function set status(value:Object):void
title | property |
title:String
[read-write]
Indicates the text to display in the title bar of this uiWindow
instance.
public function get title():String
public function set title(value:String):void
uimenubar | property |
uimenubar:uiMenuBar
[read-only]
Returns the embedded uiMenuBar
instance, if any - for advanced users only.
This property is exposed in case you would like greater control over the embedded
uiMenuBar
instance (that would be instantiated and embedded if the
menuModel
property is defined).
By default, a uiWindow
instance will not embed a menu bar unless the
menuModel
property is set.
public function get uimenubar():uiMenuBar
See also
uiWindow | () | constructor |
public function uiWindow(mode:int, owner:uiWindow = null)
Constructor - creates a new uiWindow
container instance.
mode:int — Optional. An integer value indicating the mode of this uiWindow
instance. The mode determines whether the uiWindow instance is modal
and/or can be closed, minimized, maximized and/or resizeable by end-users. This value cannot be
changed after the instance is created. The default value is WINDOW.NORMAL (which is
equivalent to WINDOW.CAN_CLOSE|WINDOW.CAN_MAXIMIZE|WINDOW.CAN_MINIMIZE|WINDOW.CAN_RESIZE ).
|
|
owner:uiWindow (default = null ) — Optional. Indicates the uiWindow instance that owns this window. A
uiWindow instance with an owner is created as a child window and appears on top of the
parent window. If no owner is defined, this uiWindow instance is created as a
top-level window.
|
See also
close | () | method |
public function close():Boolean
Closes this uiWindow
instance (and its child windows if any).
Calling this method dispatches a Event.CLOSE
event. If this event is cancelled
by a listener, this method returns false
. Otherwise, true
is returned.
Boolean — A Boolean value indicating whether the window has closed.
|
getWindow | () | method |
public static function getWindow(child:DisplayObject):uiWindow
Returns a reference to the uiWindow
container within which the specified
child
is contained. The uiWindow
container need not be, and is
unlikely to be, the direct parent of the specified child
.
The method returns null
if the child
is not contained within
a uiWindow
container, not on the display list, or is itself a
uiWindow
.
This method is useful if you wish to know if a DisplayObject
instance is
contained within a uiWindow
container, and if so, which one.
child:DisplayObject — The DisplayObject to query.
|
uiWindow —
A reference to the uiWindow containing the specified
child . Returns null if the child is not
contained within a uiWindow container, not on the display list, or is
itself a uiWindow .
|
initialize | () | method |
public static function initialize(stage:Stage):void
Initializes the uiWindow
class, registering the stage
of the document
(so that we know where to place the windows).
You must call this method once at the beginning of your application, otherwise no
uiWindow
instance can be shown.
stage:Stage — A reference to the document Stage . Each Flash application has only
one Stage object - the stage property of every display object on the
display list refers to the same Stage object.
|
open | () | method |
public function open(x:int = -1, y:int = -1):void
Opens this uiWindow
instance, making it the current active window, giving it focus
and bringing it to the front of its peer windows (if any).
You can also use this method to activate a window that is already opened (making it the current active window, giving it focus and bringing it to the front of its peer windows).
Note that adding the window to the display list manually (via the addChild()
method)
will not work - you must call this method to show a window. When this method is called, the window
is added to the display list automatically at the specified position (stage coordinates).
The static class method, uiWindow.initialize()
, must be called at the beginning of
your application, before this method is used (otherwise calling this method fails silently).
If you call this method without passing any parameter, the window will be positioned in the center of the stage.
Parametersx:int (default = -1 ) — Optional. The horizontal position of the window. If this value is negative, the current
x position of the instance is used.
|
|
y:int (default = -1 ) — Optional. The vertical position of the window. If this value is negative, the current
y position of the instance is used.
|
See also
close | event |
flash.events.Event
Dispatched when the uiWindow
container is about to be closed.
This event has the following properties:
Property | Value |
---|---|
bubbles | false |
cancelable | true ; if cancelled, the window will not close. |
currentTarget | The object that is actively processing the event object with an event listener. |
target | The object that dispatched the event. The target is
not always the object listening for the event. Use the currentTarget
property to access the object that is listening for the event. |
menuSelect | event |
com.ghostwire.ui.events.uiMenuEvent
com.ghostwire.ui.events.uiMenuEvent.MENU_SELECT
Dispatched when the end-user selects an enabled menu item from the menu bar.
Dispatched when a user selects an enabled menu item from a uiMenu
instance.
This event has the following properties:
Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is no default behavior to cancel. |
currentTarget | The object that is actively processing the event object with an event listener. For example, if you use myMenuBar.addEventListener() to register an event listener, myMenuBar is the value of the currentTarget. |
target | The object that dispatched the event. The target is
not always the object listening for the event. Use the currentTarget
property to access the object that is listening for the event. |
item | A data object representing the menu item selected. |
menu | The uiMenu containing the menu item that has been selected. |
open | event |
flash.events.Event
Dispatched when the uiWindow
container is opened.
This event has the following properties:
Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is no default behavior to cancel. |
currentTarget | The object that is actively processing the event object with an event listener. |
target | The object that dispatched the event. The target is
not always the object listening for the event. Use the currentTarget
property to access the object that is listening for the event. |