Changes between Initial Version and Version 1 of Exposed_GUI_Functions


Ignore:
Timestamp:
Feb 23, 2008, 4:19:00 AM (16 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Exposed_GUI_Functions

    v1 v1  
     1The GUIObject class provides a !JavaScript wrapper around GUI objects, allowing their properties to be manipulated.
     2
     3= GUIObject Methods =
     4
     5== getByName ==
     6
     7 * '''Overview:'''
     8  * Returns another GUIObject, matching a specific name.
     9 * '''Syntax:'''
     10  * var newguiobject = oldguiobject.getByName("objectname");
     11 * '''Parameters:'''
     12  * objectname: A string that corresponds to the name given in the GUI XML file. Case sensitive.
     13 * '''Returns:'''
     14  * A new GUIObject, or null if no match was found.Notes:
     15  * Has the same effect as the global ''getGUIObjectByName(name)'' function.
     16
     17== toString (Implicit) ==
     18
     19 * '''Overview:'''
     20  * Overrides the default string conversion to include the name of this GUI object.
     21 * '''Syntax:'''
     22  * var name = "The name is " + guiobject;
     23 * '''Parameters:'''
     24  * None.
     25 * '''Returns:'''
     26  * A string of the form '[GUIObject: objectname]'
     27 * '''Notes:'''
     28  * This function is called implicitly by the !JavaScript engine to convert this object to a string.
     29
     30= GUIObject Properties =
     31
     32== parent ==
     33
     34 * '''Overview:'''
     35  * The GUIObject corresponding to the parent of this object.
     36 * '''Type:'''
     37  * GUIObject
     38 * '''Notes:'''
     39  * Has the value null if the object has no parent. Read-only.
     40
     41== anything else ==
     42
     43 * '''Overview:'''
     44  * Read/write access to object-type specific settings.
     45 * '''Type:'''
     46  * boolean / integer / double / string / GUIColor / GUISize
     47 * '''Notes:'''
     48  * Unrecognised parameters are passed to the GUI system as object-specific settings. The valid settings are documented in the GUI TDD, with the addition of 'caption'. If the object does not recognise the setting, an error is reported and a JS exception is thrown.
     49  * These data types are used to pass data in and out of GUI objects. All have constructors (with parameters in the same order as the properties described below) and toString methods.
     50
     51= GUIMouse Properties =
     52
     53== x, y ==
     54
     55 * '''Overview:'''
     56  * The coordinates of the mouse, measured in pixels from the top-left corner of the screen.
     57 * '''Type:'''
     58  * integer
     59 * '''Notes:'''
     60  * Read-only. '''mouse.x''' and '''mouse.y''' also seem to work.
     61
     62== buttons ==
     63
     64 * '''Overview:'''
     65  * Indicates the state of the mouse buttons.
     66  * Bit 0 = LMB, bit 1 = RMB, bit 2 = MMB.
     67 * '''Type:'''
     68  * integer
     69 * '''Notes:'''
     70  * If the mouse buttons are read by code inside a mouse-related event handler, mouse-down events set the appropriate bit of 'buttons' high before executing the code, while mouse-up events clear the appropriate bit of 'buttons' to zero after running the code.
     71
     72= GUISize Properties =
     73
     74== left, top, right, bottom ==
     75
     76 * '''Overview:'''
     77  * The absolute components of a rectangle, measured in pixels from the top-left corner of the parent object.
     78 * '''Type:'''
     79  * integer
     80
     81== rleft, rtop, rright, rbottom ==
     82
     83 * '''Overview:'''
     84  * The relative components of a rectangle, measured in percentages of the width/height of the parent object.
     85 * '''Type:'''
     86  * integer
     87 * '''Notes:'''
     88  * The absolute and relative components are added to compute the final size of a GUI object. Either can be negative.
     89
     90= GUIColor Properties =
     91
     92== r, g, b, a ==
     93
     94 * '''Overview:'''
     95  * The red/green/blue/alpha components of a colour, in the range 0.0 to 1.0.
     96 * '''Type:'''
     97  * double
     98
     99= GUI Global Functions =
     100
     101== getGUIObjectByName ==
     102 * '''Overview:'''
     103  * Look up a GUI object, given name.
     104 * '''Syntax:'''
     105  * object = getGUIObjectByName(name)
     106 * '''Parameters:'''
     107  * name [string]
     108 * '''Returns:'''
     109  * object
     110 * '''Notes:'''
     111  *
     112
     113== getGUIGlobal ==
     114 * '''Overview:'''
     115  * Returns the sort-of-global object associated with the current GUI.
     116 * '''Syntax:'''
     117  * global = getGUIGlobal()
     118 * '''Parameters:'''
     119  *
     120 * '''Returns:'''
     121  * global object
     122 * '''Notes:'''
     123  * Useful for accessing an object from another scope.
     124
     125= GUI JS Functions =
     126
     127Utility functions that have been written in JS, rather than being exposed from the engine.
     128
     129== List functions ==
     130These are functions for all the controls using the [wiki:GUI_-_Properties#list list] property, i.e. The [wiki:GUI_-_List List] and the [wiki:GUI_-_Drop-down Drop-down].
     131
     132=== insertItem ===
     133 * '''Overview:'''
     134  * Inserts an item to an object's [wiki:GUI_-_Properties#list list], and updates the selection accordingly.
     135 * '''Syntax:'''
     136  * insertItem(objectName, pos, value)
     137 * '''Parameters:'''
     138  * objectName: Name of the object.
     139  * pos: index position in the list, 0 inserts it before the first item.
     140  * value: string value of the new item.
     141 * '''Returns:'''
     142
     143=== removeItem ===
     144 * '''Overview:'''
     145  * Removes an item from an object's [wiki:GUI_-_Properties#list list], and updates the selection accordingly.
     146 * '''Syntax:'''
     147  * removeItem(objectName, pos)
     148 * '''Parameters:'''
     149  * objectName: Name of the object.
     150  * pos: index position in the list, 0 removes the first item.
     151 * '''Returns:'''
     152
     153=== pushItem ===
     154 * '''Overview:'''
     155  * Adds an item to the end of the list.
     156 * '''Syntax:'''
     157  * pushItem(objectName, value)
     158 * '''Parameters:'''
     159  * objectName: Name of the object.
     160  * value: The string value you would like to input.
     161 * '''Returns:'''
     162
     163=== popItem ===
     164 * '''Overview:'''
     165  * Removes the last item from a list.
     166 * '''Syntax:'''
     167  * popItem(objectName)
     168 * '''Parameters:'''
     169  * objectName: Name of the object.
     170 * '''Returns:'''
     171
     172=== getNumItems ===
     173 * '''Overview:'''
     174  * Retrieves the number of items in a list.
     175 * '''Syntax:'''
     176  * getNumItems(objectName)
     177 * '''Parameters:'''
     178  * objectName: Name of the object.
     179 * '''Returns:'''
     180  * Number of items in the list.
     181
     182=== getItemValue ===
     183 * '''Overview:'''
     184  * Retrieves the item value at given position.
     185 * '''Syntax:'''
     186  * getItemValue(objectName, pos)
     187 * '''Parameters:'''
     188  * objectName: Name of the object.
     189  * pos: Position of item you would like to retrieve, the first one is 0.
     190 * '''Returns:'''
     191  * The value as string.
     192
     193=== getCurrItemValue ===
     194 * '''Overview:'''
     195  * Retrieves the item value of the currently selected item.
     196 * '''Syntax:'''
     197  * getCurrItemValue(objectName)
     198 * '''Parameters:'''
     199  * objectName: Name of the object.
     200 * '''Returns:'''
     201  * The value as string.