ScummVM API documentation
Graphics::Views::UIElement Class Reference

#include <events.h>

Inheritance diagram for Graphics::Views::UIElement:
Graphics::Views::Events Graphics::Views::View Ultima::Shared::UIElement Ultima::Ultima1::Gfx::TextCursor Ultima::Ultima1::Gfx::TextInput Ultima::Ultima1::Views::Commands Ultima::Ultima1::Views::SpaceStats Ultima::Ultima1::Views::Stats Ultima::Ultima2::Gfx::TextCursor Ultima::Ultima2::Views::Commands Ultima::Ultima2::Views::SpaceStats Ultima::Ultima2::Views::Stats

Public Member Functions

 UIElement (const Common::String &name, UIElement *uiParent)
 
 UIElement (const Common::String &name)
 
bool needsRedraw () const
 
void redraw ()
 
virtual void close ()
 
virtual void replaceView (UIElement *ui, bool replaceAllViews=false)
 
virtual void replaceView (const Common::String &name, bool replaceAllViews=false)
 
virtual void addView (UIElement *ui)
 
virtual void addView (const Common::String &name)
 
void addView ()
 
void open ()
 
int getRandomNumber (int minNumber, int maxNumber)
 
int getRandomNumber (int maxNumber)
 
virtual void setBounds (const Common::Rect &r)
 
Common::Rect getBounds () const
 
const Common::String & getName () const
 
GfxSurface getSurface (bool innerBounds=false) const
 
virtual void draw ()
 
virtual bool tick ()
 
virtual UIElement * findView (const Common::String &name)
 
bool send (const MouseMoveMessage &msg)
 
bool send (const Common::String &viewName, const FocusMessage &msg)
 
bool send (const FocusMessage &msg)
 
bool send (const Common::String &viewName, const UnfocusMessage &msg)
 
bool send (const UnfocusMessage &msg)
 
bool send (const Common::String &viewName, const MouseEnterMessage &msg)
 
bool send (const MouseEnterMessage &msg)
 
bool send (const Common::String &viewName, const MouseLeaveMessage &msg)
 
bool send (const MouseLeaveMessage &msg)
 
bool send (const Common::String &viewName, const KeypressMessage &msg)
 
bool send (const KeypressMessage &msg)
 
bool send (const Common::String &viewName, const MouseDownMessage &msg)
 
bool send (const MouseDownMessage &msg)
 
bool send (const Common::String &viewName, const MouseUpMessage &msg)
 
bool send (const MouseUpMessage &msg)
 
bool send (const Common::String &viewName, const ActionMessage &msg)
 
bool send (const ActionMessage &msg)
 
bool send (const Common::String &viewName, const GameMessage &msg)
 
bool send (const GameMessage &msg)
 
bool send (const Common::String &viewName, const ValueMessage &msg)
 
bool send (const ValueMessage &msg)
 
template<class T >
bool send (const T &msg)
 
template<class T >
bool send (const Common::String &viewName, const T &msg)
 

Protected Member Functions

void delaySeconds (uint seconds)
 
void delayFrames (uint frames)
 
bool isDelayActive () const
 
void cancelDelay ()
 
virtual void timeout ()
 
virtual bool msgMouseMove (const MouseMoveMessage &msg)
 
void stopTextToSpeech ()
 
virtual bool msgFocus (const FocusMessage &e)
 
virtual bool msgUnfocus (const UnfocusMessage &e)
 
virtual bool msgMouseEnter (const MouseEnterMessage &e)
 
virtual bool msgMouseLeave (const MouseLeaveMessage &e)
 
virtual bool msgKeypress (const KeypressMessage &e)
 
virtual bool msgMouseDown (const MouseDownMessage &e)
 
virtual bool msgMouseUp (const MouseUpMessage &e)
 
virtual bool msgAction (const ActionMessage &e)
 
virtual bool msgGame (const GameMessage &e)
 
virtual bool msgValue (const ValueMessage &e)
 
virtual bool msgCustom (const Message &msg)
 

Protected Attributes

UIElement * _parent
 
Common::Array< UIElement * > _children
 
Common::Rect _innerBounds
 
Bounds _bounds
 
bool _needsRedraw = true
 
Common::String _name
 
Common::String _previousSaid
 

Detailed Description

User interface element

Member Function Documentation

◆ delaySeconds()

void Graphics::Views::UIElement::delaySeconds ( uint  seconds)
protected

Set a delay countdown in seconds, after which timeout() is called

◆ delayFrames()

void Graphics::Views::UIElement::delayFrames ( uint  frames)
protected

Set a delay countdown in frames, after which timeout() is called

◆ isDelayActive()

bool Graphics::Views::UIElement::isDelayActive ( ) const
inlineprotected

Returns true if a delay is active

◆ cancelDelay()

void Graphics::Views::UIElement::cancelDelay ( )
inlineprotected

Cancels any active delay

◆ timeout()

◆ needsRedraw()

bool Graphics::Views::UIElement::needsRedraw ( ) const
inline

Returns true if the elements needs to be redrawn

◆ redraw()

void Graphics::Views::UIElement::redraw ( )

Sets that the element needs to be redrawn

◆ close()

virtual void Graphics::Views::UIElement::close ( )
virtual

Closes the current view. The view must have been added via addView, so there's a remaining view afterwards

Reimplemented in Graphics::Views::Events.

◆ replaceView()

virtual void Graphics::Views::UIElement::replaceView ( UIElement *  ui,
bool  replaceAllViews = false 
)
virtual

Sets the focus to a new view

Reimplemented in Graphics::Views::Events.

◆ addView()

virtual void Graphics::Views::UIElement::addView ( UIElement *  ui)
virtual

Adds a focused view to the view stack without replacing current one

Reimplemented in Graphics::Views::Events.

◆ getRandomNumber()

int Graphics::Views::UIElement::getRandomNumber ( int  minNumber,
int  maxNumber 
)

Returns a random number

◆ setBounds()

virtual void Graphics::Views::UIElement::setBounds ( const Common::Rect &  r)
inlinevirtual

Sets the element's bounds

◆ getBounds()

Common::Rect Graphics::Views::UIElement::getBounds ( ) const
inline

Gets the element's bounds

◆ getName()

const Common::String & Graphics::Views::UIElement::getName ( ) const
inline

Gets a view's name

◆ getSurface()

GfxSurface Graphics::Views::UIElement::getSurface ( bool  innerBounds = false) const

Returns a surface for drawing the element

◆ draw()

virtual void Graphics::Views::UIElement::draw ( )
virtual

Draws the element

Reimplemented in Ultima::Ultima1::Gfx::TextCursor, Ultima::Ultima1::Gfx::TextInput, Ultima::Ultima1::Views::Commands, Ultima::Ultima1::Views::CreateCharacter, Ultima::Ultima1::Views::Dialog, Ultima::Ultima1::Views::DungeonMap, Ultima::Ultima1::Views::FullScreenDialog, Ultima::Ultima1::Views::Game, Ultima::Ultima1::Views::Interactions::Dead, Ultima::Ultima1::Views::Interactions::SpaceDead, Ultima::Ultima1::Views::Interactions::Drop, Ultima::Ultima1::Views::Interactions::EnteringCraft, Ultima::Ultima1::Views::Interactions::King, Ultima::Ultima1::Views::Interactions::Lose, Ultima::Ultima1::Views::Interactions::Merchant, Ultima::Ultima1::Views::Interactions::OperateCraft, Ultima::Ultima1::Views::Interactions::Pillar, Ultima::Ultima1::Views::Interactions::PrincessSaved, Ultima::Ultima1::Views::Interactions::Ready, Ultima::Ultima1::Views::Interactions::SectorScan, Ultima::Ultima1::Views::Interactions::Win, Ultima::Ultima1::Views::LocationMap, Ultima::Ultima1::Views::MainMenu, Ultima::Ultima1::Views::MondainMap, Ultima::Ultima1::Views::OverworldMap, Ultima::Ultima1::Views::SpaceCockpit, Ultima::Ultima1::Views::SpaceGame, Ultima::Ultima1::Views::SpaceMap, Ultima::Ultima1::Views::SpaceStats, Ultima::Ultima1::Views::Startup, Ultima::Ultima1::Views::Stats, Ultima::Ultima1::Views::Title, Ultima::Ultima1::Views::ZStats, Ultima::Ultima2::Gfx::TextCursor, Ultima::Ultima2::Views::Commands, Ultima::Ultima2::Views::CreateCharacter, Ultima::Ultima2::Views::DungeonMap, Ultima::Ultima2::Views::Ending, Ultima::Ultima2::Views::HelmMap, Ultima::Ultima2::Views::LocationMap, Ultima::Ultima2::Views::OverworldMap, Ultima::Ultima2::Views::SpaceMap, Ultima::Ultima2::Views::SpaceStats, Ultima::Ultima2::Views::Stats, Ultima::Ultima2::Views::Title, Ultima::Ultima2::Views::ZStats, Ultima::Ultima3::Views::CharacterDetails, Ultima::Ultima3::Views::CreateCharacter, Ultima::Ultima3::Views::DisperseParty, Ultima::Ultima3::Views::FormParty, Ultima::Ultima3::Views::Game, Ultima::Ultima3::Views::JourneyOnward, Ultima::Ultima3::Views::LogoScreen, Ultima::Ultima3::Views::MainMenu, Ultima::Ultima3::Views::PartyMenu, Ultima::Ultima3::Views::Register, Ultima::Ultima3::Views::TerminateCharacter, Ultima::Ultima3::Views::Title, and Graphics::Views::Events.

◆ tick()

◆ findView()

virtual UIElement * Graphics::Views::UIElement::findView ( const Common::String &  name)
virtual

Find a view by name

◆ msgMouseMove()

virtual bool Graphics::Views::UIElement::msgMouseMove ( const MouseMoveMessage &  msg)
inlineprotectedvirtual

◆ stopTextToSpeech()

void Graphics::Views::UIElement::stopTextToSpeech ( )
protected

Stops TTS voicing and clears the previously spoken text

◆ msgAction()

virtual bool Graphics::Views::UIElement::msgAction ( const ActionMessage &  e)
inlineprotectedvirtual

◆ msgCustom()

virtual bool Graphics::Views::UIElement::msgCustom ( const Message &  msg)
inlineprotectedvirtual

Handles messages of types that the library has no dedicated msgXXX method for - i.e. message structs an engine defines for itself, derived from Message. Overrides should identify the types they care about (typically with dynamic_cast) and return the base class's result for everything else. The default passes the message to each child in turn

Reimplemented in Ultima::Shared::UIElement, and Graphics::Views::Events.

◆ send()

template<class T >
bool Graphics::Views::UIElement::send ( const T &  msg)
inline

Sends an engine-defined message, either to this element or the named view. Only used for types without one of the dedicated overloads above, which are preferred when they match exactly. Note that a type derived from one of the built-in messages will therefore come through here rather than being converted to its base


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