nomlib
Loading...
Searching...
No Matches
nom::UIMessageBox Class Reference

Simple message box model. More...

#include <UIMessageBox.hpp>

Inheritance diagram for nom::UIMessageBox:
[legend]

Public Types

typedef UIMessageBox self_type
typedef self_type * raw_ptr
Public Types inherited from nom::UIWidget
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

 UIMessageBox ()
 Default constructor; initialize default element IDs.
virtual ~UIMessageBox ()
 Destructor.
bool enabled () const
std::string title_text () const
IntRect title_bounds () const
 Obtain the rectangle bounds of the title string.
uint32 title_alignment () const
std::string message_text () const
IntRect message_bounds () const
 Obtain the rectangle bounds of the message string.
uint32 message_alignment () const
const std::string & message_id () const
void disable ()
void enable ()
void set_title (const std::string &text, const std::string &font, uint point_size)
 Set the title (caption) text of the message box.
void set_title_text (const std::string &text)
 Set the title (caption) text of the message box.
void set_title_font (const std::string &font)
 Set the title (caption) text's font.
void set_title_font_size (int point_size)
 Set the title (caption) text's font size.
void set_title_alignment (uint32 align)
 Set the title (caption) text's alignment.
void set_message (const std::string &text, const std::string &font, uint point_size)
 Set the message text label.
void set_message_text (const std::string &text)
 Set the message text label.
void set_message_font (const std::string &font)
 Set the message text's font.
void set_message_font_size (int point_size)
 Set the message text's font size.
void set_message_alignment (uint32 align)
 Set the message text's alignment.
void set_message_id (const std::string &id)
Public Member Functions inherited from nom::UIWidget
 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

std::string message_id_

Detailed Description

Simple message box model.

Todo
Check for valid element IDs

Definition at line 45 of file UIMessageBox.hpp.

Member Typedef Documentation

◆ raw_ptr

typedef self_type* nom::UIMessageBox::raw_ptr

Definition at line 50 of file UIMessageBox.hpp.

◆ self_type

typedef UIMessageBox nom::UIMessageBox::self_type

Definition at line 48 of file UIMessageBox.hpp.

Constructor & Destructor Documentation

◆ UIMessageBox()

nom::UIMessageBox::UIMessageBox ( )

Default constructor; initialize default element IDs.

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

Member Function Documentation

◆ message_bounds()

IntRect nom::UIMessageBox::message_bounds ( ) const

Obtain the rectangle bounds of the message string.

Returns
nom::IntRect object with the absolute X, Y coordinates – as rendered – and string's dimensions with respect to the current font in use.
Note
The string's height dimension is the newline height, not the maximal glyph height.
Todo
Rename to message_text_bounds

◆ set_message()

void nom::UIMessageBox::set_message ( const std::string & text,
const std::string & font,
uint point_size )

Set the message text label.

Remarks
The message label text's alignment is set to Anchor::MiddleCenter.

◆ set_message_alignment()

void nom::UIMessageBox::set_message_alignment ( uint32 align)

Set the message text's alignment.

Parameters
alignmentOne of the following Anchor enumerations: Anchor::Left, Anchor::Center, Anchor::Right.
Todo
This method is currently broken; although the text-align property is, in fact, being updated (as per visual debugger output), we are still getting the original text-align value. Something to do with the internal (libRocket) caching perhaps...

◆ set_title()

void nom::UIMessageBox::set_title ( const std::string & text,
const std::string & font,
uint point_size )

Set the title (caption) text of the message box.

Remarks
The title text's alignment is set to Anchor::TopLeft.

◆ set_title_alignment()

void nom::UIMessageBox::set_title_alignment ( uint32 align)

Set the title (caption) text's alignment.

Parameters
alignmentOne of the following Anchor enumerations: Anchor::Left, Anchor::Center, Anchor::Right.
Todo
This method is currently broken; although the text-align property is, in fact, being updated (as per visual debugger output), we are still getting the original text-align value. Something to do with the internal (libRocket) caching perhaps...

◆ title_bounds()

IntRect nom::UIMessageBox::title_bounds ( ) const

Obtain the rectangle bounds of the title string.

Returns
nom::IntRect object with the absolute X, Y coordinates – as rendered – and string's dimensions with respect to the current font in use.
Note
The string's height dimension is the newline height, not the maximal glyph height.
Todo
Rename to title_text_bounds

Member Data Documentation

◆ message_id_

std::string nom::UIMessageBox::message_id_
private

Definition at line 156 of file UIMessageBox.hpp.


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