FifeGUI 0.3.0
A C++ GUI library designed for games.
fcn::Widget Class Referenceabstract

#include <widget.hpp>

Inheritance diagram for fcn::Widget:
fcn::BarGraph fcn::Button fcn::Container fcn::CurveGraph fcn::DropDown fcn::Icon fcn::IconProgressBar fcn::ImageProgressBar fcn::Label fcn::LineGraph fcn::ListBox fcn::PieGraph fcn::PointGraph fcn::ScrollArea fcn::Slider fcn::Spacer fcn::TabbedArea fcn::TextBox fcn::TextField

Public Types

enum  BorderSide : uint8_t {
  BORDER_NONE = 0 , BORDER_LEFT = 1 << 0 , BORDER_TOP = 1 << 1 , BORDER_RIGHT = 1 << 2 ,
  BORDER_BOTTOM = 1 << 3 , BORDER_ALL = BORDER_LEFT | BORDER_TOP | BORDER_RIGHT | BORDER_BOTTOM
}
enum  BorderStyle : uint8_t { BORDER_STYLE_BEVEL = 0 , BORDER_STYLE_FLAT = 1 }
enum class  SelectionMode : uint8_t { None = 0 , Border = 1 , Background = 2 }

Public Member Functions

virtual void _draw (Graphics *graphics)
virtual FocusHandler_getFocusHandler ()
virtual std::list< FocusListener * > const & _getFocusListeners ()
virtual FocusHandler_getInternalFocusHandler ()
virtual std::list< KeyListener * > const & _getKeyListeners ()
virtual std::list< MouseListener * > const & _getMouseListeners ()
virtual void _logic ()
virtual void _setFocusHandler (FocusHandler *focusHandler)
virtual void _setParent (Widget *parent)
void adaptLayout ()
virtual void adaptLayout (bool top)
void addActionListener (ActionListener *actionListener)
void addDeathListener (DeathListener *deathListener)
void addDropTargetListener (DropTargetListener *listener)
void addFocusListener (FocusListener *focusListener)
void addKeyListener (KeyListener *keyListener)
void addMouseListener (MouseListener *mouseListener)
void addWidgetListener (WidgetListener *widgetListener)
virtual void adjustSize ()
bool captureMouse ()
bool contains (int x, int y) const
virtual void draw (Graphics *graphics)=0
virtual void drawBorder (Graphics *graphics)
void drawBorder (Graphics *graphics, unsigned int sides) const
virtual void drawOutline (Graphics *graphics)
virtual void drawSelectionFrame (Graphics *graphics)
void expandContent ()
virtual void expandContent (bool recursion)
virtual void focusNext ()
virtual void focusPrevious ()
virtual void fontChanged ()
virtual void getAbsolutePosition (int &x, int &y) const
std::string const & getActionEventId () const
Color const & getBackgroundColor () const
Color const & getBaseColor () const
Color const & getBorderColor () const
unsigned int getBorderSides () const
unsigned int getBorderSize () const
unsigned int getBorderStyle () const
virtual Rectangle getChildrenArea ()
unsigned int getChildrenCount () const
Rectangle const & getDimension () const
Size const & getFixedSize () const
FontgetFont () const
Color const & getForegroundColor () const
int getHeight () const
std::string const & getId () const
void getLastPosition (int &x, int &y) const
int getMarginBottom () const
int getMarginLeft () const
int getMarginRight () const
int getMarginTop () const
Size const & getMaxSize () const
Size const & getMinSize () const
Color const & getOutlineColor () const
unsigned int getOutlineSize () const
unsigned int getPaddingBottom () const
unsigned int getPaddingLeft () const
unsigned int getPaddingRight () const
unsigned int getPaddingTop () const
virtual WidgetgetParent () const
Color const & getSelectionColor () const
SelectionMode getSelectionMode () const
virtual WidgetgetTop () const
unsigned int getVisibleChildrenCount () const
WidgetgetWidgetAt (int x, int y)
virtual WidgetgetWidgetAt (int x, int y, Widget *exclude)
std::list< Widget * > getWidgetsIn (Rectangle const &area)
virtual std::list< Widget * > getWidgetsIn (Rectangle const &area, Widget *ignore)
int getWidth () const
int getX () const
int getY () const
bool hasMouseCapture () const
bool isDescendantOf (Widget const *ancestor) const noexcept
bool isEnabled () const
bool isFixedSize () const
bool isFocusable () const
virtual bool isFocused () const
bool isHorizontalExpand () const
bool isInsideActiveMouseModal () const noexcept
bool isLastPositionSet () const
virtual bool isLayouted ()
virtual bool isModalFocusable () const
virtual bool isModalFocused () const
virtual bool isModalMouseInputFocusable () const
bool isMouseInside (MouseEvent const &mouseEvent) const
bool isSetVisible () const
bool isTabInEnabled () const
bool isTabOutEnabled () const
virtual bool isUnderMouseModal () const
bool isVerticalExpand () const
bool isVisible () const
virtual void logic ()
virtual void moveToBottom (Widget *widget)
virtual void moveToTop (Widget *widget)
virtual void onFocusChanged ()
virtual void onFocusGained ()
virtual void onFocusLost ()
Widgetoperator= (Widget &&)=delete
Widgetoperator= (Widget const &)=delete
void releaseMouse ()
void removeActionListener (ActionListener *actionListener)
void removeDeathListener (DeathListener *deathListener)
void removeDropTargetListener (DropTargetListener *listener)
void removeFocusListener (FocusListener *focusListener)
void removeKeyListener (KeyListener *keyListener)
void removeMouseListener (MouseListener *mouseListener)
void removeWidgetListener (WidgetListener *widgetListener)
virtual void requestFocus ()
virtual void requestMoveToBottom ()
virtual void requestMoveToTop ()
virtual void resizeToContent (bool recursion=true)
void setActionEventId (std::string const &actionEventId)
virtual void setBackgroundColor (Color const &color)
virtual void setBaseColor (Color const &color)
void setBorderBottom (unsigned int size, unsigned int style)
virtual void setBorderColor (Color const &color)
void setBorderSides (unsigned int sides)
void setBorderSize (unsigned int size)
void setBorderStyle (unsigned int style)
void setBorderTop (unsigned int size, unsigned int style)
virtual void setDimension (Rectangle const &dimension)
void setEnabled (bool enabled)
void setFixedSize (Size const &size)
void setFocusable (bool focusable)
virtual void setFocused (bool focused)
virtual void setFont (Font *font)
virtual void setForegroundColor (Color const &color)
virtual void setHeight (int height)
void setHorizontalExpand (bool expand)
void setId (std::string const &id)
void setInternalFocusHandler (FocusHandler *internalFocusHandler)
void setLastPosition (int x, int y)
void setMargin (int margin)
void setMarginBottom (int margin)
void setMarginLeft (int margin)
void setMarginRight (int margin)
void setMarginTop (int margin)
void setMaxSize (Size const &size)
void setMinSize (Size const &size)
virtual void setOutlineColor (Color const &color)
void setOutlineSize (unsigned int size)
void setPadding (unsigned int padding)
void setPaddingBottom (unsigned int padding)
void setPaddingLeft (unsigned int padding)
void setPaddingRight (unsigned int padding)
void setPaddingTop (unsigned int padding)
void setPosition (int x, int y)
virtual void setSelectionColor (Color const &color)
virtual void setSelectionMode (SelectionMode mode)
virtual void setSize (int width, int height)
void setTabInEnabled (bool enabled)
void setTabOutEnabled (bool enabled)
void setVerticalExpand (bool expand)
void setVisible (bool visible)
virtual void setWidth (int width)
void setX (int x)
void setY (int y)
virtual void showPart (Rectangle rectangle)
virtual void showWidgetPart (Widget *widget, Rectangle area)
virtual void textInput (TextInputEvent &event)
 Widget ()
 Widget (Widget &&)=delete
 Widget (Widget const &)=delete

Static Public Member Functions

static DeathListener_getGuiDeathListener ()
static VisibilityEventHandler_getVisibilityEventHandler ()
static void _setGuiDeathListener (DeathListener *deathListener)
static void _setVisibilityEventHandler (VisibilityEventHandler *visibilityEventHandler)
static WidgetgetMouseCapture ()
static void resetGlobalFont ()
static void setGlobalFont (Font *font)
static bool widgetExists (Widget const *widget)

Protected Member Functions

void add (Widget *widget)
void calculateSize ()
void distributeActionEvent ()
void distributeAncestorHiddenEvent (Widget *ancestor)
void distributeAncestorMovedEvent (Widget *ancestor)
void distributeAncestorShownEvent (Widget *ancestor)
void distributeDragDrop (DragEvent &event)
bool distributeDragEnter (DragEvent &event)
void distributeDragHover (DragEvent &event)
void distributeDragLeave (DragEvent &event)
void distributeHiddenEvent ()
void distributeMovedEvent ()
void distributeResizedEvent ()
void distributeShownEvent ()
virtual WidgetfindWidgetById (std::string const &id)
std::list< Widget * > const & getChildren () const
virtual void remove (Widget *widget)
virtual void removeAllChildren ()
void resizeToChildren ()

Protected Attributes

std::string mActionEventId
std::list< ActionListener * > mActionListeners
Color mBackgroundColor {0xf9fafb}
Color mBaseColor {0xe5e7eb}
Color mBorderColor {0xd1d5db}
unsigned int mBorderSides {BORDER_ALL}
unsigned int mBorderSize {0}
unsigned int mBorderStyle {BORDER_STYLE_FLAT}
std::list< Widget * > mChildren
FontmCurrentFont {nullptr}
std::list< DeathListener * > mDeathListeners
Rectangle mDimension
std::list< DropTargetListener * > mDropTargetListeners
bool mEnabled {true}
Size mFixedSize {-1, -1}
bool mFixedSizeUsed {false}
bool mFocusable {false}
bool mFocused {false}
FocusHandlermFocusHandler {nullptr}
std::list< FocusListener * > mFocusListeners
Color mForegroundColor {0x1f2933}
bool mHExpand {false}
std::string mId
FocusHandlermInternalFocusHandler {nullptr}
std::list< KeyListener * > mKeyListeners
int mLastX {0}
int mLastY {0}
int mMarginBottom {0}
int mMarginLeft {0}
int mMarginRight {0}
int mMarginTop {0}
Size mMaxSize {std::numeric_limits<int>::max(), std::numeric_limits<int>::max()}
Size mMinSize {0, 0}
std::list< MouseListener * > mMouseListeners
Rectangle mOffsetRect
Color mOutlineColor {0x9ca3af}
unsigned int mOutlineSize {0}
unsigned int mPaddingBottom {0}
unsigned int mPaddingLeft {0}
unsigned int mPaddingRight {0}
unsigned int mPaddingTop {0}
WidgetmParent {nullptr}
Color mSelectionColor {0x3b82f6}
SelectionMode mSelectionMode {SelectionMode::None}
bool mTabIn {true}
bool mTabOut {true}
bool mVExpand {false}
bool mVisible {true}
std::list< WidgetListener * > mWidgetListeners

Static Protected Attributes

static DefaultFont mDefaultFont
static FontmGlobalFont = nullptr
static DeathListenermGuiDeathListener = nullptr
static VisibilityEventHandlermVisibilityEventHandler = nullptr
static std::list< Widget * > mWidgetInstances
static WidgetsMouseCapture = nullptr

Friends

class DragHandler

Detailed Description

Abstract base class defining the common behavior, properties, and lifecycle of all GUI elements.

It contains basic functions every widget should have.

Note
Functions beginning with underscore "_" should not be overloaded unless you know what you are doing.

Definition at line 55 of file widget.hpp.

Member Enumeration Documentation

◆ BorderSide

enum fcn::Widget::BorderSide : uint8_t

Border side flags for flexible border drawing.

Definition at line 61 of file widget.hpp.

◆ BorderStyle

enum fcn::Widget::BorderStyle : uint8_t

Border drawing style.

Definition at line 74 of file widget.hpp.

◆ SelectionMode

enum class fcn::Widget::SelectionMode : uint8_t
strong

Selection mode.

Definition at line 82 of file widget.hpp.

Constructor & Destructor Documentation

◆ Widget()

fcn::Widget::Widget ( )

Constructor.

Resets member variables. Notably, a widget is not focusable as default, therefore, widgets that are supposed to be focusable should override this default in their own constructor.

Definition at line 52 of file widget.cpp.

Referenced by _setParent(), fcn::TabbedArea::action(), adaptLayout(), fcn::Container::add(), fcn::Container::add(), add(), fcn::TabbedArea::addTab(), fcn::Container::addWidget(), fcn::Container::addWidget(), fcn::ScrollArea::adjustSize(), fcn::Container::Container(), distributeAncestorHiddenEvent(), distributeAncestorMovedEvent(), distributeAncestorShownEvent(), fcn::Container::distributeWidgetAddedEvent(), fcn::Container::distributeWidgetRemovedEvent(), fcn::ScrollArea::expandContent(), fcn::Container::findWidgetById(), findWidgetById(), fcn::Container::getBackgroundWidget(), fcn::TabbedArea::getBackgroundWidget(), fcn::Container::getChild(), fcn::ScrollArea::getContent(), getMouseCapture(), getParent(), getTop(), fcn::ScrollArea::getWidgetAt(), getWidgetAt(), getWidgetAt(), getWidgetsIn(), isDescendantOf(), isInsideActiveMouseModal(), fcn::TextBox::keyPressed(), fcn::TabbedArea::mousePressed(), moveToBottom(), moveToTop(), fcn::Container::remove(), remove(), removeAllChildren(), resizeToChildren(), fcn::ScrollArea::resizeToContent(), fcn::ScrollArea::ScrollArea(), fcn::ScrollArea::ScrollArea(), fcn::Container::setBackgroundWidget(), fcn::TabbedArea::setBackgroundWidget(), fcn::ScrollArea::setContent(), fcn::ScrollArea::setDimension(), fcn::ScrollArea::setHeight(), fcn::ScrollArea::setWidth(), fcn::ScrollArea::showWidgetPart(), showWidgetPart(), and widgetExists().

◆ ~Widget()

fcn::Widget::~Widget ( )
virtual

Definition at line 57 of file widget.cpp.

Member Function Documentation

◆ _draw()

void fcn::Widget::_draw ( Graphics * graphics)
virtual

Called whenever a widget should draw itself.

The function will set up clip areas and call the draw function for this widget and for all its children.

Warning
This function is used internally and should not be called or overloaded unless you know what you are doing.

Definition at line 1546 of file widget.cpp.

References draw(), drawOutline(), getChildrenArea(), fcn::Rectangle::height, fcn::Rectangle::isIntersecting(), mChildren, mDimension, mOutlineSize, fcn::Graphics::popClipArea(), fcn::Graphics::pushClipArea(), fcn::Rectangle::width, fcn::Rectangle::x, and fcn::Rectangle::y.

◆ _getFocusHandler()

FocusHandler * fcn::Widget::_getFocusHandler ( )
virtual

Gets the focus handler used.

Warning
This function is used internally and should not be called or overloaded unless you know what you are doing.
Returns
The focus handler used.
See also
_setFocusHandler

Definition at line 838 of file widget.cpp.

References mFocusHandler.

Referenced by add(), setInternalFocusHandler(), and fcn::MenuPopup::show().

◆ _getFocusListeners()

std::list< FocusListener * > const & fcn::Widget::_getFocusListeners ( )
virtual

Gets the focus listeners of the widget.

Returns
The focus listeners of the widget.

Definition at line 1161 of file widget.cpp.

References mFocusListeners.

Referenced by fcn::FocusHandler::distributeFocusGainedEvent(), and fcn::FocusHandler::distributeFocusLostEvent().

◆ _getGuiDeathListener()

DeathListener * fcn::Widget::_getGuiDeathListener ( )
static

Get the global GUI death listener.

Returns
The current DeathListener or nullptr if none is set.

Definition at line 858 of file widget.cpp.

References mGuiDeathListener.

◆ _getInternalFocusHandler()

FocusHandler * fcn::Widget::_getInternalFocusHandler ( )
virtual

Gets the internal focus handler used.

Returns
the internalFocusHandler used. If no internal focus handler is used, Nullptr will be returned.
See also
setInternalFocusHandler

Definition at line 1171 of file widget.cpp.

References mInternalFocusHandler.

Referenced by fcn::Gui::getKeyEventSource().

◆ _getKeyListeners()

std::list< KeyListener * > const & fcn::Widget::_getKeyListeners ( )
virtual

Gets the key listeners of the widget.

Returns
The key listeners of the widget.

Definition at line 1156 of file widget.cpp.

References mKeyListeners.

Referenced by fcn::Gui::distributeKeyEvent().

◆ _getMouseListeners()

std::list< MouseListener * > const & fcn::Widget::_getMouseListeners ( )
virtual

Gets the mouse listeners of the widget.

Returns
The mouse listeners of the widget.

Definition at line 1151 of file widget.cpp.

References mMouseListeners.

Referenced by fcn::Gui::distributeMouseEvent().

◆ _getVisibilityEventHandler()

VisibilityEventHandler * fcn::Widget::_getVisibilityEventHandler ( )
static

Gets the visibility event handler of this widget.

Warning
This function is used internally and should not be called unless you know what you are doing.
Todo
We don't like the visibility handler being static, but we leave it as is for the moment, until we come up a better solution.

Definition at line 848 of file widget.cpp.

References mVisibilityEventHandler.

Referenced by add(), distributeAncestorHiddenEvent(), distributeAncestorShownEvent(), remove(), removeAllChildren(), and setVisible().

◆ _logic()

void fcn::Widget::_logic ( )
virtual

Called whenever a widget should perform logic.

The function will call the logic function for this widget and for all its children.

Warning
This function is used internally and should not be called or overloaded unless you know what you are doing.

Definition at line 1579 of file widget.cpp.

References logic(), and mChildren.

◆ _setFocusHandler()

void fcn::Widget::_setFocusHandler ( FocusHandler * focusHandler)
virtual

Sets the focus handler to be used.

Warning
This function is used internally and should not be called or overloaded unless you know what you are doing.
Parameters
focusHandlerThe focus handler to use.
See also
_getFocusHandler

Definition at line 807 of file widget.cpp.

References fcn::FocusHandler::add(), mChildren, mFocusHandler, mInternalFocusHandler, and widgetExists().

Referenced by add(), remove(), removeAllChildren(), and fcn::Gui::setTop().

◆ _setGuiDeathListener()

void fcn::Widget::_setGuiDeathListener ( DeathListener * deathListener)
static

Set the global GUI death listener used to observe widget deletions.

Parameters
deathListenerPointer to a DeathListener instance (ownership not transferred).

Definition at line 853 of file widget.cpp.

References mGuiDeathListener.

◆ _setParent()

void fcn::Widget::_setParent ( Widget * parent)
virtual

Sets the parent of the widget.

A parent must be a Container.

Warning
This function is used internally and should not be called or overloaded unless you know what you are doing.
Parameters
parentThe parent of the widget.
See also
getParent

Definition at line 234 of file widget.cpp.

References mParent, and Widget().

Referenced by add(), remove(), and removeAllChildren().

◆ _setVisibilityEventHandler()

void fcn::Widget::_setVisibilityEventHandler ( VisibilityEventHandler * visibilityEventHandler)
static

Sets the visibility event handler to be used.

Warning
This function is used internally and should not be called unless you know what you are doing.
Todo
We don't like the visibility handler being static, but we leave it as is for the moment, until we come up a better solution.
Parameters
visibilityEventHandlerThe visibility event handler to be used.

Definition at line 843 of file widget.cpp.

References mVisibilityEventHandler.

◆ adaptLayout() [1/2]

void fcn::Widget::adaptLayout ( )
inline

Execute the layouting.

In case you want to relayout a visible widget. This function will automatically perform the layout adaption from the widget.

This is a convenience wrapper that calls adaptLayout(true).

Definition at line 1560 of file widget.hpp.

References adaptLayout().

Referenced by adaptLayout(), fcn::TabbedArea::addTab(), fcn::TabbedArea::removeTab(), and fcn::TabbedArea::setSelectedTab().

◆ adaptLayout() [2/2]

void fcn::Widget::adaptLayout ( bool top)
virtual

Execute the layouting for this widget.

Parameters
topIf true, perform top-level layout adaptations as well.

Definition at line 445 of file widget.cpp.

References expandContent(), getParent(), isLayouted(), resizeToContent(), and Widget().

◆ add()

void fcn::Widget::add ( Widget * widget)
protected

Adds a child to the widget.

THIS METHOD IS NOT SAFE TO CALL INSIDE A WIDGETS LOGIC FUNCTION INSIDE ANY LISTER FUNCTIONS!

Parameters
widgetThe widget to add.
See also
remove, clear

Definition at line 1446 of file widget.cpp.

References _getFocusHandler(), _getVisibilityEventHandler(), _setFocusHandler(), _setParent(), mChildren, mInternalFocusHandler, setLastPosition(), Widget(), and fcn::VisibilityEventHandler::widgetShown().

Referenced by fcn::Container::add(), fcn::Container::add(), fcn::DropDown::DropDown(), fcn::ActivityBarItem::mouseEntered(), and fcn::ScrollArea::setContent().

◆ addActionListener()

void fcn::Widget::addActionListener ( ActionListener * actionListener)

Adds an action listener to the widget.

When an action event is fired by the widget the action listeners of the widget will get notified.

Parameters
actionListenerThe action listener to add.
See also
removeActionListener

Definition at line 863 of file widget.cpp.

References mActionListeners.

Referenced by fcn::TabbedArea::addTab().

◆ addDeathListener()

void fcn::Widget::addDeathListener ( DeathListener * deathListener)

Adds a death listener to the widget.

When a death event is fired by the widget the death listeners of the widget will get notified.

Parameters
deathListenerThe death listener to add.
See also
removeDeathListener

Definition at line 874 of file widget.cpp.

References mDeathListeners.

◆ addDropTargetListener()

void fcn::Widget::addDropTargetListener ( DropTargetListener * listener)

Adds a drop target listener to the widget.

When a drag event is fired the drop target listeners of the widget will get notified.

Parameters
listenerThe listener to add (non-owning).
See also
removeDropTargetListener

Definition at line 967 of file widget.cpp.

References mDropTargetListeners.

◆ addFocusListener()

void fcn::Widget::addFocusListener ( FocusListener * focusListener)

Adds a focus listener to the widget.

When a focus event is fired by the widget the key listeners of the widget will get notified.

Parameters
focusListenerThe focus listener to add.
See also
removeFocusListener

Definition at line 896 of file widget.cpp.

References mFocusListeners.

Referenced by fcn::Button::Button(), and fcn::DropDown::DropDown().

◆ addKeyListener()

void fcn::Widget::addKeyListener ( KeyListener * keyListener)

Adds a key listener to the widget.

When a key event is fired by the widget the key listeners of the widget will get notified.

Parameters
keyListenerThe key listener to add.
See also
removeKeyListener

Definition at line 885 of file widget.cpp.

References mKeyListeners.

Referenced by fcn::Button::Button(), fcn::DropDown::DropDown(), fcn::ListBox::ListBox(), fcn::Slider::Slider(), fcn::TextBox::TextBox(), and fcn::TextField::TextField().

◆ addMouseListener()

void fcn::Widget::addMouseListener ( MouseListener * mouseListener)

Adds a mouse listener to the widget.

When a mouse event is fired by the widget the mouse listeners of the widget will get notified.

Parameters
mouseListenerThe mouse listener to add.
See also
removeMouseListener

Definition at line 907 of file widget.cpp.

References mMouseListeners.

Referenced by fcn::Button::Button(), fcn::DropDown::DropDown(), fcn::ListBox::ListBox(), fcn::MenuBar::MenuBar(), fcn::MenuPopup::MenuPopup(), fcn::Panel::Panel(), fcn::RadioButton::RadioButton(), fcn::ScrollArea::ScrollArea(), fcn::ScrollArea::ScrollArea(), fcn::Slider::Slider(), fcn::TextBox::TextBox(), fcn::TextField::TextField(), and fcn::Window::Window().

◆ addWidgetListener()

void fcn::Widget::addWidgetListener ( WidgetListener * widgetListener)

Adds a widget listener to the widget.

When a widget event is fired by the widget the key listeners of the widget will get notified.

Parameters
widgetListenerThe widget listener to add.
See also
removeWidgetListener

Definition at line 918 of file widget.cpp.

References mWidgetListeners.

Referenced by fcn::Button::Button().

◆ adjustSize()

◆ calculateSize()

void fcn::Widget::calculateSize ( )
protected

Checks the size against the size constraints.

Used by setDimension.

Prevents negative sizes and sizes larger than the maximum size.

Definition at line 406 of file widget.cpp.

References mDimension, mFixedSize, mFixedSizeUsed, mMaxSize, and mMinSize.

Referenced by setDimension(), setFixedSize(), setMaxSize(), and setMinSize().

◆ captureMouse()

bool fcn::Widget::captureMouse ( )

Attempts to capture mouse input to this widget.

Returns
True if capture was successfully acquired, false if another widget already has mouse capture.
See also
releaseMouse, getMouseCapture, hasMouseCapture

Definition at line 1611 of file widget.cpp.

References sMouseCapture.

Referenced by fcn::Gui::captureMouse().

◆ contains()

bool fcn::Widget::contains ( int x,
int y ) const

Checks if a point is within the widget's bounds.

Parameters
xThe x coordinate (relative to widget origin).
yThe y coordinate (relative to widget origin).
Returns
True if the point is within bounds.

Definition at line 270 of file widget.cpp.

References getHeight(), and getWidth().

Referenced by isMouseInside(), and fcn::MenuPopup::mousePressed().

◆ distributeActionEvent()

◆ distributeAncestorHiddenEvent()

void fcn::Widget::distributeAncestorHiddenEvent ( Widget * ancestor)
protected

Distributes ancestor hidden events to all of the widget's listeners.

All children will also distribute the same event.

Parameters
ancestorAncestor widget that was hidden.

Definition at line 1245 of file widget.cpp.

References _getVisibilityEventHandler(), mChildren, mWidgetListeners, Widget(), and fcn::VisibilityEventHandler::widgetHidden().

◆ distributeAncestorMovedEvent()

void fcn::Widget::distributeAncestorMovedEvent ( Widget * ancestor)
protected

Distributes ancestor moved events to all of the widget's listeners.

All children will also distribute the same event.

Parameters
ancestorAncestor widget that was moved.

Definition at line 1227 of file widget.cpp.

References mChildren, mWidgetListeners, and Widget().

◆ distributeAncestorShownEvent()

void fcn::Widget::distributeAncestorShownEvent ( Widget * ancestor)
protected

Distributes ancestor shown events to all of the widget's listeners.

All children will also distribute the same event.

Parameters
ancestorAncestor widget that was shown.

Definition at line 1268 of file widget.cpp.

References _getVisibilityEventHandler(), mChildren, mWidgetListeners, Widget(), and fcn::VisibilityEventHandler::widgetShown().

◆ distributeDragDrop()

void fcn::Widget::distributeDragDrop ( DragEvent & event)
protected

Distribute a drop event to listeners.

Definition at line 958 of file widget.cpp.

References mDropTargetListeners.

◆ distributeDragEnter()

bool fcn::Widget::distributeDragEnter ( DragEvent & event)
protected

Distribute a drag enter event to listeners.

Definition at line 929 of file widget.cpp.

References mDropTargetListeners.

◆ distributeDragHover()

void fcn::Widget::distributeDragHover ( DragEvent & event)
protected

Distribute a drag hover event to listeners.

Definition at line 949 of file widget.cpp.

References mDropTargetListeners.

◆ distributeDragLeave()

void fcn::Widget::distributeDragLeave ( DragEvent & event)
protected

Distribute a drag leave event to listeners.

Definition at line 940 of file widget.cpp.

References mDropTargetListeners.

◆ distributeHiddenEvent()

void fcn::Widget::distributeHiddenEvent ( )
protected

Distributes hidden events to all of the widget's listeners.

Definition at line 1218 of file widget.cpp.

References mWidgetListeners.

Referenced by setVisible().

◆ distributeMovedEvent()

void fcn::Widget::distributeMovedEvent ( )
protected

Distributes moved events to all of the widget's listeners.

Definition at line 1209 of file widget.cpp.

References mWidgetListeners.

Referenced by setDimension().

◆ distributeResizedEvent()

void fcn::Widget::distributeResizedEvent ( )
protected

Distributes resized events to all of the widget's listeners.

Definition at line 1200 of file widget.cpp.

References mWidgetListeners.

Referenced by setDimension().

◆ distributeShownEvent()

void fcn::Widget::distributeShownEvent ( )
protected

Distributes shown events to all of the widget's listeners.

Definition at line 1300 of file widget.cpp.

References mWidgetListeners.

Referenced by setVisible().

◆ draw()

virtual void fcn::Widget::draw ( Graphics * graphics)
pure virtual

Draws the widget.

The call to draw is initiated by the widget's parent. The graphics object is set up so that all drawing is relative to the widget, i.e coordinate (0,0) is the top left corner of the widget. It is not possible to draw outside of a widget's dimension. If a widget has children, the parent's draw function will always be called before the children's draw functions are called.

Note
A widget with children won't draw its children unless the children area given by Widget::getChildrenArea returns a none empty rectangle inside the widgets dimension. The children area is considered relative to the widget's position.
Parameters
graphicsA graphics object to draw with.
See also
getChildrenArea, drawOutline, drawBorder

Implemented in fcn::ActivityBar, fcn::BarGraph, fcn::Button, fcn::CheckBox, fcn::Container, fcn::CurveGraph, fcn::DropDown, fcn::HorizontalBar, fcn::Icon, fcn::IconProgressBar, fcn::ImageButton, fcn::ImageProgressBar, fcn::Label, fcn::LineGraph, fcn::ListBox, fcn::MenuBar, fcn::MenuItem, fcn::MenuPopup, fcn::ModalBackdrop, fcn::Panel, fcn::PieGraph, fcn::PointGraph, fcn::ScrollArea, fcn::Slider, fcn::Spacer, fcn::StatusBar, fcn::Tab, fcn::TabbedArea, fcn::TextBox, fcn::TextField, fcn::Tooltip, and fcn::Window.

References drawBorder(), drawOutline(), drawSelectionFrame(), getOutlineSize(), and setOutlineSize().

Referenced by _draw().

◆ drawBorder() [1/2]

◆ drawBorder() [2/2]

void fcn::Widget::drawBorder ( Graphics * graphics,
unsigned int sides ) const

Draw the border for the given sides.

This overload allows callers to draw a subset of sides.

Definition at line 161 of file widget.cpp.

References fcn::Color::a, fcn::Graphics::drawLine(), getBaseColor(), getBorderColor(), getBorderSize(), getHeight(), getWidth(), mBorderStyle, and fcn::Graphics::setColor().

◆ drawOutline()

void fcn::Widget::drawOutline ( Graphics * graphics)
virtual

Called when a widget is given a chance to draw a outline around itself.

The outline is not considered as part of the widget, it only allows a outline to be drawn around the widget, thus a outline will never be included when calculating if a widget should receive events from user input. Also a widget's outline will never be included when calculating a widget's position.

The size of the outline is calculated using the widget's outline size. If a widget has a outline size of 10 pixels than the area the drawOutline function can draw to will be the size of the widget with an additional extension of 10 pixels in each direction.

An example when drawOutline is a useful function is if a widget needs a glow around itself.

Parameters
graphicsA graphics object to draw with.
See also
setOutlineSize, getOutlineSize

Definition at line 133 of file widget.cpp.

References fcn::Color::a, fcn::Graphics::drawLine(), getBaseColor(), getHeight(), getOutlineColor(), getOutlineSize(), getWidth(), and fcn::Graphics::setColor().

Referenced by _draw(), and draw().

◆ drawSelectionFrame()

void fcn::Widget::drawSelectionFrame ( Graphics * graphics)
virtual

Called when a widget is "active" and the selection mode is Frame or FrameWithBackground.

Currently the size of the border is used, so it will replace the border with the frame.

Parameters
graphicsA graphics object to draw with.
See also
setSelectionMode, getSelectionMode, setSelectionColor, getSelectionColor

Definition at line 217 of file widget.cpp.

References fcn::Graphics::drawLine(), getBorderSize(), getHeight(), getSelectionColor(), getWidth(), and fcn::Graphics::setColor().

Referenced by fcn::BarGraph::draw(), fcn::Button::draw(), fcn::Container::draw(), fcn::CurveGraph::draw(), fcn::Icon::draw(), fcn::IconProgressBar::draw(), fcn::ImageButton::draw(), fcn::ImageProgressBar::draw(), fcn::Label::draw(), fcn::LineGraph::draw(), fcn::PieGraph::draw(), fcn::PointGraph::draw(), draw(), and fcn::CheckBox::drawBox().

◆ expandContent() [1/2]

void fcn::Widget::expandContent ( )
inline

Expands the child widgets to the size of this widget, calls recursively all childs.

This is a convenience wrapper that calls expandContent(true).

Definition at line 1597 of file widget.hpp.

References expandContent().

Referenced by adaptLayout(), fcn::Container::Container(), fcn::ScrollArea::expandContent(), and expandContent().

◆ expandContent() [2/2]

virtual void fcn::Widget::expandContent ( bool recursion)
inlinevirtual

Expands child widgets to fit this widget's size.

Parameters
recursionIf true, call expandContent recursively on children.

Reimplemented in fcn::AdjustingContainer, fcn::Container, fcn::FlowContainer, fcn::ScrollArea, and fcn::TabbedArea.

Definition at line 1607 of file widget.hpp.

◆ findWidgetById()

Widget * fcn::Widget::findWidgetById ( std::string const & id)
protectedvirtual

Finds a widget by id.

This function can be useful when implementing a GUI generator, such as the ability to create a GUI from an XML file.

Parameters
idThe id to find a widget by.
Returns
The widget with the corresponding id, Nullptr if no widget is found.

Reimplemented in fcn::Container.

Definition at line 1358 of file widget.cpp.

References findWidgetById(), getId(), mChildren, and Widget().

Referenced by fcn::Container::findWidgetById(), and findWidgetById().

◆ focusNext()

void fcn::Widget::focusNext ( )
virtual

Focuses the next widget in the widget.

See also
moveToBottom

Definition at line 1490 of file widget.cpp.

References mChildren.

◆ focusPrevious()

void fcn::Widget::focusPrevious ( )
virtual

Focuses the previous widget in the widget.

See also
moveToBottom

Definition at line 1517 of file widget.cpp.

References mChildren.

◆ fontChanged()

virtual void fcn::Widget::fontChanged ( )
inlinevirtual

Called when the font has changed.

If the change is global, this function will only be called if the widget doesn't have a font already set.

Reimplemented in fcn::Button, and fcn::TextBox.

Definition at line 1160 of file widget.hpp.

Referenced by setFont().

◆ getAbsolutePosition()

void fcn::Widget::getAbsolutePosition ( int & x,
int & y ) const
virtual

◆ getActionEventId()

std::string const & fcn::Widget::getActionEventId ( ) const

Gets the action event identifier of the widget.

Returns
The action event identifier of the widget.
See also
setActionEventId

Definition at line 614 of file widget.cpp.

References mActionEventId.

◆ getBackgroundColor()

◆ getBaseColor()

◆ getBorderColor()

Color const & fcn::Widget::getBorderColor ( ) const

Gets the border color.

Returns
The border color.
See also
setBorderColor

Definition at line 792 of file widget.cpp.

References mBorderColor.

Referenced by drawBorder().

◆ getBorderSides()

unsigned int fcn::Widget::getBorderSides ( ) const

Get the currently selected border sides.

Definition at line 484 of file widget.cpp.

References mBorderSides.

Referenced by fcn::Container::draw(), fcn::FlowContainer::expandContent(), and fcn::Container::getChildrenArea().

◆ getBorderSize()

unsigned int fcn::Widget::getBorderSize ( ) const

Gets the size of the widget's border.

The border is considered as part of the widget.

A border size of 0 means that the widget has no border. The default border size is 0.

Returns
The size of the widget's border.
See also
setBorderSize, drawBorder

Definition at line 474 of file widget.cpp.

References mBorderSize.

Referenced by fcn::AdjustingContainer::adjustSize(), fcn::Container::adjustSize(), fcn::Panel::adjustSize(), fcn::Window::adjustSize(), fcn::Button::adjustSizeImpl(), fcn::CheckBox::adjustSizeImpl(), fcn::Icon::adjustSizeImpl(), fcn::IconProgressBar::adjustSizeImpl(), fcn::ImageButton::adjustSizeImpl(), fcn::ImageProgressBar::adjustSizeImpl(), fcn::Label::adjustSizeImpl(), fcn::BarGraph::draw(), fcn::Button::draw(), fcn::CheckBox::draw(), fcn::Container::draw(), fcn::CurveGraph::draw(), fcn::Icon::draw(), fcn::IconProgressBar::draw(), fcn::ImageButton::draw(), fcn::ImageProgressBar::draw(), fcn::Label::draw(), fcn::LineGraph::draw(), fcn::Panel::draw(), fcn::PieGraph::draw(), fcn::PointGraph::draw(), fcn::Window::draw(), drawBorder(), fcn::CheckBox::drawBox(), fcn::Window::drawInnerBorder(), drawSelectionFrame(), fcn::FlowContainer::expandContent(), fcn::AdjustingContainer::getChildrenArea(), fcn::Container::getChildrenArea(), fcn::Tab::getChildrenArea(), fcn::TabbedArea::getChildrenArea(), fcn::Window::getChildrenArea(), fcn::ScrollArea::getHorizontalMaxScroll(), fcn::ScrollArea::getVerticalMaxScroll(), fcn::ScrollArea::logic(), fcn::MenuPopup::MenuPopup(), fcn::Panel::mousePressed(), fcn::Window::mousePressed(), and fcn::ScrollArea::showWidgetPart().

◆ getBorderStyle()

unsigned int fcn::Widget::getBorderStyle ( ) const

Get the current border drawing style.

Definition at line 494 of file widget.cpp.

References mBorderStyle.

Referenced by fcn::FlowContainer::expandContent(), fcn::MenuBar::MenuBar(), and fcn::MenuPopup::MenuPopup().

◆ getChildren()

std::list< Widget * > const & fcn::Widget::getChildren ( ) const
protected

◆ getChildrenArea()

Rectangle fcn::Widget::getChildrenArea ( )
virtual

Gets the area of the widget occupied by the widget's children.

By default this method returns an empty rectangle as not all widgets are containers. If you want to make a container this method should return the area where the children resides. This method is used when drawing children of a widget when computing clip rectangles for the children.

Note
The returned rectangle should be relative to the widget, i.e a rectangle with x and y coordinate (0,0) and with width and height the same as the widget will let the children draw themselves in the whole widget.

An example of a widget that overloads this method is ScrollArea. A ScrollArea has a view of its constant and that view is the children area. The size of a ScrollArea's children area might vary depending on if the scroll bars of the ScrollArea is shown or not.

Returns
The area of the widget occupied by the widget's children.

Reimplemented in fcn::AdjustingContainer, fcn::Container, fcn::DropDown, fcn::ScrollArea, fcn::Tab, fcn::TabbedArea, fcn::Tooltip, and fcn::Window.

Definition at line 1166 of file widget.cpp.

Referenced by _draw(), fcn::DropDown::adjustHeight(), getAbsolutePosition(), getWidgetAt(), fcn::TextBox::keyPressed(), and showWidgetPart().

◆ getChildrenCount()

unsigned int fcn::Widget::getChildrenCount ( ) const

Gets how many childs the widget have.

Returns
The children count of the widget.

Definition at line 339 of file widget.cpp.

References mChildren.

Referenced by fcn::Container::getChild(), fcn::MenuBar::keyPressed(), fcn::MenuPopup::mousePressed(), and fcn::ModalBackdrop::mousePressed().

◆ getDimension()

Rectangle const & fcn::Widget::getDimension ( ) const

Gets the dimension of the widget.

The dimension is relative to the widget's parent.

Returns
The dimension of the widget.
See also
getDimension, setX, getX, setY, getY, setPosition

Definition at line 609 of file widget.cpp.

References mDimension.

Referenced by fcn::FlowContainer::adjustContent(), getWidgetAt(), getWidgetsIn(), and fcn::Container::resizeToContent().

◆ getFixedSize()

Size const & fcn::Widget::getFixedSize ( ) const

Gets the fixed size of the widget.

Returns
The fixed size of the widget.
See also
setFixedSize, isFixedSize

Definition at line 396 of file widget.cpp.

References mFixedSize.

◆ getFont()

◆ getForegroundColor()

◆ getHeight()

int fcn::Widget::getHeight ( ) const

Gets the height of the widget.

Returns
The height of the widget.
See also
setHeight, setWidth, getWidth, setSize, setDimension, getDimension

Definition at line 265 of file widget.cpp.

References mDimension.

Referenced by fcn::TextField::adjustHeight(), fcn::ActivityBar::adjustSize(), fcn::Container::adjustSize(), fcn::TabbedArea::adjustSize(), fcn::Window::adjustSize(), fcn::CheckBox::adjustSizeImpl(), fcn::ImageButton::adjustSizeImpl(), fcn::TextBox::adjustSizeImpl(), fcn::TabbedArea::adjustTabPositions(), fcn::ScrollArea::checkPolicies(), contains(), fcn::ActivityBar::draw(), fcn::BarGraph::draw(), fcn::Button::draw(), fcn::CheckBox::draw(), fcn::Container::draw(), fcn::CurveGraph::draw(), fcn::DropDown::draw(), fcn::HorizontalBar::draw(), fcn::Icon::draw(), fcn::IconProgressBar::draw(), fcn::ImageButton::draw(), fcn::ImageProgressBar::draw(), fcn::Label::draw(), fcn::LineGraph::draw(), fcn::ListBox::draw(), fcn::MenuBar::draw(), fcn::MenuItem::draw(), fcn::MenuPopup::draw(), fcn::PieGraph::draw(), fcn::PointGraph::draw(), fcn::ScrollArea::draw(), fcn::Slider::draw(), fcn::StatusBar::draw(), fcn::Tab::draw(), fcn::TabbedArea::draw(), fcn::TextBox::draw(), fcn::TextField::draw(), fcn::Tooltip::draw(), fcn::Window::draw(), drawBorder(), fcn::CheckBox::drawBox(), fcn::TextBox::drawCaret(), fcn::Window::drawInnerBorder(), fcn::Slider::drawMarker(), drawOutline(), fcn::CheckBox::drawRhombus(), drawSelectionFrame(), fcn::DropDown::dropDown(), fcn::ScrollArea::expandContent(), fcn::AdjustingContainer::getChildrenArea(), fcn::Container::getChildrenArea(), fcn::DropDown::getChildrenArea(), fcn::ScrollArea::getChildrenArea(), fcn::Tab::getChildrenArea(), fcn::TabbedArea::getChildrenArea(), fcn::Window::getChildrenArea(), fcn::ScrollArea::getDownButtonDimension(), fcn::ScrollArea::getHorizontalBarDimension(), fcn::ScrollArea::getLeftButtonDimension(), fcn::ScrollArea::getRightButtonDimension(), fcn::ScrollArea::getVerticalBarDimension(), fcn::ScrollArea::getVerticalMarkerDimension(), fcn::ScrollArea::getVerticalMaxScroll(), fcn::Slider::markerPositionToValue(), fcn::Slider::mouseDragged(), fcn::MenuPopup::mousePressed(), fcn::ModalBackdrop::mousePressed(), fcn::Slider::mousePressed(), resizeToChildren(), fcn::ActivityBar::resizeToContent(), fcn::FlowContainer::resizeToContent(), fcn::Spacer::resizeToContent(), fcn::ScrollArea::setDimension(), fcn::ScrollArea::setHeight(), fcn::ActivityBar::setWidth(), fcn::MenuPopup::show(), and fcn::Slider::valueToMarkerPosition().

◆ getId()

std::string const & fcn::Widget::getId ( ) const

Gets the id of a widget.

The id is useful if a widget needs to be identified in a container. For example, if widgets are created by an XML document, a certain widget can be retrieved given that the widget has an id.

Returns
The id of the widget.
See also
setId, Container::findWidgetById

Definition at line 1195 of file widget.cpp.

References mId.

Referenced by findWidgetById().

◆ getLastPosition()

void fcn::Widget::getLastPosition ( int & x,
int & y ) const

Retrieves the last stored position used by layout or event logic.

Parameters
xOutput parameter receiving the last x coordinate.
yOutput parameter receiving the last y coordinate.

Definition at line 1594 of file widget.cpp.

References mLastX, and mLastY.

◆ getMarginBottom()

int fcn::Widget::getMarginBottom ( ) const

Gets the bottom margin.

The margin clears an area around an element (outside the border). The margin does not have a background color, and is completely transparent. It is also possible to use negative values, to overlap content.

Returns
The bottom margin of the widget.
See also
setMarginBottom

Definition at line 546 of file widget.cpp.

References mMarginBottom.

Referenced by fcn::FlowContainer::adjustContent(), and fcn::FlowContainer::expandContent().

◆ getMarginLeft()

int fcn::Widget::getMarginLeft ( ) const

Gets the left margin.

The margin clears an area around an element (outside the border). The margin does not have a background color, and is completely transparent. It is also possible to use negative values, to overlap content.

Returns
The left margin of the widget.
See also
setMarginLeft

Definition at line 556 of file widget.cpp.

References mMarginLeft.

Referenced by fcn::FlowContainer::adjustContent(), and fcn::FlowContainer::expandContent().

◆ getMarginRight()

int fcn::Widget::getMarginRight ( ) const

Gets the right margin.

The margin clears an area around an element (outside the border). The margin does not have a background color, and is completely transparent. It is also possible to use negative values, to overlap content.

Returns
The right margin of the widget.
See also
setMarginRight

Definition at line 536 of file widget.cpp.

References mMarginRight.

Referenced by fcn::FlowContainer::adjustContent(), and fcn::FlowContainer::expandContent().

◆ getMarginTop()

int fcn::Widget::getMarginTop ( ) const

Gets the top margin.

The margin clears an area around an element (outside the border). The margin does not have a background color, and is completely transparent. It is also possible to use negative values, to overlap content.

Returns
The top margin of the widget.
See also
setMarginTop

Definition at line 526 of file widget.cpp.

References mMarginTop.

Referenced by fcn::FlowContainer::adjustContent(), and fcn::FlowContainer::expandContent().

◆ getMaxSize()

Size const & fcn::Widget::getMaxSize ( ) const

Gets the maximal dimension of the widget.

Returns
The maximal size of the widget.
See also
setMaxSize

Definition at line 380 of file widget.cpp.

References mMaxSize.

◆ getMinSize()

Size const & fcn::Widget::getMinSize ( ) const

Gets the minimal dimension of the widget.

Returns
The minimal size of the widget.
See also
setMinSize

Definition at line 369 of file widget.cpp.

References mMinSize.

Referenced by fcn::ScrollArea::adjustSize(), fcn::FlowContainer::resizeToContent(), fcn::ScrollArea::resizeToContent(), and fcn::Spacer::resizeToContent().

◆ getMouseCapture()

Widget * fcn::Widget::getMouseCapture ( )
static

Gets the widget that currently has mouse capture.

Returns
The widget with mouse capture, or nullptr if no widget has capture.
See also
captureMouse, releaseMouse, hasMouseCapture

Definition at line 1629 of file widget.cpp.

References sMouseCapture, and Widget().

Referenced by fcn::FocusHandler::pushModal().

◆ getOutlineColor()

Color const & fcn::Widget::getOutlineColor ( ) const

Gets the outline color.

Returns
The outline color.
See also
setOutlineColor

Definition at line 782 of file widget.cpp.

References mOutlineColor.

Referenced by drawOutline().

◆ getOutlineSize()

unsigned int fcn::Widget::getOutlineSize ( ) const

Gets the size of the widget's outline.

The outline is not considered as part of the widget, it only allows a outline to be drawn around the widget, thus a outline will never be included when calculating if a widget should receive events from user input. Also a widget's outline will never be included when calculating a widget's position.

A outline size of 0 means that the widget has no outline. The default outline size is 0.

Returns
The size of the widget's outline.
See also
setOutlineSize, drawOutline

Definition at line 464 of file widget.cpp.

References mOutlineSize.

Referenced by draw(), and drawOutline().

◆ getPaddingBottom()

◆ getPaddingLeft()

◆ getPaddingRight()

◆ getPaddingTop()

◆ getParent()

◆ getSelectionColor()

◆ getSelectionMode()

◆ getTop()

Widget * fcn::Widget::getTop ( ) const
virtual

Gets the top widget, or top parent, of this widget.

Returns
The top widget, or top parent, for this widget. Nullptr if no top widget exists (this widget doesn't have a parent).

Definition at line 1316 of file widget.cpp.

References getParent(), and Widget().

Referenced by fcn::MenuBar::addMenu(), fcn::MenuPopup::mousePressed(), fcn::ModalBackdrop::mousePressed(), and fcn::MenuPopup::show().

◆ getVisibleChildrenCount()

unsigned int fcn::Widget::getVisibleChildrenCount ( ) const

Gets how many visible childs the widget have.

Returns
The visible children count of the widget.

Definition at line 350 of file widget.cpp.

References mChildren.

◆ getWidgetAt() [1/2]

Widget * fcn::Widget::getWidgetAt ( int x,
int y )
inline

Gets a widget at a certain position in the widget.

This function is used to decide which gets mouse input, thus it can be overloaded to change that behaviour.

Note
This always returns Nullptr if the widget is not a container.
Parameters
xThe x coordinate of the widget to get.
yThe y coordinate of the widget to get.
Returns
The widget at the specified coordinate, Nullptr if no widget is found.

Definition at line 1287 of file widget.hpp.

References getWidgetAt(), and Widget().

Referenced by fcn::DragHandler::findWidgetAt(), fcn::Gui::getWidgetAt(), getWidgetAt(), fcn::Gui::getWidgetsAt(), fcn::MenuBar::mousePressed(), and fcn::DragHandler::update().

◆ getWidgetAt() [2/2]

Widget * fcn::Widget::getWidgetAt ( int x,
int y,
Widget * exclude )
virtual

Variant of getWidgetAt that allows excluding a specific widget from the hit-test.

Parameters
xThe x coordinate of the widget to get.
yThe y coordinate of the widget to get.
excludeWidget to exclude from search, if Nullptr no widgets get excluded.
Returns
The widget at the specified coordinate, Nullptr if no widget is found.

Definition at line 1128 of file widget.cpp.

References getChildrenArea(), getDimension(), fcn::Rectangle::isContaining(), isVisible(), mChildren, Widget(), fcn::Rectangle::x, and fcn::Rectangle::y.

◆ getWidgetsIn() [1/2]

std::list< Widget * > fcn::Widget::getWidgetsIn ( Rectangle const & area)
inline

Gets all widgets inside a certain area of the widget.

Note
This always returns an empty list if the widget is not a container.
Parameters
areaThe area to check.
Returns
A list of widgets. An empty list if no widgets was found.

Definition at line 1312 of file widget.hpp.

References getWidgetsIn().

Referenced by getWidgetsIn().

◆ getWidgetsIn() [2/2]

std::list< Widget * > fcn::Widget::getWidgetsIn ( Rectangle const & area,
Widget * ignore )
virtual

Gets all widgets inside a certain area of the widget.

Note
This always returns an empty list if the widget is not a container.
Parameters
areaThe area to check.
ignoreOptional widget pointer to exclude from the results.
Returns
A list of widgets found inside area. Empty list if none.

Definition at line 1333 of file widget.cpp.

References getDimension(), fcn::Rectangle::isIntersecting(), mChildren, and Widget().

◆ getWidth()

int fcn::Widget::getWidth ( ) const

Gets the width of the widget.

Returns
The width of the widget.
See also
setWidth, setHeight, getHeight, setSize, setDimension, getDimension

Definition at line 252 of file widget.cpp.

References mDimension.

Referenced by fcn::DropDown::adjustHeight(), fcn::Container::adjustSize(), fcn::HorizontalBar::adjustSize(), fcn::TabbedArea::adjustSize(), fcn::Window::adjustSize(), fcn::ImageButton::adjustSizeImpl(), fcn::ListBox::adjustSizeImpl(), fcn::TextBox::adjustSizeImpl(), fcn::TabbedArea::adjustTabPositions(), fcn::ScrollArea::checkPolicies(), contains(), fcn::BarGraph::draw(), fcn::Button::draw(), fcn::Container::draw(), fcn::CurveGraph::draw(), fcn::DropDown::draw(), fcn::HorizontalBar::draw(), fcn::Icon::draw(), fcn::IconProgressBar::draw(), fcn::ImageButton::draw(), fcn::ImageProgressBar::draw(), fcn::Label::draw(), fcn::LineGraph::draw(), fcn::ListBox::draw(), fcn::MenuBar::draw(), fcn::MenuItem::draw(), fcn::MenuPopup::draw(), fcn::Panel::draw(), fcn::PieGraph::draw(), fcn::PointGraph::draw(), fcn::ScrollArea::draw(), fcn::Slider::draw(), fcn::StatusBar::draw(), fcn::Tab::draw(), fcn::TabbedArea::draw(), fcn::TextBox::draw(), fcn::TextField::draw(), fcn::Tooltip::draw(), fcn::Window::draw(), drawBorder(), fcn::CheckBox::drawBox(), fcn::Window::drawInnerBorder(), fcn::Slider::drawMarker(), drawOutline(), fcn::CheckBox::drawRhombus(), drawSelectionFrame(), fcn::ScrollArea::expandContent(), fcn::TextField::fixScroll(), fcn::AdjustingContainer::getChildrenArea(), fcn::Container::getChildrenArea(), fcn::DropDown::getChildrenArea(), fcn::ScrollArea::getChildrenArea(), fcn::Tab::getChildrenArea(), fcn::TabbedArea::getChildrenArea(), fcn::Window::getChildrenArea(), fcn::ScrollArea::getDownButtonDimension(), fcn::ScrollArea::getHorizontalBarDimension(), fcn::ScrollArea::getHorizontalMarkerDimension(), fcn::ScrollArea::getHorizontalMaxScroll(), fcn::ScrollArea::getRightButtonDimension(), fcn::ScrollArea::getUpButtonDimension(), fcn::ScrollArea::getVerticalBarDimension(), fcn::Slider::markerPositionToValue(), fcn::ActivityBarItem::mouseEntered(), fcn::MenuPopup::mousePressed(), fcn::ModalBackdrop::mousePressed(), fcn::Slider::mousePressed(), resizeToChildren(), fcn::FlowContainer::resizeToContent(), fcn::HorizontalBar::resizeToContent(), fcn::Spacer::resizeToContent(), fcn::ScrollArea::setDimension(), fcn::ScrollArea::setWidth(), fcn::MenuPopup::show(), and fcn::Slider::valueToMarkerPosition().

◆ getX()

int fcn::Widget::getX ( ) const

Gets the x coordinate of the widget.

The coordinate is relative to the widget's parent.

Returns
The x coordinate of the widget.
See also
setX, setY, getY, setPosition, setDimension, getDimension

Definition at line 288 of file widget.cpp.

References mDimension.

Referenced by fcn::MenuBar::action(), fcn::Window::mouseDragged(), resizeToChildren(), fcn::ScrollArea::showWidgetPart(), and showWidgetPart().

◆ getY()

int fcn::Widget::getY ( ) const

Gets the y coordinate of the widget.

The coordinate is relative to the widget's parent.

Returns
The y coordinate of the widget.
See also
setY, setX, getX, setPosition, setDimension, getDimension

Definition at line 301 of file widget.cpp.

References mDimension.

Referenced by fcn::MenuBar::action(), fcn::DropDown::adjustHeight(), fcn::ListBox::draw(), fcn::Window::mouseDragged(), resizeToChildren(), fcn::ScrollArea::showWidgetPart(), and showWidgetPart().

◆ hasMouseCapture()

bool fcn::Widget::hasMouseCapture ( ) const

Checks if this widget currently has mouse capture.

Returns
True if this widget has mouse capture, false otherwise.
See also
captureMouse, releaseMouse, getMouseCapture

Definition at line 1634 of file widget.cpp.

References sMouseCapture.

◆ isDescendantOf()

bool fcn::Widget::isDescendantOf ( Widget const * ancestor) const
noexcept

Checks if this widget is a descendant of (or equal to) the given ancestor.

Walks the parent chain to determine if this widget is somewhere in the ancestor's child tree.

Parameters
ancestorThe potential ancestor to check against.
Returns
True if this widget is a descendant of ancestor, false otherwise. Returns false if ancestor is nullptr.

Definition at line 1639 of file widget.cpp.

References getParent(), and Widget().

Referenced by isInsideActiveMouseModal(), and fcn::FocusHandler::pushModal().

◆ isEnabled()

bool fcn::Widget::isEnabled ( ) const

Checks if the widget is enabled.

A disabled widget will never receive mouse or key events.

Returns
True if widget is enabled, false otherwise.
See also
setEnabled

Definition at line 1079 of file widget.cpp.

References isVisible(), and mEnabled.

Referenced by fcn::Gui::distributeKeyEvent(), fcn::Gui::distributeMouseEvent(), fcn::Gui::handleTextInput(), and isFocusable().

◆ isFixedSize()

bool fcn::Widget::isFixedSize ( ) const

Gets if the widget use a fixed size.

Returns
True if the widget use a fixed size, otherwise false.
See also
setFixedSize, getFixedSize

Definition at line 401 of file widget.cpp.

References mFixedSizeUsed.

Referenced by fcn::TextBox::adjustSizeImpl().

◆ isFocusable()

bool fcn::Widget::isFocusable ( ) const

Checks if a widget is focusable.

Returns
True if the widget should be focusable, false otherwise.
See also
setFocusable

Definition at line 655 of file widget.cpp.

References isEnabled(), isVisible(), and mFocusable.

Referenced by fcn::TabbedArea::mousePressed(), and requestFocus().

◆ isFocused()

◆ isHorizontalExpand()

bool fcn::Widget::isHorizontalExpand ( ) const

Gets if widget is horizontal expandable.

Returns
True if the widget can be horizontal expanded, otherwise false.
See also
setHorizontalExpand

Definition at line 440 of file widget.cpp.

References mHExpand.

Referenced by fcn::FlowContainer::adjustContent(), fcn::HorizontalBar::adjustSize(), fcn::TextBox::adjustSizeImpl(), fcn::Container::expandContent(), and fcn::HorizontalBar::resizeToContent().

◆ isInsideActiveMouseModal()

bool fcn::Widget::isInsideActiveMouseModal ( ) const
noexcept

Checks if this widget is inside the active mouse modal root.

Walks up from this widget to find if it is contained within the widget returned by FocusHandler::getActiveMouseInputRoot().

Returns
True if this widget is inside the active mouse modal, false otherwise.

Definition at line 1654 of file widget.cpp.

References isDescendantOf(), mFocusHandler, and Widget().

◆ isLastPositionSet()

bool fcn::Widget::isLastPositionSet ( ) const

Returns whether a last position has been stored for this widget.

Returns
True if a last position is set, false otherwise.

Definition at line 1606 of file widget.cpp.

References mLastX, and mLastY.

Referenced by getAbsolutePosition().

◆ isLayouted()

virtual bool fcn::Widget::isLayouted ( )
inlinevirtual

Helper function to decide if we need to layout.

Reimplemented in fcn::Container.

Definition at line 1614 of file widget.hpp.

Referenced by adaptLayout().

◆ isModalFocusable()

bool fcn::Widget::isModalFocusable ( ) const
virtual

Checks if a widget is modal focusable.

Returns
True if no other widget is modal focused, false otherwise.

Definition at line 1084 of file widget.cpp.

References mFocusHandler, and fcn::throwException().

◆ isModalFocused()

bool fcn::Widget::isModalFocused ( ) const
virtual

Checks if the widget or it's parent has modal focus.

Returns
True if the widget has modal focus, false otherwise.

Definition at line 1102 of file widget.cpp.

References getParent(), isModalFocused(), mFocusHandler, and fcn::throwException().

Referenced by fcn::Gui::distributeKeyEvent(), fcn::Gui::distributeMouseEvent(), fcn::Gui::handleMousePressed(), and isModalFocused().

◆ isModalMouseInputFocusable()

bool fcn::Widget::isModalMouseInputFocusable ( ) const
virtual

Checks if a widget is modal mouse input focusable.

Returns
True if no other widget is modal mouse input focused, false otherwise.

Definition at line 1093 of file widget.cpp.

References mFocusHandler, and fcn::throwException().

◆ isMouseInside()

bool fcn::Widget::isMouseInside ( MouseEvent const & mouseEvent) const

Checks if a mouse event occurred within this widget.

Parameters
mouseEventThe mouse event to check.
Returns
True if the event coordinates are within bounds.

Definition at line 275 of file widget.cpp.

References contains(), fcn::MouseEvent::getX(), and fcn::MouseEvent::getY().

Referenced by fcn::Button::mousePressed(), fcn::DropDown::mousePressed(), fcn::DropDown::mouseReleased(), fcn::DropDown::mouseWheelMovedDown(), and fcn::DropDown::mouseWheelMovedUp().

◆ isSetVisible()

bool fcn::Widget::isSetVisible ( ) const

Checks if the widget setting is visible.

Returns
True if widget setting is be visible, false otherwise.

Definition at line 732 of file widget.cpp.

References mVisible.

◆ isTabInEnabled()

bool fcn::Widget::isTabInEnabled ( ) const

Checks if tab in is enabled.

Tab in means that you can set focus to this widget by pressing the tab button. If tab in is disabled then the focus handler will skip this widget and focus the next in its focus order.

Returns
True if tab in is enabled, false otherwise.
See also
setTabInEnabled

Definition at line 1045 of file widget.cpp.

References mTabIn.

◆ isTabOutEnabled()

bool fcn::Widget::isTabOutEnabled ( ) const

Checks if tab out is enabled.

Tab out means that you can lose focus to this widget by pressing the tab button. If tab out is disabled then the FocusHandler ignores tabbing and focus will stay with this widget.

Returns
True if tab out is enabled, false otherwise.
See also
setTabOutEnabled

Definition at line 1055 of file widget.cpp.

References mTabOut.

◆ isUnderMouseModal()

bool fcn::Widget::isUnderMouseModal ( ) const
virtual

Checks if the widget or its parent is under a mouse modal.

Returns
True if the widget has modal mouse input focus, false otherwise.

Definition at line 1115 of file widget.cpp.

References getParent(), isUnderMouseModal(), mFocusHandler, and fcn::throwException().

Referenced by fcn::Gui::distributeMouseEvent(), isUnderMouseModal(), and fcn::DropDown::mouseReleased().

◆ isVerticalExpand()

bool fcn::Widget::isVerticalExpand ( ) const

Gets if widget is vertical expandable.

Returns
True if the widget can be vertical expanded, otherwise false.
See also
setVerticalExpand

Definition at line 430 of file widget.cpp.

References mVExpand.

Referenced by fcn::FlowContainer::adjustContent(), fcn::TextBox::adjustSizeImpl(), and fcn::Container::expandContent().

◆ isVisible()

bool fcn::Widget::isVisible ( ) const

Checks if the widget is visible.

Returns
True if widget is be visible, false otherwise.
See also
setVisible

Definition at line 724 of file widget.cpp.

References getParent(), isVisible(), and mVisible.

Referenced by fcn::FlowContainer::adjustContent(), getWidgetAt(), isEnabled(), isFocusable(), and isVisible().

◆ logic()

virtual void fcn::Widget::logic ( )
inlinevirtual

Called for all widgets in the GUI each time Gui::logic is called.

You can do logic stuff here like playing an animation.

See also
Gui::logic

Reimplemented in fcn::ListBox, and fcn::ScrollArea.

Definition at line 467 of file widget.hpp.

Referenced by _logic(), and fcn::ScrollArea::logic().

◆ moveToBottom()

void fcn::Widget::moveToBottom ( Widget * widget)
virtual

Moves a widget in this widget to the bottom of this widget.

The moved widget will be drawn below all other widgets in this widget.

This method is safe to call at any time.

Parameters
widgetThe widget to move to the bottom.
See also
moveToTop

Definition at line 1477 of file widget.cpp.

References mChildren, fcn::throwException(), and Widget().

◆ moveToTop()

void fcn::Widget::moveToTop ( Widget * widget)
virtual

Moves a widget to the top of this widget.

The moved widget will be drawn above all other widgets in this widget.

This method is safe to call at any time.

Parameters
widgetThe widget to move to the top.
See also
moveToBottom

Definition at line 1464 of file widget.cpp.

References mChildren, fcn::throwException(), and Widget().

Referenced by fcn::DropDown::dropDown(), fcn::Window::mousePressed(), and fcn::MenuPopup::show().

◆ onFocusChanged()

virtual void fcn::Widget::onFocusChanged ( )
inlinevirtual

Called when the widget focus changes.

Override this to perform custom actions when focus is gained or lost.

Definition at line 1187 of file widget.hpp.

Referenced by setFocused().

◆ onFocusGained()

virtual void fcn::Widget::onFocusGained ( )
inlinevirtual

Called when the widget gains focus.

Override this to perform custom actions when focus is gained.

Definition at line 1169 of file widget.hpp.

Referenced by setFocused().

◆ onFocusLost()

virtual void fcn::Widget::onFocusLost ( )
inlinevirtual

Called when the widget loses focus.

Override this to perform custom actions when focus is lost.

Definition at line 1178 of file widget.hpp.

Referenced by setFocused().

◆ releaseMouse()

void fcn::Widget::releaseMouse ( )

Releases mouse capture from this widget, if it has capture.

This method is idempotent - it's safe to call even if this widget doesn't currently have mouse capture.

See also
captureMouse, getMouseCapture

Definition at line 1621 of file widget.cpp.

References sMouseCapture.

Referenced by fcn::Gui::releaseMouse().

◆ remove()

void fcn::Widget::remove ( Widget * widget)
protectedvirtual

Removes a specific child from the widget.

THIS METHOD IS NOT SAFE TO CALL INSIDE A WIDGETS LOGIC FUNCTION INSIDE ANY LISTER FUNCTIONS!

Parameters
widgetThe widget to remove.
See also
removeAllChildren

Reimplemented in fcn::AdjustingContainer, and fcn::Container.

Definition at line 1422 of file widget.cpp.

References _getVisibilityEventHandler(), _setFocusHandler(), _setParent(), getAbsolutePosition(), mChildren, setLastPosition(), fcn::throwException(), Widget(), and fcn::VisibilityEventHandler::widgetHidden().

Referenced by fcn::ActivityBarItem::mouseExited(), and fcn::Container::remove().

◆ removeActionListener()

void fcn::Widget::removeActionListener ( ActionListener * actionListener)

Removes an added action listener from the widget.

Parameters
actionListenerThe action listener to remove.
See also
addActionListener

Definition at line 869 of file widget.cpp.

References mActionListeners.

◆ removeAllChildren()

void fcn::Widget::removeAllChildren ( )
protectedvirtual

Remvoes all children from the widget.

THIS METHOD IS NOT SAFE TO CALL INSIDE A WIDGETS LOGIC FUNCTION INSIDE ANY LISTER FUNCTIONS!

See also
remove

Reimplemented in fcn::AdjustingContainer, and fcn::Container.

Definition at line 1402 of file widget.cpp.

References _getVisibilityEventHandler(), _setFocusHandler(), _setParent(), getAbsolutePosition(), mChildren, setLastPosition(), Widget(), and fcn::VisibilityEventHandler::widgetHidden().

Referenced by fcn::Container::removeAllChildren(), and fcn::ScrollArea::setContent().

◆ removeDeathListener()

void fcn::Widget::removeDeathListener ( DeathListener * deathListener)

Removes an added death listener from the widget.

Parameters
deathListenerThe death listener to remove.
See also
addDeathListener

Definition at line 880 of file widget.cpp.

References mDeathListeners.

◆ removeDropTargetListener()

void fcn::Widget::removeDropTargetListener ( DropTargetListener * listener)

Removes an added drop target listener from the widget.

Parameters
listenerThe listener to remove.
See also
addDropTargetListener

Definition at line 973 of file widget.cpp.

References mDropTargetListeners.

◆ removeFocusListener()

void fcn::Widget::removeFocusListener ( FocusListener * focusListener)

Removes an added focus listener from the widget.

Parameters
focusListenerThe focus listener to remove.
See also
addFocusListener

Definition at line 902 of file widget.cpp.

References mFocusListeners.

◆ removeKeyListener()

void fcn::Widget::removeKeyListener ( KeyListener * keyListener)

Removes an added key listener from the widget.

Parameters
keyListenerThe key listener to remove.
See also
addKeyListener

Definition at line 891 of file widget.cpp.

References mKeyListeners.

◆ removeMouseListener()

void fcn::Widget::removeMouseListener ( MouseListener * mouseListener)

Removes an added mouse listener from the widget.

Parameters
mouseListenerThe mouse listener to remove.
See also
addMouseListener

Definition at line 913 of file widget.cpp.

References mMouseListeners.

◆ removeWidgetListener()

void fcn::Widget::removeWidgetListener ( WidgetListener * widgetListener)

Removes an added widget listener from the widget.

Parameters
widgetListenerThe widget listener to remove.
See also
addWidgetListener

Definition at line 924 of file widget.cpp.

References mWidgetListeners.

◆ requestFocus()

void fcn::Widget::requestFocus ( )
virtual

Requests focus for the widget.

A widget will only receive focus if it is focusable.

Definition at line 660 of file widget.cpp.

References isFocusable(), mFocusHandler, and fcn::throwException().

Referenced by fcn::MenuBar::action(), fcn::Gui::handleMousePressed(), fcn::MenuBar::keyPressed(), fcn::MenuBar::mousePressed(), fcn::TabbedArea::mousePressed(), and fcn::MenuPopup::show().

◆ requestMoveToBottom()

void fcn::Widget::requestMoveToBottom ( )
virtual

Requests a move to the bottom in the parent widget.

Definition at line 678 of file widget.cpp.

References mParent.

◆ requestMoveToTop()

void fcn::Widget::requestMoveToTop ( )
virtual

Requests a move to the top in the parent widget.

Definition at line 671 of file widget.cpp.

References mParent.

◆ resetGlobalFont()

void fcn::Widget::resetGlobalFont ( )
static

Resets the global font, detaching it from the Widget class.

This allows the font to be destroyed externally after being detached.

See also
setGlobalFont

Definition at line 1026 of file widget.cpp.

References mGlobalFont.

◆ resizeToChildren()

void fcn::Widget::resizeToChildren ( )
protected

Resizes the widget to fit it's children exactly.

Definition at line 1344 of file widget.cpp.

References getHeight(), getWidth(), getX(), getY(), mChildren, setSize(), and Widget().

Referenced by fcn::Container::adjustSize(), fcn::Window::adjustSize(), and fcn::TabbedArea::resizeToContent().

◆ resizeToContent()

virtual void fcn::Widget::resizeToContent ( bool recursion = true)
inlinevirtual

Resizes the widget's size to fit the content exactly, calls recursively all childs.

The default value true allows callers to use resizeToContent() without argument.

Parameters
recursionIf true, perform the resize operation recursively on children.

Reimplemented in fcn::ActivityBar, fcn::AdjustingContainer, fcn::Button, fcn::Container, fcn::DropDown, fcn::FlowContainer, fcn::HorizontalBar, fcn::Icon, fcn::IconProgressBar, fcn::ImageButton, fcn::ImageProgressBar, fcn::Label, fcn::ListBox, fcn::ScrollArea, fcn::Spacer, fcn::TabbedArea, fcn::TextBox, and fcn::TextField.

Definition at line 1580 of file widget.hpp.

Referenced by adaptLayout(), fcn::Container::Container(), and fcn::ScrollArea::resizeToContent().

◆ setActionEventId()

void fcn::Widget::setActionEventId ( std::string const & actionEventId)

Sets the action event identifier of the widget.

The identifier is used to be able to identify which action has occurred.

Note
An action event identifier should not be used to identify a certain widget but rather a certain event in your application. Several widgets can have the same action event identifier.
Parameters
actionEventIdThe action event identifier.
See also
getActionEventId

Definition at line 619 of file widget.cpp.

References mActionEventId.

◆ setBackgroundColor()

void fcn::Widget::setBackgroundColor ( Color const & color)
virtual

Sets the background color.

Parameters
colorThe background Color.
See also
setBackgroundColor

Reimplemented in fcn::DropDown.

Definition at line 757 of file widget.cpp.

References mBackgroundColor.

Referenced by fcn::DropDown::setBackgroundColor(), and fcn::Slider::Slider().

◆ setBaseColor()

void fcn::Widget::setBaseColor ( Color const & color)
virtual

Sets the base color of the widget.

Parameters
colorThe base color.
See also
getBaseColor

Reimplemented in fcn::DropDown, and fcn::TabbedArea.

Definition at line 737 of file widget.cpp.

References mBaseColor.

Referenced by fcn::TabbedArea::addTab(), fcn::DropDown::setBaseColor(), fcn::TabbedArea::setBaseColor(), and fcn::Slider::Slider().

◆ setBorderBottom()

void fcn::Widget::setBorderBottom ( unsigned int size,
unsigned int style )

Convenience helper: set a bottom-only border with size and style.

This sets the border size, selects the bottom side and applies style.

Definition at line 506 of file widget.cpp.

References setBorderSides(), setBorderSize(), and setBorderStyle().

Referenced by fcn::FlowContainer::expandContent(), and fcn::MenuBar::MenuBar().

◆ setBorderColor()

void fcn::Widget::setBorderColor ( Color const & color)
virtual

Sets the border color.

Parameters
colorThe border color.
See also
getBorderColor

Definition at line 787 of file widget.cpp.

References mBorderColor.

◆ setBorderSides()

void fcn::Widget::setBorderSides ( unsigned int sides)

Select which sides the border should be drawn on.

Default is BORDER_ALL.

Definition at line 479 of file widget.cpp.

References mBorderSides.

Referenced by fcn::FlowContainer::expandContent(), setBorderBottom(), and setBorderTop().

◆ setBorderSize()

void fcn::Widget::setBorderSize ( unsigned int size)

Sets the size of the widget's border.

The border is considered a part of the widget.

A border size of 0 means that the widget has no border. The default border size is 0.

Parameters
sizeThe size of the widget's border.
See also
getBorderSize, drawBorder

Definition at line 469 of file widget.cpp.

References mBorderSize.

Referenced by fcn::FlowContainer::expandContent(), fcn::MenuItem::MenuItem(), fcn::MenuPopup::MenuPopup(), setBorderBottom(), setBorderTop(), fcn::Slider::Slider(), and fcn::Window::Window().

◆ setBorderStyle()

void fcn::Widget::setBorderStyle ( unsigned int style)

Set border drawing style (bevel or flat).

Definition at line 489 of file widget.cpp.

References mBorderStyle.

Referenced by fcn::FlowContainer::expandContent(), fcn::MenuPopup::MenuPopup(), setBorderBottom(), and setBorderTop().

◆ setBorderTop()

void fcn::Widget::setBorderTop ( unsigned int size,
unsigned int style )

Convenience helper: set a top-only border with size and style.

This sets the border size, selects the top side and applies style.

Definition at line 499 of file widget.cpp.

References setBorderSides(), setBorderSize(), and setBorderStyle().

Referenced by fcn::FlowContainer::expandContent().

◆ setDimension()

void fcn::Widget::setDimension ( Rectangle const & dimension)
virtual

Sets the dimension of the widget.

The dimension is relative to the widget's parent.

Parameters
dimensionThe dimension of the widget.
See also
getDimension, setX, getX, setY, getY, setPosition

Reimplemented in fcn::ScrollArea, and fcn::TabbedArea.

Definition at line 315 of file widget.cpp.

References calculateSize(), distributeMovedEvent(), distributeResizedEvent(), fcn::Rectangle::height, mChildren, mDimension, fcn::Rectangle::width, fcn::Rectangle::x, and fcn::Rectangle::y.

Referenced by fcn::ScrollArea::setDimension(), fcn::TabbedArea::setDimension(), setHeight(), setPosition(), setSize(), setWidth(), setX(), and setY().

◆ setEnabled()

void fcn::Widget::setEnabled ( bool enabled)

Sets the widget to enabled, or not.

A disabled widget will never receive mouse or key events.

Parameters
enabledTrue if widget should be enabled, false otherwise.
See also
isEnabled

Definition at line 1074 of file widget.cpp.

References mEnabled.

Referenced by fcn::ModalBackdrop::ModalBackdrop().

◆ setFixedSize()

void fcn::Widget::setFixedSize ( Size const & size)

Sets the dimension of the widget to a fixed size.

To disable it, provide a size with negative values.

Parameters
sizeThe fixed size of the widget.
See also
getFixedSize, isFixedSize

Definition at line 385 of file widget.cpp.

References calculateSize(), mFixedSize, and mFixedSizeUsed.

◆ setFocusable()

void fcn::Widget::setFocusable ( bool focusable)

Sets the widget to be focusable, or not.

Parameters
focusableTrue if the widget should be focusable, false otherwise.
See also
isFocusable

Definition at line 646 of file widget.cpp.

References isFocused(), mFocusable, and mFocusHandler.

Referenced by fcn::Button::Button(), fcn::DropDown::DropDown(), fcn::ListBox::ListBox(), fcn::ModalBackdrop::ModalBackdrop(), fcn::Slider::Slider(), fcn::TextBox::TextBox(), and fcn::TextField::TextField().

◆ setFocused()

void fcn::Widget::setFocused ( bool focused)
virtual

Sets the widget as focused, or not.

This method handles focus state changes and calls onFocusGained(), onFocusLost(), and onFocusChanged() hooks.

Parameters
focusedTrue if the widget should be focused, false otherwise.
See also
isFocused

Definition at line 629 of file widget.cpp.

References mFocused, onFocusChanged(), onFocusGained(), and onFocusLost().

Referenced by fcn::FocusHandler::setFocusedWidget().

◆ setFont()

void fcn::Widget::setFont ( Font * font)
virtual

Sets the font for the widget.

If Nullptr is passed, the global font will be used.

Parameters
fontThe font to set for the widget.
See also
getFont

Reimplemented in fcn::DropDown.

Definition at line 1031 of file widget.cpp.

References fontChanged(), and mCurrentFont.

Referenced by fcn::DropDown::setFont().

◆ setForegroundColor()

void fcn::Widget::setForegroundColor ( Color const & color)
virtual

Sets the foreground color.

Parameters
colorThe foreground color.
See also
getForegroundColor

Reimplemented in fcn::DropDown.

Definition at line 747 of file widget.cpp.

References mForegroundColor.

Referenced by fcn::DropDown::setForegroundColor(), and fcn::Slider::Slider().

◆ setGlobalFont()

void fcn::Widget::setGlobalFont ( Font * font)
static

Sets the global font to be used by default for all widgets.

IMPORTANT: This method does not support resetting the font (use resetGlobalFont() instead).

Parameters
fontThe global font (must not be null).
See also
getGlobalFont, resetGlobalFont

Definition at line 1013 of file widget.cpp.

References mGlobalFont.

Referenced by fcn::Gui::setGlobalFont().

◆ setHeight()

◆ setHorizontalExpand()

void fcn::Widget::setHorizontalExpand ( bool expand)

Sets the widget to horizontal expandable.

Parameters
expandTrue if the widget can be horizontal expanded, otherwise false.
See also
isHorizontalExpand

Definition at line 435 of file widget.cpp.

References mHExpand.

Referenced by fcn::HorizontalBar::adjustSize(), fcn::HorizontalBar::resizeToContent(), and fcn::Spacer::Spacer().

◆ setId()

void fcn::Widget::setId ( std::string const & id)

Sets an id of a widget.

The id is useful if a widget needs to be identified in a container. For example, if widgets are created by an XML document, a certain widget can be retrieved given that the widget has an id.

Parameters
idThe id to set to the widget.
See also
getId, Container::findWidgetById

Definition at line 1190 of file widget.cpp.

References mId.

◆ setInternalFocusHandler()

void fcn::Widget::setInternalFocusHandler ( FocusHandler * internalFocusHandler)

Sets the internal focus handler.

An internal focus handler is needed, if both 'a widget in the widget' and 'the widget itself' should be focused at the same time.

Parameters
internalFocusHandlerThe internal focus handler to be used.
See also
getInternalFocusHandler

Definition at line 1176 of file widget.cpp.

References _getFocusHandler(), mChildren, and mInternalFocusHandler.

◆ setLastPosition()

void fcn::Widget::setLastPosition ( int x,
int y )

Stores the last known position for this widget.

Parameters
xThe x coordinate to store.
yThe y coordinate to store.

Definition at line 1600 of file widget.cpp.

References mLastX, and mLastY.

Referenced by add(), remove(), and removeAllChildren().

◆ setMargin()

void fcn::Widget::setMargin ( int margin)

Sets all 4 margins to one value.

The margin clears an area around an element (outside the border). The margin does not have a background color, and is completely transparent. It is also possible to use negative values, to overlap content.

Parameters
marginThe margin of the widget.
See also
setMarginTop, setMarginRight, setMarginBottom, setMarginRight

Definition at line 513 of file widget.cpp.

References mMarginBottom, mMarginLeft, mMarginRight, and mMarginTop.

Referenced by fcn::FlowContainer::expandContent().

◆ setMarginBottom()

void fcn::Widget::setMarginBottom ( int margin)

Sets the bottom margin.

The margin clears an area around an element (outside the border). The margin does not have a background color, and is completely transparent. It is also possible to use negative values, to overlap content.

Parameters
marginThe bottom margin of the widget.
See also
getMarginBottom

Definition at line 541 of file widget.cpp.

References mMarginBottom.

Referenced by fcn::FlowContainer::expandContent().

◆ setMarginLeft()

void fcn::Widget::setMarginLeft ( int margin)

Sets the left margin.

The margin clears an area around an element (outside the border). The margin does not have a background color, and is completely transparent. It is also possible to use negative values, to overlap content.

Parameters
marginThe left margin of the widget.
See also
getMarginLeft

Definition at line 551 of file widget.cpp.

References mMarginLeft.

Referenced by fcn::FlowContainer::expandContent().

◆ setMarginRight()

void fcn::Widget::setMarginRight ( int margin)

Sets the right margin.

The margin clears an area around an element (outside the border). The margin does not have a background color, and is completely transparent. It is also possible to use negative values, to overlap content.

Parameters
marginThe right margin of the widget.
See also
getMarginRight

Definition at line 531 of file widget.cpp.

References mMarginRight.

Referenced by fcn::FlowContainer::expandContent().

◆ setMarginTop()

void fcn::Widget::setMarginTop ( int margin)

Sets the top margin.

The margin clears an area around an element (outside the border). The margin does not have a background color, and is completely transparent. It is also possible to use negative values, to overlap content.

Parameters
marginThe top margin of the widget.
See also
getMarginTop

Definition at line 521 of file widget.cpp.

References mMarginTop.

Referenced by fcn::FlowContainer::expandContent().

◆ setMaxSize()

void fcn::Widget::setMaxSize ( Size const & size)

Sets the maximal dimension of the widget.

Parameters
sizeThe maximal size of the widget.
See also
getMaxSize

Definition at line 374 of file widget.cpp.

References calculateSize(), and mMaxSize.

◆ setMinSize()

void fcn::Widget::setMinSize ( Size const & size)

Sets the minimal dimension of the widget.

Parameters
sizeThe minimal size of the widget.
See also
getMinSize

Definition at line 363 of file widget.cpp.

References calculateSize(), and mMinSize.

◆ setOutlineColor()

void fcn::Widget::setOutlineColor ( Color const & color)
virtual

Sets the outline color.

Parameters
colorThe outline color.
See also
getOutlineColor

Definition at line 777 of file widget.cpp.

References mOutlineColor.

◆ setOutlineSize()

void fcn::Widget::setOutlineSize ( unsigned int size)

Sets the size of the widget's outline.

The outline is not considered as part of the widget, it only allows a outline to be drawn around the widget, thus a outline will never be included when calculating if a widget should receive events from user input. Also a widget's outline will never be included when calculating a widget's position.

A outline size of 0 means that the widget has no outline. The default outline size is 0.

Parameters
sizeThe size of the widget's outline.
See also
getOutlineSize, drawOutline

Definition at line 459 of file widget.cpp.

References mOutlineSize.

Referenced by draw().

◆ setPadding()

void fcn::Widget::setPadding ( unsigned int padding)

Sets all 4 paddings to one value.

The padding clears an area around the content (inside the border) of an element. The padding is affected by the background color of the element.

Parameters
paddingThe top padding of the widget.
See also
setPaddingTop, setPaddingRight, setPaddingBottom, setPaddingLeft

Definition at line 561 of file widget.cpp.

References mPaddingBottom, mPaddingLeft, mPaddingRight, and mPaddingTop.

Referenced by fcn::FlowContainer::expandContent(), and fcn::Window::Window().

◆ setPaddingBottom()

void fcn::Widget::setPaddingBottom ( unsigned int padding)

Sets the bottom padding.

The padding clears an area around the content (inside the border) of an element. The padding is affected by the background color of the element.

Parameters
paddingThe bottom padding of the widget.
See also
getPaddingBottom

Definition at line 589 of file widget.cpp.

References mPaddingBottom.

Referenced by fcn::FlowContainer::expandContent().

◆ setPaddingLeft()

void fcn::Widget::setPaddingLeft ( unsigned int padding)

Sets the left padding.

The padding clears an area around the content (inside the border) of an element. The padding is affected by the background color of the element.

Parameters
paddingThe left padding of the widget.
See also
getPaddingLeft

Definition at line 599 of file widget.cpp.

References mPaddingLeft.

Referenced by fcn::FlowContainer::expandContent(), and fcn::MenuPopup::MenuPopup().

◆ setPaddingRight()

void fcn::Widget::setPaddingRight ( unsigned int padding)

Sets the right padding.

The padding clears an area around the content (inside the border) of an element. The padding is affected by the background color of the element.

Parameters
paddingThe right padding of the widget.
See also
getPaddingRight

Definition at line 579 of file widget.cpp.

References mPaddingRight.

Referenced by fcn::FlowContainer::expandContent(), and fcn::MenuPopup::MenuPopup().

◆ setPaddingTop()

void fcn::Widget::setPaddingTop ( unsigned int padding)

Sets the top padding.

The padding clears an area around the content (inside the border) of an element. The padding is affected by the background color of the element.

Parameters
paddingThe top padding of the widget.
See also
getPaddingTop

Definition at line 569 of file widget.cpp.

References mPaddingTop.

Referenced by fcn::FlowContainer::expandContent().

◆ setPosition()

void fcn::Widget::setPosition ( int x,
int y )

Sets position of the widget.

The position is relative to the widget's parent.

Parameters
xThe x coordinate of the widget.
yThe y coordinate of the widget.
See also
setX, getX, setY, getY, setDimension, getDimension

Definition at line 306 of file widget.cpp.

References mDimension, setDimension(), fcn::Rectangle::x, and fcn::Rectangle::y.

Referenced by fcn::Container::add(), fcn::TabbedArea::adjustTabPositions(), fcn::ScrollArea::logic(), fcn::Window::mouseDragged(), fcn::ScrollArea::setContent(), and fcn::MenuPopup::show().

◆ setSelectionColor()

void fcn::Widget::setSelectionColor ( Color const & color)
virtual

Sets the selection color.

Parameters
colorThe selection color.
See also
getSelectionColor

Reimplemented in fcn::DropDown.

Definition at line 767 of file widget.cpp.

References mSelectionColor.

Referenced by fcn::DropDown::setSelectionColor().

◆ setSelectionMode()

void fcn::Widget::setSelectionMode ( SelectionMode mode)
virtual

Sets the selection mode.

Parameters
modeThe selection mode that is used when the widget is "active".
See also
getSelectionMode

Definition at line 797 of file widget.cpp.

References mSelectionMode.

◆ setSize()

◆ setTabInEnabled()

void fcn::Widget::setTabInEnabled ( bool enabled)

Sets tab in enabled, or not.

Tab in means that you can set focus to this widget by pressing the tab button. If tab in is disabled then the FocusHandler will skip this widget and focus the next in its focus order.

Parameters
enabledTrue if tab in should be enabled, false otherwise.
See also
isTabInEnabled

Definition at line 1050 of file widget.cpp.

References mTabIn.

◆ setTabOutEnabled()

void fcn::Widget::setTabOutEnabled ( bool enabled)

Sets tab out enabled.

Tab out means that you can lose focus to this widget by pressing the tab button. If tab out is disabled then the FocusHandler ignores tabbing and focus will stay with this widget.

Parameters
enabledTrue if tab out should be enabled, false otherwise.
See also
isTabOutEnabled

Definition at line 1060 of file widget.cpp.

References mTabOut.

◆ setVerticalExpand()

void fcn::Widget::setVerticalExpand ( bool expand)

Sets the widget to vertical expandable.

Parameters
expandTrue if the widget can be vertical expanded, otherwise false.
See also
isVerticalExpand

Definition at line 425 of file widget.cpp.

References mVExpand.

Referenced by fcn::Spacer::Spacer().

◆ setVisible()

void fcn::Widget::setVisible ( bool visible)

◆ setWidth()

◆ setX()

void fcn::Widget::setX ( int x)

Sets the x coordinate of the widget.

The coordinate is relative to the widget's parent.

Parameters
xThe x coordinate of the widget.
See also
getX, setY, getY, setPosition, setDimension, getDimension

Definition at line 280 of file widget.cpp.

References mDimension, setDimension(), and fcn::Rectangle::x.

Referenced by showWidgetPart().

◆ setY()

void fcn::Widget::setY ( int y)

Sets the y coordinate of the widget.

The coordinate is relative to the widget's parent.

Parameters
yThe y coordinate of the widget.
See also
setY, setX, getX, setPosition, setDimension, getDimension

Definition at line 293 of file widget.cpp.

References mDimension, setDimension(), and fcn::Rectangle::y.

Referenced by showWidgetPart().

◆ showPart()

void fcn::Widget::showPart ( Rectangle rectangle)
virtual

Shows a certain part of a widget in the widget's parent.

Used when widgets want a specific part to be visible in its parent. An example is a TextArea that wants a specific part of its text to be visible when a TextArea is a child of a ScrollArea.

Parameters
rectangleThe rectangle to be shown.

Definition at line 1309 of file widget.cpp.

References mParent.

Referenced by fcn::TextBox::scrollToCaret(), and fcn::ListBox::setSelected().

◆ showWidgetPart()

void fcn::Widget::showWidgetPart ( Widget * widget,
Rectangle area )
virtual

Tries to show a specific part of a widget by moving it.

Used if the widget should act as a container.

Parameters
widgetThe target widget.
areaThe area to show.

Reimplemented in fcn::ScrollArea.

Definition at line 1378 of file widget.cpp.

References getChildrenArea(), getX(), getY(), fcn::Rectangle::height, setX(), setY(), Widget(), fcn::Rectangle::width, fcn::Rectangle::x, and fcn::Rectangle::y.

Referenced by fcn::ScrollArea::showWidgetPart().

◆ textInput()

virtual void fcn::Widget::textInput ( TextInputEvent & event)
inlinevirtual

Called when text input (IME, dead-key, paste) is received.

Override this to handle text input in your widget. The default implementation does nothing.

Parameters
eventThe text input event containing the UTF-8 text.

Reimplemented in fcn::TextBox, and fcn::TextField.

Definition at line 479 of file widget.hpp.

Referenced by fcn::Gui::handleTextInput().

◆ widgetExists()

bool fcn::Widget::widgetExists ( Widget const * widget)
static

Checks if a widget exists or not, that is if it still exists an instance of the object.

Parameters
widgetThe widget to check.
Returns
True if an instance of the widget exists, false otherwise.

Definition at line 1037 of file widget.cpp.

References Widget().

Referenced by _setFocusHandler(), fcn::Gui::distributeKeyEvent(), fcn::Gui::distributeMouseEvent(), and fcn::Gui::handleHiddenWidgets().

◆ DragHandler

friend class DragHandler
friend

Definition at line 105 of file widget.hpp.

Member Data Documentation

◆ mActionEventId

std::string fcn::Widget::mActionEventId
protected

Holds the action event of the widget.

Definition at line 1987 of file widget.hpp.

Referenced by distributeActionEvent(), getActionEventId(), and setActionEventId().

◆ mActionListeners

std::list<ActionListener*> fcn::Widget::mActionListeners
protected

Holds the action listeners of the widget.

Definition at line 1836 of file widget.hpp.

Referenced by addActionListener(), distributeActionEvent(), and removeActionListener().

◆ mBackgroundColor

Color fcn::Widget::mBackgroundColor {0xf9fafb}
protected

Holds the background color of the widget.

Definition at line 1866 of file widget.hpp.

Referenced by getBackgroundColor(), and setBackgroundColor().

◆ mBaseColor

Color fcn::Widget::mBaseColor {0xe5e7eb}
protected

Holds the base color of the widget.

Definition at line 1871 of file widget.hpp.

Referenced by getBaseColor(), and setBaseColor().

◆ mBorderColor

Color fcn::Widget::mBorderColor {0xd1d5db}
protected

Holds the border color of the widget.

Definition at line 1886 of file widget.hpp.

Referenced by getBorderColor(), and setBorderColor().

◆ mBorderSides

unsigned int fcn::Widget::mBorderSides {BORDER_ALL}
protected

Which sides to draw the border on (bitmask of BorderSide).

See also
BorderSide enum

Definition at line 1930 of file widget.hpp.

Referenced by drawBorder(), getBorderSides(), and setBorderSides().

◆ mBorderSize

unsigned int fcn::Widget::mBorderSize {0}
protected

Holds the border size of the widget.

Definition at line 1923 of file widget.hpp.

Referenced by getBorderSize(), and setBorderSize().

◆ mBorderStyle

unsigned int fcn::Widget::mBorderStyle {BORDER_STYLE_FLAT}
protected

Border drawing style (see BorderStyle).

See also
BorderStyle enum

Definition at line 1937 of file widget.hpp.

Referenced by drawBorder(), getBorderStyle(), and setBorderStyle().

◆ mChildren

◆ mCurrentFont

Font* fcn::Widget::mCurrentFont {nullptr}
protected

Holds the font used by the widget.

Definition at line 2060 of file widget.hpp.

Referenced by getFont(), and setFont().

◆ mDeathListeners

std::list<DeathListener*> fcn::Widget::mDeathListeners
protected

Holds the death listeners of the widget.

Definition at line 1841 of file widget.hpp.

Referenced by addDeathListener(), and removeDeathListener().

◆ mDefaultFont

DefaultFont fcn::Widget::mDefaultFont
staticprotected

Holds the default font used by the widget.

Definition at line 2065 of file widget.hpp.

Referenced by getFont().

◆ mDimension

◆ mDropTargetListeners

std::list<DropTargetListener*> fcn::Widget::mDropTargetListeners
protected

Holds the drop target listeners of the widget.

Definition at line 1856 of file widget.hpp.

Referenced by addDropTargetListener(), distributeDragDrop(), distributeDragEnter(), distributeDragHover(), distributeDragLeave(), and removeDropTargetListener().

◆ mEnabled

bool fcn::Widget::mEnabled {true}
protected

True if the widget is enabled, false otherwise.

Definition at line 2017 of file widget.hpp.

Referenced by isEnabled(), and setEnabled().

◆ mFixedSize

Size fcn::Widget::mFixedSize {-1, -1}
protected

Holds the fixed size.

Definition at line 2040 of file widget.hpp.

Referenced by calculateSize(), getFixedSize(), and setFixedSize().

◆ mFixedSizeUsed

bool fcn::Widget::mFixedSizeUsed {false}
protected

True if the widget used a fixed size.

Definition at line 2045 of file widget.hpp.

Referenced by calculateSize(), isFixedSize(), and setFixedSize().

◆ mFocusable

bool fcn::Widget::mFocusable {false}
protected

True if the widget focusable, false otherwise.

Definition at line 1992 of file widget.hpp.

Referenced by isFocusable(), and setFocusable().

◆ mFocused

bool fcn::Widget::mFocused {false}
protected

True if the widget has focus, false otherwise.

Definition at line 1997 of file widget.hpp.

Referenced by isFocused(), and setFocused().

◆ mFocusHandler

◆ mFocusListeners

std::list<FocusListener*> fcn::Widget::mFocusListeners
protected

Holds the focus listeners of the widget.

Definition at line 1846 of file widget.hpp.

Referenced by _getFocusListeners(), addFocusListener(), and removeFocusListener().

◆ mForegroundColor

Color fcn::Widget::mForegroundColor {0x1f2933}
protected

Holds the foreground color of the widget.

Definition at line 1861 of file widget.hpp.

Referenced by getForegroundColor(), and setForegroundColor().

◆ mGlobalFont

Font * fcn::Widget::mGlobalFont = nullptr
staticprotected

Holds the global font used by the widget.

Definition at line 2070 of file widget.hpp.

Referenced by getFont(), resetGlobalFont(), and setGlobalFont().

◆ mGuiDeathListener

DeathListener * fcn::Widget::mGuiDeathListener = nullptr
staticprotected

Holds the death listener used by the widgets.

Definition at line 2089 of file widget.hpp.

Referenced by _getGuiDeathListener(), and _setGuiDeathListener().

◆ mHExpand

bool fcn::Widget::mHExpand {false}
protected

True if the widget can be horizontal expanded.

Definition at line 2055 of file widget.hpp.

Referenced by isHorizontalExpand(), and setHorizontalExpand().

◆ mId

std::string fcn::Widget::mId
protected

Holds the id of the widget.

Definition at line 2022 of file widget.hpp.

Referenced by getId(), and setId().

◆ mInternalFocusHandler

FocusHandler* fcn::Widget::mInternalFocusHandler {nullptr}
protected

Holds the focus handler used by the widget.

Nullptr if no internal focus handler is used.

Definition at line 1897 of file widget.hpp.

Referenced by _getInternalFocusHandler(), _setFocusHandler(), add(), and setInternalFocusHandler().

◆ mKeyListeners

std::list<KeyListener*> fcn::Widget::mKeyListeners
protected

Holds the key listeners of the widget.

Definition at line 1831 of file widget.hpp.

Referenced by _getKeyListeners(), addKeyListener(), and removeKeyListener().

◆ mLastX

int fcn::Widget::mLastX {0}
protected

Last stored X coordinate used for layout and event calculations.

Definition at line 2102 of file widget.hpp.

Referenced by getAbsolutePosition(), getLastPosition(), isLastPositionSet(), and setLastPosition().

◆ mLastY

int fcn::Widget::mLastY {0}
protected

Last stored Y coordinate used for layout and event calculations.

Definition at line 2105 of file widget.hpp.

Referenced by getAbsolutePosition(), getLastPosition(), isLastPositionSet(), and setLastPosition().

◆ mMarginBottom

int fcn::Widget::mMarginBottom {0}
protected

Holds the bottom margin of the widget.

Definition at line 1957 of file widget.hpp.

Referenced by getMarginBottom(), setMargin(), and setMarginBottom().

◆ mMarginLeft

int fcn::Widget::mMarginLeft {0}
protected

Holds the left margin of the widget.

Definition at line 1962 of file widget.hpp.

Referenced by getMarginLeft(), setMargin(), and setMarginLeft().

◆ mMarginRight

int fcn::Widget::mMarginRight {0}
protected

Holds the top right of the widget.

Definition at line 1952 of file widget.hpp.

Referenced by getMarginRight(), setMargin(), and setMarginRight().

◆ mMarginTop

int fcn::Widget::mMarginTop {0}
protected

Holds the top margin of the widget.

Definition at line 1947 of file widget.hpp.

Referenced by getMarginTop(), setMargin(), and setMarginTop().

◆ mMaxSize

Size fcn::Widget::mMaxSize {std::numeric_limits<int>::max(), std::numeric_limits<int>::max()}
protected

Holds the max size.

Default to a very large value so widgets are not clamped to zero when the user does not explicitly set a max size.

Definition at line 2035 of file widget.hpp.

Referenced by calculateSize(), getMaxSize(), and setMaxSize().

◆ mMinSize

Size fcn::Widget::mMinSize {0, 0}
protected

Holds the min size.

Definition at line 2027 of file widget.hpp.

Referenced by calculateSize(), getMinSize(), and setMinSize().

◆ mMouseListeners

std::list<MouseListener*> fcn::Widget::mMouseListeners
protected

Holds the mouse listeners of the widget.

Definition at line 1826 of file widget.hpp.

Referenced by _getMouseListeners(), addMouseListener(), and removeMouseListener().

◆ mOffsetRect

Rectangle fcn::Widget::mOffsetRect
protected

Holds the offset dimension of the widget.

Definition at line 1913 of file widget.hpp.

◆ mOutlineColor

Color fcn::Widget::mOutlineColor {0x9ca3af}
protected

Holds the outline color of the widget.

Definition at line 1881 of file widget.hpp.

Referenced by getOutlineColor(), and setOutlineColor().

◆ mOutlineSize

unsigned int fcn::Widget::mOutlineSize {0}
protected

Holds the outline size of the widget.

Definition at line 1918 of file widget.hpp.

Referenced by _draw(), getOutlineSize(), and setOutlineSize().

◆ mPaddingBottom

unsigned int fcn::Widget::mPaddingBottom {0}
protected

Holds the bottom padding of the widget.

Definition at line 1977 of file widget.hpp.

Referenced by fcn::AdjustingContainer::adjustSize(), getPaddingBottom(), setPadding(), and setPaddingBottom().

◆ mPaddingLeft

unsigned int fcn::Widget::mPaddingLeft {0}
protected

Holds the left padding of the widget.

Definition at line 1982 of file widget.hpp.

Referenced by fcn::AdjustingContainer::adjustContent(), fcn::AdjustingContainer::adjustSize(), getPaddingLeft(), setPadding(), and setPaddingLeft().

◆ mPaddingRight

unsigned int fcn::Widget::mPaddingRight {0}
protected

Holds the right padding of the widget.

Definition at line 1972 of file widget.hpp.

Referenced by fcn::AdjustingContainer::adjustSize(), getPaddingRight(), setPadding(), and setPaddingRight().

◆ mPaddingTop

unsigned int fcn::Widget::mPaddingTop {0}
protected

Holds the top padding of the widget.

Definition at line 1967 of file widget.hpp.

Referenced by fcn::AdjustingContainer::adjustContent(), fcn::AdjustingContainer::adjustSize(), getPaddingTop(), setPadding(), and setPaddingTop().

◆ mParent

Widget* fcn::Widget::mParent {nullptr}
protected

Holds the parent of the widget.

Nullptr if the widget has no parent.

Definition at line 1903 of file widget.hpp.

Referenced by _setParent(), getParent(), requestMoveToBottom(), requestMoveToTop(), and showPart().

◆ mSelectionColor

Color fcn::Widget::mSelectionColor {0x3b82f6}
protected

Holds the selection color of the widget.

Definition at line 1876 of file widget.hpp.

Referenced by getSelectionColor(), and setSelectionColor().

◆ mSelectionMode

SelectionMode fcn::Widget::mSelectionMode {SelectionMode::None}
protected

Holds the selection mode.

Definition at line 1942 of file widget.hpp.

Referenced by getSelectionMode(), and setSelectionMode().

◆ mTabIn

bool fcn::Widget::mTabIn {true}
protected

True if the widget has tab in enabled, false otherwise.

Definition at line 2007 of file widget.hpp.

Referenced by isTabInEnabled(), and setTabInEnabled().

◆ mTabOut

bool fcn::Widget::mTabOut {true}
protected

True if the widget has tab in enabled, false otherwise.

Definition at line 2012 of file widget.hpp.

Referenced by isTabOutEnabled(), and setTabOutEnabled().

◆ mVExpand

bool fcn::Widget::mVExpand {false}
protected

True if the widget can be vertical expanded.

Definition at line 2050 of file widget.hpp.

Referenced by isVerticalExpand(), and setVerticalExpand().

◆ mVisibilityEventHandler

VisibilityEventHandler * fcn::Widget::mVisibilityEventHandler = nullptr
staticprotected

Holds the visibility event handler used by the widgets.

Todo
We don't like the visibility handler being static, but we leave it as is for the moment, until we come up a better solution.

Definition at line 2084 of file widget.hpp.

Referenced by _getVisibilityEventHandler(), and _setVisibilityEventHandler().

◆ mVisible

bool fcn::Widget::mVisible {true}
protected

True if the widget visible, false otherwise.

Definition at line 2002 of file widget.hpp.

Referenced by isSetVisible(), isVisible(), and setVisible().

◆ mWidgetInstances

std::list< Widget * > fcn::Widget::mWidgetInstances
staticprotected

Holds a list of all instances of widgets.

Definition at line 2075 of file widget.hpp.

◆ mWidgetListeners

◆ sMouseCapture

Widget * fcn::Widget::sMouseCapture = nullptr
staticprotected

Holds the widget that currently has mouse capture.

Definition at line 2094 of file widget.hpp.

Referenced by captureMouse(), getMouseCapture(), hasMouseCapture(), and releaseMouse().


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