Changes between Version 2 and Version 3 of documentation/LuaManual/APIReference

Show
Ignore:
Author:
gambini (IP: 96.38.104.126)
Timestamp:
05/28/12 13:56:21 (5 years ago)
Comment:

halfway through converting types to monospace

Legend:

Unmodified
Added
Removed
Modified
  • documentation/LuaManual/APIReference

    v2 v3  
    1515== rocket Table == 
    1616 
    17  ''Context''` `'''CreateContext'''(''string name'', ''Vector2i dimensions''):: 
     17 `Context `'''CreateContext'''(`string` ''name'', `Vector2i` ''dimensions''):: 
    1818   Creates and returns a new context called ''name'', with initial dimensions of ''dimensions''. The name of the context must be unique; if it is not, ''nil'' will be returned 
    1919 
    20  ''bool''` `'''LoadFontFace'''(''string font_path''):: 
     20 `bool `'''LoadFontFace'''(`string` ''font_path''):: 
    2121   Loads the font face at ''font_path''. The function will return true if the font face was loaded, false if not. 
    2222 
    23  ''void''` `'''RegisterTag'''(''string tag_name'', ''ElementInstancer instancer''):: 
     23 `void `'''RegisterTag'''(`string` ''tag_name'', `ElementInstancer` ''instancer''):: 
    2424   Registers a [wiki:documentation/LuaManual/ElementInstancer ElementInstancer] to instance when a specific XML tag is encountered in an RML file. 
    2525 
    26  {{{{} }}}'''contexts''':: 
     26 '''contexts'''`   `(`{}`):: 
    2727   A table of the active libRocket contexts. It can be indexed by string (in which case the context with the matching name is returned), or number (in which case the nth context is returned). 
    2828 
    4343== Log == 
    4444 
    45  ''void''` `'''Message'''(''logtype type'', ''string message''):: 
     45 `void `'''Message'''(`logtype` ''type'', `string` ''message''):: 
    4646   Sends a log message to libRocket (and the attached debugger if present). This is not called from an instance of a Log object, just ''Log.Message''.[[br]] 
    4747   type should be one of: 
    5656Abstract DataSource Interface. Create one by calling ''DataSource.new'', and set the ''GetNumRows'' and ''GetRow'' functions to a Lua function that fits the specification. 
    5757 
    58  ''DataSource''` `'''new'''(''string name''):: 
     58 `DataSource `'''new'''(`string` ''name''):: 
    5959   Create a new DataSource object for use in Lua. 
    6060 
    61  ''void''` `'''NotifyRowAdd'''(''string table_name'', ''int first_row_added'', ''int num_rows_added''):: 
     61 `void `'''NotifyRowAdd'''(`string` ''table_name'', `int` ''first_row_added'', `int` ''num_rows_added''):: 
    6262   Notify listeners that rows have been added to the data source. 
    6363 
    64  ''void''` `'''NotifyRowRemove'''(''string table_name'', ''int first_row_removed'', ''int num_rows_removed''):: 
     64 `void `'''NotifyRowRemove'''(`string` ''table_name'', `int` ''first_row_removed'', `int` ''num_rows_removed''):: 
    6565   Notify listeners that rows have been removed from the data source. 
    6666 
    67  ''void''` `'''NotifyRowChange'''(''string table_name'', ''int first_row_changed'', ''int num_rows_changed''):: 
     67 `void `'''NotifyRowChange'''(`string` ''table_name'', `int` ''first_row_changed'', `int` ''num_rows_changed''):: 
    6868   Notify listeners that rows have been changed on the data source. 
    6969 
    70  ''void''` `'''NotifyRowChange'''(''string table_name''):: 
     70 `void `'''NotifyRowChange'''(`string` ''table_name''):: 
    7171   Notify listeners that all rows on the data source have changed. 
    7272 
    73  ''int''` `'''GetNumRows''' = function(''string table_name''):: 
     73 `int `'''GetNumRows''' = function(`string` ''table_name''):: 
    7474   To be set in Lua; return the number of rows in the given table. 
    7575 
    76  `{`''string''`} `'''GetRow''' = function(''string table_name'', ''int index'', `{`string`}` ''columns'') :: 
     76 `{string} `'''GetRow''' = function(`string` ''table_name'', `int` ''index'', `{string}` ''columns'') :: 
    7777   To be set in Lua; return a table of the values of the columns in string form. 
    7878 
    8282The ''Element'' class has no constructor; it must be instantiated through a ''[wiki:documentation/LuaManual/APIReference#Document Document]'' object instead. It has the following methods and properties: 
    8383 
    84  ''void''` `'''AddEventListener'''(''string event'', ''string'' OR ''function listener''[, ''bool in_capture_phase'']):: 
     84 `void `'''AddEventListener'''(`string` ''event'', `string` OR `function` ''listener''[, `bool` ''in_capture_phase'']):: 
    8585   Attaches ''listener'' to this element, listening for occurrences of ''event'' in either the bubble or capture phase. If not specified, ''in_capture_phase'' will default to false. [wiki:documentation/LuaManual/AttachingToEvents See also][[br]]''NOTE: Events added from Lua cannot be removed.'' 
    8686 
    87  ''void''` `'''AppendChild'''(''Element element''):: 
     87 `void `'''AppendChild'''(`Element` ''element''):: 
    8888   Appends ''element'' as a child to this element. 
    8989 
    90  ''void''` `'''Blur'''():: 
     90 `void `'''Blur'''():: 
    9191   Removes input focus from this element. 
    9292 
    93  ''void''` `'''Click'''():: 
     93 `void `'''Click'''():: 
    9494   Fakes a click on this element. 
    9595 
    96  ''void''` `'''DispatchEvent'''(''string event'', `{}` ''parameters'', ''bool interruptible''):: 
     96 `void `'''DispatchEvent'''(`string` ''event'', `{}` ''parameters'', `bool` ''interruptible''):: 
    9797   Dispatches an event to this element. The event is of type ''event''. Parameters to the event are given in the table ''parameters''; the table must only contain string keys and floating-point, integer, boolean, Lua userdata, or string values. ''interruptible'' determines if the event can be forced to stop propagation early. 
    9898 
    99  ''void''` `'''Focus'''():: 
     99 `void `'''Focus'''():: 
    100100   Gives input focus to this element. 
    101101 
    102  ''[wiki:documentation/LuaManual/Variant variant]''` `'''GetAttribute'''(''string name''):: 
     102 ''[wiki:documentation/LuaManual/Variant variant]''` `'''GetAttribute'''(`string` ''name''):: 
    103103   Returns the value of the attribute named ''name''. If no such attribute exists, the empty string will be returned. 
    104104 
    105  ''Element''` `'''GetElementById'''(''string id''):: 
     105 `Element `'''GetElementById'''(`string` ''id''):: 
    106106   Returns the descendant element with an id of ''id''. 
    107107 
    108  `{`''Element''`}` '''GetElementsByTagName'''(''string tag_name''):: 
     108 `{`Element} `'''GetElementsByTagName'''(`string` ''tag_name''):: 
    109109   Returns a list of all descendant elements with the tag of ''tag_name''. 
    110110 
    111  ''bool''` `'''HasAttribute'''(''string name''):: 
     111 `bool `'''HasAttribute'''(`string` ''name''):: 
    112112   Returns True if the element has a value for the attribute named ''name'', False if not. 
    113113 
    114  ''bool''` `'''HasChildNodes'''():: 
     114 `bool `'''HasChildNodes'''():: 
    115115   Returns True if the element has at least one child node, false if not. 
    116116 
    117  ''void''` `'''InsertBefore'''(''Element element'', ''Element adjacent_element''):: 
     117 `void `'''InsertBefore'''(`Element` ''element'', `Element` ''adjacent_element''):: 
    118118   Inserts the element ''element'' as a child of this element, directly before ''adjacent_element'' in the list of children. 
    119119 
    203203 
    204204 '''scroll_left'''`   `(''float''):: 
    205    The offset between the left edge of this element's client area and the left edge of the content area. 
     205   The offset between the left edge of this element's client area and the left edge of the content area. Read & write. 
    206206 
    207207 '''scroll_top'''`   `(''float''):: 
    208    The offset between the top edge of this element's client area and the top edge of the content area. 
     208   The offset between the top edge of this element's client area and the top edge of the content area. Read & write. 
    209209 
    210210 '''scroll_width'''`   `(''float''):: 
    219219== ElementText == 
    220220 
    221 '''class''' IElementText 
    222  
    223 ''IElementText'' derives from ''Element''. ''IElementText'' is an interface, and therefore cannot be instanced directly. A concrete ''ElementText'' must be instantiated through a ''[wiki:documentation/PythonManual/APIReference#Document Document]'' object instead. It has the following property: 
    224  
    225  '''text''':: 
     221''ElementText'' derives from ''Element''. ''ElementText'' is an interface, and therefore cannot be instanced directly. A concrete ''ElementText'' must be instantiated through a ''[wiki:documentation/LuaManual/APIReference#Document Document]'' object instead. It has the following property: 
     222 
     223 '''text'''`   `(''string''):: 
    226224   The raw text content of the text element in UTF-8 encoding. 
    227225 
    228226== Document == 
    229227 
    230 '''class''' Document 
    231  
    232228''Document'' derives from ''Element''. ''Document'' has no constructor; it must be instantiated through a ''[wiki:documentation/PythonManual/APIReference#Context Context]'' object instead, either by loading an external RML file or creating an empty document. It has the following methods and properties: 
    233229 
    234  '''PullToFront'''():: 
     230 ''void''` `'''PullToFront'''():: 
    235231   Pulls the document in front of other documents within its context with a similar z-index. 
    236232 
    237  '''PushToBack'''():: 
     233 ''void''` `'''PushToBack'''():: 
    238234   Pushes the document behind other documents within its context with a similar z-index. 
    239235 
    240  '''Show'''([''flags'']):: 
    241    Shows the document. ''flags'' is either ''NONE'', ''FOCUS'' or ''MODAL''. ''flags'' defaults to ''FOCUS''. 
    242  
    243  '''Hide'''():: 
     236 ''void''` `'''Show'''([''flags'']):: 
     237   Shows the document. ''flags'' is either ''Document.NONE'', ''Document.FOCUS'' or ''Document.MODAL''. ''flags'' defaults to ''Document.FOCUS''. 
     238 
     239 ''void''` `'''Hide'''():: 
    244240   Hides the document. 
    245241 
    246  '''Close'''():: 
     242 ''void''` `'''Close'''():: 
    247243   Hides and closes the document, destroying its contents. 
    248244 
    249  '''CreateElement'''(''tag_name''):: 
     245 ''Element''` `'''CreateElement'''(''tag_name''):: 
    250246   Instances an element with a tag of ''tag_name''. 
    251247 
    252  '''CreateTextNode'''(''text''):: 
     248 ''ElementText''` `'''CreateTextNode'''(''text''):: 
    253249   Instances a text element containing the string ''text''. 
    254250 
    255  '''title''':: 
    256    The title of the document, as initially set by the <title> tag in the document's header. 
    257  
    258  '''context''':: 
     251 '''title'''`   `(''string''):: 
     252   The title of the document, as initially set by the <title> tag in the document's header. Read & write. 
     253 
     254 '''context'''`   `(''Context''):: 
    259255   The context the document belongs to. Read-only. 
    260256 
    261257== Event == 
    262258 
    263 '''class''' Event 
    264  
    265259The Event class has no constructor; it is generated internally. It has the following methods and properties: 
    266260 
    267  '''StopPropagation'''():: 
     261 ''void''` `'''StopPropagation'''():: 
    268262   Stops the propagation of the event through the event cycle, if allowed. 
    269263 
    270  '''current_element''':: 
     264 '''current_element'''`   `(''Element''):: 
    271265   The element the event has propagated to. Read-only. 
    272266 
    273  '''type''':: 
     267 '''type'''`   `(''string''):: 
    274268   The string name of the event. Read-only. 
    275269 
    276  '''target_element''':: 
     270 '''target_element'''`   `(''Element''):: 
    277271   The element the event was originally targeted at. Read-only. 
    278272 
    279  '''parameters''':: 
    280    A dictionary like object containing all the parameters in the event. 
     273 '''parameters'''`   `(`{k=`''string'',`v=`''[wiki:documentation/LuaManual/Variant variant]''):: 
     274   A dictionary like object containing all the parameters in the event. Read-only [wiki:documentation/LuaManual/ProxyTables proxy table]. 
    281275 
    282276== Context == 
    283  
    284 '''class''' Context 
    285  
    286 The ''Context'' class has no constructor; it must be instantiated through the ''CreateContext()'' function. It has the following methods and properties: 
    287  
    288  '''AddEventListener'''(''event'', ''script'', ''element_context'', ''in_capture_phase''):: 
    289    Adds the inline Python script, ''script'', as an event listener to the context. ''element_context'' is an optional Element; if it is not None, then the script will be executed as if it was bound to that element. 
    290  
    291  '''AddMouseCursor'''(''cursor_document''):: 
     277The ''Context'' class has no constructor; it must be instantiated through the ''rocket.CreateContext()'' function. It has the following methods and properties: 
     278 
     279 ''void''` `'''AddEventListener'''(''string event'', ''string OR function script'', ''Element element_context'', ''bool in_capture_phase''):: 
     280   Adds the inline Lua script, ''script'', as an event listener to the context. Rules for ''script'' are the same as the ''listener'' argument to ''Element.AddEventListener''. ''element_context'' is an optional Element; if it is not nil, then the script will be executed as if it was bound to that element. 
     281 
     282 ''void''` `'''AddMouseCursor'''(''cursor_document''):: 
    292283   Adds a cursor document loaded by another context into this context. The cursor document will be returned. 
    293284