Changes between Initial Version and Version 1 of GUI_Object_Interface


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

--

Legend:

Unmodified
Added
Removed
Modified
  • GUI_Object_Interface

    v1 v1  
     1The GUIObject class provides a JavaScript wrapper around GUI objects, allowing their properties to be manipulated.
     2
     3== GUIObject Methods ==
     4
     5getByName
     6
     7{{{
     8      Overview:
     9            Returns another GUIObject, matching a specific name.Syntax:
     10            var newguiobject = oldguiobject.getByName("objectname");Parameters:
     11            objectname: A string that corresponds to the name given in the GUI XML file. Case sensitive.Returns:
     12            A new GUIObject, or null if no match was found.Notes:
     13            Has the same effect as the global getGUIObjectByName(name) function.
     14}}}
     15
     16toString (Implicit)
     17
     18{{{
     19      Overview:
     20            Overrides the default string conversion to include the name of this GUI object.Syntax:
     21            var name = "The name is " + guiobject;Parameters:
     22            None.Returns:
     23            A string of the form '[GUIObject: objectname]'Notes:
     24            This function is called implicitly by the JavaScript engine to convert this object to a string.
     25}}}
     26
     27== GUIObject Properties ==
     28
     29parent
     30
     31{{{
     32      Overview:
     33            The GUIObject corresponding to the parent of this object.Type:
     34            GUIObjectNotes:
     35            Has the value null if the object has no parent. Read-only.
     36}}}
     37
     38anything else
     39
     40{{{
     41      Overview:
     42            Read/write access to object-type specific settings.Type:
     43            boolean / integer / double / string / GUIColor / GUISizeNotes:
     44            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.
     45}}}
     46
     47
     48
     49These 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
     53x, y
     54
     55{{{
     56      Overview:
     57            The coordinates of the mouse, measured in pixels from the top-left corner of the screen.Type:
     58            integerNotes:
     59            Read-only.
     60}}}
     61
     62buttons
     63
     64{{{
     65      Overview:
     66            Indicates the state of the mouse buttons. Bit 0 = LMB, bit 1 = RMB, bit 2 = MMB.Type:
     67            integerNotes:
     68            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.
     69}}}
     70
     71== GUISize Properties ==
     72
     73left, top, right, bottom
     74
     75{{{
     76      Overview:
     77            The absolute components of a rectangle, measured in pixels from the top-left corner of the parent object.Type:
     78            integer
     79}}}
     80
     81rleft, rtop, rright, rbottom
     82
     83{{{
     84      Overview:
     85            The relative components of a rectangle, measured in percentages of the width/height of the parent object.Type:
     86            integerNotes:
     87            The absolute and relative components are added to compute the final size of a GUI object. Either can be negative.
     88}}}
     89
     90== GUIColor Properties ==
     91
     92r, g, b, a
     93
     94{{{
     95      Overview:
     96            The red/green/blue/alpha components of a colour, in the range 0.0 to 1.0.Type:
     97            double
     98}}}