Gl_Window Object (part of the WidgetManager module)
Description:
The Gl_Window is a draggable, resizable, scrolling container that can be used to display external content much like a normal web browser window. These objects are fully re-skinnable, which means all the graphic elements can be replaced to change the look of the windows. Buttons on the titlebar can be changed around or not used at all, depending upon the author's choices. Gl_Windows can also have menubars and statusbars added to them very easily, to further enhance their usefulness! The Gl_Window objects are usually accessed via the WidgetManager. They should never be created or destroyed directly as it could cause problems if the WidgetManager loses track of what's happening.
To use:
<script language="Javascript" src="gamelib_widgetmanager.js"></script>
An example of creating a new Gl_Window is given in the Widget docs. This document will describe the useful methods and properties of Gl_Windows. In practice you're unlikely to need to call many of the methods directly unless your scripts have very special requirements...
List of methods for Gl_Windows
addMenuBar
addStatusBar
addVScrollBar
changeContent
childDead
destroy
dragMoveTo
dragResizeTo
load
maximize
moveNoClipTo
moveTo
moveToTop
positionElements
resizeTo
removeVScrollBar
scroll
search
setActive
setBGColour
setStatus
setTitle
shade
switchToOutlines
switchToOpaque
unMaximize
List of (useful) properties for Gl_Windows
hasMenuBar
hasStatusBar
height
index
maximized
scrollBarWidth
scrollX
scrollY
searchMatches
shaded
statusTxt
title
URL
width
x
y
z
Descriptions of methods for Gl_Windows
Method | Parameters | Description |
---|---|---|
addMenuBar | MenuBar Object | When passed a menubar object as the sole parameter, the menubar will be fixed to the top of the window, and resize with its new parent window. See the menuBar docs for more details of the menuBar object. |
addStatusBar | String | This method adds a statusBar to a window. There's no need to create the statusBar yourself. The sole (optional) parameter is the text to display in the status bar. |
addVScrollBar | none | Private method - do not use. |
changeContent | String | This method is used to re-write the window with new HTML content. The window will be remeasured after this, and scrollbars hidden/shown to suit. |
childDead | none | Private method - do not use. |
destroy | none | Private method - do not use. |
dragMoveTo | none | Private method - do not use. |
dragResizeTo | none | Private method - do not use. |
load | String | This is used to load a new page into a window. The WidgetManager actually handles this, via its internal loading stack. This means a script can start several windows loading, and the WidgetManager will handle the synchronisation, loading the windows in the correct order. |
maximize | none | Causes the window to grow to fill the browser window. In this state, the window cannot be dragged or resized until its unMaximize method is called and it returns to its normal size. |
moveNoClipTo | Numeric, Numeric | The two parameters passed are the new X and Y coordinates for the top left hand corner of the window. This method is really designed for internal use, as it allows the window to be moved completely out of the browser window. |
moveTo | Numeric, Numeric | The two parameters passed are the new X and Y coordinates for the top left hand corner of the window. Windows cannot be moved off of the browser page using this method. |
moveToTop | none | This will move the window to the top of the Z-stack of windows. This means that this window will appear above all other windows on the screen. |
positionElements | none | This causes the window to check and reset the scrollbar, width, height and any elements contained within it. If you wish to manually change the scrolled position of the window by changing the scrollX and scrollY properties, you must call this method afterwards to update the window. |
resizeTo | Numeric, Numeric | Causes the window to resize to X,Y. A window cannot be resized larger than the browser window in either axis. |
removeVScrollBar | none | Private method - do not use. |
scroll | Numeric, Numeric | Private method - do not use. |
search | String | This causes the window to search its loaded or written contents for matches for the String passed as the parameter. Any text matches are highlighted in the window, and the statusBar (if present) will display the number of matches. |
setActive | none | Makes this window the active window. This also causes the window to move to the top of the Z-stacking order. |
setBGColour | String | Sets the background colour for the window. String passed must be a colour value. |
setStatus | String | Sets the text in the status bar (if present). |
setTitle | String | Sets the text in the title bar. |
shade | none | Causes the window to switch between "shaded" and "unshaded" states. When shaded, the main body of the window is hidden, so only the title bar is visible. The window can still be dragged around, maximized or destroyed in this state. |
switchToOutlines | none | Private method - do not use. |
switchToOpaque | none | Private method - do not use. |
unMaximize | none | Switches window from maximized state back to normal. |
Descriptions of (useful) properties for Gl_Windows
Property | Data Type | Read/Write | Description |
---|---|---|---|
hasMenuBar | Boolean | R | True if this window has a menuBar attached to it. See the menuBar docs for more details of the menuBar object. |
hasStatusBar | Boolean | R | True if this window has a statusBar object attached to it. See the statusBar docs for more details of the statusBar object. |
height | Numeric | R | The total height including titlebar and statusbar (if attached) of the window. |
index | Numeric | R | The window's unique index. This is its position in the widgetManager's .windows[] array. |
maximized | Boolean | R | True if the window has been maximized. |
scrollBarWidth | Numeric | R | If this is anything other than zero, the window is displaying a scrollbar. This would be due to the content of the window being longer than the window's current canvasHeight (the window's height-(titlebar height+statusbar height+menubar height). |
scrollX | Numeric | R/W | The window contents scrolled position in the X axis. If you set this value the window will not be updated unless you also call its positionElements method. |
scrollY | Numeric | R/W | The window contents scrolled position in the Y axis. If you set this value the window will not be updated unless you also call its positionElements method. |
searchMatches | Numeric | R | This is set after the search method has been called on the window. It reports the number of matches found within the window's current contents. |
shaded | Boolean | R | True if the window is currently shaded (minimized). |
statusTxt | String | R | The text currently displayed in the status bar attached to the window. Use the setStatus method to change this text. |
title | String | R | The text currently displayed in the title bar. Use the setTitle method to change this text. |
width | Numeric | R | The current width of the window. |
x | Numeric | R | The current X position of the window. This is the position of the left-hand edge of the window relative to the left-hand edge of the browser window. |
y | Numeric | R | The current Y position of the window. This is the position of the top edge of the window relative to the top edge of the browser window. |
z | Numeric | R | The current Z index of the window. Windows with higher Z indexes move over those with lower Z indexes. To move a window to the top of the stack on the desktop, use the setActive method. |