CoreComponents 3.0.0
A Modern C++ Toolkit
Loading...
Searching...
No Matches
View::State Struct Reference

Internal state. More...

#include <View>

Inheritance diagram for View::State:

Public Member Functions

 ~State ()
 Virtual destructor.
 
const char * objectName () const
 Get the object name (for debugging)
 
void objectName (const char *name)
 Set the object name
 
bool hasParent () const
 Check if this view has a parent
 
View parent () const
 Get the parent.
 
const Set< View > & children () const
 Get set of all children.
 
const Set< View > & visibleChildren () const
 Get set of visible children.
 
void attach (const Object &other)
 Attach a non-visual object (e.g.
 
void attach (Function< void()> &&f)
 Convenience method for attaching a monitor.
 
void deplete ()
 Remove all children.
 
double x () const
 Get pos().x()
 
double y () const
 Get pos().y()
 
double width () const
 Get width.
 
double height () const
 Get height.
 
double innerWidth () const
 Get inner width.
 
double innerHeight () const
 Get inner height.
 
Layout layout () const
 Get the layout.
 
double expandableWidth (double width) const
 Get the expandable width of this view within its parent layout.
 
double top () const
 Get y-coordinate of this view's top border.
 
double bottom () const
 Get y-coordinate of this view's bottom border.
 
double left () const
 Get x-coordinate of this view's left border.
 
double right () const
 Get x-coordinate of this view's right border.
 
Point topLeft () const
 Get this view's top-left corner.
 
Point topCenter () const
 Get this view's top-center point.
 
Point topRight () const
 Get this view's top-right corner.
 
Point bottomLeft () const
 Get this view's bottom-left corner.
 
Point bottomCenter () const
 
Point bottomRight () const
 Get this view's bottom-right corner.
 
Point centerLeft () const
 Get this view's center-left point.
 
Point centerRight () const
 Get this view's center-right point.
 
void topLeft (Point newValue)
 Get this view's top-left corner.
 
void topCenter (Point newValue)
 Get this view's top-center point.
 
void topRight (Point newValue)
 Get this view's top-right corner.
 
void bottomLeft (Point newValue)
 Get this view's bottom-left corner.
 
void bottomCenter (Point newValue)
 Get this view's bottom-center point.
 
void bottomRight (Point newValue)
 Get this view's bottom-right corner.
 
void centerLeft (Point newValue)
 Get this view's center-left point.
 
void centerRight (Point newValue)
 Get this view's center-right point.
 
void center (Point newValue)
 Make this view's center match newValue.
 
void topLeft (Definition< Point > &&a)
 Get this view's top-left corner.
 
void topCenter (Definition< Point > &&a)
 Get this view's top-center point.
 
void topRight (Definition< Point > &&a)
 Get this view's top-right corner.
 
void bottomLeft (Definition< Point > &&a)
 Get this view's bottom-left corner.
 
void bottomCenter (Definition< Point > &&a)
 Get this view's bottom-center point.
 
void bottomRight (Definition< Point > &&a)
 Get this view's bottom-right corner.
 
void centerLeft (Definition< Point > &&a)
 Get this view's center-left point.
 
void centerRight (Definition< Point > &&a)
 Get this view's center-right point.
 
void center (Definition< Point > &&a)
 Make this view's center match newValue.
 
void centerInParent ()
 Anchor this view's center to its parent's center.
 
void layout (const Layout &newValue)
 Set the layout
 
Point mapToGlobal (Point l) const
 Map view coordinates l to window coordinates
 
Point mapToLocal (Point g) const
 Map window coordinates g to view coordinates
 
Point mapToChild (const View &child, Point l) const
 Map local coordinates l to child coordinates
 
Point mapToParent (const View &parent, Point l) const
 Map local coordinates l to parent coordinates
 
View findChild (Point l) const
 Find the first child which contains local point l.
 
Control findControl (Point l) const
 Find the first control which contains local point l.
 
bool isParentOf (const View &other) const
 Check if this view is parent of other.
 
bool laysInsideOf (const View &other, double margin=0.) const
 Check if this view is fully visible inside other with given surrounding margin.
 
virtual Size preferredSize () const
 Get preferred size.
 
virtual Size minSize () const
 Get minimal size.
 
virtual Size maxSize () const
 Get maximal size.
 
virtual bool isOpaque () const
 Tells the graphics engine if all pixels of this view are fully opaque.
 
virtual bool isPainted () const
 Tells the graphics engine if this view has visible pixels.
 
virtual bool isStatic () const
 Tells the graphics engine if this view is static (i.e. is not changing with each frame)
 
virtual bool isPremultiplied () const
 Tells the underlying image contains a color tuple with premultiplied alpha.
 
Color basePaper () const
 Search upwards in the view hierarchy for the first valid background color
 
virtual bool withinBounds (Point l) const
 Check if local point l is inside this view.
 
bool containsLocal (Point l) const
 Check if local point l lays inside this view.
 
bool containsGlobal (Point g) const
 Check if global point l lays inside this view.
 
virtual void childReady (InOut< View > child)
 Called when a new child has been added.
 
virtual void childDone (InOut< View > child)
 Called after a child had been removed.
 
virtual void settled ()
 Called on the child after it has been added (ideal place for setting up easing behavior / transitions)
 
void add (const View &child)
 Add new child placed visually above all existing children.
 
void addAbove (const View &child)
 Add new child placed visually above all existing children.
 
void addBelow (const View &child)
 Add child place visually below all existing children.
 
void insertAt (Locator target, View child)
 Insert new child at target.
 
void insertAt (long index, const View &child)
 Insert new child at index.
 
void remove (const View &child)
 Remove a child.
 
virtual void insertChild (View child)
 Handles the insertion of new children.
 
virtual void removeChild (View child)
 Handles the removal of children.
 
void moveToTop ()
 Make this view be visible above any other visible sibling.
 
void moveToBottom ()
 Make this view be visible beneath any other visible sibling.
 
void moveToTop (View child)
 Make child visible above all its siblings.
 
void moveToBottom (View child)
 Make child visible beneath all its siblings.
 
Imageimage ()
 Painting target.
 
void image (const Image &newValue)
 Set painting target
 
View self () const
 Get a view from this state.
 
bool hasWindow () const
 
Window window () const
 Check if this view is already shown in a window.
 
bool sizing () const
 Window is currently undergoing size change
 
bool isHandheld () const
 Get window().display().isHandheld()
 
void clear (Color color)
 
void clear ()
 
void polish () override
 

Public Attributes

Property< void > paint
 Painting monitor
 
Property< Colorpaper
 Background color
 
Property< bool > visible { true }
 Visiblity
 
Property< double > opacity { 1. }
 Opacity (0: fully transparent, 1: fully opaque)
 
Property< bool > clip { false }
 Clip children views
 
Property< bool > moving { false }
 
Property< Pointpos
 Position within its parent
 
Property< Sizesize
 Size of this view
 
Property< Paddingpadding
 Padding to apply when adding this view to a layout
 
Property< Pointpivot
 Rotation center
 
Property< double > angle { 0 }
 Rotation angle
 
Property< double > scale { 1 }
 Zoom factor
 
Property< long > childrenCount { 0 }
 Number of children
 
Property< Viewdecoration
 
Trigger onWindowEntered
 Triggered when the pointer enters the window.
 
Trigger onWindowLeft
 Triggered when the pointer leaves the window.
 
Event< PointerEventonPointerPressed
 Pointing device is pressed over this view
 
Event< PointerEventonPointerReleased
 Pointing device is released over this view
 
Event< PointerEventonPointerMoved
 Pointer moved over this view
 
Event< MouseEventonMousePressed
 Mouse is pressed over this view
 
Event< MouseEventonMouseReleased
 Mouse is released over this view
 
Event< MouseEventonMouseMoved
 Mouse moved over this view
 
Event< FingerEventonFingerPressed
 Finger contact started over this view
 
Event< FingerEventonFingerReleased
 Finger contact ended over this view
 
Event< FingerEventonFingerMoved
 Finger contact moved over this view
 
Event< WheelEventonWheelMoved
 Mouse wheel is moved
 
Event< KeyEventonKeyPressed
 Keyboard key is pressed
 
Event< KeyEventonKeyReleased
 Keyboard key is released
 

Protected Member Functions

Id nextAboveId () const
 
Id nextBelowId () const
 
cairo_surface_t * cairoSurface () override
 
void update (UpdateReason reason)
 
virtual bool feedExposedEvent () const
 
virtual bool feedEnterEvent () const
 
virtual bool feedLeaveEvent () const
 
virtual bool feedFingerEvent (FingerEvent &event) const
 
virtual bool feedMouseEvent (MouseEvent &event) const
 
virtual bool feedWheelEvent (WheelEvent &event) const
 
virtual bool feedKeyEvent (KeyEvent &event) const
 

Protected Attributes

Id id_ { std::numeric_limits<double>::quiet_NaN() }
 
const char * objectName_ { "" }
 
Property< View::State * > parent_ { nullptr }
 
Property< Object::State * > window_
 
Property< Layoutlayout_
 
Property< double > width_
 
Property< double > height_
 
Set< Viewchildren_
 
Set< ViewvisibleChildren_
 
List< Objectattachments_
 
Image image_
 
Object context_
 
void * trackingHandle_ { nullptr }
 

Detailed Description

Internal state.

Constructor & Destructor Documentation

◆ ~State()

~State ( )
virtual

Virtual destructor.

Reimplemented from Object::State.

Member Function Documentation

◆ objectName() [1/2]

const char * objectName ( ) const

Get the object name (for debugging)

◆ objectName() [2/2]

void objectName ( const char * name)

Set the object name

◆ hasParent()

bool hasParent ( ) const

Check if this view has a parent

◆ parent()

View parent ( ) const

Get the parent.

◆ children()

const Set< View > & children ( ) const

Get set of all children.

◆ visibleChildren()

const Set< View > & visibleChildren ( ) const

Get set of visible children.

◆ attach() [1/2]

void attach ( const Object & other)

Attach a non-visual object (e.g.

a Monitor)

◆ attach() [2/2]

void attach ( Function< void()> && f)

Convenience method for attaching a monitor.

◆ deplete()

void deplete ( )

Remove all children.

◆ x()

double x ( ) const

Get pos().x()

◆ y()

double y ( ) const

Get pos().y()

◆ width()

double width ( ) const

Get width.

◆ height()

double height ( ) const

Get height.

◆ innerWidth()

double innerWidth ( ) const

Get inner width.

◆ innerHeight()

double innerHeight ( ) const

Get inner height.

◆ layout() [1/2]

Layout layout ( ) const

Get the layout.

◆ expandableWidth()

double expandableWidth ( double width) const

Get the expandable width of this view within its parent layout.

◆ top()

double top ( ) const

Get y-coordinate of this view's top border.

◆ bottom()

double bottom ( ) const

Get y-coordinate of this view's bottom border.

◆ left()

double left ( ) const

Get x-coordinate of this view's left border.

◆ right()

double right ( ) const

Get x-coordinate of this view's right border.

◆ topLeft() [1/3]

Point topLeft ( ) const

Get this view's top-left corner.

◆ topCenter() [1/3]

Point topCenter ( ) const

Get this view's top-center point.

◆ topRight() [1/3]

Point topRight ( ) const

Get this view's top-right corner.

◆ bottomLeft() [1/3]

Point bottomLeft ( ) const

Get this view's bottom-left corner.

◆ bottomRight() [1/3]

Point bottomRight ( ) const

Get this view's bottom-right corner.

◆ centerLeft() [1/3]

Point centerLeft ( ) const

Get this view's center-left point.

◆ centerRight() [1/3]

Point centerRight ( ) const

Get this view's center-right point.

◆ topLeft() [2/3]

void topLeft ( Point newValue)

Get this view's top-left corner.

◆ topCenter() [2/3]

void topCenter ( Point newValue)

Get this view's top-center point.

◆ topRight() [2/3]

void topRight ( Point newValue)

Get this view's top-right corner.

◆ bottomLeft() [2/3]

void bottomLeft ( Point newValue)

Get this view's bottom-left corner.

◆ bottomCenter() [1/2]

void bottomCenter ( Point newValue)

Get this view's bottom-center point.

◆ bottomRight() [2/3]

void bottomRight ( Point newValue)

Get this view's bottom-right corner.

◆ centerLeft() [2/3]

void centerLeft ( Point newValue)

Get this view's center-left point.

◆ centerRight() [2/3]

void centerRight ( Point newValue)

Get this view's center-right point.

◆ center() [1/2]

void center ( Point newValue)

Make this view's center match newValue.

◆ topLeft() [3/3]

void topLeft ( Definition< Point > && a)

Get this view's top-left corner.

◆ topCenter() [3/3]

void topCenter ( Definition< Point > && a)

Get this view's top-center point.

◆ topRight() [3/3]

void topRight ( Definition< Point > && a)

Get this view's top-right corner.

◆ bottomLeft() [3/3]

void bottomLeft ( Definition< Point > && a)

Get this view's bottom-left corner.

◆ bottomCenter() [2/2]

void bottomCenter ( Definition< Point > && a)

Get this view's bottom-center point.

◆ bottomRight() [3/3]

void bottomRight ( Definition< Point > && a)

Get this view's bottom-right corner.

◆ centerLeft() [3/3]

void centerLeft ( Definition< Point > && a)

Get this view's center-left point.

◆ centerRight() [3/3]

void centerRight ( Definition< Point > && a)

Get this view's center-right point.

◆ center() [2/2]

void center ( Definition< Point > && a)

Make this view's center match newValue.

◆ centerInParent()

void centerInParent ( )

Anchor this view's center to its parent's center.

◆ layout() [2/2]

void layout ( const Layout & newValue)

Set the layout

◆ mapToGlobal()

Point mapToGlobal ( Point l) const

Map view coordinates l to window coordinates

◆ mapToLocal()

Point mapToLocal ( Point g) const

Map window coordinates g to view coordinates

◆ mapToChild()

Point mapToChild ( const View & child,
Point l ) const

Map local coordinates l to child coordinates

◆ mapToParent()

Point mapToParent ( const View & parent,
Point l ) const

Map local coordinates l to parent coordinates

◆ findChild()

View findChild ( Point l) const

Find the first child which contains local point l.

◆ findControl()

Control findControl ( Point l) const

Find the first control which contains local point l.

◆ isParentOf()

bool isParentOf ( const View & other) const

Check if this view is parent of other.

◆ laysInsideOf()

bool laysInsideOf ( const View & other,
double margin = 0. ) const

Check if this view is fully visible inside other with given surrounding margin.

◆ preferredSize()

virtual Size preferredSize ( ) const
virtual

Get preferred size.

◆ minSize()

virtual Size minSize ( ) const
virtual

Get minimal size.

◆ maxSize()

virtual Size maxSize ( ) const
virtual

Get maximal size.

◆ isOpaque()

virtual bool isOpaque ( ) const
virtual

Tells the graphics engine if all pixels of this view are fully opaque.

◆ isPainted()

virtual bool isPainted ( ) const
virtual

Tells the graphics engine if this view has visible pixels.

◆ isStatic()

virtual bool isStatic ( ) const
virtual

Tells the graphics engine if this view is static (i.e. is not changing with each frame)

◆ isPremultiplied()

virtual bool isPremultiplied ( ) const
virtual

Tells the underlying image contains a color tuple with premultiplied alpha.

◆ basePaper()

Color basePaper ( ) const

Search upwards in the view hierarchy for the first valid background color

◆ withinBounds()

virtual bool withinBounds ( Point l) const
virtual

Check if local point l is inside this view.

◆ containsLocal()

bool containsLocal ( Point l) const

Check if local point l lays inside this view.

◆ containsGlobal()

bool containsGlobal ( Point g) const

Check if global point l lays inside this view.

◆ childReady()

void childReady ( InOut< View > child)
virtual

Called when a new child has been added.

◆ childDone()

void childDone ( InOut< View > child)
virtual

Called after a child had been removed.

◆ settled()

void settled ( )
virtual

Called on the child after it has been added (ideal place for setting up easing behavior / transitions)

◆ add()

void add ( const View & child)

Add new child placed visually above all existing children.

◆ addAbove()

void addAbove ( const View & child)

Add new child placed visually above all existing children.

◆ addBelow()

void addBelow ( const View & child)

Add child place visually below all existing children.

◆ insertAt() [1/2]

void insertAt ( Locator target,
View child )

Insert new child at target.

◆ insertAt() [2/2]

void insertAt ( long index,
const View & child )

Insert new child at index.

◆ remove()

void remove ( const View & child)

Remove a child.

◆ insertChild()

void insertChild ( View child)
virtual

Handles the insertion of new children.

◆ removeChild()

void removeChild ( View child)
virtual

Handles the removal of children.

◆ moveToTop() [1/2]

void moveToTop ( )

Make this view be visible above any other visible sibling.

◆ moveToBottom() [1/2]

void moveToBottom ( )

Make this view be visible beneath any other visible sibling.

◆ moveToTop() [2/2]

void moveToTop ( View child)

Make child visible above all its siblings.

◆ moveToBottom() [2/2]

void moveToBottom ( View child)

Make child visible beneath all its siblings.

◆ image() [1/2]

Image & image ( )

Painting target.

◆ image() [2/2]

void image ( const Image & newValue)

Set painting target

◆ self()

View self ( ) const

Get a view from this state.

◆ window()

Window window ( ) const

Check if this view is already shown in a window.

Get the window this view is shown in.

◆ sizing()

bool sizing ( ) const

Window is currently undergoing size change

◆ isHandheld()

bool isHandheld ( ) const

Get window().display().isHandheld()

Member Data Documentation

◆ paint

Property<void> paint

Painting monitor

◆ paper

Property<Color> paper

Background color

◆ visible

Property<bool> visible { true }

Visiblity

◆ opacity

Property<double> opacity { 1. }

Opacity (0: fully transparent, 1: fully opaque)

◆ clip

Property<bool> clip { false }

Clip children views

◆ pos

Position within its parent

◆ size

Property<Size> size

Size of this view

◆ padding

Property<Padding> padding

Padding to apply when adding this view to a layout

The padding also extends the views bounds in terms of event propagation.

See also
View::containsLocal(), View::containsGlobal()

◆ pivot

Property<Point> pivot

Rotation center

◆ angle

Property<double> angle { 0 }

Rotation angle

◆ scale

Property<double> scale { 1 }

Zoom factor

◆ childrenCount

Property<long> childrenCount { 0 }

Number of children

◆ onWindowEntered

Trigger onWindowEntered

Triggered when the pointer enters the window.

◆ onWindowLeft

Trigger onWindowLeft

Triggered when the pointer leaves the window.

◆ onPointerPressed

Event<PointerEvent> onPointerPressed

Pointing device is pressed over this view

◆ onPointerReleased

Event<PointerEvent> onPointerReleased

Pointing device is released over this view

◆ onPointerMoved

Event<PointerEvent> onPointerMoved

Pointer moved over this view

◆ onMousePressed

Event<MouseEvent> onMousePressed

Mouse is pressed over this view

◆ onMouseReleased

Event<MouseEvent> onMouseReleased

Mouse is released over this view

◆ onMouseMoved

Event<MouseEvent> onMouseMoved

Mouse moved over this view

◆ onFingerPressed

Event<FingerEvent> onFingerPressed

Finger contact started over this view

◆ onFingerReleased

Event<FingerEvent> onFingerReleased

Finger contact ended over this view

◆ onFingerMoved

Event<FingerEvent> onFingerMoved

Finger contact moved over this view

◆ onWheelMoved

Event<WheelEvent> onWheelMoved

Mouse wheel is moved

◆ onKeyPressed

Event<KeyEvent> onKeyPressed

Keyboard key is pressed

◆ onKeyReleased

Event<KeyEvent> onKeyReleased

Keyboard key is released