ScummVM
GUI::Widget Class Referenceabstract

#include <widget.h>

+ Inheritance diagram for GUI::Widget:
+ Collaboration diagram for GUI::Widget:

Public Member Functions

 Widget (GuiObject *boss, int x, int y, int w, int h, const char *tooltip=nullptr)
 
 Widget (GuiObject *boss, const Common::String &name, const char *tooltip=nullptr)
 
 ~Widget () override
 
void init ()
 
void resize (int x, int y, int w, int h)
 
void setNext (Widget *w)
 
Widgetnext ()
 
int16 getAbsX () const override
 
int16 getAbsY () const override
 
virtual void setPos (int x, int y)
 
virtual void setSize (int w, int h)
 
virtual void getMinSize (int &minWidth, int &minHeight)
 Returns the minimal size the widget needs to have for its contents to fit. More...
 
virtual void handleMouseDown (int x, int y, int button, int clickCount)
 
virtual void handleMouseUp (int x, int y, int button, int clickCount)
 
virtual void handleMouseEntered (int button)
 
virtual void handleMouseLeft (int button)
 
virtual void handleMouseMoved (int x, int y, int button)
 
virtual void handleMouseWheel (int x, int y, int direction)
 
virtual bool handleKeyDown (Common::KeyState state)
 
virtual bool handleKeyUp (Common::KeyState state)
 
virtual void handleTickle ()
 
virtual void markAsDirty ()
 Mark the widget and its children as dirty so they are redrawn on the next screen update. More...
 
virtual void draw ()
 Redraw the widget if it was marked as dirty, and recursively proceed with its children. More...
 
void receivedFocus ()
 
void lostFocus ()
 
virtual bool wantsFocus ()
 
void setFlags (int flags)
 
void clearFlags (int flags)
 
int getFlags () const
 
void setEnabled (bool e)
 
bool isEnabled () const
 
void setVisible (bool e)
 
bool isVisible () const override
 
uint8 parseHotkey (const Common::String &label)
 
Common::String cleanupHotkey (const Common::String &label)
 
bool hasTooltip () const
 
const Common::StringgetTooltip () const
 
void setTooltip (const Common::String &tooltip)
 
virtual bool containsWidget (Widget *) const
 
void read (Common::String str)
 
- Public Member Functions inherited from GUI::GuiObject
 GuiObject (int x, int y, int w, int h)
 
 GuiObject (const Common::String &name)
 
 ~GuiObject () override
 
virtual void setTextDrawableArea (const Common::Rect &r)
 
virtual int16 getRelX () const
 
virtual int16 getRelY () const
 
virtual int16 getChildX () const
 
virtual int16 getChildY () const
 
virtual uint16 getWidth () const
 
virtual uint16 getHeight () const
 
virtual void reflowLayout ()
 
virtual void removeWidget (Widget *widget)
 
virtual bool isPointIn (int x, int y)
 
virtual Common::Rect getClipRect () const
 Returns the clipping rect to be used when drawing the children widgets of this object. More...
 

Static Public Member Functions

static WidgetfindWidgetInChain (Widget *start, int x, int y)
 
static WidgetfindWidgetInChain (Widget *start, const char *name)
 
static bool containsWidgetInChain (Widget *start, Widget *search)
 

Protected Member Functions

void updateState (int oldFlags, int newFlags)
 
virtual void drawWidget ()=0
 
virtual void receivedFocusWidget ()
 
virtual void lostFocusWidget ()
 
virtual WidgetfindWidget (int x, int y)
 
void releaseFocus () override
 
void handleCommand (CommandSender *sender, uint32 cmd, uint32 data) override
 
- Protected Member Functions inherited from GUI::CommandReceiver
virtual ~CommandReceiver ()
 

Protected Attributes

uint32 _type
 
GuiObject_boss
 
Widget_next
 
uint16 _id
 
bool _hasFocus
 
ThemeEngine::WidgetStateInfo _state
 
Common::String _tooltip
 
- Protected Attributes inherited from GUI::GuiObject
Common::Rect _textDrawableArea
 
int16 _x
 
int16 _y
 
uint16 _w
 
uint16 _h
 
const Common::String _name
 
Widget_firstWidget
 

Private Attributes

uint16 _flags
 
bool _needsRedraw
 

Friends

class Dialog
 

Detailed Description

Definition at line 96 of file widget.h.

Constructor & Destructor Documentation

◆ Widget() [1/2]

GUI::Widget::Widget ( GuiObject boss,
int  x,
int  y,
int  w,
int  h,
const char *  tooltip = nullptr 
)

Definition at line 39 of file widget.cpp.

◆ Widget() [2/2]

GUI::Widget::Widget ( GuiObject boss,
const Common::String name,
const char *  tooltip = nullptr 
)

Definition at line 45 of file widget.cpp.

◆ ~Widget()

GUI::Widget::~Widget ( )
override

Definition at line 59 of file widget.cpp.

Member Function Documentation

◆ cleanupHotkey()

Common::String GUI::Widget::cleanupHotkey ( const Common::String label)

Definition at line 253 of file widget.cpp.

◆ clearFlags()

void GUI::Widget::clearFlags ( int  flags)

Definition at line 76 of file widget.cpp.

◆ containsWidget()

virtual bool GUI::Widget::containsWidget ( Widget ) const
inlinevirtual

Reimplemented in GUI::ContainerWidget, GUI::TabWidget, GUI::ListWidget, and GUI::ScrollContainerWidget.

Definition at line 173 of file widget.h.

◆ containsWidgetInChain()

bool GUI::Widget::containsWidgetInChain ( Widget start,
Widget search 
)
static

Definition at line 175 of file widget.cpp.

◆ draw()

void GUI::Widget::draw ( )
virtual

Redraw the widget if it was marked as dirty, and recursively proceed with its children.

Reimplemented in GUI::TabWidget.

Definition at line 103 of file widget.cpp.

◆ drawWidget()

◆ findWidget()

virtual Widget* GUI::Widget::findWidget ( int  x,
int  y 
)
inlineprotectedvirtual

◆ findWidgetInChain() [1/2]

Widget * GUI::Widget::findWidgetInChain ( Widget start,
const char *  name 
)
static

Definition at line 165 of file widget.cpp.

◆ findWidgetInChain() [2/2]

Widget * GUI::Widget::findWidgetInChain ( Widget start,
int  x,
int  y 
)
static

Definition at line 153 of file widget.cpp.

◆ getAbsX()

int16 GUI::Widget::getAbsX ( ) const
inlineoverridevirtual

Reimplemented from GUI::GuiObject.

Definition at line 127 of file widget.h.

◆ getAbsY()

int16 GUI::Widget::getAbsY ( ) const
inlineoverridevirtual

Reimplemented from GUI::GuiObject.

Definition at line 128 of file widget.h.

◆ getFlags()

int GUI::Widget::getFlags ( ) const
inline

Definition at line 158 of file widget.h.

◆ getMinSize()

virtual void GUI::Widget::getMinSize ( int &  minWidth,
int &  minHeight 
)
inlinevirtual

Returns the minimal size the widget needs to have for its contents to fit.

Reimplemented in GUI::DropdownButtonWidget, and GUI::ButtonWidget.

Definition at line 134 of file widget.h.

◆ getTooltip()

const Common::String& GUI::Widget::getTooltip ( ) const
inline

Definition at line 170 of file widget.h.

◆ handleCommand()

void GUI::Widget::handleCommand ( CommandSender sender,
uint32  cmd,
uint32  data 
)
inlineoverrideprotectedvirtual

Reimplemented from GUI::CommandReceiver.

Reimplemented in GUI::ListWidget, GUI::TabWidget, and GUI::ScrollContainerWidget.

Definition at line 190 of file widget.h.

◆ handleKeyDown()

virtual bool GUI::Widget::handleKeyDown ( Common::KeyState  state)
inlinevirtual

Reimplemented in GUI::ListWidget, GUI::TabWidget, and GUI::EditableWidget.

Definition at line 142 of file widget.h.

◆ handleKeyUp()

virtual bool GUI::Widget::handleKeyUp ( Common::KeyState  state)
inlinevirtual

Reimplemented in GUI::ListWidget.

Definition at line 143 of file widget.h.

◆ handleMouseDown()

virtual void GUI::Widget::handleMouseDown ( int  x,
int  y,
int  button,
int  clickCount 
)
inlinevirtual

◆ handleMouseEntered()

virtual void GUI::Widget::handleMouseEntered ( int  button)
inlinevirtual

◆ handleMouseLeft()

virtual void GUI::Widget::handleMouseLeft ( int  button)
inlinevirtual

◆ handleMouseMoved()

virtual void GUI::Widget::handleMouseMoved ( int  x,
int  y,
int  button 
)
inlinevirtual

◆ handleMouseUp()

virtual void GUI::Widget::handleMouseUp ( int  x,
int  y,
int  button,
int  clickCount 
)
inlinevirtual

◆ handleMouseWheel()

virtual void GUI::Widget::handleMouseWheel ( int  x,
int  y,
int  direction 
)
inlinevirtual

◆ handleTickle()

virtual void GUI::Widget::handleTickle ( )
inlinevirtual

Reimplemented in GUI::ListWidget, GUI::ScrollBarWidget, GUI::EditableWidget, and Common::RemapWidget.

Definition at line 144 of file widget.h.

◆ hasTooltip()

bool GUI::Widget::hasTooltip ( ) const
inline

Definition at line 169 of file widget.h.

◆ init()

void GUI::Widget::init ( void  )

Definition at line 52 of file widget.cpp.

◆ isEnabled()

bool GUI::Widget::isEnabled ( ) const

Definition at line 195 of file widget.cpp.

◆ isVisible()

bool GUI::Widget::isVisible ( ) const
overridevirtual

Implements GUI::GuiObject.

Definition at line 209 of file widget.cpp.

◆ lostFocus()

void GUI::Widget::lostFocus ( )
inline

Definition at line 153 of file widget.h.

◆ lostFocusWidget()

virtual void GUI::Widget::lostFocusWidget ( )
inlineprotectedvirtual

Reimplemented in GUI::ListWidget, and GUI::EditTextWidget.

Definition at line 183 of file widget.h.

◆ markAsDirty()

void GUI::Widget::markAsDirty ( )
virtual

Mark the widget and its children as dirty so they are redrawn on the next screen update.

Reimplemented in GUI::TabWidget.

Definition at line 93 of file widget.cpp.

◆ next()

Widget* GUI::Widget::next ( )
inline

Definition at line 125 of file widget.h.

◆ parseHotkey()

uint8 GUI::Widget::parseHotkey ( const Common::String label)

Definition at line 216 of file widget.cpp.

◆ read()

void GUI::Widget::read ( Common::String  str)

Definition at line 263 of file widget.cpp.

◆ receivedFocus()

void GUI::Widget::receivedFocus ( )
inline

Definition at line 152 of file widget.h.

◆ receivedFocusWidget()

virtual void GUI::Widget::receivedFocusWidget ( )
inlineprotectedvirtual

Reimplemented in GUI::ListWidget, and GUI::EditTextWidget.

Definition at line 182 of file widget.h.

◆ releaseFocus()

void GUI::Widget::releaseFocus ( )
inlineoverrideprotectedvirtual

Implements GUI::GuiObject.

Definition at line 187 of file widget.h.

◆ resize()

void GUI::Widget::resize ( int  x,
int  y,
int  w,
int  h 
)

Definition at line 64 of file widget.cpp.

◆ setEnabled()

void GUI::Widget::setEnabled ( bool  e)

Definition at line 184 of file widget.cpp.

◆ setFlags()

void GUI::Widget::setFlags ( int  flags)

Definition at line 71 of file widget.cpp.

◆ setNext()

void GUI::Widget::setNext ( Widget w)
inline

Definition at line 124 of file widget.h.

◆ setPos()

virtual void GUI::Widget::setPos ( int  x,
int  y 
)
inlinevirtual

Definition at line 130 of file widget.h.

◆ setSize()

virtual void GUI::Widget::setSize ( int  w,
int  h 
)
inlinevirtual

Definition at line 131 of file widget.h.

◆ setTooltip()

void GUI::Widget::setTooltip ( const Common::String tooltip)
inline

Definition at line 171 of file widget.h.

◆ setVisible()

void GUI::Widget::setVisible ( bool  e)

Definition at line 202 of file widget.cpp.

◆ updateState()

void GUI::Widget::updateState ( int  oldFlags,
int  newFlags 
)
protected

Definition at line 81 of file widget.cpp.

◆ wantsFocus()

virtual bool GUI::Widget::wantsFocus ( )
inlinevirtual

Reimplemented in GUI::ListWidget, GUI::ScrollBarWidget, and GUI::EditTextWidget.

Definition at line 154 of file widget.h.

Friends And Related Function Documentation

◆ Dialog

friend class Dialog
friend

Definition at line 97 of file widget.h.

Member Data Documentation

◆ _boss

GuiObject* GUI::Widget::_boss
protected

Definition at line 100 of file widget.h.

◆ _flags

uint16 GUI::Widget::_flags
private

Definition at line 108 of file widget.h.

◆ _hasFocus

bool GUI::Widget::_hasFocus
protected

Definition at line 103 of file widget.h.

◆ _id

uint16 GUI::Widget::_id
protected

Definition at line 102 of file widget.h.

◆ _needsRedraw

bool GUI::Widget::_needsRedraw
private

Definition at line 109 of file widget.h.

◆ _next

Widget* GUI::Widget::_next
protected

Definition at line 101 of file widget.h.

◆ _state

ThemeEngine::WidgetStateInfo GUI::Widget::_state
protected

Definition at line 104 of file widget.h.

◆ _tooltip

Common::String GUI::Widget::_tooltip
protected

Definition at line 105 of file widget.h.

◆ _type

uint32 GUI::Widget::_type
protected

Definition at line 99 of file widget.h.


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