5#ifndef INCLUDE_FIFECHAN_WIDGET_HPP_
6#define INCLUDE_FIFECHAN_WIDGET_HPP_
15#include "fifechan/platform.hpp"
18#include "fifechan/color.hpp"
19#include "fifechan/events/dragevent.hpp"
20#include "fifechan/listeners/widgetlistener.hpp"
21#include "fifechan/rectangle.hpp"
22#include "fifechan/size.hpp"
66 BORDER_RIGHT = 1 << 2,
67 BORDER_BOTTOM = 1 << 3,
68 BORDER_ALL = BORDER_LEFT | BORDER_TOP | BORDER_RIGHT | BORDER_BOTTOM
76 BORDER_STYLE_BEVEL = 0,
256 void setBorderTop(
unsigned int size,
unsigned int style);
489 virtual Widget* getParent()
const;
497 virtual Widget* getTop()
const;
506 virtual void setWidth(
int width);
515 int getWidth()
const;
524 virtual void setHeight(
int height);
533 int getHeight()
const;
542 bool contains(
int x,
int y)
const;
550 bool isMouseInside(
MouseEvent const & mouseEvent)
const;
560 virtual void setSize(
int width,
int height);
606 void setPosition(
int x,
int y);
615 virtual void setDimension(
Rectangle const & dimension);
631 unsigned int getChildrenCount()
const;
638 unsigned int getVisibleChildrenCount()
const;
646 void setMinSize(
Size const & size);
654 Size const & getMinSize()
const;
662 void setMaxSize(
Size const & size);
670 Size const & getMaxSize()
const;
679 void setFixedSize(
Size const & size);
687 Size const & getFixedSize()
const;
695 bool isFixedSize()
const;
704 void setFocusable(
bool focusable);
712 bool isFocusable()
const;
719 virtual bool isFocused()
const;
731 virtual void setFocused(
bool focused);
741 void setEnabled(
bool enabled);
750 bool isEnabled()
const;
758 void setVisible(
bool visible);
766 bool isVisible()
const;
773 bool isSetVisible()
const;
781 virtual void setBaseColor(
Color const & color);
789 Color const & getBaseColor()
const;
797 virtual void setForegroundColor(
Color const & color);
804 Color const & getForegroundColor()
const;
812 virtual void setBackgroundColor(
Color const & color);
819 Color const & getBackgroundColor()
const;
827 virtual void setSelectionColor(
Color const & color);
835 Color const & getSelectionColor()
const;
843 virtual void setOutlineColor(
Color const & color);
851 Color const & getOutlineColor()
const;
859 virtual void setBorderColor(
Color const & color);
867 Color const & getBorderColor()
const;
875 virtual void setSelectionMode(SelectionMode mode);
883 SelectionMode getSelectionMode()
const;
890 virtual void requestFocus();
896 virtual void requestMoveToTop();
902 virtual void requestMoveToBottom();
913 virtual void _draw(
Graphics* graphics);
923 virtual void _logic();
935 virtual void _setFocusHandler(
FocusHandler* focusHandler);
1086 void setActionEventId(std::string
const & actionEventId);
1094 std::string
const & getActionEventId()
const;
1102 virtual void getAbsolutePosition(
int& x,
int& y)
const;
1114 virtual void _setParent(
Widget* parent);
1124 Font* getFont()
const;
1135 static void setGlobalFont(
Font* font);
1143 static void resetGlobalFont();
1152 virtual void setFont(
Font* font);
1198 static bool widgetExists(
Widget const * widget);
1209 bool isTabInEnabled()
const;
1220 void setTabInEnabled(
bool enabled);
1231 bool isTabOutEnabled()
const;
1244 void setTabOutEnabled(
bool enabled);
1251 virtual bool isModalFocusable()
const;
1258 virtual bool isModalMouseInputFocusable()
const;
1265 virtual bool isModalFocused()
const;
1272 virtual bool isUnderMouseModal()
const;
1301 virtual Widget* getWidgetAt(
int x,
int y,
Widget* exclude);
1327 virtual std::list<Widget*> getWidgetsIn(
Rectangle const & area,
Widget* ignore);
1334 virtual std::list<MouseListener*>
const & _getMouseListeners();
1341 virtual std::list<KeyListener*>
const & _getKeyListeners();
1348 virtual std::list<FocusListener*>
const & _getFocusListeners();
1392 void setInternalFocusHandler(
FocusHandler* internalFocusHandler);
1404 virtual void moveToTop(
Widget* widget);
1416 virtual void moveToBottom(
Widget* widget);
1423 virtual void focusNext();
1430 virtual void focusPrevious();
1452 void setId(std::string
const &
id);
1464 std::string
const & getId()
const;
1476 virtual void showPart(
Rectangle rectangle);
1511 static void _setGuiDeathListener(
DeathListener* deathListener);
1526 void setVerticalExpand(
bool expand);
1534 bool isVerticalExpand()
const;
1542 void setHorizontalExpand(
bool expand);
1550 bool isHorizontalExpand()
const;
1570 virtual void adaptLayout(
bool top);
1625 void getLastPosition(
int& x,
int& y)
const;
1633 void setLastPosition(
int x,
int y);
1640 bool isLastPositionSet()
const;
1649 bool captureMouse();
1658 void releaseMouse();
1666 static Widget* getMouseCapture();
1674 bool hasMouseCapture()
const;
1686 bool isDescendantOf(
Widget const * ancestor)
const noexcept;
1696 bool isInsideActiveMouseModal() const noexcept;
1702 void distributeActionEvent();
1707 void distributeResizedEvent();
1712 void distributeMovedEvent();
1717 void distributeHiddenEvent();
1722 void distributeShownEvent();
1730 void distributeAncestorMovedEvent(
Widget* ancestor);
1738 void distributeAncestorHiddenEvent(
Widget* ancestor);
1746 void distributeAncestorShownEvent(
Widget* ancestor);
1757 void add(
Widget* widget);
1768 virtual
void remove(
Widget* widget);
1778 virtual
void removeAllChildren();
1789 virtual
Widget* findWidgetById(std::
string const &
id);
1795 void resizeToChildren();
1802 void calculateSize();
1809 std::list<
Widget*> const & getChildren() const;
1812 bool distributeDragEnter(
DragEvent& event);
1815 void distributeDragLeave(
DragEvent& event);
1818 void distributeDragHover(
DragEvent& event);
1821 void distributeDragDrop(
DragEvent& event);
2035 Size mMaxSize{std::numeric_limits<int>::max(), std::numeric_limits<int>::max()};
2119 using T = std::underlying_type_t<Widget::SelectionMode>;
2128 using T = std::underlying_type_t<Widget::SelectionMode>;
Interface for listening to action events from widgets.
Interface for listening to widget destruction events.
A basic font implementation capable only of drawing rectangles (placeholder).
Drag and drop event type container.
Manages drag and drop operations for a Gui instance.
Listener interface for widgets that accept dragged payloads.
Manages focus navigation and assignment among widgets within a Gui instance.
Interface for listening to focus gain/loss events.
Abstract interface for font rendering.
Abstract interface providing primitive drawing functions (lines, rectangles, etc.).
Interface for listening to keyboard events.
Represents a mouse event.
Interface for listening to mouse events.
Represents a rectangular area (X, Y, Width, Height).
Represents dimensions defined by width and height.
Text input event for IME (input method editor) composition, dead keys, and pasted text.
Handles changes in widget visibility states.
Used replacement tokens by configure_file():
constexpr Widget::SelectionMode operator|(Widget::SelectionMode a, Widget::SelectionMode b) noexcept
Bitwise OR operator for Widget::SelectionMode.
constexpr Widget::SelectionMode & operator|=(Widget::SelectionMode &a, Widget::SelectionMode b) noexcept
Bitwise and for selection modes.
constexpr Widget::SelectionMode & operator&=(Widget::SelectionMode &a, Widget::SelectionMode b) noexcept
Bitwise or assign for selection modes.
constexpr Widget::SelectionMode operator&(Widget::SelectionMode a, Widget::SelectionMode b) noexcept
Bitwise or for selection modes.