vegui. window. class.js

Summary
VegUI element type for VegUIWindow
The css class to use for VegUIManager.WinShadow
the minimum z-level of windows
the z level space between windows
Bitmask flags that can be set on the flags property of the VegUIWindow widget
A dragable, resizeable window widget with a header component
extends VegUINode
These flags are turned on by default for this element
These elements are all directly accessable by this.[child_name] even though they may not be direct childs of this element.
constructor
Builds the window
Clones a window, calls clone_node() and also clones window specific event handlers
Closes the window.
This method is called when the mouse is moved while drag mode for this window is on.
Maximizes the window, moving it to the position this.maxX,maxY and resizing it to this.maxW, this.maxH
Minimizes the window, hiding it from the user but never destroying it
Resizes the WinShadow element in relation to the mouse cursor coordinates
This makes the WinShadow element visible and molds it to fit the window’s proportions and position
Sets the most common template properties of the window
Sets the title of the window
Similar to <VegUI::set_focus_node> but also has the option to bring the window to the foreground and z-sort the other windows
Unhides the window and gives focus to it
Toggles drag mode on or off, when the window is in drag mode the WinShadow element is visible and moves with the mouse cursor
Toggles resize mode on or off.
when close is called
when set_focus_win is called
when window is moved to the background
when window is brought to the front
when maximize is called
when minimize is called

Constants

VUI_WIN

VegUI element type for VegUIWindow

WINSHAD_CLASS

The css class to use for VegUIManager.WinShadow

VUI_WIN_Z

the minimum z-level of windows

VUI_WIN_Z_SPACE

the z level space between windows

Flags

Bitmask flags that can be set on the flags property of the VegUIWindow widget

VUI_KILL_ON_CLOSEWindow is destroyed when the close() method is called
VUI_NORESIZE_WWindow’s width can not be resized
VUI_NORESIZE_HWindow’s height can not be resized
VUI_NORESIZEWindow can not be resized
VUI_NOMOVE_XWindow cannot be moved along the x axis
VUI_NOMOVE_YWindow cannot be moved along the y axis
VUI_NOMOVEWindow cannot be moved
VUI_MOMAXIMIZEWindow cannot be maximized
VUI_NOMINIMIZEWindow cannot be minimized
VUI_NOTASKWindow will not be added to taskbar if there is one

VegUIWindow

A dragable, resizeable window widget with a header component

Summary
extends VegUINode
These flags are turned on by default for this element
These elements are all directly accessable by this.[child_name] even though they may not be direct childs of this element.
constructor
Builds the window
Clones a window, calls clone_node() and also clones window specific event handlers
Closes the window.
This method is called when the mouse is moved while drag mode for this window is on.
Maximizes the window, moving it to the position this.maxX,maxY and resizing it to this.maxW, this.maxH
Minimizes the window, hiding it from the user but never destroying it
Resizes the WinShadow element in relation to the mouse cursor coordinates
This makes the WinShadow element visible and molds it to fit the window’s proportions and position
Sets the most common template properties of the window
Sets the title of the window
Similar to <VegUI::set_focus_node> but also has the option to bring the window to the foreground and z-sort the other windows
Unhides the window and gives focus to it
Toggles drag mode on or off, when the window is in drag mode the WinShadow element is visible and moves with the mouse cursor
Toggles resize mode on or off.
when close is called
when set_focus_win is called
when window is moved to the background
when window is brought to the front
when maximize is called
when minimize is called

Hierarchy

extends VegUINode

Inherits all properties and methods from VegUINode

VegUINode
|
+--> VegUIWindow

Flags

These flags are turned on by default for this element

VUI_HMOUSE_DOWN

Child Elements

These elements are all directly accessable by this.[child_name] even though they may not be direct childs of this element.

SkinVegUINode, Skin node
UiVegUINode, UI node, add any childs that need interaction to this.
HeaderVegUIButton, Header node (Child of Ui)
CaptionVegUINode, holds window caption (Child of Header)
RC_RVegUIButton, resize capture right (Child of Ui)
RC_BVegUIButton, resize capture bottom (Child of Ui)
RC_RBVegUIButton, resize capture right-bottom (Child of Ui)
BtnCloseVegUIButton, closes the window (Child of Ui)
BtnMaximizeVegUIButton, maximizes the window (Child of Ui)
BtnMinimizeVegUIButton, minimizes the window (Child of Ui)

Properties

Object Properties

minWint, minimum width (pixels)
maxWint, maximum width (pixels)
minHint, minimum height (pixels)
maxHint, maximum height (pixels)
maxXint, x position of the window when maximized
maxYint, y position of the window when maximized
bMaximizedbool, set to true if the window is currently maximized
origWint, original width of window (set by maximize)
origHint, original height of window (set by maximize)
origXint, original x position of window (set by maximize)
origYint, original y position of window (set by minimize)
pushZint, push z index (pixels)
titlestring, read-only, current window title
WinShadowVegUINode, link to WinShadow in the window’s manager
winIdxint, read-only, index of the window

Template Properties

T.minWminW
T.minHminH
T.maxWmaxW
T.maxHmaxH
T.winTitletitle
T.pushZpushZ

Functions

VegUIWindow

function VegUIWindow(refName,
Parent,
Manager)

constructor

See Parent

VegUINode::VegUINode

build_win

this.build = this.build_win = function(toNode)

Builds the window

private function

You should always use VegUIManager::build_element to build vegui elements

Alias

build()

Parameters

<HTMLNode toNode>if submitted the created HTML node will be appedned to toNode

Returns

int1 on success
nullon failure

See Parent

VegUINode::build_node

clone_win

this.clone = this.clone_win = function(Template)

Clones a window, calls clone_node() and also clones window specific event handlers

private function

Alias

clone()

Parameters

VegUIWindow Templatethe template window to clone from

Returns

VegUIWindowthis

See Parent

VegUINode::clone_node

close

this.close = function()

Closes the window.  If the VUI_KILL_ON_CLOSE flag is set it will also destroy the window.  Will trigger onclose event

Example

// window will be hidden and can be made visible again
// by calling the .show() method
myWin.close();

// window will be destroyed
myWin.flags |= VUI_KILL_ON_CLOSE
myWin.close();

drag

this.drag = function()

This method is called when the mouse is moved while drag mode for this window is on.  It moves the WinShadow element to a new position

private function

See also

tgl_drag

maximize

this.maximize = function()

Maximizes the window, moving it to the position this.maxX,maxY and resizing it to this.maxW, this.maxH

If window is maximized when this method is called it will be restored to its original proportions and position

See Also

minimize, close

minimize

this.minimize = function()

Minimizes the window, hiding it from the user but never destroying it

mresize

this.mresize = function(dir)

Resizes the WinShadow element in relation to the mouse cursor coordinates

This function is called when the user clicks on one of the resize panels on the borders of the window

private function

Paramters

string dirresize direction, makes sure the window can only be resized in the given direction (‘e-resize’, ‘s-resize’, ‘se-resize’)

See also

tgl_resize

put_shadow

this.put_shadow = function()

This makes the WinShadow element visible and molds it to fit the window’s proportions and position

private function

set_win

this.set = this.set_win = function(title,
w,
h,
x,
y)

Sets the most common template properties of the window

Alias

set()

Parameters

string titletitle of the window
int wwidth (pixels)
int hheight (pixels)
int xx position (pixels)
int yy position (pixels)

See Parent

VegUINode::set_node

Example

myWin.set('Some Window!', 500, 300, 50, 50);

set_caption

this.set_caption = function(txt)

Sets the title of the window

Paramters

string txtnew title for the window

Example

myWin.set_caption('Another title for my window');

set_focus_win

this.set_focus = this.set_focus_win = function(focusType,
bringToFront)

Similar to <VegUI::set_focus_node> but also has the option to bring the window to the foreground and z-sort the other windows

Alias

set_focus()

Parameters

int focusTypeFocus types
bool bringToFronif true the window is brough to the foreground

See Parent

VegUINode::set_focus_node

show

this.show = function()

Unhides the window and gives focus to it

tgl_drag

this.tgl_drag = function(b)

Toggles drag mode on or off, when the window is in drag mode the WinShadow element is visible and moves with the mouse cursor

Parameters

bool btrue (on), false (off)

See also

drag

tgl_resize

this.tgl_resize = function(b)

Toggles resize mode on or off.  When resize mode is on the WinShadow element resizes in relation to mouse cursor movements

Parameters

bool btrue (on) , false (off)

See also

mresize

onclose

when close is called

onwinfocus

when set_focus_win is called

ontoback

when window is moved to the background

ontofront

when window is brought to the front

onmaximize

when maximize is called

onminimize

when minimize is called

A dragable, resizeable window widget with a header component
Spawns and keeps track of all vegUI elements
VegUI element type for VegUIWindow
function VegUIWindow(refName,
Parent,
Manager)
constructor
this.build = this.build_win = function(toNode)
Builds the window
this.clone = this.clone_win = function(Template)
Clones a window, calls clone_node() and also clones window specific event handlers
this.close = function()
Closes the window.
this.drag = function()
This method is called when the mouse is moved while drag mode for this window is on.
this.maximize = function()
Maximizes the window, moving it to the position this.maxX,maxY and resizing it to this.maxW, this.maxH
this.minimize = function()
Minimizes the window, hiding it from the user but never destroying it
this.mresize = function(dir)
Resizes the WinShadow element in relation to the mouse cursor coordinates
this.put_shadow = function()
This makes the WinShadow element visible and molds it to fit the window’s proportions and position
this.set = this.set_win = function(title,
w,
h,
x,
y)
Sets the most common template properties of the window
this.set_caption = function(txt)
Sets the title of the window
this.set_focus = this.set_focus_win = function(focusType,
bringToFront)
Similar to VegUI::set_focus_node but also has the option to bring the window to the foreground and z-sort the other windows
this.show = function()
Unhides the window and gives focus to it
this.tgl_drag = function(b)
Toggles drag mode on or off, when the window is in drag mode the WinShadow element is visible and moves with the mouse cursor
this.tgl_resize = function(b)
Toggles resize mode on or off.
The most basic VegUI Element.
enable event handling for VUI_MOUSE_DOWN
int, minimum width (pixels)
int, minimum height (pixels)
int, maximum width (pixels)
int, maximum height (pixels)
string, read-only, current window title
int, push z index (pixels)
function VegUINode(refName,
Parent,
Manager)
this.build_element = function(VegUIObj,
toNode)
builds a VegUIElement.
this.build = this.build_node = function(toNode,
takeNode)
build a HTML node from the template properties of this element.
this.clone = this.clone_node = function(Template)
Clones the children and properties of a template element to this element
Window is destroyed when the close() method is called
when close is called
this.set = this.set_node = function(nodeType,
w,
h,
x,
y,
pos,
z)
Template Function
this.set_focus = this.set_focus_node = function(focusType)
Gives focus to the element.