25#include <mxgui/display.h>
26#include <mxgui/misc_inst.h>
47 operator mxgui::Point() {
return mxgui::Point(
x,
y); }
51 return {short(
x + other.x), short(
y + other.y)};
56 return {short(
x - other.x), short(
y - other.y)};
138 this->bounds = bounds;
162 for (
auto child : childs)
163 child->invalidateTree();
171 virtual void draw(mxgui::DrawingContext& dc)
219 this->selected = selected;
227 listeners.push_back(listener);
232 for (
auto lst : listeners)
241 mxgui::Color colSelected = mxgui::red;
242 mxgui::Color colBg = mxgui::black;
244 std::vector<OnInteractionListener> listeners;
246 bool selected =
false;
247 bool selectable =
false;
248 bool invalidated =
true;
250 Bounds bounds{{0, 0}, {0, 0}};
254 bool wasSelected =
false;
255 mxgui::Color lastBgColor = colBg;
Base class for anything that can be drawn on the screen and interacted with.
virtual void draw(mxgui::DrawingContext &dc)
Draw the view in its bounds.
virtual std::vector< View * > getChilds()
Returns the list of childs.
virtual void setBackgroundColor(mxgui::Color color)
std::function< void(View *, Interaction)> OnInteractionListener
void addOnInteractionListener(OnInteractionListener listener)
void invalidate()
Signal that what has been previously drawn is now invalid and has to be redrawn.
void setSelectable(bool selectable)
virtual void performInteraction(Interaction action)
void setSelected(bool selected)
virtual mxgui::Color getBackgroundColor()
void setSelectedColor(mxgui::Color color)
void invalidateTree()
Invalidate the view tree which has this view as a root.
virtual void setBounds(Bounds bounds)
Sets the bounds in which the view will be drawn.
This file includes all the types the logdecoder script will decode.
void operator+=(const Position &other)
Position operator-(const Position &other)
Position operator+(const Position &other)
void operator-=(const Position &other)