|
@@ -27,96 +27,7 @@
|
|
|
|
|
|
|
|
#ifndef ROCKETCORELUAELEMENT_H
|
|
#ifndef ROCKETCORELUAELEMENT_H
|
|
|
#define ROCKETCORELUAELEMENT_H
|
|
#define ROCKETCORELUAELEMENT_H
|
|
|
-/*
|
|
|
|
|
- This defines the Element type in the Lua global namespace
|
|
|
|
|
-
|
|
|
|
|
- A few classes "inherit" from Element, such as Document. Document will call
|
|
|
|
|
- LuaType<Element>::_regfunctions to put all of these functions in its own table, and
|
|
|
|
|
- will be used with the same syntax except it will be from a Document object. It isn't true
|
|
|
|
|
- inheritance, but it is a fair enough emulation. Any functions in the child class that have
|
|
|
|
|
- the same name as the function in Element will overwrite the one in Element.
|
|
|
|
|
-
|
|
|
|
|
- Here, I will be showing usage of the API, and it will show the type names rather than the regular
|
|
|
|
|
- local var = foo that is Lua. If you need info on the purpose of the functions, see the python docs
|
|
|
|
|
-
|
|
|
|
|
- //methods that need to be called from an Element object using the colon syntax
|
|
|
|
|
- noreturn Element:AddEventListener(string event, ? see footnote 1, [bool capture])
|
|
|
|
|
- noreturn Element:AppendChild(Element child)
|
|
|
|
|
- noreturn Element:Blur()
|
|
|
|
|
- noreturn Element:Click()
|
|
|
|
|
- noreturn Element:DispatchEvent(string event, {} params) --in params, keys have to be a string and value can be number,bool,string,userdata,lightuserdata
|
|
|
|
|
- noreturn Element:Focus()
|
|
|
|
|
- [int,float,Colourb,Colourf,string,Vector2f,lightuserdata] Element:GetAttribute(string name) --will return one of those types
|
|
|
|
|
- Element Element:GetElementById(string id)
|
|
|
|
|
- {}of elements Element:GetElementsByTagName(string tag)
|
|
|
|
|
- bool Element:HasAttribute(string name)
|
|
|
|
|
- bool Element:HasChildNodes()
|
|
|
|
|
- noreturn Element:InsertBefore(Element child,Element adjacent)
|
|
|
|
|
- bool Element:IsClassSet(string name)
|
|
|
|
|
- noreturn Element:RemoveAttribute(string name)
|
|
|
|
|
- bool Element:RemoveChild(Element child)
|
|
|
|
|
- bool Element:ReplaceChild(Element inserted,Element replaced)
|
|
|
|
|
- noreturn Element:ScrollIntoView(bool align_with_top)
|
|
|
|
|
- noreturn Element:SetAttribute(string name,string value)
|
|
|
|
|
- noreturn Element:SetClass(string name, bool activate)
|
|
|
|
|
- %type% Element.As.%type%(Element obj) --see footnote 2
|
|
|
|
|
- Element Element.new(string tag) --Do not use unless inside an ElementInstancer function.
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- //getters accessed by the period syntax from an element object
|
|
|
|
|
- --for attributes, if you save it to a local/global variable and try to modify that variable,
|
|
|
|
|
- --your changes will not be saved. You will have to use Element:SetAttribute
|
|
|
|
|
- {} of [key=string,value=int,float,Colourb,Colourf,string,Vector2f,lightuserdata] Element.attributes
|
|
|
|
|
- {} of Element Element.child_nodes
|
|
|
|
|
- string Element.class_name
|
|
|
|
|
- float Element.client_left
|
|
|
|
|
- float Element.client_height
|
|
|
|
|
- float Element.client_top
|
|
|
|
|
- float Element.client_width
|
|
|
|
|
- Element Element.first_child
|
|
|
|
|
- string Element.id
|
|
|
|
|
- string Element.inner_rml
|
|
|
|
|
- Element Element.last_child
|
|
|
|
|
- Element Element.next_sibling
|
|
|
|
|
- float Element.offset_height
|
|
|
|
|
- float Element.offset_left
|
|
|
|
|
- Element Element.offset_parent
|
|
|
|
|
- float Element.offset_top
|
|
|
|
|
- float Element.offset_width
|
|
|
|
|
- Document Element.owner_document
|
|
|
|
|
- Element Element.parent_nod
|
|
|
|
|
- Element Element.previous_sibling
|
|
|
|
|
- float Element.scroll_height
|
|
|
|
|
- float Element.scroll_left
|
|
|
|
|
- float Element.scroll_top
|
|
|
|
|
- float Element.scroll_width
|
|
|
|
|
- ElementStyle Element.style --see ElementStyle.h documentation
|
|
|
|
|
- string Element.tag_name
|
|
|
|
|
-
|
|
|
|
|
- //setters to be used with a dot syntax on an Element object
|
|
|
|
|
- Element.class_name = string
|
|
|
|
|
- Element.id = string
|
|
|
|
|
- Element.inner_rml = string
|
|
|
|
|
- Element.scroll_left = float
|
|
|
|
|
- Element.scroll_top = float
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- footnote 1: for Element:AddEventListener(string,?,bool)
|
|
|
|
|
- The ? can be either a string or a function.
|
|
|
|
|
- In the string, you can be guaranteed that you will have the
|
|
|
|
|
- named variables 'event','element','document' available to you, and they mean the same as if you were to put
|
|
|
|
|
- the string as onclick="string" in a .rml file.
|
|
|
|
|
- If you give it a function, the function will be called every time that C++ EventListener::ProcessEvent would
|
|
|
|
|
- would be called. In this case, it will call the function, and you can decide the name of the parameters, however
|
|
|
|
|
- it is in a specific order. The order is event,element,document. So:
|
|
|
|
|
- function foo(l,q,e) end element:AddEventListener("click",foo,true) is the correct syntax, and puts l=event,q=element,e=document
|
|
|
|
|
- They are terrible names, but it is to make a point.
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
- footnote 2: For Element.As used for casting an Element object to a more derived class.
|
|
|
|
|
- If you are using RocketControls, it will be filled with those types. For instance, you would say
|
|
|
|
|
- local input_element = Element.As.ElementFormControlInput(element) --where element is an Element object
|
|
|
|
|
-*/
|
|
|
|
|
#include <Rocket/Core/Lua/LuaType.h>
|
|
#include <Rocket/Core/Lua/LuaType.h>
|
|
|
#include <Rocket/Core/Lua/lua.hpp>
|
|
#include <Rocket/Core/Lua/lua.hpp>
|
|
|
#include <Rocket/Core/Element.h>
|
|
#include <Rocket/Core/Element.h>
|