|
FifeGUI 0.2.0
A C++ GUI library designed for games.
|
#include <widget.hpp>
Public Types | |
| 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 | addFocusListener (FocusListener *focusListener) |
| void | addKeyListener (KeyListener *keyListener) |
| void | addMouseListener (MouseListener *mouseListener) |
| void | addWidgetListener (WidgetListener *widgetListener) |
| virtual void | adjustSize () |
| virtual void | draw (Graphics *graphics)=0 |
| virtual void | drawBorder (Graphics *graphics) |
| 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 | getBorderSize () const |
| virtual Rectangle | getChildrenArea () |
| unsigned int | getChildrenCount () const |
| Rectangle const & | getDimension () const |
| Size const & | getFixedSize () const |
| Font * | getFont () 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 Widget * | getParent () const |
| Color const & | getSelectionColor () const |
| SelectionMode | getSelectionMode () const |
| virtual Widget * | getTop () const |
| unsigned int | getVisibleChildrenCount () const |
| Widget * | getWidgetAt (int x, int y) |
| virtual Widget * | getWidgetAt (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 | isEnabled () const |
| bool | isFixedSize () const |
| bool | isFocusable () const |
| virtual bool | isFocused () const |
| bool | isHorizontalExpand () const |
| bool | isLastPositionSet () const |
| virtual bool | isLayouted () |
| virtual bool | isModalFocusable () const |
| virtual bool | isModalFocused () const |
| virtual bool | isModalMouseInputFocusable () const |
| virtual bool | isModalMouseInputFocused () const |
| bool | isSetVisible () const |
| bool | isTabInEnabled () const |
| bool | isTabOutEnabled () const |
| bool | isVerticalExpand () const |
| bool | isVisible () const |
| virtual void | logic () |
| virtual void | moveToBottom (Widget *widget) |
| virtual void | moveToTop (Widget *widget) |
| Widget & | operator= (Widget &&)=delete |
| Widget & | operator= (Widget const &)=delete |
| virtual void | releaseModalFocus () |
| virtual void | releaseModalMouseInputFocus () |
| void | removeActionListener (ActionListener *actionListener) |
| void | removeDeathListener (DeathListener *deathListener) |
| void | removeFocusListener (FocusListener *focusListener) |
| void | removeKeyListener (KeyListener *keyListener) |
| void | removeMouseListener (MouseListener *mouseListener) |
| void | removeWidgetListener (WidgetListener *widgetListener) |
| virtual void | requestFocus () |
| virtual void | requestModalFocus () |
| virtual void | requestModalMouseInputFocus () |
| virtual void | requestMoveToBottom () |
| virtual void | requestMoveToTop () |
| void | resizeToContent () |
| virtual void | resizeToContent (bool recursion) |
| void | setActionEventId (std::string const &actionEventId) |
| virtual void | setBackgroundColor (Color const &color) |
| virtual void | setBaseColor (Color const &color) |
| virtual void | setBorderColor (Color const &color) |
| void | setBorderSize (unsigned int size) |
| void | setDimension (Rectangle const &dimension) |
| void | setEnabled (bool enabled) |
| void | setFixedSize (Size const &size) |
| void | setFocusable (bool focusable) |
| virtual void | setFont (Font *font) |
| virtual void | setForegroundColor (Color const &color) |
| 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) |
| void | setSize (int width, int height) |
| void | setTabInEnabled (bool enabled) |
| void | setTabOutEnabled (bool enabled) |
| void | setVerticalExpand (bool expand) |
| void | setVisible (bool visible) |
| void | setWidth (int width) |
| void | setX (int x) |
| void | setY (int y) |
| virtual void | showPart (Rectangle rectangle) |
| virtual void | showWidgetPart (Widget *widget, Rectangle area) |
| 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 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 | distributeHiddenEvent () |
| void | distributeMovedEvent () |
| void | distributeResizedEvent () |
| void | distributeShownEvent () |
| virtual Widget * | findWidgetById (std::string const &id) |
| std::list< Widget * > const & | getChildren () const |
| virtual void | remove (Widget *widget) |
| virtual void | removeAllChildren () |
| void | resizeToChildren () |
Static Protected Attributes | |
| static DefaultFont | mDefaultFont |
| static Font * | mGlobalFont = nullptr |
| static DeathListener * | mGuiDeathListener = nullptr |
| static VisibilityEventHandler * | mVisibilityEventHandler = nullptr |
| static std::list< Widget * > | mWidgetInstances |
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 44 of file widget.hpp.
|
strong |
Selection mode.
Definition at line 50 of file widget.hpp.
| 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 36 of file widget.cpp.
References mWidgetInstances.
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(), getParent(), getTop(), fcn::ScrollArea::getWidgetAt(), getWidgetAt(), getWidgetAt(), getWidgetsIn(), 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().
|
virtual |
Definition at line 41 of file widget.cpp.
|
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 1372 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.
|
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.
Definition at line 689 of file widget.cpp.
References mFocusHandler.
Referenced by add(), and setInternalFocusHandler().
|
virtual |
Gets the focus listeners of the widget.
Definition at line 987 of file widget.cpp.
References mFocusListeners.
Referenced by fcn::FocusHandler::distributeFocusGainedEvent(), and fcn::FocusHandler::distributeFocusLostEvent().
|
static |
Get the global GUI death listener.
Definition at line 709 of file widget.cpp.
References mGuiDeathListener.
|
virtual |
Gets the internal focus handler used.
Definition at line 997 of file widget.cpp.
References mInternalFocusHandler.
Referenced by fcn::Gui::getKeyEventSource().
|
virtual |
Gets the key listeners of the widget.
Definition at line 982 of file widget.cpp.
References mKeyListeners.
Referenced by fcn::Gui::distributeKeyEvent().
|
virtual |
Gets the mouse listeners of the widget.
Definition at line 977 of file widget.cpp.
References mMouseListeners.
Referenced by fcn::Gui::distributeMouseEvent().
|
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.
FIXME 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 699 of file widget.cpp.
References mVisibilityEventHandler.
Referenced by add(), distributeAncestorHiddenEvent(), distributeAncestorShownEvent(), remove(), removeAllChildren(), and setVisible().
|
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 1405 of file widget.cpp.
|
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.
| focusHandler | The focus handler to use. |
Definition at line 661 of file widget.cpp.
References fcn::FocusHandler::add(), mChildren, mFocusHandler, mInternalFocusHandler, releaseModalFocus(), releaseModalMouseInputFocus(), and widgetExists().
Referenced by add(), remove(), removeAllChildren(), and fcn::Gui::setTop().
|
static |
Set the global GUI death listener used to observe widget deletions.
| deathListener | Pointer to a DeathListener instance (ownership not transferred). |
Definition at line 704 of file widget.cpp.
References mGuiDeathListener.
|
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.
| parent | The parent of the widget. |
Definition at line 152 of file widget.cpp.
References mParent, and Widget().
Referenced by add(), remove(), and removeAllChildren().
|
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.
FIXME 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.
| visibilityEventHandler | The visibility event handler to be used. |
Definition at line 694 of file widget.cpp.
References mVisibilityEventHandler.
|
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 1399 of file widget.hpp.
References adaptLayout().
Referenced by adaptLayout(), fcn::TabbedArea::addTab(), fcn::TabbedArea::removeTab(), and fcn::TabbedArea::setSelectedTab().
|
virtual |
Execute the layouting for this widget.
| top | If true, perform top-level layout adaptations as well. |
Definition at line 352 of file widget.cpp.
References expandContent(), getParent(), isLayouted(), resizeToContent(), and Widget().
|
protected |
Adds a child to the widget.
THIS METHOD IS NOT SAFE TO CALL INSIDE A WIDGETS LOGIC FUNCTION INSIDE ANY LISTER FUNCTIONS!
| widget | The widget to add. |
Definition at line 1272 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(), and fcn::ScrollArea::setContent().
| 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.
| actionListener | The action listener to add. |
Definition at line 714 of file widget.cpp.
References mActionListeners.
Referenced by fcn::TabbedArea::addTab().
| 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.
| deathListener | The death listener to add. |
Definition at line 724 of file widget.cpp.
References mDeathListeners.
| 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.
| focusListener | The focus listener to add. |
Definition at line 744 of file widget.cpp.
References mFocusListeners.
Referenced by fcn::Button::Button(), and fcn::DropDown::DropDown().
| 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.
| keyListener | The key listener to add. |
Definition at line 734 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().
| 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.
| mouseListener | The mouse listener to add. |
Definition at line 754 of file widget.cpp.
References mMouseListeners.
Referenced by fcn::Button::Button(), fcn::DropDown::DropDown(), fcn::ListBox::ListBox(), fcn::ScrollArea::ScrollArea(), fcn::ScrollArea::ScrollArea(), fcn::Slider::Slider(), fcn::TextBox::TextBox(), fcn::TextField::TextField(), and fcn::Window::Window().
| 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.
| widgetListener | The widget listener to add. |
Definition at line 764 of file widget.cpp.
References mWidgetListeners.
Referenced by fcn::Button::Button().
|
inlinevirtual |
Resizes the widget's size to fit the content exactly.
Reimplemented in fcn::AdjustingContainer, fcn::Button, fcn::CheckBox, fcn::Container, fcn::DropDown, fcn::Icon, fcn::IconProgressBar, fcn::ImageButton, fcn::ImageProgressBar, fcn::Label, fcn::ListBox, fcn::ScrollArea, fcn::Tab, fcn::TabbedArea, fcn::TextBox, fcn::TextField, and fcn::Window.
Definition at line 1432 of file widget.hpp.
Referenced by fcn::ScrollArea::adjustSize().
|
protected |
Checks the size against the size constraints.
Used by setDimension.
Definition at line 314 of file widget.cpp.
References mDimension, mFixedSize, mFixedSizeUsed, mMaxSize, and mMinSize.
Referenced by setDimension(), setFixedSize(), setMaxSize(), and setMinSize().
|
protected |
Distributes an action event to all action listeners of the widget.
Definition at line 1113 of file widget.cpp.
References mActionEventId, and mActionListeners.
Referenced by fcn::DropDown::action(), fcn::CheckBox::keyPressed(), fcn::ListBox::keyPressed(), fcn::PasswordField::keyPressed(), fcn::Slider::keyPressed(), fcn::TextField::keyPressed(), fcn::Button::keyReleased(), fcn::CheckBox::mouseClicked(), fcn::Slider::mouseDragged(), fcn::ListBox::mousePressed(), fcn::Slider::mousePressed(), fcn::Button::mouseReleased(), fcn::Slider::mouseWheelMovedDown(), fcn::Slider::mouseWheelMovedLeft(), fcn::Slider::mouseWheelMovedRight(), fcn::Slider::mouseWheelMovedUp(), and fcn::ToggleButton::toggleSelected().
|
protected |
Distributes ancestor hidden events to all of the widget's listeners.
All children will also distribute the same event.
| ancestor | Ancestor widget that was hidden. |
Definition at line 1071 of file widget.cpp.
References _getVisibilityEventHandler(), mChildren, mWidgetListeners, Widget(), and fcn::VisibilityEventHandler::widgetHidden().
|
protected |
Distributes ancestor moved events to all of the widget's listeners.
All children will also distribute the same event.
| ancestor | Ancestor widget that was moved. |
Definition at line 1053 of file widget.cpp.
References mChildren, mWidgetListeners, and Widget().
|
protected |
Distributes ancestor shown events to all of the widget's listeners.
All children will also distribute the same event.
| ancestor | Ancestor widget that was shown. |
Definition at line 1092 of file widget.cpp.
References _getVisibilityEventHandler(), mChildren, mWidgetListeners, Widget(), and fcn::VisibilityEventHandler::widgetShown().
|
protected |
Distributes hidden events to all of the widget's listeners.
Definition at line 1044 of file widget.cpp.
References mWidgetListeners.
Referenced by setVisible().
|
protected |
Distributes moved events to all of the widget's listeners.
Definition at line 1035 of file widget.cpp.
References mWidgetListeners.
Referenced by setDimension().
|
protected |
Distributes resized events to all of the widget's listeners.
Definition at line 1026 of file widget.cpp.
References mWidgetListeners.
Referenced by setDimension().
|
protected |
Distributes shown events to all of the widget's listeners.
Definition at line 1122 of file widget.cpp.
References mWidgetListeners.
Referenced by setVisible().
|
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.
| Graphics & Rendering | A graphics object to draw with. |
Implemented in fcn::BarGraph, fcn::Button, fcn::CheckBox, fcn::Container, fcn::CurveGraph, fcn::DropDown, fcn::Icon, fcn::IconProgressBar, fcn::ImageButton, fcn::ImageProgressBar, fcn::Label, fcn::LineGraph, fcn::ListBox, fcn::PieGraph, fcn::PointGraph, fcn::ScrollArea, fcn::Slider, fcn::Spacer, fcn::Tab, fcn::TabbedArea, fcn::TextBox, fcn::TextField, and fcn::Window.
References drawBorder(), drawOutline(), drawSelectionFrame(), getOutlineSize(), setBorderSize(), and setOutlineSize().
Referenced by _draw().
|
virtual |
Called when a widget have a border.
| Graphics & Rendering | A graphics object to draw with. |
Definition at line 111 of file widget.cpp.
References fcn::Color::a, fcn::Graphics::drawLine(), getBaseColor(), getBorderColor(), getBorderSize(), getHeight(), 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(), fcn::Window::draw(), and fcn::CheckBox::drawBox().
|
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.
| Graphics & Rendering | A graphics object to draw with. |
Definition at line 88 of file widget.cpp.
References fcn::Color::a, fcn::Graphics::drawLine(), getBaseColor(), getHeight(), getOutlineColor(), getOutlineSize(), getWidth(), and fcn::Graphics::setColor().
|
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.
| Graphics & Rendering | A graphics object to draw with. |
Definition at line 135 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().
|
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 1440 of file widget.hpp.
References expandContent().
Referenced by adaptLayout(), fcn::Container::Container(), fcn::ScrollArea::expandContent(), and expandContent().
|
inlinevirtual |
Expands child widgets to fit this widget's size.
| recursion | If true, call expandContent recursively on children. |
Reimplemented in fcn::AdjustingContainer, fcn::Container, fcn::FlowContainer, fcn::ScrollArea, and fcn::TabbedArea.
Definition at line 1450 of file widget.hpp.
|
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.
| id | The id to find a widget by. |
Reimplemented in fcn::Container.
Definition at line 1184 of file widget.cpp.
References findWidgetById(), getId(), mChildren, and Widget().
Referenced by fcn::Container::findWidgetById(), and findWidgetById().
|
virtual |
Focuses the next widget in the widget.
Definition at line 1316 of file widget.cpp.
References mChildren.
|
virtual |
Focuses the previous widget in the widget.
Definition at line 1343 of file widget.cpp.
References mChildren.
|
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 999 of file widget.hpp.
Referenced by setFont().
|
virtual |
Gets the absolute position on the screen for the widget.
| x | The absolute x coordinate will be stored in this parameter. |
| y | The absolute y coordinate will be stored in this parameter. |
Definition at line 774 of file widget.cpp.
References getAbsolutePosition(), getChildrenArea(), getParent(), isLastPositionSet(), mDimension, mLastX, mLastY, fcn::Rectangle::x, and fcn::Rectangle::y.
Referenced by fcn::Gui::distributeMouseEvent(), getAbsolutePosition(), fcn::Gui::getWidgetAt(), fcn::Gui::getWidgetsAt(), fcn::Gui::handleHiddenWidgets(), fcn::Gui::handleMousePressed(), fcn::Gui::handleMouseReleased(), fcn::Gui::handleMouseWheelMovedDown(), fcn::Gui::handleMouseWheelMovedLeft(), fcn::Gui::handleMouseWheelMovedRight(), fcn::Gui::handleMouseWheelMovedUp(), fcn::Gui::handleShownWidgets(), remove(), and removeAllChildren().
| std::string const & fcn::Widget::getActionEventId | ( | ) | const |
Gets the action event identifier of the widget.
Definition at line 487 of file widget.cpp.
References mActionEventId.
| Color const & fcn::Widget::getBackgroundColor | ( | ) | const |
Gets the background color.
Definition at line 616 of file widget.cpp.
References mBackgroundColor.
Referenced by fcn::BarGraph::draw(), fcn::CurveGraph::draw(), fcn::DropDown::draw(), fcn::Icon::draw(), fcn::IconProgressBar::draw(), fcn::ImageProgressBar::draw(), fcn::LineGraph::draw(), fcn::ListBox::draw(), fcn::PieGraph::draw(), fcn::PointGraph::draw(), fcn::TextBox::draw(), fcn::TextField::draw(), fcn::ScrollArea::drawBackground(), fcn::CheckBox::drawBox(), and fcn::CheckBox::drawRhombus().
| Color const & fcn::Widget::getBaseColor | ( | ) | const |
Gets the base color.
Definition at line 596 of file widget.cpp.
References mBaseColor.
Referenced by fcn::TabbedArea::addTab(), fcn::BarGraph::draw(), fcn::Button::draw(), fcn::Container::draw(), fcn::CurveGraph::draw(), fcn::DropDown::draw(), fcn::ImageButton::draw(), fcn::LineGraph::draw(), fcn::PointGraph::draw(), fcn::ScrollArea::draw(), fcn::Slider::draw(), fcn::Tab::draw(), fcn::TabbedArea::draw(), fcn::TextField::draw(), fcn::Window::draw(), drawBorder(), fcn::CheckBox::drawBox(), fcn::DropDown::drawButton(), fcn::ScrollArea::drawDownButton(), fcn::ScrollArea::drawHBar(), fcn::ScrollArea::drawHMarker(), fcn::Window::drawInnerBorder(), fcn::ScrollArea::drawLeftButton(), fcn::Slider::drawMarker(), drawOutline(), fcn::CheckBox::drawRhombus(), fcn::ScrollArea::drawRightButton(), fcn::ScrollArea::drawUpButton(), fcn::ScrollArea::drawVBar(), and fcn::ScrollArea::drawVMarker().
| Color const & fcn::Widget::getBorderColor | ( | ) | const |
Gets the border color.
Definition at line 646 of file widget.cpp.
References mBorderColor.
Referenced by drawBorder().
| 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.
Definition at line 381 of file widget.cpp.
References mBorderSize.
Referenced by fcn::AdjustingContainer::adjustSize(), fcn::Container::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::PieGraph::draw(), fcn::PointGraph::draw(), fcn::Window::draw(), drawBorder(), fcn::CheckBox::drawBox(), fcn::Window::drawInnerBorder(), drawSelectionFrame(), 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::Window::mousePressed(), fcn::FlowContainer::resizeToContent(), and fcn::ScrollArea::showWidgetPart().
|
protected |
Gets the children of the widget.
Definition at line 1415 of file widget.cpp.
References mChildren.
Referenced by fcn::Container::getChild().
|
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.
Reimplemented in fcn::AdjustingContainer, fcn::Container, fcn::DropDown, fcn::ScrollArea, fcn::Tab, fcn::TabbedArea, and fcn::Window.
Definition at line 992 of file widget.cpp.
Referenced by _draw(), fcn::DropDown::adjustHeight(), getAbsolutePosition(), getWidgetAt(), fcn::TextBox::keyPressed(), and showWidgetPart().
| unsigned int fcn::Widget::getChildrenCount | ( | ) | const |
Gets how many childs the widget have.
Definition at line 247 of file widget.cpp.
References mChildren.
Referenced by fcn::Container::getChild().
| Rectangle const & fcn::Widget::getDimension | ( | ) | const |
Gets the dimension of the widget.
The dimension is relative to the widget's parent.
Definition at line 482 of file widget.cpp.
References mDimension.
Referenced by fcn::FlowContainer::adjustContent(), getWidgetAt(), getWidgetsIn(), and fcn::Container::resizeToContent().
| Size const & fcn::Widget::getFixedSize | ( | ) | const |
Gets the fixed size of the widget.
Definition at line 304 of file widget.cpp.
References mFixedSize.
| Font * fcn::Widget::getFont | ( | ) | const |
Gets the font set for the widget.
If no font has been set, the global font will be returned. If no global font has been set, the default font will be returned.
Definition at line 796 of file widget.cpp.
References mCurrentFont, mDefaultFont, and mGlobalFont.
Referenced by fcn::DropDown::adjustHeight(), fcn::TextField::adjustHeight(), fcn::Window::adjustSize(), fcn::Button::adjustSizeImpl(), fcn::CheckBox::adjustSizeImpl(), fcn::ImageButton::adjustSizeImpl(), fcn::Label::adjustSizeImpl(), fcn::ListBox::adjustSizeImpl(), fcn::TextBox::adjustSizeImpl(), fcn::TextField::adjustSizeImpl(), fcn::Button::draw(), fcn::CheckBox::draw(), fcn::DropDown::draw(), fcn::ImageButton::draw(), fcn::Label::draw(), fcn::ListBox::draw(), fcn::TextBox::draw(), fcn::TextField::draw(), fcn::Window::draw(), fcn::TextBox::drawCaret(), fcn::TextField::fixScroll(), fcn::ListBox::getRowHeight(), fcn::TextBox::keyPressed(), fcn::TextBox::mousePressed(), fcn::TextField::mousePressed(), and fcn::TextBox::scrollToCaret().
| Color const & fcn::Widget::getForegroundColor | ( | ) | const |
Gets the foreground color.
Definition at line 606 of file widget.cpp.
References mForegroundColor.
Referenced by fcn::Button::draw(), fcn::CheckBox::draw(), fcn::DropDown::draw(), fcn::ImageButton::draw(), fcn::Label::draw(), fcn::ListBox::draw(), fcn::TextBox::draw(), fcn::TextField::draw(), fcn::Window::draw(), fcn::CheckBox::drawBox(), fcn::DropDown::drawButton(), fcn::TextBox::drawCaret(), fcn::TextField::drawCaret(), fcn::ScrollArea::drawDownButton(), fcn::ScrollArea::drawLeftButton(), fcn::Slider::drawMarker(), fcn::CheckBox::drawRhombus(), fcn::ScrollArea::drawRightButton(), and fcn::ScrollArea::drawUpButton().
| int fcn::Widget::getHeight | ( | ) | const |
Gets the height of the widget.
Definition at line 183 of file widget.cpp.
References mDimension.
Referenced by fcn::TextField::adjustHeight(), fcn::AdjustingContainer::adjustSize(), fcn::Container::adjustSize(), fcn::TabbedArea::adjustSize(), fcn::Window::adjustSize(), fcn::CheckBox::adjustSizeImpl(), fcn::ImageButton::adjustSizeImpl(), fcn::Label::adjustSizeImpl(), fcn::TabbedArea::adjustTabPositions(), fcn::ScrollArea::checkPolicies(), fcn::BarGraph::draw(), fcn::Button::draw(), fcn::CheckBox::draw(), fcn::Container::draw(), fcn::CurveGraph::draw(), fcn::DropDown::draw(), fcn::Icon::draw(), fcn::IconProgressBar::draw(), fcn::ImageButton::draw(), fcn::ImageProgressBar::draw(), fcn::Label::draw(), fcn::LineGraph::draw(), fcn::ListBox::draw(), fcn::PieGraph::draw(), fcn::PointGraph::draw(), fcn::ScrollArea::draw(), fcn::Slider::draw(), fcn::Tab::draw(), fcn::TabbedArea::draw(), fcn::TextBox::draw(), fcn::TextField::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::Gui::handleHiddenWidgets(), fcn::Gui::handleShownWidgets(), fcn::Slider::markerPositionToValue(), fcn::Slider::mouseDragged(), fcn::DropDown::mousePressed(), fcn::Slider::mousePressed(), fcn::DropDown::mouseReleased(), resizeToChildren(), fcn::FlowContainer::resizeToContent(), fcn::Spacer::resizeToContent(), fcn::ScrollArea::setDimension(), fcn::ScrollArea::setHeight(), and fcn::Slider::valueToMarkerPosition().
| std::string const & fcn::Widget::getId | ( | ) | const |
Gets the id of a widget.
An id can be 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.
Definition at line 1021 of file widget.cpp.
References mId.
Referenced by findWidgetById().
| void fcn::Widget::getLastPosition | ( | int & | x, |
| int & | y ) const |
Retrieves the last stored position used by layout or event logic.
| x | Output parameter receiving the last x coordinate. |
| y | Output parameter receiving the last y coordinate. |
Definition at line 1420 of file widget.cpp.
| 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.
Definition at line 419 of file widget.cpp.
References mMarginBottom.
Referenced by fcn::FlowContainer::adjustContent(), and fcn::FlowContainer::resizeToContent().
| 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.
Definition at line 429 of file widget.cpp.
References mMarginLeft.
Referenced by fcn::FlowContainer::adjustContent(), and fcn::FlowContainer::resizeToContent().
| 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.
Definition at line 409 of file widget.cpp.
References mMarginRight.
Referenced by fcn::FlowContainer::adjustContent(), and fcn::FlowContainer::resizeToContent().
| 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.
Definition at line 399 of file widget.cpp.
References mMarginTop.
Referenced by fcn::FlowContainer::adjustContent(), and fcn::FlowContainer::resizeToContent().
| Size const & fcn::Widget::getMaxSize | ( | ) | const |
Gets the maximal dimension of the widget.
Definition at line 288 of file widget.cpp.
References mMaxSize.
| Size const & fcn::Widget::getMinSize | ( | ) | const |
Gets the minimal dimension of the widget.
Definition at line 277 of file widget.cpp.
References mMinSize.
Referenced by fcn::ScrollArea::adjustSize(), fcn::FlowContainer::resizeToContent(), fcn::ScrollArea::resizeToContent(), and fcn::Spacer::resizeToContent().
| Color const & fcn::Widget::getOutlineColor | ( | ) | const |
Gets the outline color.
Definition at line 636 of file widget.cpp.
References mOutlineColor.
Referenced by drawOutline().
| 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.
Definition at line 371 of file widget.cpp.
References mOutlineSize.
Referenced by draw(), and drawOutline().
| unsigned int fcn::Widget::getPaddingBottom | ( | ) | const |
Gets 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.
Definition at line 467 of file widget.cpp.
References mPaddingBottom.
Referenced by fcn::Container::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::Button::draw(), fcn::CheckBox::draw(), fcn::Icon::draw(), fcn::ImageButton::draw(), fcn::Label::draw(), fcn::CheckBox::drawBox(), fcn::Window::drawInnerBorder(), fcn::Container::getChildrenArea(), fcn::Tab::getChildrenArea(), fcn::TabbedArea::getChildrenArea(), fcn::Window::getChildrenArea(), and fcn::FlowContainer::resizeToContent().
| unsigned int fcn::Widget::getPaddingLeft | ( | ) | const |
Gets 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.
Definition at line 477 of file widget.cpp.
References mPaddingLeft.
Referenced by fcn::Container::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::Button::draw(), fcn::CheckBox::draw(), fcn::Icon::draw(), fcn::IconProgressBar::draw(), fcn::ImageButton::draw(), fcn::ImageProgressBar::draw(), fcn::Label::draw(), fcn::Window::draw(), fcn::CheckBox::drawBox(), fcn::Window::drawInnerBorder(), fcn::Container::getChildrenArea(), fcn::Tab::getChildrenArea(), fcn::TabbedArea::getChildrenArea(), fcn::Window::getChildrenArea(), and fcn::FlowContainer::resizeToContent().
| unsigned int fcn::Widget::getPaddingRight | ( | ) | const |
Gets 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.
Definition at line 457 of file widget.cpp.
References mPaddingRight.
Referenced by fcn::Container::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::Button::draw(), fcn::Icon::draw(), fcn::ImageButton::draw(), fcn::Label::draw(), fcn::Window::draw(), fcn::Window::drawInnerBorder(), fcn::Container::getChildrenArea(), fcn::Tab::getChildrenArea(), fcn::TabbedArea::getChildrenArea(), fcn::Window::getChildrenArea(), and fcn::FlowContainer::resizeToContent().
| unsigned int fcn::Widget::getPaddingTop | ( | ) | const |
Gets 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.
Definition at line 447 of file widget.cpp.
References mPaddingTop.
Referenced by fcn::Container::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::Button::draw(), fcn::CheckBox::draw(), fcn::Icon::draw(), fcn::IconProgressBar::draw(), fcn::ImageButton::draw(), fcn::ImageProgressBar::draw(), fcn::Label::draw(), fcn::Window::draw(), fcn::CheckBox::drawBox(), fcn::Window::drawInnerBorder(), fcn::Container::getChildrenArea(), fcn::Tab::getChildrenArea(), fcn::TabbedArea::getChildrenArea(), fcn::Window::getChildrenArea(), fcn::Window::mousePressed(), and fcn::FlowContainer::resizeToContent().
|
virtual |
Gets the widget's parent container.
Definition at line 157 of file widget.cpp.
References mParent, and Widget().
Referenced by adaptLayout(), fcn::DropDown::adjustHeight(), fcn::Gui::distributeKeyEvent(), fcn::Gui::distributeMouseEvent(), fcn::DropDown::dropDown(), fcn::Container::expandContent(), getAbsolutePosition(), getTop(), isModalFocused(), isModalMouseInputFocused(), isVisible(), fcn::TextBox::keyPressed(), fcn::Window::mousePressed(), and fcn::FlowContainer::resizeToContent().
| Color const & fcn::Widget::getSelectionColor | ( | ) | const |
Gets the selection color.
Definition at line 626 of file widget.cpp.
References mSelectionColor.
Referenced by fcn::BarGraph::draw(), fcn::Button::draw(), fcn::Container::draw(), fcn::CurveGraph::draw(), fcn::DropDown::draw(), fcn::Icon::draw(), fcn::IconProgressBar::draw(), fcn::ImageButton::draw(), fcn::ImageProgressBar::draw(), fcn::LineGraph::draw(), fcn::ListBox::draw(), fcn::PieGraph::draw(), fcn::PointGraph::draw(), fcn::TextField::draw(), fcn::CheckBox::drawBox(), fcn::CheckBox::drawRhombus(), and drawSelectionFrame().
| Widget::SelectionMode fcn::Widget::getSelectionMode | ( | ) | const |
Gets the selection mode.
Definition at line 656 of file widget.cpp.
References mSelectionMode.
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(), and fcn::CheckBox::drawBox().
|
virtual |
Gets the top widget, or top parent, of this widget.
Definition at line 1138 of file widget.cpp.
References getParent(), and Widget().
| unsigned int fcn::Widget::getVisibleChildrenCount | ( | ) | const |
Gets how many visible childs the widget have.
Definition at line 258 of file widget.cpp.
References isVisible(), and mChildren.
|
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.
| x | The x coordinate of the widget to get. |
| y | The y coordinate of the widget to get. |
Definition at line 1135 of file widget.hpp.
References getWidgetAt(), and Widget().
Referenced by fcn::Gui::getWidgetAt(), getWidgetAt(), and fcn::Gui::getWidgetsAt().
Variant of getWidgetAt that allows excluding a specific widget from the hit-test.
| x | The x coordinate of the widget to get. |
| y | The y coordinate of the widget to get. |
| exclude | Widget to exclude from search, if Nullptr no widgets get excluded. |
Definition at line 954 of file widget.cpp.
References getChildrenArea(), getDimension(), fcn::Rectangle::isContaining(), isVisible(), mChildren, Widget(), fcn::Rectangle::x, and fcn::Rectangle::y.
Gets all widgets inside a certain area of the widget.
NOTE: This always returns an emtpy list if the widget is not a container.
| area | The area to check. |
Definition at line 1160 of file widget.hpp.
References getWidgetsIn().
Referenced by getWidgetsIn().
Gets all widgets inside a certain area of the widget.
NOTE: This always returns an empty list if the widget is not a container.
| area | The area to check. |
| ignore | Optional widget pointer to exclude from the results. |
Definition at line 1155 of file widget.cpp.
References getDimension(), fcn::Rectangle::isIntersecting(), mChildren, and Widget().
| int fcn::Widget::getWidth | ( | ) | const |
Gets the width of the widget.
Definition at line 170 of file widget.cpp.
References mDimension.
Referenced by fcn::DropDown::adjustHeight(), fcn::AdjustingContainer::adjustSize(), fcn::Container::adjustSize(), fcn::TabbedArea::adjustSize(), fcn::Window::adjustSize(), fcn::ImageButton::adjustSizeImpl(), fcn::Label::adjustSizeImpl(), fcn::ListBox::adjustSizeImpl(), fcn::TabbedArea::adjustTabPositions(), fcn::ScrollArea::checkPolicies(), fcn::BarGraph::draw(), fcn::Button::draw(), fcn::Container::draw(), fcn::CurveGraph::draw(), fcn::DropDown::draw(), fcn::Icon::draw(), fcn::IconProgressBar::draw(), fcn::ImageButton::draw(), fcn::ImageProgressBar::draw(), fcn::Label::draw(), fcn::LineGraph::draw(), fcn::ListBox::draw(), fcn::PieGraph::draw(), fcn::PointGraph::draw(), fcn::ScrollArea::draw(), fcn::Slider::draw(), fcn::Tab::draw(), fcn::TabbedArea::draw(), fcn::TextBox::draw(), fcn::TextField::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::Gui::handleHiddenWidgets(), fcn::Gui::handleShownWidgets(), fcn::Slider::markerPositionToValue(), fcn::DropDown::mousePressed(), fcn::Slider::mousePressed(), fcn::DropDown::mouseReleased(), resizeToChildren(), fcn::FlowContainer::resizeToContent(), fcn::Spacer::resizeToContent(), fcn::ScrollArea::setDimension(), fcn::ScrollArea::setWidth(), and fcn::Slider::valueToMarkerPosition().
| int fcn::Widget::getX | ( | ) | const |
Gets the x coordinate of the widget.
The coordinate is relative to the widget's parent.
Definition at line 196 of file widget.cpp.
References mDimension.
Referenced by fcn::Window::mouseDragged(), resizeToChildren(), fcn::ScrollArea::showWidgetPart(), and showWidgetPart().
| int fcn::Widget::getY | ( | ) | const |
Gets the y coordinate of the widget.
The coordinate is relative to the widget's parent.
Definition at line 209 of file widget.cpp.
References mDimension.
Referenced by fcn::DropDown::adjustHeight(), fcn::ListBox::draw(), fcn::Window::mouseDragged(), resizeToChildren(), fcn::ScrollArea::showWidgetPart(), and showWidgetPart().
| bool fcn::Widget::isEnabled | ( | ) | const |
Checks if the widget is enabled.
A disabled widget will never receive mouse or key events.
Definition at line 869 of file widget.cpp.
References isVisible(), and mEnabled.
Referenced by fcn::Gui::distributeKeyEvent(), fcn::Gui::distributeMouseEvent(), fcn::Gui::handleHiddenWidgets(), fcn::Gui::handleShownWidgets(), and isFocusable().
| bool fcn::Widget::isFixedSize | ( | ) | const |
Gets if the widget use a fixed size.
Definition at line 309 of file widget.cpp.
References mFixedSizeUsed.
| bool fcn::Widget::isFocusable | ( | ) | const |
Checks if a widget is focusable.
Definition at line 515 of file widget.cpp.
References isEnabled(), isVisible(), and mFocusable.
Referenced by fcn::TabbedArea::mousePressed(), and requestFocus().
|
virtual |
Checks if the widget is focused.
Definition at line 497 of file widget.cpp.
References mFocusHandler.
Referenced by fcn::BarGraph::draw(), fcn::Button::draw(), fcn::Container::draw(), fcn::CurveGraph::draw(), fcn::DropDown::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(), fcn::TextBox::draw(), fcn::TextField::draw(), fcn::CheckBox::drawBox(), fcn::Slider::drawMarker(), fcn::CheckBox::drawRhombus(), fcn::TextField::fixScroll(), fcn::TabbedArea::keyPressed(), fcn::DropDown::mouseWheelMovedDown(), fcn::ListBox::mouseWheelMovedDown(), fcn::DropDown::mouseWheelMovedUp(), fcn::ListBox::mouseWheelMovedUp(), setFocusable(), and setVisible().
| bool fcn::Widget::isHorizontalExpand | ( | ) | const |
Gets if widget is horizontal expandable.
Definition at line 347 of file widget.cpp.
References mHExpand.
Referenced by fcn::FlowContainer::adjustContent(), and fcn::Container::expandContent().
| bool fcn::Widget::isLastPositionSet | ( | ) | const |
Returns whether a last position has been stored for this widget.
Definition at line 1432 of file widget.cpp.
References mLastX, and mLastY.
Referenced by getAbsolutePosition().
|
inlinevirtual |
Helper function to decide if we need to layout.
Reimplemented in fcn::Container.
Definition at line 1455 of file widget.hpp.
Referenced by adaptLayout().
|
virtual |
Checks if a widget is modal focusable.
Definition at line 874 of file widget.cpp.
References mFocusHandler.
|
virtual |
Checks if the widget or it's parent has modal focus.
Definition at line 928 of file widget.cpp.
References getParent(), isModalFocused(), and mFocusHandler.
Referenced by fcn::Gui::distributeKeyEvent(), fcn::Gui::distributeMouseEvent(), fcn::Gui::handleMousePressed(), and isModalFocused().
|
virtual |
Checks if a widget is modal mouse input focusable.
Definition at line 883 of file widget.cpp.
References mFocusHandler.
|
virtual |
Checks if the widget or it's parent has modal mouse input focus.
Definition at line 941 of file widget.cpp.
References getParent(), isModalMouseInputFocused(), and mFocusHandler.
Referenced by fcn::Gui::distributeMouseEvent(), fcn::Gui::getMouseEventSource(), fcn::Gui::handleMouseMoved(), isModalMouseInputFocused(), and fcn::DropDown::mouseReleased().
| bool fcn::Widget::isSetVisible | ( | ) | const |
Checks if the widget setting is visible.
Definition at line 586 of file widget.cpp.
References mVisible.
| 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.
Definition at line 835 of file widget.cpp.
References mTabIn.
| 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.
Definition at line 845 of file widget.cpp.
References mTabOut.
| bool fcn::Widget::isVerticalExpand | ( | ) | const |
Gets if widget is vertical expandable.
Definition at line 337 of file widget.cpp.
References mVExpand.
Referenced by fcn::FlowContainer::adjustContent(), and fcn::Container::expandContent().
| bool fcn::Widget::isVisible | ( | ) | const |
Checks if the widget is visible.
Definition at line 578 of file widget.cpp.
References getParent(), isVisible(), and mVisible.
Referenced by fcn::FlowContainer::adjustContent(), getVisibleChildrenCount(), getWidgetAt(), isEnabled(), isFocusable(), and isVisible().
|
inlinevirtual |
Called for all widgets in the gui each time Gui::logic is called.
You can do logic stuff here like playing an animation.
Reimplemented in fcn::ListBox, and fcn::ScrollArea.
Definition at line 378 of file widget.hpp.
Referenced by _logic(), and fcn::ScrollArea::logic().
|
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.
| widget | The widget to move to the bottom. |
Definition at line 1303 of file widget.cpp.
|
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.
| widget | The widget to move to the top. |
Definition at line 1290 of file widget.cpp.
References mChildren, and Widget().
Referenced by fcn::DropDown::dropDown(), and fcn::Window::mousePressed().
|
virtual |
Releases modal focus.
Modal focus will only be released if the widget has modal focus.
Definition at line 910 of file widget.cpp.
References mFocusHandler.
Referenced by _setFocusHandler().
|
virtual |
Releases modal mouse input focus.
Modal mouse input focus will only be released if the widget has modal mouse input focus.
Definition at line 919 of file widget.cpp.
References mFocusHandler.
Referenced by _setFocusHandler(), fcn::DropDown::action(), fcn::DropDown::mousePressed(), and fcn::DropDown::mouseReleased().
|
protectedvirtual |
Removes a specific child from the widget.
THIS METHOD IS NOT SAFE TO CALL INSIDE A WIDGETS LOGIC FUNCTION INSIDE ANY LISTER FUNCTIONS!
| widget | The widget to remove. |
Reimplemented in fcn::AdjustingContainer, and fcn::Container.
Definition at line 1248 of file widget.cpp.
References _getVisibilityEventHandler(), _setFocusHandler(), _setParent(), getAbsolutePosition(), mChildren, setLastPosition(), Widget(), and fcn::VisibilityEventHandler::widgetHidden().
Referenced by fcn::Container::remove().
| void fcn::Widget::removeActionListener | ( | ActionListener * | actionListener | ) |
Removes an added action listener from the widget.
| actionListener | The action listener to remove. |
Definition at line 719 of file widget.cpp.
References mActionListeners.
|
protectedvirtual |
Remvoes all children from the widget.
THIS METHOD IS NOT SAFE TO CALL INSIDE A WIDGETS LOGIC FUNCTION INSIDE ANY LISTER FUNCTIONS!
Reimplemented in fcn::AdjustingContainer, and fcn::Container.
Definition at line 1228 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().
| void fcn::Widget::removeDeathListener | ( | DeathListener * | deathListener | ) |
Removes an added death listener from the widget.
| deathListener | The death listener to remove. |
Definition at line 729 of file widget.cpp.
References mDeathListeners.
| void fcn::Widget::removeFocusListener | ( | FocusListener * | focusListener | ) |
Removes an added focus listener from the widget.
| focusListener | The focus listener to remove. |
Definition at line 749 of file widget.cpp.
References mFocusListeners.
| void fcn::Widget::removeKeyListener | ( | KeyListener * | keyListener | ) |
Removes an added key listener from the widget.
| keyListener | The key listener to remove. |
Definition at line 739 of file widget.cpp.
References mKeyListeners.
| void fcn::Widget::removeMouseListener | ( | MouseListener * | mouseListener | ) |
Removes an added mouse listener from the widget.
| mouseListener | The mouse listener to remove. |
Definition at line 759 of file widget.cpp.
References mMouseListeners.
| void fcn::Widget::removeWidgetListener | ( | WidgetListener * | widgetListener | ) |
Removes an added widget listener from the widget.
| widgetListener | The widget listener to remove. |
Definition at line 769 of file widget.cpp.
References mWidgetListeners.
|
virtual |
Requests focus for the widget.
A widget will only receive focus if it is focusable.
Definition at line 520 of file widget.cpp.
References isFocusable(), and mFocusHandler.
Referenced by fcn::Gui::handleMousePressed(), and fcn::TabbedArea::mousePressed().
|
virtual |
Requests modal focus.
When a widget has modal focus, only that widget and it's children may receive input.
| Exception | if another widget already has modal focus. |
Definition at line 892 of file widget.cpp.
References mFocusHandler.
|
virtual |
Requests modal mouse input focus.
When a widget has modal input focus that widget will be the only widget receiving input even if the input occurs outside of the widget and no matter what the input is.
| Exception | if another widget already has modal focus. |
Definition at line 901 of file widget.cpp.
References mFocusHandler.
Referenced by fcn::DropDown::mousePressed().
|
virtual |
Requests a move to the bottom in the parent widget.
Definition at line 538 of file widget.cpp.
References mParent.
|
virtual |
Requests a move to the top in the parent widget.
Definition at line 531 of file widget.cpp.
References mParent.
|
protected |
Resizes the widget to fit it's children exactly.
Definition at line 1170 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().
|
inline |
Resizes the widget's size to fit the content exactly, calls recursively all childs.
This is a convenience wrapper that calls resizeToContent(true).
Definition at line 1417 of file widget.hpp.
References resizeToContent().
Referenced by adaptLayout(), fcn::Container::Container(), fcn::ScrollArea::resizeToContent(), and resizeToContent().
|
inlinevirtual |
Resize this widget to fit its content.
| recursion | If true, perform the resize operation recursively on children. |
Reimplemented in fcn::AdjustingContainer, fcn::Button, fcn::Container, fcn::DropDown, fcn::FlowContainer, 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 1427 of file widget.hpp.
| 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.
| actionEventId | The action event identifier. |
Definition at line 492 of file widget.cpp.
References mActionEventId.
|
virtual |
Sets the background color.
| color | The background Color. |
Reimplemented in fcn::DropDown.
Definition at line 611 of file widget.cpp.
References mBackgroundColor.
Referenced by fcn::DropDown::setBackgroundColor().
|
virtual |
Sets the base color of the widget.
| color | The base color. |
Reimplemented in fcn::DropDown, and fcn::TabbedArea.
Definition at line 591 of file widget.cpp.
References mBaseColor.
Referenced by fcn::TabbedArea::addTab(), fcn::DropDown::setBaseColor(), and fcn::TabbedArea::setBaseColor().
|
virtual |
Sets the border color.
| color | The border color. |
Definition at line 641 of file widget.cpp.
References mBorderColor.
| void fcn::Widget::setBorderSize | ( | unsigned int | size | ) |
Sets 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.
| size | The size of the widget's border. |
Definition at line 376 of file widget.cpp.
References mBorderSize.
Referenced by draw(), fcn::Slider::Slider(), and fcn::Window::Window().
| void fcn::Widget::setDimension | ( | Rectangle const & | dimension | ) |
Sets the dimension of the widget.
The dimension is relative to the widget's parent.
| dimension | The dimension of the widget. |
Definition at line 223 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().
| void fcn::Widget::setEnabled | ( | bool | enabled | ) |
Sets the widget to enabled, or not.
A disabled widget will never receive mouse or key events.
| enabled | True if widget should be enabled, false otherwise. |
Definition at line 864 of file widget.cpp.
References mEnabled.
| 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.
| size | The fixed size of the widget. |
Definition at line 293 of file widget.cpp.
References calculateSize(), mFixedSize, and mFixedSizeUsed.
| void fcn::Widget::setFocusable | ( | bool | focusable | ) |
Sets the widget to be focusable, or not.
| focusable | True if the widget should be focusable, false otherwise. |
Definition at line 506 of file widget.cpp.
References isFocused(), mFocusable, and mFocusHandler.
Referenced by fcn::Button::Button(), fcn::DropDown::DropDown(), fcn::ListBox::ListBox(), fcn::Slider::Slider(), fcn::TextBox::TextBox(), and fcn::TextField::TextField().
|
virtual |
Sets the font for the widget.
If Nullptr is passed, the global font will be used.
| font | The font to set for the widget. |
Reimplemented in fcn::DropDown.
Definition at line 821 of file widget.cpp.
References fontChanged(), and mCurrentFont.
Referenced by fcn::DropDown::setFont().
|
virtual |
Sets the foreground color.
| color | The foreground color. |
Reimplemented in fcn::DropDown.
Definition at line 601 of file widget.cpp.
References mForegroundColor.
Referenced by fcn::DropDown::setForegroundColor().
|
static |
Sets the global font to be used by default for all widgets.
| font | The global font. |
Definition at line 809 of file widget.cpp.
References mGlobalFont, and mWidgetInstances.
Referenced by fcn::Gui::setGlobalFont().
| void fcn::Widget::setHeight | ( | int | height | ) |
Sets the height of the widget.
| height | The height of the widget. |
Definition at line 175 of file widget.cpp.
References fcn::Rectangle::height, mDimension, and setDimension().
Referenced by fcn::DropDown::adjustHeight(), fcn::TextField::adjustHeight(), fcn::AdjustingContainer::adjustSize(), fcn::ListBox::adjustSizeImpl(), fcn::ScrollArea::setDimension(), fcn::ScrollArea::setHeight(), and fcn::TabbedArea::setHeight().
| void fcn::Widget::setHorizontalExpand | ( | bool | expand | ) |
Sets the widget to horizontal expandable.
| expand | True if the widget can be horizontal expanded, otherwise false. |
Definition at line 342 of file widget.cpp.
References mHExpand.
Referenced by fcn::Spacer::Spacer().
| void fcn::Widget::setId | ( | std::string const & | id | ) |
Sets an id of a widget.
An id can be 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.
| id | The id to set to the widget. |
Definition at line 1016 of file widget.cpp.
References mId.
| 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.
| internalFocusHandler | The internal focus handler to be used. |
Definition at line 1002 of file widget.cpp.
References _getFocusHandler(), mChildren, and mInternalFocusHandler.
Referenced by fcn::DropDown::DropDown().
| void fcn::Widget::setLastPosition | ( | int | x, |
| int | y ) |
Stores the last known position for this widget.
| x | The x coordinate to store. |
| y | The y coordinate to store. |
Definition at line 1426 of file widget.cpp.
References mLastX, and mLastY.
Referenced by add(), remove(), and removeAllChildren().
| 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.
| margin | The margin of the widget. |
Definition at line 386 of file widget.cpp.
References mMarginBottom, mMarginLeft, mMarginRight, and mMarginTop.
Referenced by fcn::FlowContainer::resizeToContent().
| 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.
| margin | The bottom margin of the widget. |
Definition at line 414 of file widget.cpp.
References mMarginBottom.
Referenced by fcn::FlowContainer::resizeToContent().
| 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.
| margin | The left margin of the widget. |
Definition at line 424 of file widget.cpp.
References mMarginLeft.
Referenced by fcn::FlowContainer::resizeToContent().
| 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.
| margin | The right margin of the widget. |
Definition at line 404 of file widget.cpp.
References mMarginRight.
Referenced by fcn::FlowContainer::resizeToContent().
| 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.
| margin | The top margin of the widget. |
Definition at line 394 of file widget.cpp.
References mMarginTop.
Referenced by fcn::FlowContainer::resizeToContent().
| void fcn::Widget::setMaxSize | ( | Size const & | size | ) |
Sets the maximal dimension of the widget.
| size | The maximal size of the widget. |
Definition at line 282 of file widget.cpp.
References calculateSize(), and mMaxSize.
| void fcn::Widget::setMinSize | ( | Size const & | size | ) |
Sets the minimal dimension of the widget.
| size | The minimal size of the widget. |
Definition at line 271 of file widget.cpp.
References calculateSize(), and mMinSize.
|
virtual |
Sets the outline color.
| color | The outline color. |
Definition at line 631 of file widget.cpp.
References mOutlineColor.
| 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.
| size | The size of the widget's outline. |
Definition at line 366 of file widget.cpp.
References mOutlineSize.
Referenced by draw().
| 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.
| padding | The top padding of the widget. |
Definition at line 434 of file widget.cpp.
References mPaddingBottom, mPaddingLeft, mPaddingRight, and mPaddingTop.
Referenced by fcn::FlowContainer::resizeToContent(), and fcn::Window::Window().
| 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.
| padding | The bottom padding of the widget. |
Definition at line 462 of file widget.cpp.
References mPaddingBottom.
Referenced by fcn::FlowContainer::resizeToContent().
| 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.
| padding | The left padding of the widget. |
Definition at line 472 of file widget.cpp.
References mPaddingLeft.
Referenced by fcn::FlowContainer::resizeToContent().
| 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.
| padding | The right padding of the widget. |
Definition at line 452 of file widget.cpp.
References mPaddingRight.
Referenced by fcn::FlowContainer::resizeToContent().
| 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.
| padding | The top padding of the widget. |
Definition at line 442 of file widget.cpp.
References mPaddingTop.
Referenced by fcn::FlowContainer::resizeToContent().
| void fcn::Widget::setPosition | ( | int | x, |
| int | y ) |
Sets position of the widget.
The position is relative to the widget's parent.
| x | The x coordinate of the widget. |
| y | The y coordinate of the widget. |
Definition at line 214 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(), and fcn::ScrollArea::setContent().
|
virtual |
Sets the selection color.
| color | The selection color. |
Reimplemented in fcn::DropDown.
Definition at line 621 of file widget.cpp.
References mSelectionColor.
Referenced by fcn::DropDown::setSelectionColor().
|
virtual |
Sets the selection mode.
| mode | The selection mode that is used when the widget is "active". |
Definition at line 651 of file widget.cpp.
References mSelectionMode.
| void fcn::Widget::setSize | ( | int | width, |
| int | height ) |
Sets the size of the widget.
| width | The width of the widget. |
| height | The height of the widget. |
Definition at line 855 of file widget.cpp.
References fcn::Rectangle::height, mDimension, setDimension(), and fcn::Rectangle::width.
Referenced by fcn::FlowContainer::adjustContent(), fcn::Container::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::TextBox::adjustSizeImpl(), resizeToChildren(), fcn::Container::resizeToContent(), fcn::FlowContainer::resizeToContent(), fcn::Spacer::resizeToContent(), and fcn::TabbedArea::setSize().
| 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.
| enabled | True if tab in should be enabled, false otherwise. |
Definition at line 840 of file widget.cpp.
References mTabIn.
| 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.
| enabled | True if tab out should be enabled, false otherwise. |
Definition at line 850 of file widget.cpp.
References mTabOut.
| void fcn::Widget::setVerticalExpand | ( | bool | expand | ) |
Sets the widget to vertical expandable.
| expand | True if the widget can be vertical expanded, otherwise false. |
Definition at line 332 of file widget.cpp.
References mVExpand.
Referenced by fcn::Spacer::Spacer().
| void fcn::Widget::setVisible | ( | bool | visible | ) |
Sets the widget to be visible, or not.
| visible | True if widget should be visible, false otherwise. |
Definition at line 545 of file widget.cpp.
References _getVisibilityEventHandler(), distributeHiddenEvent(), distributeShownEvent(), isFocused(), mChildren, mFocusHandler, mVisible, fcn::VisibilityEventHandler::widgetHidden(), and fcn::VisibilityEventHandler::widgetShown().
| void fcn::Widget::setWidth | ( | int | width | ) |
Sets the width of the widget.
| width | The width of the widget. |
Definition at line 162 of file widget.cpp.
References mDimension, setDimension(), and fcn::Rectangle::width.
Referenced by fcn::AdjustingContainer::adjustSize(), fcn::ListBox::adjustSizeImpl(), fcn::TextField::adjustSizeImpl(), fcn::DropDown::DropDown(), fcn::ListBox::ListBox(), fcn::ScrollArea::setDimension(), fcn::ScrollArea::setWidth(), and fcn::TabbedArea::setWidth().
| void fcn::Widget::setX | ( | int | x | ) |
Sets the x coordinate of the widget.
The coordinate is relative to the widget's parent.
| x | The x coordinate of the widget. |
Definition at line 188 of file widget.cpp.
References mDimension, setDimension(), and fcn::Rectangle::x.
Referenced by showWidgetPart().
| void fcn::Widget::setY | ( | int | y | ) |
Sets the y coordinate of the widget.
The coordinate is relative to the widget's parent.
| y | The y coordinate of the widget. |
Definition at line 201 of file widget.cpp.
References mDimension, setDimension(), and fcn::Rectangle::y.
Referenced by showWidgetPart().
|
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.
| rectangle | The rectangle to be shown. |
Definition at line 1131 of file widget.cpp.
References mParent.
Referenced by fcn::TextBox::scrollToCaret(), and fcn::ListBox::setSelected().
Tries to show a specific part of a widget by moving it.
Used if the widget should act as a container.
| widget | The target widget. |
| area | The area to show. |
Reimplemented in fcn::ScrollArea.
Definition at line 1204 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().
|
static |
Checks if a widget exists or not, that is if it still exists an instance of the object.
| widget | The widget to check. |
Definition at line 827 of file widget.cpp.
References mWidgetInstances, and Widget().
Referenced by _setFocusHandler(), fcn::Gui::distributeKeyEvent(), fcn::Gui::distributeMouseEvent(), and fcn::Gui::handleHiddenWidgets().
|
protected |
Holds the action event of the widget.
Definition at line 1740 of file widget.hpp.
Referenced by distributeActionEvent(), getActionEventId(), and setActionEventId().
|
protected |
Holds the action listeners of the widget.
Definition at line 1608 of file widget.hpp.
Referenced by addActionListener(), distributeActionEvent(), and removeActionListener().
|
protected |
Holds the background color of the widget.
Definition at line 1633 of file widget.hpp.
Referenced by getBackgroundColor(), and setBackgroundColor().
|
protected |
Holds the base color of the widget.
Definition at line 1638 of file widget.hpp.
Referenced by getBaseColor(), and setBaseColor().
|
protected |
Holds the border color of the widget.
Definition at line 1653 of file widget.hpp.
Referenced by getBorderColor(), and setBorderColor().
|
protected |
Holds the border size of the widget.
Definition at line 1690 of file widget.hpp.
Referenced by getBorderSize(), and setBorderSize().
|
protected |
Holds all children of the widget.
Definition at line 1842 of file widget.hpp.
Referenced by _draw(), _logic(), _setFocusHandler(), add(), fcn::FlowContainer::adjustContent(), distributeAncestorHiddenEvent(), distributeAncestorMovedEvent(), distributeAncestorShownEvent(), fcn::Container::expandContent(), fcn::FlowContainer::expandContent(), findWidgetById(), focusNext(), focusPrevious(), getChildren(), getChildrenCount(), fcn::ScrollArea::getContent(), getVisibleChildrenCount(), getWidgetAt(), getWidgetsIn(), moveToBottom(), moveToTop(), remove(), removeAllChildren(), resizeToChildren(), fcn::Container::resizeToContent(), fcn::FlowContainer::resizeToContent(), setDimension(), setInternalFocusHandler(), and setVisible().
|
protected |
Holds the font used by the widget.
Definition at line 1808 of file widget.hpp.
|
protected |
Holds the death listeners of the widget.
Definition at line 1613 of file widget.hpp.
Referenced by addDeathListener(), and removeDeathListener().
|
staticprotected |
Holds the default font used by the widget.
Definition at line 1813 of file widget.hpp.
Referenced by getFont().
|
protected |
Holds the dimension of the widget.
Definition at line 1675 of file widget.hpp.
Referenced by _draw(), calculateSize(), getAbsolutePosition(), getDimension(), getHeight(), getWidth(), getX(), getY(), fcn::TabbedArea::setDimension(), setDimension(), fcn::TabbedArea::setHeight(), setHeight(), setPosition(), fcn::TabbedArea::setSize(), setSize(), fcn::TabbedArea::setWidth(), setWidth(), setX(), and setY().
|
protected |
True if the widget is enabled, false otherwise.
Definition at line 1765 of file widget.hpp.
Referenced by isEnabled(), and setEnabled().
|
protected |
Holds the fixed size.
Definition at line 1788 of file widget.hpp.
Referenced by calculateSize(), getFixedSize(), and setFixedSize().
|
protected |
True if the widget used a fixed size.
Definition at line 1793 of file widget.hpp.
Referenced by calculateSize(), isFixedSize(), and setFixedSize().
|
protected |
True if the widget focusable, false otherwise.
Definition at line 1745 of file widget.hpp.
Referenced by isFocusable(), and setFocusable().
|
protected |
Holds the focus handler used by the widget.
Definition at line 1658 of file widget.hpp.
Referenced by _getFocusHandler(), _setFocusHandler(), isFocused(), isModalFocusable(), isModalFocused(), isModalMouseInputFocusable(), isModalMouseInputFocused(), releaseModalFocus(), releaseModalMouseInputFocus(), requestFocus(), requestModalFocus(), requestModalMouseInputFocus(), setFocusable(), and setVisible().
|
protected |
Holds the focus listeners of the widget.
Definition at line 1618 of file widget.hpp.
Referenced by _getFocusListeners(), addFocusListener(), and removeFocusListener().
|
protected |
Holds the foreground color of the widget.
Definition at line 1628 of file widget.hpp.
Referenced by getForegroundColor(), and setForegroundColor().
|
staticprotected |
Holds the global font used by the widget.
Definition at line 1818 of file widget.hpp.
Referenced by getFont(), and setGlobalFont().
|
staticprotected |
Holds the death listener used by the widgets.
Definition at line 1837 of file widget.hpp.
Referenced by _getGuiDeathListener(), and _setGuiDeathListener().
|
protected |
True if the widget can be horizontal expanded.
Definition at line 1803 of file widget.hpp.
Referenced by isHorizontalExpand(), and setHorizontalExpand().
|
protected |
Holds the id of the widget.
Definition at line 1770 of file widget.hpp.
|
protected |
Holds the focus handler used by the widget.
Nullptr if no internal focus handler is used.
Definition at line 1664 of file widget.hpp.
Referenced by _getInternalFocusHandler(), _setFocusHandler(), add(), and setInternalFocusHandler().
|
protected |
Holds the key listeners of the widget.
Definition at line 1603 of file widget.hpp.
Referenced by _getKeyListeners(), addKeyListener(), and removeKeyListener().
|
protected |
Last stored X coordinate used for layout and event calculations.
Definition at line 1845 of file widget.hpp.
Referenced by getAbsolutePosition(), getLastPosition(), isLastPositionSet(), and setLastPosition().
|
protected |
Last stored Y coordinate used for layout and event calculations.
Definition at line 1848 of file widget.hpp.
Referenced by getAbsolutePosition(), getLastPosition(), isLastPositionSet(), and setLastPosition().
|
protected |
Holds the bottom margin of the widget.
Definition at line 1710 of file widget.hpp.
Referenced by getMarginBottom(), setMargin(), and setMarginBottom().
|
protected |
Holds the left margin of the widget.
Definition at line 1715 of file widget.hpp.
Referenced by getMarginLeft(), setMargin(), and setMarginLeft().
|
protected |
Holds the top right of the widget.
Definition at line 1705 of file widget.hpp.
Referenced by getMarginRight(), setMargin(), and setMarginRight().
|
protected |
Holds the top margin of the widget.
Definition at line 1700 of file widget.hpp.
Referenced by getMarginTop(), setMargin(), and setMarginTop().
|
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 1783 of file widget.hpp.
Referenced by calculateSize(), getMaxSize(), and setMaxSize().
|
protected |
Holds the min size.
Definition at line 1775 of file widget.hpp.
Referenced by calculateSize(), getMinSize(), and setMinSize().
|
protected |
Holds the mouse listeners of the widget.
Definition at line 1598 of file widget.hpp.
Referenced by _getMouseListeners(), addMouseListener(), and removeMouseListener().
|
protected |
Holds the offset dimension of the widget.
Definition at line 1680 of file widget.hpp.
|
protected |
Holds the outline color of the widget.
Definition at line 1648 of file widget.hpp.
Referenced by getOutlineColor(), and setOutlineColor().
|
protected |
Holds the outline size of the widget.
Definition at line 1685 of file widget.hpp.
Referenced by _draw(), getOutlineSize(), and setOutlineSize().
|
protected |
Holds the bottom padding of the widget.
Definition at line 1730 of file widget.hpp.
Referenced by fcn::AdjustingContainer::adjustSize(), getPaddingBottom(), setPadding(), and setPaddingBottom().
|
protected |
Holds the left padding of the widget.
Definition at line 1735 of file widget.hpp.
Referenced by fcn::AdjustingContainer::adjustContent(), fcn::AdjustingContainer::adjustSize(), getPaddingLeft(), setPadding(), and setPaddingLeft().
|
protected |
Holds the right padding of the widget.
Definition at line 1725 of file widget.hpp.
Referenced by fcn::AdjustingContainer::adjustSize(), getPaddingRight(), setPadding(), and setPaddingRight().
|
protected |
Holds the top padding of the widget.
Definition at line 1720 of file widget.hpp.
Referenced by fcn::AdjustingContainer::adjustContent(), fcn::AdjustingContainer::adjustSize(), getPaddingTop(), setPadding(), and setPaddingTop().
|
protected |
Holds the parent of the widget.
Nullptr if the widget has no parent.
Definition at line 1670 of file widget.hpp.
Referenced by _setParent(), getParent(), requestMoveToBottom(), requestMoveToTop(), and showPart().
|
protected |
Holds the selection color of the widget.
Definition at line 1643 of file widget.hpp.
Referenced by getSelectionColor(), and setSelectionColor().
|
protected |
Holds the selection mode.
Definition at line 1695 of file widget.hpp.
Referenced by getSelectionMode(), and setSelectionMode().
|
protected |
True if the widget has tab in enabled, false otherwise.
Definition at line 1755 of file widget.hpp.
Referenced by isTabInEnabled(), and setTabInEnabled().
|
protected |
True if the widget has tab in enabled, false otherwise.
Definition at line 1760 of file widget.hpp.
Referenced by isTabOutEnabled(), and setTabOutEnabled().
|
protected |
True if the widget can be vertical expanded.
Definition at line 1798 of file widget.hpp.
Referenced by isVerticalExpand(), and setVerticalExpand().
|
staticprotected |
Holds the visibility event handler used by the widgets.
TODO: FIXME 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 1832 of file widget.hpp.
Referenced by _getVisibilityEventHandler(), and _setVisibilityEventHandler().
|
protected |
True if the widget visible, false otherwise.
Definition at line 1750 of file widget.hpp.
Referenced by isSetVisible(), isVisible(), and setVisible().
|
staticprotected |
Holds a list of all instances of widgets.
Definition at line 1823 of file widget.hpp.
Referenced by setGlobalFont(), Widget(), and widgetExists().
|
protected |
Holds the widget listeners of the widget.
Definition at line 1623 of file widget.hpp.
Referenced by addWidgetListener(), distributeAncestorHiddenEvent(), distributeAncestorMovedEvent(), distributeAncestorShownEvent(), distributeHiddenEvent(), distributeMovedEvent(), distributeResizedEvent(), distributeShownEvent(), and removeWidgetListener().