|
libRocket
|
#include <Context.h>
Public Member Functions | |
| Context (const String &name) | |
| virtual | ~Context () |
| Destroys a context. More... | |
| const String & | GetName () const |
| void | SetDimensions (const Vector2i &dimensions) |
| const Vector2i & | GetDimensions () const |
| bool | Update () |
| Updates all elements in the context's documents. More... | |
| bool | Render () |
| Renders all visible elements in the context's documents. More... | |
| ElementDocument * | CreateDocument (const String &tag="body") |
| ElementDocument * | LoadDocument (const String &document_path) |
| ElementDocument * | LoadDocument (Stream *document_stream) |
| ElementDocument * | LoadDocumentFromMemory (const String &string) |
| void | UnloadDocument (ElementDocument *document) |
| void | UnloadAllDocuments () |
| Unloads all loaded documents. More... | |
| void | AddMouseCursor (ElementDocument *cursor_document) |
| ElementDocument * | LoadMouseCursor (const String &cursor_document_path) |
| void | UnloadMouseCursor (const String &cursor_name) |
| void | UnloadAllMouseCursors () |
| Unloads all currently loaded cursors. More... | |
| bool | SetMouseCursor (const String &cursor_name) |
| void | ShowMouseCursor (bool show) |
| ElementDocument * | GetDocument (const String &id) |
| ElementDocument * | GetDocument (int index) |
| int | GetNumDocuments () const |
| Element * | GetHoverElement () |
| Element * | GetFocusElement () |
| Element * | GetRootElement () |
| void | PullDocumentToFront (ElementDocument *document) |
| void | PushDocumentToBack (ElementDocument *document) |
| void | AddEventListener (const String &event, EventListener *listener, bool in_capture_phase=false) |
| void | RemoveEventListener (const String &event, EventListener *listener, bool in_capture_phase=false) |
| bool | ProcessKeyDown (Input::KeyIdentifier key_identifier, int key_modifier_state) |
| bool | ProcessKeyUp (Input::KeyIdentifier key_identifier, int key_modifier_state) |
| bool | ProcessTextInput (word character) |
| bool | ProcessTextInput (const String &string) |
| void | ProcessMouseMove (int x, int y, int key_modifier_state) |
| void | ProcessMouseButtonDown (int button_index, int key_modifier_state) |
| void | ProcessMouseButtonUp (int button_index, int key_modifier_state) |
| bool | ProcessMouseWheel (int wheel_delta, int key_modifier_state) |
| RenderInterface * | GetRenderInterface () const |
| bool | GetActiveClipRegion (Vector2i &origin, Vector2i &dimensions) const |
| void | SetActiveClipRegion (const Vector2i &origin, const Vector2i &dimensions) |
| void | SetInstancer (ContextInstancer *instancer) |
Public Member Functions inherited from Rocket::Core::ScriptInterface | |
| virtual | ~ScriptInterface () |
| virtual ScriptObject | GetScriptObject () const |
Public Member Functions inherited from Rocket::Core::ReferenceCountable | |
| ReferenceCountable (int initial_count=1) | |
| virtual | ~ReferenceCountable () |
| Destructor. The reference count must be 0 when this is invoked. More... | |
| virtual int | GetReferenceCount () |
| Returns the number of references outstanding against this object. More... | |
| virtual void | AddReference () |
| Increases the reference count. If this pushes the count above 0, OnReferenceActivate() will be called. More... | |
| virtual void | RemoveReference () |
| Decreases the reference count. If this pushes the count to 0, OnReferenceDeactivate() will be called. More... | |
| ReferenceCountable & | operator= (const ReferenceCountable ©) |
| Catches incorrect copy attempts. More... | |
Protected Member Functions | |
| virtual void | OnReferenceDeactivate () |
| A hook method called when the reference count drops to 0. More... | |
Protected Member Functions inherited from Rocket::Core::ReferenceCountable | |
| virtual void | OnReferenceActivate () |
| A hook method called when the reference count climbs from 0. More... | |
Friends | |
| class | Element |
| ROCKETCORE_API Context * | CreateContext (const String &, const Vector2i &, RenderInterface *) |
Additional Inherited Members | |
Static Public Member Functions inherited from Rocket::Core::ReferenceCountable | |
| static void | DumpLeakReport () |
| If any reference countable objects are still allocated, this function will write a leak report to the log. More... | |
A context for storing, rendering and processing RML documents. Multiple contexts can exist simultaneously.
| Rocket::Core::Context::Context | ( | const String & | name | ) |
Constructs a new, uninitialised context. This should not be called directly, use Core::CreateContext() instead.
| [in] | name | The name of the context. |
|
virtual |
Destroys a context.
| void Rocket::Core::Context::AddEventListener | ( | const String & | event, |
| EventListener * | listener, | ||
| bool | in_capture_phase = false |
||
| ) |
Adds an event listener to the context's root element.
| [in] | event | The name of the event to attach to. |
| [in] | listener | Listener object to be attached. |
| [in] | in_capture_phase | True if the listener is to be attached to the capture phase, false for the bubble phase. |
| void Rocket::Core::Context::AddMouseCursor | ( | ElementDocument * | cursor_document | ) |
Adds a previously-loaded cursor document as a mouse cursor within this context. This allows you to share cursors between contexts.
| [in] | cursor_document | The document to add as a cursor into this context. |
| ElementDocument* Rocket::Core::Context::CreateDocument | ( | const String & | tag = "body" | ) |
Creates a new, empty document and places it into this context.
| [in] | tag | The document type to create. |
Gets the current clipping region for the render traversal
| [out] | origin | The clipping origin |
| [out] | dimensions | The clipping dimensions |
| const Vector2i& Rocket::Core::Context::GetDimensions | ( | ) | const |
Returns the dimensions of the context.
| ElementDocument* Rocket::Core::Context::GetDocument | ( | const String & | id | ) |
Returns the first document in the context with the given id.
| [in] | id | The id of the desired document. |
| ElementDocument* Rocket::Core::Context::GetDocument | ( | int | index | ) |
Returns a document in the context by index.
| [in] | index | The index of the desired document. |
| Element* Rocket::Core::Context::GetFocusElement | ( | ) |
Returns the focus element.
| Element* Rocket::Core::Context::GetHoverElement | ( | ) |
Returns the hover element.
| const String& Rocket::Core::Context::GetName | ( | ) | const |
Returns the name of the context.
| int Rocket::Core::Context::GetNumDocuments | ( | ) | const |
Returns the number of documents in the context.
| RenderInterface* Rocket::Core::Context::GetRenderInterface | ( | ) | const |
Gets the context's render interface.
| Element* Rocket::Core::Context::GetRootElement | ( | ) |
Returns the root element that holds all the documents
| ElementDocument* Rocket::Core::Context::LoadDocument | ( | const String & | document_path | ) |
Load a document into the context.
| [in] | document_path | The path to the document to load. |
| ElementDocument* Rocket::Core::Context::LoadDocument | ( | Stream * | document_stream | ) |
Load a document into the context.
| [in] | document_stream | The opened stream, ready to read. |
| ElementDocument* Rocket::Core::Context::LoadDocumentFromMemory | ( | const String & | string | ) |
Load a document into the context.
| [in] | string | The string containing the document RML. |
| ElementDocument* Rocket::Core::Context::LoadMouseCursor | ( | const String & | cursor_document_path | ) |
Loads a document as a mouse cursor within this context.
| [in] | cursor_document_path | The path to the document to load as a cursor. |
|
protectedvirtual |
A hook method called when the reference count drops to 0.
Reimplemented from Rocket::Core::ReferenceCountable.
| bool Rocket::Core::Context::ProcessKeyDown | ( | Input::KeyIdentifier | key_identifier, |
| int | key_modifier_state | ||
| ) |
Sends a key down event into this context.
| [in] | key_identifier | The key pressed. |
| [in] | key_modifier_state | The state of key modifiers (shift, control, caps-lock, etc) keys; this should be generated by ORing together members of the Input::KeyModifier enumeration. |
| bool Rocket::Core::Context::ProcessKeyUp | ( | Input::KeyIdentifier | key_identifier, |
| int | key_modifier_state | ||
| ) |
Sends a key up event into this context.
| [in] | key_identifier | The key released. |
| [in] | key_modifier_state | The state of key modifiers (shift, control, caps-lock, etc) keys; this should be generated by ORing together members of the Input::KeyModifier enumeration. |
| void Rocket::Core::Context::ProcessMouseButtonDown | ( | int | button_index, |
| int | key_modifier_state | ||
| ) |
Sends a mouse-button down event into this context.
| [in] | button_index | The index of the button that was pressed; 0 for the left button, 1 for right, and any others from 2 onwards. |
| [in] | key_modifier_state | The state of key modifiers (shift, control, caps-lock, etc) keys; this should be generated by ORing together members of the Input::KeyModifier enumeration. |
| void Rocket::Core::Context::ProcessMouseButtonUp | ( | int | button_index, |
| int | key_modifier_state | ||
| ) |
Sends a mouse-button up event into this context.
| [in] | button_index | The index of the button that was release; 0 for the left button, 1 for right, and any others from 2 onwards. |
| [in] | key_modifier_state | The state of key modifiers (shift, control, caps-lock, etc) keys; this should be generated by ORing together members of the Input::KeyModifier enumeration. |
| void Rocket::Core::Context::ProcessMouseMove | ( | int | x, |
| int | y, | ||
| int | key_modifier_state | ||
| ) |
Sends a mouse movement event into this context.
| [in] | x | The x-coordinate of the mouse cursor, in window-coordinates (ie, 0 should be the left of the client area). |
| [in] | y | The y-coordinate of the mouse cursor, in window-coordinates (ie, 0 should be the top of the client area). |
| [in] | key_modifier_state | The state of key modifiers (shift, control, caps-lock, etc) keys; this should be generated by ORing together members of the Input::KeyModifier enumeration. |
| bool Rocket::Core::Context::ProcessMouseWheel | ( | int | wheel_delta, |
| int | key_modifier_state | ||
| ) |
Sends a mouse-wheel movement event into this context.
| [in] | wheel_delta | The mouse-wheel movement this frame. Rocket treats a negative delta as up movement (away from the user), positive as down. |
| [in] | key_modifier_state | The state of key modifiers (shift, control, caps-lock, etc) keys; this should be generated by ORing together members of the Input::KeyModifier enumeration. |
| bool Rocket::Core::Context::ProcessTextInput | ( | word | character | ) |
Sends a single character of text as text input into this context.
| [in] | character | The UCS-2 character to send into this context. |
| bool Rocket::Core::Context::ProcessTextInput | ( | const String & | string | ) |
Sends a string of text as text input into this context.
| [in] | string | The UCS-2 string to send into this context. |
| void Rocket::Core::Context::PullDocumentToFront | ( | ElementDocument * | document | ) |
Brings the document to the front of the document stack.
| [in] | document | The document to pull to the front of the stack. |
| void Rocket::Core::Context::PushDocumentToBack | ( | ElementDocument * | document | ) |
Sends the document to the back of the document stack.
| [in] | document | The document to push to the bottom of the stack. |
| void Rocket::Core::Context::RemoveEventListener | ( | const String & | event, |
| EventListener * | listener, | ||
| bool | in_capture_phase = false |
||
| ) |
Removes an event listener from the context's root element.
| [in] | event | The name of the event to detach from. |
| [in] | listener | Listener object to be detached. |
| [in] | in_capture_phase | True to detach from the capture phase, false from the bubble phase. |
| bool Rocket::Core::Context::Render | ( | ) |
Renders all visible elements in the context's documents.
| void Rocket::Core::Context::SetActiveClipRegion | ( | const Vector2i & | origin, |
| const Vector2i & | dimensions | ||
| ) |
Sets the current clipping region for the render traversal
| [out] | origin | The clipping origin |
| [out] | dimensions | The clipping dimensions |
| void Rocket::Core::Context::SetDimensions | ( | const Vector2i & | dimensions | ) |
Changes the dimensions of the context.
| [in] | dimensions | The new dimensions of the context. |
| void Rocket::Core::Context::SetInstancer | ( | ContextInstancer * | instancer | ) |
Sets the instancer to use for releasing this object.
| [in] | instancer | The context's instancer. |
| bool Rocket::Core::Context::SetMouseCursor | ( | const String & | cursor_name | ) |
Sets a cursor as the active cursor.
| [in] | cursor_name | The name of the cursor to activate. |
| void Rocket::Core::Context::ShowMouseCursor | ( | bool | show | ) |
Shows or hides the cursor.
| [in] | show | True to show the cursor, false to hide it. |
| void Rocket::Core::Context::UnloadAllDocuments | ( | ) |
Unloads all loaded documents.
| void Rocket::Core::Context::UnloadAllMouseCursors | ( | ) |
Unloads all currently loaded cursors.
| void Rocket::Core::Context::UnloadDocument | ( | ElementDocument * | document | ) |
Unload the given document.
| [in] | document | The document to unload. |
| void Rocket::Core::Context::UnloadMouseCursor | ( | const String & | cursor_name | ) |
Unload the given cursor.
| [in] | cursor_name | The name of cursor to unload. |
| bool Rocket::Core::Context::Update | ( | ) |
Updates all elements in the context's documents.
|
friend |
Creates a new element context.
| [in] | name | The new name of the context. This must be unique. |
| [in] | dimensions | The initial dimensions of the new context. |
| [in] | render_interface | The custom render interface to use, or NULL to use the default. |
|
friend |
1.8.8