|
Aurore
A Switch-like interface for your app, on every screen
|
#include <aurore/core/view.hpp>
Public Types | |
| typedef std::vector< std::shared_ptr< Action > >::iterator | ActionIterator |
Public Member Functions | |
| void | setScale (float scale) |
| void | setScaleX (float scale) |
| void | setScaleY (float scale) |
| float | getScaleX () const |
| float | getScaleY () const |
| View () | |
| virtual | ~View () |
| void | setBackground (ViewBackground background) |
| How the view's background is drawn: none, the sidebar's, the backdrop, a plain colour or a gradient. | |
| void | setBackgroundLinearGradient (NVGcolor start, NVGcolor end, ViewBackground direction=ViewBackground::VERTICAL_LINEAR) |
| void | shakeHighlight (FocusDirection direction) |
Shakes the focus highlight towards direction: there is nothing to go to there. | |
| Rect | getFrame () |
| The view's position and size on the screen, after layout (getX(), getY(), getWidth(), getHeight()). | |
| float | getX () |
| The position on the screen, in layout units: the parents' positions and translations added. | |
| float | getY () |
| Rect | getLocalFrame () |
| The position and size in the parent, as laid out by Yoga. | |
| float | getLocalX () |
| float | getLocalY () |
| float | getWidth () |
The size as laid out by Yoga; the height without the collapse when includeCollapse is false. | |
| float | getHeight (bool includeCollapse=true) |
| virtual void | invalidate () |
| virtual void | onLayout () |
| virtual View * | getView (std::string id) |
| void | setWidth (float width) |
| void | setHeight (float height) |
| void | setSize (Size size) |
| void | setDimensions (float width, float height) |
| void | setWidthPercentage (float percentage) |
| void | setHeightPercentage (float percentage) |
| void | setMinWidth (float minWidth) |
| void | setMinHeight (float minHeight) |
| void | setMinWidthPercentage (float percentage) |
| void | setMinHeightPercentage (float percentage) |
| void | setMaxWidth (float maxWidth) |
| void | setMaxHeight (float maxHeight) |
| void | setMaxWidthPercentage (float percentage) |
| void | setMaxHeightPercentage (float percentage) |
| void | setGrow (float grow) |
| void | setShrink (float shrink) |
| void | setMargins (float top, float right, float bottom, float left) |
| void | setMarginTop (float top) |
| void | setMarginRight (float right) |
| float | getMarginRight () |
| float | getMarginLeft () |
| void | setMarginBottom (float right) |
| void | setMarginLeft (float left) |
| void | setVisibility (Visibility visibility) |
| Visibility | getVisibility () |
| void | setPositionTop (float pos) |
| void | setPositionRight (float pos) |
| void | setPositionBottom (float pos) |
| void | setPositionLeft (float pos) |
| void | setPositionTopPercentage (float percentage) |
| void | setPositionRightPercentage (float percentage) |
| void | setPositionBottomPercentage (float percentage) |
| void | setPositionLeftPercentage (float percentage) |
| void | setPositionType (PositionType type) |
| void | setId (std::string id) |
| const std::string & | getId () const |
| void | setAlignSelf (AlignSelf align) |
| void | setBoxSizing (BoxSizing sizing) |
| void | setLineColor (NVGcolor color) |
| void | setLineTop (float thickness) |
| void | setLineRight (float thickness) |
| void | setLineBottom (float thickness) |
| void | setLineLeft (float thickness) |
| void | setBackgroundColor (NVGcolor color) |
| void | setBorderColor (NVGcolor color) |
| ViewBackground | getBackground () const |
| NVGcolor | getBackgroundColor () const |
| NVGcolor | getBorderColor () const |
| void | setBorderThickness (float thickness) |
| float | getBorderThickness () |
| void | setCornerRadius (float radius) |
| void | setCornerRadius (float topLeft, float topRight, float bottomRight, float bottomLeft) |
| float | getCornerRadius () |
| void | setThemeArea (ThemeArea area) |
| ThemeArea | getThemeArea () const |
| void | setShadowType (ShadowType type) |
| void | setShadowVisibility (bool visible) |
| void | setHideHighlightBackground (bool hide) |
| void | setHideHighlightBorder (bool hide) |
| void | setHideHighlight (bool hide) |
| void | setHideClickAnimation (bool hide) |
| No click animation when the view is clicked. | |
| void | setHighlightPadding (float padding) |
| void | setHighlightCornerRadius (float radius) |
| virtual View * | getNearestView (std::string id) |
| virtual void | handleXMLElement (tinyxml2::XMLElement *element) |
| virtual void | applyXMLAttributes (tinyxml2::XMLElement *element) |
| virtual bool | applyXMLAttribute (std::string name, std::string value) |
| void | registerAutoXMLAttribute (std::string name, AutoAttributeHandler handler) |
| void | registerPercentageXMLAttribute (std::string name, FloatAttributeHandler handler) |
| void | registerFloatXMLAttribute (std::string name, FloatAttributeHandler handler) |
| void | registerStringXMLAttribute (std::string name, StringAttributeHandler handler) |
| void | registerColorXMLAttribute (std::string name, ColorAttributeHandler handler) |
| void | registerBoolXMLAttribute (std::string name, BoolAttributeHandler handler) |
| void | registerFilePathXMLAttribute (std::string name, FilePathAttributeHandler handler) |
| bool | isXMLAttributeValid (std::string attributeName) |
| void | setMaximumAllowedXMLElements (unsigned max) |
| unsigned | getMaximumAllowedXMLElements () |
| void | setInFadeAnimation (bool translucent) |
| void | setFocusable (bool focusable) |
| bool | isFocusable () |
| Whether the view takes the focus: focusable, and visible. | |
| void | removeFromSuperView (bool free=true) |
| void | setFocusSound (enum Sound sound) |
| virtual enum Sound | getFocusSound () |
| void | detach () |
| bool | isDetached () |
| See detach(). | |
| void | setDetachedPosition (float x, float y) |
| void | setDetachedPositionX (float x) |
| void | setDetachedPositionY (float y) |
| Point | getDetachedPosition () const |
| void | setParent (Box *parent, void *parentUserdata=nullptr) |
The box this view is in (Box::addView sets it; parentUserdata is the box's own). | |
| Box * | getParent () |
| bool | hasParent () |
| void * | getParentUserData () |
| template<class ButtonType > | |
| ActionIterator | getAction (ButtonType button) |
| ActionIterator | getAction (ActionIdentifier identifier) |
The action registered under identifier, or getActions().end(). | |
| template<class ButtonType , class ActionType > | |
| ActionIdentifier | registerAction (const std::string &hintText, ButtonType button, const ActionListener &actionListener, bool hidden=false, bool allowRepeating=false, enum Sound sound=SOUND_NONE) |
| ActionIdentifier | registerAction (const std::string &hintText, ControllerButton button, const ActionListener &actionListener, bool hidden=false, bool allowRepeating=false, enum Sound sound=SOUND_NONE) |
| The same, on a controller button. | |
| ActionIdentifier | registerAction (AuroreKeyCombination key, const ActionListener &actionListener, bool allowRepeating=false) |
| An action on a keyboard key (a combination with modifiers): no hint, no sound. | |
| void | func (AuroreKeyCombination key) |
| void | unregisterAction (ActionIdentifier identifier) |
| void | registerClickAction (const ActionListener &actionListener) |
| void | updateActionHint (enum ControllerButton button, const std::string &hintText) |
Changes the hint of the action on button. | |
| void | setActionAvailable (enum ControllerButton button, bool available) |
Turns the action on button on or off (an action off runs nothing and shows no hint). | |
| void | setActionsAvailable (bool available) const |
| The same for every action of the view. | |
| void | setActionHidden (enum ControllerButton button, bool hidden) |
| void | resetClickAnimation () |
| void | playClickAnimation (bool reverse=false, bool animateBack=true, bool force=false) |
| Plays the click animation (the flash over the view). | |
| std::string | getClassString () const |
| The view's class name ("Label", "Box"…). | |
| std::string | describe () const |
The class name and the id, for logs: Label (id="title"). | |
| YGNode * | getYGNode () |
| The view's Yoga node. | |
| const std::vector< std::shared_ptr< Action > > & | getActions () |
| The actions registered on the view. | |
| const std::vector< GestureRecognizer * > & | getGestureRecognizers () |
| void | interruptGestures (bool onlyIfUnsureState) |
| void | addGestureRecognizer (GestureRecognizer *recognizer) |
| bool | removeGestureRecognizer (GestureRecognizer *recognizer) |
| Sound | gestureRecognizerRequest (TouchState touch, MouseState mouse, View *firstResponder) |
| virtual void | frame (FrameContext *ctx) |
| void | frameHighlight (FrameContext *ctx) |
| virtual void | draw (NVGcontext *vg, float x, float y, float width, float height, Style style, FrameContext *ctx)=0 |
| virtual void | willAppear (bool resetState=false) |
| virtual void | willDisappear (bool resetState=false) |
| virtual void | onShowAnimationEnd () |
| virtual void | show (std::function< void(void)> cb) |
| virtual void | show (std::function< void(void)> cb, bool animate, float animationDuration) |
| virtual float | getShowAnimationDuration (TransitionAnimation animation) |
| void | collapse (bool animated=true) |
| bool | isCollapsed () |
| Whether collapse() hid the view. | |
| void | setAlpha (float alpha) |
| The view's opacity, 0 to 1 (a transition when its style has one). | |
| void | expand (bool animated=true) |
| virtual void | hide (std::function< void(void)> cb) |
| virtual void | hide (std::function< void(void)> cb, bool animate, float animationDuration) |
| bool | isHidden () |
| Whether hide() hid the view. | |
| virtual bool | isTranslucent () |
| bool | isFocused () |
| Whether the view has the focus. | |
| virtual View * | getDefaultFocus () |
| virtual View * | hitTest (Point point) |
| virtual View * | getNextFocus (FocusDirection direction, View *currentView) |
| void | setCustomNavigationRoute (FocusDirection direction, View *target) |
| void | setCustomNavigationRoute (FocusDirection direction, std::string targetId) |
| bool | hasCustomNavigationRouteByPtr (FocusDirection direction) |
| bool | hasCustomNavigationRouteById (FocusDirection direction) |
| View * | getCustomNavigationRoutePtr (FocusDirection direction) |
| std::string | getCustomNavigationRouteId (FocusDirection direction) |
| virtual void | onFocusGained () |
| virtual void | onFocusLost () |
| virtual void | onParentFocusGained (View *focusedView) |
| virtual void | onParentFocusLost (View *focusedView) |
| virtual void | onWindowSizeChanged () |
| GenericEvent * | getFocusEvent () |
| Fired with the view when it gains the focus. | |
| GenericEvent * | getFocusLostEvent () |
| Fired with the view when it loses the focus. | |
| virtual float | getAlpha (bool child=false) |
| The opacity drawn: the view's alpha times its parents'. | |
| float | getClickAlpha () |
| void | overrideTheme (Theme *newTheme) |
| void | setCulled (bool culled) |
| bool | isCulled () |
| void | setAspectRatio (float value) |
| The width over the height, kept by the layout (values <= 0 are ignored). | |
| float | getAspectRatio () |
| void | setBackgroundCornerRadii (float topLeft, float topRight, float bottomRight, float bottomLeft) |
| void | setTranslationY (float translateY) |
| void | setTranslationX (float translateX) |
| void | setWireframeEnabled (bool wireframe) |
| bool | isWireframeEnabled () |
| AppletFrameItem * | getAppletFrameItem () |
| void | updateAppletFrameItem () |
| bool | getClipsToBounds () const |
| Whether the children are clipped to the view's frame when drawn. | |
| void | setClipsToBounds (bool value) |
| virtual AppletFrame * | getAppletFrame () |
| The AppletFrame the view is in, or nullptr. | |
| void | present (View *view) |
Pushes view as the content of the view's AppletFrame (a page inside the frame). | |
| virtual void | dismiss (std::function< void(void)> cb=[] {}) |
Pops the AppletFrame's content back to the one before, then runs cb. | |
| std::weak_ptr< void > | aliveToken () |
| void | ptrLock () |
| void | ptrUnlock () |
| bool | isPtrLocked () |
| Whether a ptrLock() holds the view. | |
| void | freeView () |
| Deletes the view at the end of the frame (Application::addToFreeQueue). | |
| Activity * | getParentActivity () |
| The activity the view is in, through its parents; nullptr when none. | |
| void | setParentActivity (Activity *activity) |
| bool | setStateStyle (StyleState state, const std::string &property, const std::string &value) |
| void | setStyleState (StyleState state, bool on) |
| bool | hasStyleState (StyleState state) |
| bool | setTransition (const std::string &spec) |
| virtual bool | getStyleProperty (const std::string &name, StyleValue *value) |
| virtual bool | setStyleProperty (const std::string &name, const StyleValue &value) |
| void | keepSubscription (Subscription &&subscription) |
| bool | bind (const std::string &spec) |
| virtual bool | setBoundText (const std::string &text) |
| void | setAccessibilityRole (AccessibilityRole role) |
| AccessibilityRole | getAccessibilityRole () |
| See setAccessibilityRole(). | |
| void | setAccessibilityLabel (const std::string &label) |
| std::string | getAccessibilityLabel () |
| void | setAccessibilityValue (const std::string &value) |
| std::string | getAccessibilityValue () |
| void | setAccessibilitySelected (bool selected) |
| bool | isAccessibilitySelected () |
| virtual bool | getAccessibilityPosition (int *index, int *count) |
| virtual std::string | getAccessibilityDescription () |
| std::string | getAccessibilityText () |
| void | announceAccessibilityValue () |
| void | resolveBindings (Activity *activity=nullptr) |
| virtual void | onTextScaleChanged () |
| bool | setThemeColor (const std::string &property, const std::string &key) |
| std::string | getThemeColor (const std::string &property) |
| virtual void | onThemeChanged () |
Static Public Member Functions | |
| static void | setHighlightGlide (bool glide) |
| static View * | createFromXMLString (std::string_view xml) |
| static View * | createFromXMLElement (tinyxml2::XMLElement *element) |
| static View * | createFromXMLFile (std::string path) |
| static View * | createFromXMLResource (std::string name) |
| static std::shared_ptr< tinyxml2::XMLDocument > | getXMLCache (std::string_view path) |
| static void | forgetXMLCache (const std::string &path) |
| static std::string | describeXMLError (tinyxml2::XMLDocument *document, const std::string &source="") |
| static std::string | describeXMLLocation (const tinyxml2::XMLElement *element) |
| static void | fatalXML (const std::string &message) |
| static std::string | closestXMLName (const std::string &name, const std::vector< std::string > &known) |
| template<typename T > | |
| static std::string | listXMLValues (const std::unordered_map< std::string, T > &values) |
| An enumeration's values, sorted, for an error message. | |
| static std::string | getStringXMLAttributeValue (std::string value) |
| static std::string | getFilePathXMLAttributeValue (std::string value) |
Public Attributes | |
| Animatable | alpha = 1.0f |
Static Public Attributes | |
| static constexpr float | AUTO = NAN |
A size or position left to the layout (auto in XML). | |
| static std::string | CUSTOM_RESOURCES_PATH |
| static std::string | currentXMLResource |
Protected Member Functions | |
| NVGcolor | a (NVGcolor color) |
| Helper functions to apply this view's alpha to a color. | |
| NVGpaint | a (NVGpaint paint) |
| NVGcolor | RGB (unsigned r, unsigned g, unsigned b) |
| NVGcolor | RGBA (unsigned r, unsigned g, unsigned b, unsigned a) |
| NVGcolor | RGBf (float r, float g, float b) |
| NVGcolor | RGBAf (float r, float g, float b, float a) |
| NVGcolor | shadowColor (NVGcolor color, float opacity) |
| virtual bool | animateHint () |
| virtual AccessibilityRole | getDefaultAccessibilityRole () |
| virtual std::string | getDefaultAccessibilityLabel () |
| virtual std::string | getDefaultAccessibilityValue () |
| virtual bool | getDefaultAccessibilitySelected () |
| bool | transitionStyle (const char *name, const StyleValue &to) |
Protected Attributes | |
| Animatable | collapseState = 1.0f |
| bool | focused = false |
| Activity * | parentActivity = nullptr |
| Box * | parent = nullptr |
| GenericEvent | focusEvent |
| GenericEvent | focusLostEvent |
| YGNode * | ygNode |
| std::string | id = "" |
Friends | |
| class | Application |
Superclass for all the other views Lifecycle of a view is : new -> [willAppear -> willDisappear] -> delete
Users have do to the new, the rest of the lifecycle is taken care of by the library
willAppear and willDisappear can be called zero or multiple times before deletion (in case of a TabLayout for instance)
| typedef std::vector<std::shared_ptr<Action>>::iterator aurore::View::ActionIterator |
| aurore::View::View | ( | ) |
|
virtual |
|
protected |
Helper functions to apply this view's alpha to a color.
|
protected |
| void aurore::View::addGestureRecognizer | ( | GestureRecognizer * | recognizer | ) |
Add new gesture recognizer on this view.
| std::weak_ptr< void > aurore::View::aliveToken | ( | ) |
A token that expires when this view is deleted. A task that comes back to the view from another thread captures it by value and checks it on the UI thread, before it touches the view:
aurore::async([this, alive = aliveToken()] { auto result = work(); // not this: the view may be gone aurore::sync([this, alive, result] { if (alive.expired()) return; ... }); });
Checked on another thread it only says the view was alive then.
|
inlineprotectedvirtual |
Should the hint alpha be animated when pushing the view?
| void aurore::View::announceAccessibilityValue | ( | ) |
Says the view's value and state again (Application::announce) when it has the focus and the user pressed or touched something in the last 2 s (not a value changing on its own): called by the views whose value changes in place (a toggle flipped, a slider moved, a detail changed).
|
virtual |
Applies the given attribute to the view.
You can add your own attributes to by calling registerXMLAttribute() in the view constructor.
Reimplemented in aurore::Box, and aurore::IconButton.
|
virtual |
Applies the attributes of the given XML element to the view.
You can add your own attributes to by calling registerXMLAttribute() in the view constructor.
| bool aurore::View::bind | ( | const std::string & | spec | ) |
Binds a property of the view to an observable of the data models (Application::registerModel, Activity::registerModel): "text: profile.name, visible: profile.online". Properties: text (a string, int or float observable; views that have a text: Label, Button, cells), visible (bool: VISIBLE or GONE), and every style property (float or NVGcolor). Returns false for a spec it cannot read; a model not registered yet is looked up again when the view joins an activity. XML: bind="…".
|
static |
The known name closest to name (a typo's), or "" when none is close.
| void aurore::View::collapse | ( | bool | animated = true | ) |
Hides the view in a collapse animation
|
static |
Creates a view from the given XML element (node and attributes).
Elements nest at most 64 levels deep, the files aurore:View includes counted (a file including itself is an error, not a stack overflow).
The method handleXMLElement() is executed for each child node in the XML.
Uses the internal lookup table to instantiate the views. Use registerXMLView() to add your own views to the table so that you can use them in your own XML files.
|
static |
Creates a view from the given XML file path.
The method handleXMLElement() is executed for each child node in the XML.
Uses the internal lookup table to instantiate the views. Use registerXMLView() to add your own views to the table so that you can use them in your own XML files.
|
static |
Creates a view from the given XML resource file name.
The method handleXMLElement() is executed for each child node in the XML.
Uses the internal lookup table to instantiate the views. Use registerXMLView() to add your own views to the table so that you can use them in your own XML files.
|
static |
Creates a view from the given XML file content.
The method handleXMLElement() is executed for each child node in the XML.
Uses the internal lookup table to instantiate the views. Use registerXMLView() to add your own views to the table so that you can use them in your own XML files.
| std::string aurore::View::describe | ( | ) | const |
The class name and the id, for logs: Label (id="title").
|
static |
Describes the document's parse error for a fatal message: where it comes from (the path, or the resource being loaded), the line and tinyxml2's own text.
|
static |
Where an element is: "file:line" (the path or the resource it was loaded from), "line N" for an XML string.
| void aurore::View::detach | ( | ) |
Sets the detached flag to true. This action is irreversible.
A detached view will, as the name suggests, not be attached to their parent Yoga node. That means that invalidation and layout need to be taken care of manually by the parent.
detach() must be called before adding the view to the parent.
|
virtual |
Pops the AppletFrame's content back to the one before, then runs cb.
|
pure virtual |
Called by frame() to draw the view onscreen. Views should not draw outside of their bounds (they may be clipped if they do so).
Implemented in cadran::kit::Mark, cadran::kit::Bar, cadran::Card, cadran::Switch, CadranDigits, CadranIcon, CadranSwatch, FooterHints, HeaderSetting, LoadingBar, QrView, ScrollView, TabBadge, aurore::Box, aurore::Padding, aurore::BottomBar, aurore::CheckBox, aurore::ContextMenu, aurore::HScrollingFrame, aurore::IconButton, aurore::Image, aurore::Label, aurore::ProgressSpinner, aurore::Rectangle, aurore::RecyclerFrame, aurore::RecyclingGrid, aurore::HRecyclerFrame, aurore::ScrollingFrame, aurore::SidebarSeparator, aurore::Slider, aurore::BatteryWidget, and aurore::WirelessWidget.
| void aurore::View::expand | ( | bool | animated = true | ) |
Shows the view in a expand animation (opposite of collapse)
|
static |
fatal() for an XML error, the message prefixed with where the element being read is ("file:line: <tag>: ").
|
static |
Drops the cached document of an XML file, which is then read again (hot reload). The document stays in memory: views made from it may still point into it.
|
virtual |
Called each frame Do not override it to draw your view, override draw() instead
Reimplemented in cadran::kit::Chip.
| void aurore::View::frameHighlight | ( | FrameContext * | ctx | ) |
Called each frame
| void aurore::View::freeView | ( | ) |
Deletes the view at the end of the frame (Application::addToFreeQueue).
| void aurore::View::func | ( | AuroreKeyCombination | key | ) |
| Sound aurore::View::gestureRecognizerRequest | ( | TouchState | touch, |
| MouseState | mouse, | ||
| View * | firstResponder | ||
| ) |
Called each frame when touch is registered.
|
virtual |
What is announced when the view takes the focus: its label, then its role, its value and state in the app's language and its place ("Wi-Fi, switch, on, 2 of 5"; "Save, button, disabled").
| std::string aurore::View::getAccessibilityLabel | ( | ) |
|
virtual |
Where the view is among the rows it belongs to, from 1, said as "3 of 10": a recycler's cell its row in its section, a cell, a button or a tab among the focusable views of its parent. False when that says nothing (a view alone, a label).
| AccessibilityRole aurore::View::getAccessibilityRole | ( | ) |
| std::string aurore::View::getAccessibilityText | ( | ) |
The texts shown in the view, for a label made of them: its own label for a view with no children, else the labels of the views under it (a focusable one left out: it speaks for itself), joined by ", ". Nothing for a hidden view.
| std::string aurore::View::getAccessibilityValue | ( | ) |
| ActionIterator aurore::View::getAction | ( | ActionIdentifier | identifier | ) |
The action registered under identifier, or getActions().end().
| ActionIterator aurore::View::getAction | ( | ButtonType | button | ) |
| const std::vector< std::shared_ptr< Action > > & aurore::View::getActions | ( | ) |
The actions registered on the view.
|
virtual |
The opacity drawn: the view's alpha times its parents'.
|
virtual |
The AppletFrame the view is in, or nullptr.
Reimplemented in aurore::Dialog, and aurore::Dropdown.
|
inline |
| float aurore::View::getAspectRatio | ( | ) |
|
inline |
|
inline |
|
inline |
|
inline |
| std::string aurore::View::getClassString | ( | ) | const |
The view's class name ("Label", "Box"…).
|
inline |
|
inline |
Whether the children are clipped to the view's frame when drawn.
|
inline |
| std::string aurore::View::getCustomNavigationRouteId | ( | FocusDirection | direction | ) |
| View * aurore::View::getCustomNavigationRoutePtr | ( | FocusDirection | direction | ) |
|
inlineprotectedvirtual |
Reimplemented in CadranDigits, HeaderSetting, aurore::Box, aurore::Button, aurore::DetailCell, aurore::RadioCell, aurore::Dialog, aurore::Dropdown, aurore::Label, aurore::SidebarItem, and aurore::Slider.
|
inlineprotectedvirtual |
The view's own role and label when the app gave none.
Reimplemented in cadran::kit::Chip, CadranDigits, HeaderSetting, aurore::Button, aurore::BooleanCell, aurore::DetailCell, aurore::InputCell, aurore::InputNumericCell, aurore::RadioCell, aurore::SliderCell, aurore::Dialog, aurore::Dropdown, aurore::Label, aurore::SidebarItem, and aurore::Slider.
|
inlineprotectedvirtual |
Reimplemented in aurore::RadioCell, and aurore::SidebarItem.
|
inlineprotectedvirtual |
Reimplemented in aurore::BooleanCell, aurore::DetailCell, and aurore::Slider.
|
virtual |
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 :
Reimplemented in ScrollView, aurore::Box, aurore::SliderCell, aurore::ContextMenu, aurore::HScrollingFrame, aurore::RecyclingGrid, aurore::HRecyclerFrame, aurore::ScrollingFrame, and aurore::Slider.
|
inline |
Gets detached position of the view.
|
static |
Resolves the value of the given XML attribute file path. Returns the full path of the resource if it starts with "@res/", returns the path as it is otherwise. A resource path with ".." is refused: "".
| GenericEvent * aurore::View::getFocusEvent | ( | ) |
Fired with the view when it gains the focus.
| GenericEvent * aurore::View::getFocusLostEvent | ( | ) |
Fired with the view when it loses the focus.
|
virtual |
Reimplemented in aurore::HScrollingFrame, and aurore::ScrollingFrame.
| Rect aurore::View::getFrame | ( | ) |
The view's position and size on the screen, after layout (getX(), getY(), getWidth(), getHeight()).
| const std::vector< GestureRecognizer * > & aurore::View::getGestureRecognizers | ( | ) |
Get the vector of all gesture recognizers attached to that view.
| float aurore::View::getHeight | ( | bool | includeCollapse = true | ) |
|
inline |
The view's id (setId, or the XML's id attribute), "" for none.
| Rect aurore::View::getLocalFrame | ( | ) |
The position and size in the parent, as laid out by Yoga.
| float aurore::View::getLocalX | ( | ) |
| float aurore::View::getLocalY | ( | ) |
| float aurore::View::getMarginLeft | ( | ) |
| float aurore::View::getMarginRight | ( | ) |
| unsigned aurore::View::getMaximumAllowedXMLElements | ( | ) |
|
virtual |
Returns the "nearest" view with the corresponding id, or nullptr if none has been found. "Nearest" means the closest in the vicinity of this view. The siblings are searched as well as its children.
Research is done by traversing the tree upwards, starting from this view. The current algorithm is very inefficient.
|
virtual |
Returns 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
Reimplemented in ScrollView, aurore::Box, aurore::HScrollingFrame, aurore::RecyclerContentBox, aurore::RecyclingGridContentBox, and aurore::ScrollingFrame.
| Box * aurore::View::getParent | ( | ) |
| Activity * aurore::View::getParentActivity | ( | ) |
The activity the view is in, through its parents; nullptr when none.
| void * aurore::View::getParentUserData | ( | ) |
|
inline |
|
inline |
|
virtual |
Returns the duration of the view show / hide animation.
Reimplemented in aurore::Dropdown.
|
static |
Resolves the value of the given XML attribute string. Applies i18n if the value is an "@i18n/" string, returns the string as it is otherwise.
|
virtual |
The style properties the states and transitions work on, by name: backgroundColor, borderColor, lineColor (colours), borderThickness, cornerRadius, alpha, scale (numbers); a Label adds textColor, a Rectangle color, a Button textColor. Only properties that are drawn, never laid out. A subclass adds its own by overriding both and calling the base for the others.
Reimplemented in CadranDigits, CadranIcon, aurore::Button, aurore::Label, aurore::ProgressSpinner, and aurore::Rectangle.
|
inline |
| std::string aurore::View::getThemeColor | ( | const std::string & | property | ) |
The key setThemeColor gave property, "" when it has none.
|
virtual |
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.
Reimplemented in aurore::Box.
| Visibility aurore::View::getVisibility | ( | ) |
Gets the visibility of the view.
| float aurore::View::getWidth | ( | ) |
The size as laid out by Yoga; the height without the collapse when includeCollapse is false.
| float aurore::View::getX | ( | ) |
The position on the screen, in layout units: the parents' positions and translations added.
|
static |
Get the XML document for the XML file, creating a new one if none is cached.
| float aurore::View::getY | ( | ) |
| YGNode * aurore::View::getYGNode | ( | ) |
The view's Yoga node.
|
virtual |
Handles a child XML element.
You can redefine this method to handle child XML like as you want in your own views.
If left unimplemented, will throw an exception because raw views cannot handle child XML elements (Boxes can).
Reimplemented in aurore::Box, aurore::AppletFrame, and aurore::TabFrame.
| bool aurore::View::hasCustomNavigationRouteById | ( | FocusDirection | direction | ) |
| bool aurore::View::hasCustomNavigationRouteByPtr | ( | FocusDirection | direction | ) |
| bool aurore::View::hasParent | ( | ) |
| bool aurore::View::hasStyleState | ( | StyleState | state | ) |
|
virtual |
Hides the view with a fade out animation.
|
virtual |
Hides the view with a fade out animation, or no animation at all.
Reimplemented in aurore::Dropdown.
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.
Reimplemented in HeaderSetting, and aurore::Box.
| void aurore::View::interruptGestures | ( | bool | onlyIfUnsureState | ) |
Interrupt every recognizer on this view. If onlyIfUnsureState == true, only recognizers with current state UNSURE will be interupted
|
virtual |
Triggers a layout of the whole view tree. Must be called after a yoga node property is changed.
Only methods that change yoga nodes properties should call this method.
| bool aurore::View::isAccessibilitySelected | ( | ) |
| bool aurore::View::isCollapsed | ( | ) |
Whether collapse() hid the view.
|
inline |
| bool aurore::View::isDetached | ( | ) |
See detach().
| bool aurore::View::isFocusable | ( | ) |
Whether the view takes the focus: focusable, and visible.
| bool aurore::View::isFocused | ( | ) |
Whether the view has the focus.
| bool aurore::View::isHidden | ( | ) |
Whether hide() hid the view.
| bool aurore::View::isPtrLocked | ( | ) |
Whether a ptrLock() holds the view.
|
virtual |
Is this view translucent?
If you override it please return
|| View::isTranslucent() to keep the fadeIn transition
Reimplemented in aurore::ContextMenu, aurore::Dialog, aurore::Dropdown, and aurore::EditTextDialog.
| bool aurore::View::isWireframeEnabled | ( | ) |
| bool aurore::View::isXMLAttributeValid | ( | std::string | attributeName | ) |
Returns if the given XML attribute name is valid for that view.
| void aurore::View::keepSubscription | ( | Subscription && | subscription | ) |
Keeps subscription (an Observable's) as long as the view lives: what binds a view to an Observable ends with the view.
|
inlinestatic |
An enumeration's values, sorted, for an error message.
|
virtual |
Fired when focus is gained.
Reimplemented in aurore::Box, aurore::Button, aurore::HScrollingFrame, aurore::Label, aurore::RecyclerCell, aurore::ScrollingFrame, and aurore::SidebarItem.
|
virtual |
Fired when focus is lost.
Reimplemented in ScrollView, aurore::Box, aurore::Button, aurore::Label, aurore::RecyclerCell, and aurore::SidebarItem.
|
inlinevirtual |
Called when a layout pass ends on that view.
Reimplemented in aurore::EditTextDialog, aurore::HScrollingFrame, aurore::Hints, aurore::Image, aurore::Label, aurore::RecyclerFrame, aurore::RecyclingGrid, aurore::HRecyclerFrame, aurore::ScrollingFrame, and aurore::Slider.
|
virtual |
Fired when focus is gained on this view's parent, or the parent of the parent...
Reimplemented in aurore::Box, and aurore::Label.
|
virtual |
Fired when focus is lost on one of this view's parents. Works similarly to onParentFocusGained().
Reimplemented in aurore::Box, and aurore::Label.
|
inlinevirtual |
Called when the show() animation (fade in) ends
|
inlinevirtual |
Called on every view of the screens when the text scale changes (Application::setTextScale): a view that measures text marks itself dirty here.
Reimplemented in CadranDigits, aurore::Label, and aurore::RecyclerCell.
|
virtual |
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.
Reimplemented in aurore::Box, aurore::ContextMenu, aurore::RecyclerFrame, aurore::RecyclingGrid, aurore::HRecyclerFrame, and aurore::BatteryWidget.
|
inlinevirtual |
Fired when the window size changes, after updating layout.
Reimplemented in aurore::Box.
| void aurore::View::overrideTheme | ( | Theme * | newTheme | ) |
Forces this view and its children to use the specified theme.
| void aurore::View::playClickAnimation | ( | bool | reverse = false, |
| bool | animateBack = true, |
||
| bool | force = false |
||
| ) |
Plays the click animation (the flash over the view).
| void aurore::View::present | ( | View * | view | ) |
Pushes view as the content of the view's AppletFrame (a page inside the frame).
| void aurore::View::ptrLock | ( | ) |
Keeps the view from being deleted by the deletion pool while a pointer to it is in use (counted: one ptrUnlock() per ptrLock()).
| void aurore::View::ptrUnlock | ( | ) |
| ActionIdentifier aurore::View::registerAction | ( | AuroreKeyCombination | key, |
| const ActionListener & | actionListener, | ||
| bool | allowRepeating = false |
||
| ) |
An action on a keyboard key (a combination with modifiers): no hint, no sound.
| ActionIdentifier aurore::View::registerAction | ( | const std::string & | hintText, |
| ButtonType | button, | ||
| const ActionListener & | actionListener, | ||
| bool | hidden = false, |
||
| bool | allowRepeating = false, |
||
| enum Sound | sound = SOUND_NONE |
||
| ) |
Registers an action with the given parameters. The listener will be fired when the user presses the key when the view is focused.
The listener should return true if the action was consumed, false otherwise. The sound will only be played if the listener returned true.
A hidden action will not show up in the bottom-right hints.
Returns the identifier for the action, so it can be unregistered later on. Returns ACTION_NONE if the action was not registered.
| ActionIdentifier aurore::View::registerAction | ( | const std::string & | hintText, |
| ControllerButton | button, | ||
| const ActionListener & | actionListener, | ||
| bool | hidden = false, |
||
| bool | allowRepeating = false, |
||
| enum Sound | sound = SOUND_NONE |
||
| ) |
The same, on a controller button.
| void aurore::View::registerAutoXMLAttribute | ( | std::string | name, |
| AutoAttributeHandler | handler | ||
| ) |
Register a new XML attribute with the given name and handler method. You can have multiple attributes registered with the same name but different types / handlers, except if the type is string.
The method will be called if the attribute has the value "auto".
| void aurore::View::registerBoolXMLAttribute | ( | std::string | name, |
| BoolAttributeHandler | handler | ||
| ) |
Register a new XML attribute with the given name and handler method. You can have multiple attributes registered with the same name but different types / handlers, except if the type is string.
The method will be called if the attribute has a boolean value ("true" or "false").
| void aurore::View::registerClickAction | ( | const ActionListener & | actionListener | ) |
Shortcut to register a generic "A OK" click action.
| void aurore::View::registerColorXMLAttribute | ( | std::string | name, |
| ColorAttributeHandler | handler | ||
| ) |
Register a new XML attribute with the given name and handler method. You can have multiple attributes registered with the same name but different types / handlers, except if the type is string.
The method will be called if the attribute has a color value ("#XXXXXX" or "#XXXXXXXX") or a @theme value.
| void aurore::View::registerFilePathXMLAttribute | ( | std::string | name, |
| FilePathAttributeHandler | handler | ||
| ) |
Register a new XML attribute with the given name and handler method. You can have multiple attributes registered with the same name but different types / handlers, except if the type is string.
The method will be called if the attribute has a file path value ("@res/" or raw path).
| void aurore::View::registerFloatXMLAttribute | ( | std::string | name, |
| FloatAttributeHandler | handler | ||
| ) |
Register a new XML attribute with the given name and handler method. You can have multiple attributes registered with the same name but different types / handlers, except if the type is string.
The method will be called if the attribute has an integer, float, @style or "px" value.
| void aurore::View::registerPercentageXMLAttribute | ( | std::string | name, |
| FloatAttributeHandler | handler | ||
| ) |
Register a new XML attribute with the given name and handler method. You can have multiple attributes registered with the same name but different types / handlers, except if the type is string.
The method will be called if the attribute has a percentage value (an integer with "%" suffix). The given float value is guaranteed to be between 0.0f and 1.0f.
| void aurore::View::registerStringXMLAttribute | ( | std::string | name, |
| StringAttributeHandler | handler | ||
| ) |
Register a new XML attribute with the given name and handler method. You can have multiple attributes registered with the same name but different types / handlers, except if the type is string.
The method will be called if the attribute has a string or @i18n value.
If you use string as a type, you can only have one handler for the attribute.
| void aurore::View::removeFromSuperView | ( | bool | free = true | ) |
Removes view from it's parent
| bool aurore::View::removeGestureRecognizer | ( | GestureRecognizer * | recognizer | ) |
Removes a recognizer added with addGestureRecognizer and deletes it (false if the view did not have it). Not from one of its own callbacks: the gesture being handled still uses it.
| void aurore::View::resetClickAnimation | ( | ) |
| void aurore::View::resolveBindings | ( | Activity * | activity = nullptr | ) |
Resolves the bindings left pending in this view and its children against activity's models (its own activity's when nullptr), then the application's. Called when a tree joins an activity.
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
| void aurore::View::setAccessibilityLabel | ( | const std::string & | label | ) |
| void aurore::View::setAccessibilityRole | ( | AccessibilityRole | role | ) |
What the view is and what it says, for the focus announcer (Application::setFocusAnnouncer). By default a Label says its text, a Button and the cells their title, a focusable Box the texts shown in it. XML: accessibilityRole="button", accessibilityLabel="@i18n/…".
| void aurore::View::setAccessibilitySelected | ( | bool | selected | ) |
The chosen one of its kind (a picker's current row, a checked radio cell): "selected" is said after its value.
| void aurore::View::setAccessibilityValue | ( | const std::string & | value | ) |
What the view is set to, said after its role: a cell's detail, "on" or "off" for a BooleanCell, "40%" for a slider. XML: accessibilityValue="…".
| void aurore::View::setActionAvailable | ( | enum ControllerButton | button, |
| bool | available | ||
| ) |
Turns the action on button on or off (an action off runs nothing and shows no hint).
| void aurore::View::setActionHidden | ( | enum ControllerButton | button, |
| bool | hidden | ||
| ) |
Shows or hides the hint of the action on button (the action still works), as registerAction's hidden but while the view lives.
| void aurore::View::setActionsAvailable | ( | bool | available | ) | const |
The same for every action of the view.
| void aurore::View::setAlignSelf | ( | AlignSelf | align | ) |
Overrides align items of the parent box.
Default is AUTO.
| void aurore::View::setAlpha | ( | float | alpha | ) |
The view's opacity, 0 to 1 (a transition when its style has one).
| void aurore::View::setAspectRatio | ( | float | value | ) |
The width over the height, kept by the layout (values <= 0 are ignored).
| void aurore::View::setBackground | ( | ViewBackground | background | ) |
How the view's background is drawn: none, the sidebar's, the backdrop, a plain colour or a gradient.
|
inline |
Sets the view shape background color.
|
inline |
Sets the background corner radii of the view. Only for vertical linear style.
| void aurore::View::setBackgroundLinearGradient | ( | NVGcolor | start, |
| NVGcolor | end, | ||
| ViewBackground | direction = ViewBackground::VERTICAL_LINEAR |
||
| ) |
Sets a linear gradient background for the view, from start to end: top to bottom (VERTICAL_LINEAR) or left to right (HORIZONTAL_LINEAR).
|
inline |
Sets the view shape border color.
|
inline |
Sets the view shape border thickness.
|
inlinevirtual |
Sets the view's text, for bind="text: …"; false when it has none.
Reimplemented in aurore::Button, aurore::DetailCell, aurore::RadioCell, and aurore::Label.
| void aurore::View::setBoxSizing | ( | BoxSizing | sizing | ) |
Sets what the width and height of the view measure.
Default is BORDER_BOX.
|
inline |
|
inline |
Sets the view shape corner radius (uniform). 0 means no rounded corners.
|
inline |
Sets the view shape corner radii individually. Order: top-left, top-right, bottom-right, bottom-left.
|
inline |
Enables / disable culling for that view.
To disable culling for all child views of a Box use setCullingEnabled on the box.
| void aurore::View::setCustomNavigationRoute | ( | FocusDirection | direction, |
| std::string | targetId | ||
| ) |
Sets a custom navigation route from this view to the target one, by ID. The final target view will be the "nearest" with the given ID.
Resolution of the ID to View is made when the navigation event occurs, not when the route is registered.
| void aurore::View::setCustomNavigationRoute | ( | FocusDirection | direction, |
| View * | target | ||
| ) |
Sets a custom navigation route from this view to the target one.
| void aurore::View::setDetachedPosition | ( | float | x, |
| float | y | ||
| ) |
Sets the position of the view, if detached.
| void aurore::View::setDetachedPositionX | ( | float | x | ) |
Sets the position X of the view, if detached.
| void aurore::View::setDetachedPositionY | ( | float | y | ) |
Sets the position Y of the view, if detached.
| void aurore::View::setDimensions | ( | float | width, |
| float | height | ||
| ) |
Shortcut to setWidth + setHeight.
Only does one layout pass instead of two when using the two methods separately.
|
inline |
Sets the view to be focusable.
Required to be able to use actions that need focus on that view (such as an A press).
|
inline |
Sets the sound to play when this view gets focused.
| void aurore::View::setGrow | ( | float | grow | ) |
Sets the grow factor of the view, aka the percentage of remaining space to give this view, in the containing box axis. Opposite of shrink. Default is 0.0f;
| void aurore::View::setHeight | ( | float | height | ) |
Sets the preferred height of the view. Use aurore::View::AUTO to have the layout automatically resize the view.
If set to anything else than AUTO, the view is guaranteed to never shrink below the given height.
| void aurore::View::setHeightPercentage | ( | float | percentage | ) |
Sets the preferred height of the view in percentage of the parent view height. Between 0.0f and 100.0f.
|
inline |
No click animation when the view is clicked.
|
inline |
If set to true, the highlight will be hidden for this view.
|
inline |
If set to true, the highlight background will be hidden for this view (the white rectangle that goes behind the view, replacing the usual background shape).
|
inline |
If set to true, the highlight border will be hidden for this view.
|
inline |
Sets the highlight rectangle corner radius.
|
static |
Whether the highlight's border glides from the view that had the focus to the next one (140 ms), rather than jumping. On by default.
|
inline |
Sets the highlight padding of the view, aka the space between the highlight rectangle and the view. The highlight rect is enlarged, the view is untouched.
| void aurore::View::setId | ( | std::string | id | ) |
Sets the id of the view.
| void aurore::View::setInFadeAnimation | ( | bool | translucent | ) |
If set to true, will force the view to be translucent.
|
inline |
Sets the bottom line thickness. Use setLineColor() to change the line color.
The "line" is separate from the shape "border".
|
inline |
Sets the line color for the view. To be used with setLineTop(), setLineRight()...
The "line" is separate from the shape "border".
|
inline |
Sets the left line thickness. Use setLineColor() to change the line color.
The "line" is separate from the shape "border".
|
inline |
Sets the right line thickness. Use setLineColor() to change the line color.
The "line" is separate from the shape "border".
|
inline |
Sets the top line thickness. Use setLineColor() to change the line color.
The "line" is separate from the shape "border".
| void aurore::View::setMarginBottom | ( | float | right | ) |
Sets the bottom margin of the view, aka the space that separates this view and the surrounding ones.
Only works with views that have parents - top level views that are pushed on the stack don't have parents.
Use aurore::View::AUTO to have the layout automatically select the margin.
| void aurore::View::setMarginLeft | ( | float | left | ) |
Sets the right margin of the view, aka the space that separates this view and the surrounding ones.
Only works with views that have parents - top level views that are pushed on the stack don't have parents.
Use aurore::View::AUTO to have the layout automatically select the margin.
| void aurore::View::setMarginRight | ( | float | right | ) |
Sets the right margin of the view, aka the space that separates this view and the surrounding ones.
Only works with views that have parents - top level views that are pushed on the stack don't have parents.
Use aurore::View::AUTO to have the layout automatically select the margin.
| void aurore::View::setMargins | ( | float | top, |
| float | right, | ||
| float | bottom, | ||
| float | left | ||
| ) |
Sets the margin of the view, aka the space that separates this view and the surrounding ones in all 4 directions.
Use aurore::View::AUTO to have the layout automatically select the margin.
Only works with views that have parents - top level views that are pushed on the stack don't have parents.
Only does one layout pass instead of four when using the four methods separately.
| void aurore::View::setMarginTop | ( | float | top | ) |
Sets the top margin of the view, aka the space that separates this view and the surrounding ones.
Only works with views that have parents - top level views that are pushed on the stack don't have parents.
Use aurore::View::AUTO to have the layout automatically select the margin.
| void aurore::View::setMaxHeight | ( | float | maxHeight | ) |
Sets the maximum height of the view, in pixels.
This constraint is stronger than the grow factor: the view is guaranteed to never be larger than the given max height.
Use View::AUTO to disable the max height constraint.
| void aurore::View::setMaxHeightPercentage | ( | float | percentage | ) |
Sets the maximum height of the view, in parent height percentage.
This constraint is stronger than the grow factor: the view is guaranteed to never be larger than the given max height.
Use View::AUTO to disable the max height constraint.
| void aurore::View::setMaximumAllowedXMLElements | ( | unsigned | max | ) |
Sets the maximum number of allowed children XML elements when using a view of that class in an XML file.
| void aurore::View::setMaxWidth | ( | float | maxWidth | ) |
Sets the maximum width of the view, in pixels.
This constraint is stronger than the grow factor: the view is guaranteed to never be larger than the given max width.
Use View::AUTO to disable the max width constraint.
| void aurore::View::setMaxWidthPercentage | ( | float | percentage | ) |
Sets the maximum width of the view, in parent width percentage.
This constraint is stronger than the grow factor: the view is guaranteed to never be larger than the given max width.
Use View::AUTO to disable the max width constraint.
| void aurore::View::setMinHeight | ( | float | minHeight | ) |
Sets the minimum height of the view, in pixels.
This constraint is stronger than the grow factor: the view is guaranteed to never be less than the given max height.
Use View::AUTO to disable the min height constraint.
| void aurore::View::setMinHeightPercentage | ( | float | percentage | ) |
Sets the minimum height of the view, in parent height percentage.
This constraint is stronger than the grow factor: the view is guaranteed to never be less than the given max height.
Use View::AUTO to disable the min height constraint.
| void aurore::View::setMinWidth | ( | float | minWidth | ) |
Sets the minimum width of the view, in pixels.
This constraint is stronger than the grow factor: the view is guaranteed to never be less than the given min width.
Use View::AUTO to disable the min width constraint.
| void aurore::View::setMinWidthPercentage | ( | float | percentage | ) |
Sets the minimum width of the view, in parent width percentage.
This constraint is stronger than the grow factor: the view is guaranteed to never be less than the given max width.
Use View::AUTO to disable the min width constraint.
| void aurore::View::setParent | ( | Box * | parent, |
| void * | parentUserdata = nullptr |
||
| ) |
The box this view is in (Box::addView sets it; parentUserdata is the box's own).
| void aurore::View::setParentActivity | ( | Activity * | activity | ) |
| void aurore::View::setPositionBottom | ( | float | pos | ) |
Sets the bottom position of the view, in pixels.
The behavior of this attribute changes depending on the position type of the view.
If relative, it will simply offset the view by the given amount.
If absolute, it will behave like the "display: absolute;" CSS property and move the view freely in its parent. Use 0 to snap to the parent bottom edge. Absolute positioning ignores padding.
Use View::AUTO to disable (not the same as 0).
| void aurore::View::setPositionBottomPercentage | ( | float | percentage | ) |
Sets the bottom position of the view, in percentage.
The behavior of this attribute changes depending on the position type of the view.
| void aurore::View::setPositionLeft | ( | float | pos | ) |
Sets the left position of the view, in pixels.
The behavior of this attribute changes depending on the position type of the view.
If relative, it will simply offset the view by the given amount.
If absolute, it will behave like the "display: absolute;" CSS property and move the view freely in its parent. Use 0 to snap to the parent left edge. Absolute positioning ignores padding.
Use View::AUTO to disable (not the same as 0).
| void aurore::View::setPositionLeftPercentage | ( | float | percentage | ) |
Sets the left position of the view, in percents.
The behavior of this attribute changes depending on the position type of the view.
| void aurore::View::setPositionRight | ( | float | pos | ) |
Sets the right position of the view, in pixels.
The behavior of this attribute changes depending on the position type of the view.
If relative, it will simply offset the view by the given amount.
If absolute, it will behave like the "display: absolute;" CSS property and move the view freely in its parent. Use 0 to snap to the parent right edge. Absolute positioning ignores padding.
Use View::AUTO to disable (not the same as 0).
| void aurore::View::setPositionRightPercentage | ( | float | percentage | ) |
Sets the right position of the view, in percents.
The behavior of this attribute changes depending on the position type of the view.
| void aurore::View::setPositionTop | ( | float | pos | ) |
Sets the top position of the view, in pixels.
The behavior of this attribute changes depending on the position type of the view.
If relative, it will simply offset the view by the given amount.
If absolute, it will behave like the "display: absolute;" CSS property and move the view freely in its parent. Use 0 to snap to the parent top edge. Absolute positioning ignores padding.
Use View::AUTO to disable (not the same as 0).
| void aurore::View::setPositionTopPercentage | ( | float | percentage | ) |
Sets the top position of the view, in percents.
The behavior of this attribute changes depending on the position type of the view.
| void aurore::View::setPositionType | ( | PositionType | type | ) |
Sets the "position type" of the view, aka the behavior of the 4 position attributes.
Default is RELATIVE.
| void aurore::View::setScale | ( | float | scale | ) |
Draws the view (its background, content and highlight) scaled around its centre, without laying anything out again: a pressed or focused view grown or shrunk a little. Touch hit-testing keeps the unscaled frame. XML: scale="1.05".
| void aurore::View::setScaleX | ( | float | scale | ) |
| void aurore::View::setScaleY | ( | float | scale | ) |
|
inline |
Sets the view shape shadow type. Default is NONE.
|
inline |
Sets the shadow visibility.
| void aurore::View::setShrink | ( | float | shrink | ) |
Sets the shrink factor of the view, aka the percentage of space the view is allowed to shrink for if there is not enough space for everyone in the contaning box axis. Opposite of grow. Default is 1.0f;
| void aurore::View::setSize | ( | Size | size | ) |
Sets the preferred width and height of the view. Use aurore::View::AUTO to have the layout automatically resize the view.
If set to anything else than AUTO, the view is guaranteed to never shrink below the given height.
| bool aurore::View::setStateStyle | ( | StyleState | state, |
| const std::string & | property, | ||
| const std::string & | value | ||
| ) |
While state is on, the style property property takes value (as XML writes it: "#rrggbb", "rgba(…)", "@theme/…", "4", "@style/…"), and goes back to what it was when no state styles it any more. XML: focus:backgroundColor="@theme/aurore/accent", pressed:scale="0.96", disabled:alpha="0.4", hover:borderColor="#ffffff". A "@theme/" value is read when the state comes on, so it follows the theme. Returns false for a property the view does not have.
|
virtual |
Reimplemented in CadranDigits, CadranIcon, aurore::Button, aurore::Label, aurore::ProgressSpinner, and aurore::Rectangle.
| void aurore::View::setStyleState | ( | StyleState | state, |
| bool | on | ||
| ) |
Turns a style state on or off. FOCUS, PRESSED and HOVER follow the focus, the click animation and the mouse by themselves; DISABLED is the app's (a Button sets it from its ButtonState).
|
inline |
The area of the theme's decorations this view is (docs/themes.md, Decorations): HEADER, SIDEBAR or DIALOG. Its picture (backdrop.header, .sidebar, .dialog) is drawn over the view's background, under its content, in its corners. A DIALOG in a translucent colour over a theme's background image has that image drawn under it first, dimmed by aurore/backdrop, so that it does not show the screen behind it. A HEADER is drawn across the whole width of its parent (an AppletFrame), when that parent is a screen's (not in a dialog). NONE by default; the core's header, sidebar, dialogs and dropdowns are set.
| bool aurore::View::setThemeColor | ( | const std::string & | property, |
| const std::string & | key | ||
| ) |
Draws the style property property (backgroundColor, textColor…, see getStyleProperty) in the theme colour key ("aurore/text"), now and again each time the theme changes (a theme file, the light or dark variant). XML does it for every "@theme/…" colour. A colour the app sets on the property afterwards (setTextColor…) replaces the key. An empty key only forgets the property's key (the colour stays). Returns false for a property the view does not have or an unknown key.
| bool aurore::View::setTransition | ( | const std::string & | spec | ) |
Animates the changes of style properties instead of applying them at once, the state styles' as well as the setters' (setBackgroundColor…): "backgroundColor 150ms ease-out, scale 120ms" or "all 200ms". The easing is linear, ease, ease-in, ease-out, ease-in-out, or one of tweeny's (quadraticOut, backOut…). Skipped while the app asks for reduced motion (Application::getReduceMotion). An empty spec removes them. XML: transition="…". Returns false (and changes nothing) for a spec it cannot read.
| void aurore::View::setTranslationX | ( | float | translateX | ) |
Sets the X translation of this view.
Translation is applied after the layout phase. Use relative position and setPosition methods if possible instead.
| void aurore::View::setTranslationY | ( | float | translateY | ) |
Sets the Y translation of this view.
Translation is applied after the layout phase. Use relative position and setPosition methods if possible instead.
| void aurore::View::setVisibility | ( | Visibility | visibility | ) |
Sets the visibility of the view.
| void aurore::View::setWidth | ( | float | width | ) |
Sets the preferred width of the view. Use aurore::View::AUTO to have the layout automatically resize the view.
If set to anything else than AUTO, the view is guaranteed to never shrink below the given width.
| void aurore::View::setWidthPercentage | ( | float | percentage | ) |
Sets the preferred width of the view in percentage of the parent view width. Between 0.0f and 100.0f.
| void aurore::View::setWireframeEnabled | ( | bool | wireframe | ) |
Wireframe mode allows you to see the view size and margins (and padding if applicable) directly in your app.
Useful to diagnose views misplacements or display bugs.
|
protected |
| void aurore::View::shakeHighlight | ( | FocusDirection | direction | ) |
Shakes the focus highlight towards direction: there is nothing to go to there.
|
virtual |
Shows the view with a fade in animation.
|
virtual |
Shows the view with a fade in animation, or no animation at all.
Reimplemented in aurore::Dropdown.
|
inlineprotected |
Called by a style property's setter before it changes the value: true when a transition takes the change over (the setter then returns without changing anything). Cheap for a view with no transition.
| void aurore::View::unregisterAction | ( | ActionIdentifier | identifier | ) |
Unregisters an action with the given identifier.
| void aurore::View::updateActionHint | ( | enum ControllerButton | button, |
| const std::string & | hintText | ||
| ) |
Changes the hint of the action on button.
| void aurore::View::updateAppletFrameItem | ( | ) |
|
inlinevirtual |
Called when the view will appear on screen, before or after layout().
Can be called if the view has already appeared, so be careful.
Reimplemented in ScrollView, aurore::Box, aurore::HScrollingFrame, aurore::ScrollingFrame, and aurore::ProgressSpinner.
|
inlinevirtual |
Called when the view will disappear from the screen.
Can be called if the view has already disappeared, so be careful.
Reimplemented in aurore::Box, and aurore::ProgressSpinner.
|
friend |
| Animatable aurore::View::alpha = 1.0f |
|
staticconstexpr |
A size or position left to the layout (auto in XML).
|
protected |
|
static |
The XML resource being loaded, named in the parse errors of a document given as a string.
|
inlinestatic |
A folder whose xml/ files replace the built-in ones of the same name in createFromXMLResource(); one that cannot be read is logged, and the built-in one used.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |