Class · aurore
aurore::Box
Generic FlexBox layout.
#include <aurore/core/box.hpp>
class aurore::Box : public aurore::ViewDerived by
aurore::AccountWidgetaurore::AppletFrameaurore::BatteryWidgetaurore::BottomBaraurore::Buttonaurore::ContextMenuaurore::ContextMenuItemaurore::DebugLayeraurore::Dialogaurore::Dropdownaurore::EditTextDialogaurore::Headeraurore::Hintaurore::Hintsaurore::HScrollingFrameaurore::Notificationaurore::NotificationManageraurore::RecyclerCellaurore::RecyclerContentBoxaurore::RecyclingGridContentBoxaurore::RecyclingGridItemaurore::ScrollingFrameaurore::SidebarItemaurore::Slideraurore::TabFrameaurore::WirelessWidgetcadran::Cardcadran::kit::ChipVersionBadge
Constructors 3
Box(Axis flexDirection) An empty box laying its children out along flexDirection.
An empty row.
box.hpp:79Deletes the children (those a ptrLock() holds go to the deletion pool).
box.hpp:81Functions 53
virtual void draw( NVGcontext *vg,float x,float y,float width,float height,Style style,FrameContext *ctx) overrideCalled by frame() to draw the view onscreen. Views should not draw outside of their bounds (they may be clipped if they do so).
Overrides aurore::View::draw
virtual View * getDefaultFocus() override Returns the default view to focus when focusing this view Typically the view itself or one of its children.
Returning nullptr means that the view is not focusable (and neither are its children)
By default, a view is focusable if the flag is set to true with setFocusable() and if the view is visible.
When pressing a key, the flow is :
- starting from the currently focused view's parent, traverse the tree upwards and repeatedly call getNextFocus() on every view until we find a next view to focus or meet the end of the tree
- if a view is found, getNextFocus() will internally call getDefaultFocus() for the selected child
- give focus to the result, if it exists
Overrides aurore::View::getDefaultFocus
Returns the view to focus with the corresponding screen coordinates in the view or its children, or nullptr if it hasn't been found.
Research is done recursively by traversing the tree starting from this view. This view's parents are not traversed.
Overrides aurore::View::hitTest
virtual View * getNextFocus( FocusDirection direction,View *currentView) overrideReturns the next view to focus given the requested direction and the currently focused view (as parent user data)
Returning nullptr means that there is no next view to focus in that direction - getNextFocus will then be called on our parent if any
Overrides aurore::View::getNextFocus
Called when the view will appear on screen, before or after layout().
Can be called if the view has already appeared, so be careful.
Overrides aurore::View::willAppear
Called when the view will disappear from the screen.
Can be called if the view has already disappeared, so be careful.
Overrides aurore::View::willDisappear
Fired when the window size changes, after updating layout.
Overrides aurore::View::onWindowSizeChanged
Called on every view of the screens when the theme changes (Application::getThemeChangedEvent): the colours given by key (setThemeColor) take their new values, the state styles read their "@theme/" values again. A view that keeps other colours of its own looks them up again here, then calls the base. A Box goes on to its children.
Overrides aurore::View::onThemeChanged
virtual void onParentFocusGained(View *focusedView) override Fired when focus is gained on this view's parent, or the parent of the parent...
Overrides aurore::View::onParentFocusGained
virtual void onParentFocusLost(View *focusedView) override Fired when focus is lost on one of this view's parents. Works similarly to onParentFocusGained().
Overrides aurore::View::onParentFocusLost
Applies the given attribute to the view.
You can add your own attributes to by calling registerXMLAttribute() in the view constructor.
Overrides aurore::View::applyXMLAttribute
virtual void addView(View *view) Adds a view to this Box. Returns the position the view was added at.
box.hpp:107virtual void addView(View *view, size_t position) Adds a view to this Box at the given position. Returns the position the view was added at.
box.hpp:113virtual void removeView(View *view, bool free = true) Removes the given view from the Box. It will be freed.
box.hpp:118Removes all views from the Box. Them will be freed.
box.hpp:123Sets the padding of the view, aka the internal space to give between this view boundaries and its children.
Only does one layout pass instead of four when using the four methods separately.
box.hpp:131Sets the padding of the view, aka the internal space to give between this view boundaries and its children.
Only does one layout pass instead of four when using the four methods separately.
box.hpp:139Sets the padding of the view, aka the internal space to give between this view boundaries and its children.
box.hpp:145Sets the padding of the view, aka the internal space to give between this view boundaries and its children.
box.hpp:153Sets the padding of the view, aka the internal space to give between this view boundaries and its children.
box.hpp:161Sets the padding of the view, aka the internal space to give between this view boundaries and its children.
box.hpp:169Sets the gap between child elements inside this view. This is typically used in layouts like grids or lists.
box.hpp:177Returns the current gap between child elements inside this view.
box.hpp:182Sets the gap between two lines of children (wrapped rows, or the children of a column), overriding setGap() on that axis.
box.hpp:188Sets the gap between two children along a row (or between wrapped columns), overriding setGap() on that axis.
box.hpp:195void setJustifyContent(JustifyContent justify) void setAlignItems(AlignItems alignment) void setDirection(Direction direction) Sets the direction of the box, aka place the views left to right or right to left (flips the children).
Default is INHERIT.
box.hpp:218void setAxis(Axis axis) The axis the children are laid out along.
box.hpp:221void setWrap(Wrap wrap) Sets the wrapping behavior for the children inside this view.
box.hpp:227Wrap getWrap() const Returns the wrapping behavior for the children inside this view.
box.hpp:232std::vector< View * > & getChildren() The children, in order. The box owns them: it deletes them with itself.
box.hpp:235Returns the bounds used for culling children.
box.hpp:240void forwardXMLAttribute(std::string attributeName, View *target) Registers an XML attribute to be forwarded to the given view. Works regardless of the target attribute type. Useful to expose attributes of children views in the parent box without copy pasting them individually.
The forwarded attribute value will override the value of the regular attribute if it already exists in the target view.
box.hpp:248void forwardXMLAttribute( std::string attributeName,View *target,std::string targetAttributeName)Registers an XML attribute to be forwarded to the given view, while changing the target attribute name. Works regardless of the target attribute type. Useful to expose attributes of children views in the parent box without copy pasting them individually, but with a different name.
The forwarded attribute value will override the value of the regular attribute if it already exists in the target view.
box.hpp:257Fired when focus is gained on one of this view's children, or one of the children of the children...
directChild is guaranteed to be one of your children. It may not be the view that has been focused.
If focusedView == directChild, then the child of yours has been focused. Otherwise, focusedView is a child of directChild.
box.hpp:269Fired when focus is lost on one of this view's children. Works similarly to onChildFocusGained().
box.hpp:275virtual View * getView(std::string id) override Returns the view with the corresponding id in the view or its children, or nullptr if it hasn't been found.
Research is done recursively by traversing the tree starting from this view. This view's parents are not traversed.
Overrides aurore::View::getView
void setLastFocusedView(View *view) The child the focus goes back to when the box gets it again.
box.hpp:280The child that takes the focus first (negative values are ignored).
box.hpp:283View * getLastFocusedView() const Whether the focus is on one of the children, at any depth.
box.hpp:291Also the functions of aurore::View (221).
Static functions 1
Protected functions 6
A focusable box says the texts shown in it (getAccessibilityText).
Overrides aurore::View::getDefaultAccessibilityLabel
Inflates the Box with the given XML string.
The root element MUST be a aurore::Box, corresponding to the inflated Box itself. Its attributes will be applied to the Box.
Each child node in the root aurore::Box will be treated as a view and added as a child of the Box.
box.hpp:316Inflates the Box with the given XML element.
The root element MUST be a aurore::Box, corresponding to the inflated Box itself. Its attributes will be applied to the Box.
Each child node in the root aurore::Box will be treated as a view and added as a child of the Box.
box.hpp:327Inflates the Box with the given XML resource.
The root element MUST be a aurore::Box, corresponding to the inflated Box itself. Its attributes will be applied to the Box.
Each child node in the root aurore::Box will be treated as a view and added as a child of the Box.
box.hpp:338Inflates the Box with the given XML file path.
The root element MUST be a aurore::Box, corresponding to the inflated Box itself. Its attributes will be applied to the Box.
Each child node in the root aurore::Box will be treated as a view and added as a child of the Box.
box.hpp:349Handles a child XML element.
By default, calls createFromXMLElement() and adds the result to the children of the Box.
Overrides aurore::View::handleXMLElement
Read from Aurore's headers by Doxygen at each build · library/include