nomlib
Loading...
Searching...
No Matches
nom::UIWidget Class Reference
Inheritance diagram for nom::UIWidget:
[legend]

Public Types

enum  FocusPolicy { NONE = rocket::ElementDocument::FocusFlags::NONE , FOCUS = rocket::ElementDocument::FocusFlags::FOCUS , MODAL = rocket::ElementDocument::FocusFlags::MODAL }
typedef UIWidget self_type
typedef self_type * raw_ptr

Public Member Functions

 UIWidget ()
 Default constructor; initialize default title element ID.
virtual ~UIWidget ()
 Destructor.
virtual Point2i position () const
 Get the position of the widget.
virtual Size2i size () const
 Get the size of the widget.
virtual void set_position (const Point2i &pos)
 Set the position of the widget.
virtual void set_size (const Size2i &dims)
 Set the size of the widget.
UIContextcontext () const
rocket::ElementDocument * document () const
bool valid () const
bool valid (rocket::Element *target) const
bool visible () const
const std::string & title_id () const
std::string title () const
uint32 text_alignment (rocket::Element *target) const
 Get an element's text alignment.
bool set_context (UIContext *ctx)
bool load_document_file (const std::string &filename)
void show ()
void hide ()
void close ()
void set_focus (uint32 focus=FocusPolicy::FOCUS)
 Set the focus policy.
bool hit_test (rocket::Element *target, const Point2i &pt)
 Perform a bounds coordinates collision test.
void set_title (const std::string &text)
void set_title_id (const std::string &id)
void set_font (rocket::Element *target, const std::string &font)
void set_font_size (rocket::Element *target, int point_size)
bool set_alignment (uint32 alignment)
void set_text_alignment (rocket::Element *element, uint32 alignment)
void register_event_listener (rocket::Element *element, const std::string &ev, UIEventListener *observer, bool interruptible=false)
 Register an event listener for an element.

Private Attributes

UIContextctx_
rocket::ElementDocument * document_
std::string title_id_

Detailed Description

Definition at line 45 of file UIWidget.hpp.

Member Typedef Documentation

◆ raw_ptr

typedef self_type* nom::UIWidget::raw_ptr

Definition at line 49 of file UIWidget.hpp.

◆ self_type

typedef UIWidget nom::UIWidget::self_type

Definition at line 48 of file UIWidget.hpp.

Member Enumeration Documentation

◆ FocusPolicy

enum nom::UIWidget::FocusPolicy

Definition at line 51 of file UIWidget.hpp.

Constructor & Destructor Documentation

◆ UIWidget()

nom::UIWidget::UIWidget ( )

Default constructor; initialize default title element ID.

See also
UIWidget::set_context, UIWidget::load_document_file, UIWidget::show.

Member Function Documentation

◆ context()

UIContext * nom::UIWidget::context ( ) const
Returns
A non-owned object pointer.

◆ document()

rocket::ElementDocument * nom::UIWidget::document ( ) const
Returns
A non-owned object pointer.

◆ position()

virtual Point2i nom::UIWidget::position ( ) const
virtual

Get the position of the widget.

Returns
The position of the widget (body element) upon success, or Point2i::null on failure, such as when a document has not yet been loaded into memory.
Remarks
This method depends on the document first being loaded into memory.

◆ register_event_listener()

void nom::UIWidget::register_event_listener ( rocket::Element * element,
const std::string & ev,
UIEventListener * observer,
bool interruptible = false )

Register an event listener for an element.

Parameters
elementThe document's element to listen on behalf of.
evThe event name to listen for, i.e.: 'mouseup'; must use libRocket event names.
See also
http://librocket.com/wiki/documentation/RML/Events

◆ set_focus()

void nom::UIWidget::set_focus ( uint32 focus = FocusPolicy::FOCUS)

Set the focus policy.

See also
UIWidget::FocusPolicy enumeration.

◆ set_position()

virtual void nom::UIWidget::set_position ( const Point2i & pos)
virtual

Set the position of the widget.

Parameters
posThe X, Y coordinates used for document positioning; these will be relative to the context in use.
Remarks
This method depends on the document first being loaded into memory.

◆ set_size()

virtual void nom::UIWidget::set_size ( const Size2i & dims)
virtual

Set the size of the widget.

Parameters
dimsThe width and height to use for document dimensions; these will be relative to the context in use.
Remarks
This method depends on the document first being loaded into memory.
Note
The size does not take precedence over the max-width and max-height style sheet properties when they have been set by the end-user.

◆ set_text_alignment()

void nom::UIWidget::set_text_alignment ( rocket::Element * element,
uint32 alignment )
Parameters
alignmentOne of the following Anchor enumerations: Anchor::Left, Anchor::Center, Anchor::Right.
Todo
Change return type to boolean

◆ size()

virtual Size2i nom::UIWidget::size ( ) const
virtual

Get the size of the widget.

Returns
The size of the widget (body element) upon success, or Size2i::null on failure, such as when a document has not yet been loaded into memory.
Remarks
This method depends on the document first being loaded into memory.

◆ text_alignment()

uint32 nom::UIWidget::text_alignment ( rocket::Element * target) const

Get an element's text alignment.

Returns
One of the nom::Anchor enumeration values.

Member Data Documentation

◆ ctx_

UIContext* nom::UIWidget::ctx_
private
Remarks
This pointer is not owned by us, and must not be freed.

Definition at line 172 of file UIWidget.hpp.

◆ document_

rocket::ElementDocument* nom::UIWidget::document_
private
Remarks
This pointer is not owned by us, and must not be freed.

Definition at line 175 of file UIWidget.hpp.

◆ title_id_

std::string nom::UIWidget::title_id_
private

Definition at line 177 of file UIWidget.hpp.


The documentation for this class was generated from the following file: