All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
MultiWidgets::Widget Class Reference

This class is the base class for all user interface elements in Cornerstone. More...

#include <MultiWidgets/Widget.hpp>

Inheritance diagram for MultiWidgets::Widget:
Stylish::CSSBoxModel MultiWidgets::InputGrabListener Stylish::Styleable Valuable::Node Valuable::Attribute Patterns::NotCopyable Valuable::Serializable Extensions::Circles::CircleMenuLauncher Extensions::Circles::CirclePlugin Extensions::Circles::Circles Extensions::Circles::CircleWidget Extensions::Draw::BasicDrawWidget Extensions::Draw::RGBSelector Extensions::Draw::Stroke Extensions::Effects::BlobsWidget Extensions::Effects::Champagne Extensions::Effects::Divisions Extensions::Effects::FluidWidget Extensions::Effects::Rectangles Extensions::Effects::ShaderEffect Extensions::LaunchList::LaunchList Extensions::LaunchStack::LaunchStack Extensions::LightBeings::Attractor Extensions::LightBeings::Beings Extensions::LightBeings::ColorPlace Extensions::LightBeings::Snake Extensions::MissileCmd::Entity Extensions::MissileCmd::GameWidget Extensions::MissileCmd::HighScore Extensions::MissileCmd::ScoreWidget Extensions::MissileCmd::Sky Extensions::MissileCmd::Turret Extensions::SpringField::Field Extensions::TimeLine::KeyPointList Extensions::TimeLine::MainWidget Extensions::TimeLine::TimeLineWidget Extensions::TimeLine::WheelItemWidget MultiWidgets::BaseMediaWidget MultiWidgets::BookWidget MultiWidgets::BrowserFrameWidget MultiWidgets::BrowserWidget MultiWidgets::CloudWidget MultiWidgets::DropShadowWidget MultiWidgets::FlippingWidget MultiWidgets::FrameBufferWidget MultiWidgets::ImageTileWidget MultiWidgets::InputVisualizerWidget MultiWidgets::ItemFlowWidget MultiWidgets::JavaScriptWidget MultiWidgets::KeyboardInterfaceWidget MultiWidgets::LayerWidget MultiWidgets::MarkerLauncherWidget MultiWidgets::RippleOverlayWidget MultiWidgets::ScrollAreaWidget MultiWidgets::SliderWidget MultiWidgets::TimerDialWidget MultiWidgets::VideoControlWidget MultiWidgets::ViewWidget MultiWidgets::WheelWidget WebBrowserCef::AddressBarWidget WebBrowserCef::BrowserFrameWidget WebBrowserCef::BrowserWidget WebBrowserCef::WebPageWidget

Classes

class  ChildIteratorT
 An iterator over values of map. This will skip over invalid children. More...
 

Public Types

typedef ChildIteratorT
< Children::iterator, Widget
ChildIterator
 Iterator for children. More...
 
typedef
Valuable::AttributeContainer
< std::multimap< float,
ChildItem, std::greater< float > > > 
Children
 Container for child widgets.
 
typedef ChildIteratorT
< Children::reverse_iterator,
Widget
ChildReverseIterator
 Reverse iterator for children. More...
 
typedef ChildIteratorT
< Children::const_iterator,
Widget
ConstChildIterator
 Iterator for children. More...
 
typedef ChildIteratorT
< Children::const_reverse_iterator,
Widget
ConstChildReverseIterator
 Reverse iterator for children. More...
 
enum  DisplayMode { DISPLAY_NONE, DISPLAY_BLOCK, DISPLAY_FLEX }
 Determines how Widget is displayed,. More...
 
typedef TrackedObjectIds FingerIds
 Finger id container.
 
enum  Flags {
  FLAGS_NONE = 0, DEPTH_CHANGED = (1 << 0), RENDER_CULL_CHILDREN = (1 << 2), AUTO_RAISE_TO_TOP = (1 << 3),
  FORCE_RENDERING = (1 << 4), LOCK_DEPTH = (1 << 5), FLAGS_DEFAULT = AUTO_RAISE_TO_TOP
}
 Standard flags for the Widget. More...
 
typedef TrackedObjectIds HandIds
 Hand id container.
 
enum  InputFlags {
  INPUT_NONE = 0, INPUT_TRANSLATE_X = (1 << 1), INPUT_TRANSLATE_Y = (1 << 2), INPUT_TRANSLATE_XY = INPUT_TRANSLATE_X | INPUT_TRANSLATE_Y,
  INPUT_TRANSLATE = INPUT_TRANSLATE_XY, INPUT_ROTATION = (1 << 3), INPUT_SCALE = (1 << 4), INPUT_MOTION = INPUT_TRANSLATE_XY | INPUT_ROTATION | INPUT_SCALE,
  INPUT_SINGLE_TAPS = (1 << 5), INPUT_PASS_TO_CHILDREN = (1 << 6), INPUT_KEEP_GRABS = (1 << 7), INPUT_ROTATE_ABOUT_INTERACTION_CENTER = (1 << 8),
  INPUT_OPERATORS = (1<<9), INPUT_INCLUDE_EVERYTHING_INSIDE = (1 << 10), INPUT_DEFAULT = INPUT_MOTION | INPUT_SINGLE_TAPS | INPUT_PASS_TO_CHILDREN | INPUT_OPERATORS | INPUT_KEEP_GRABS
}
 Flags that control input processing. More...
 
typedef TrackedObjectIds MarkerIds
 Marker id container.
 
typedef
Valuable::AttributeContainer
< std::list< OperatorPtr > > 
Operators
 Container for operators.
 
typedef TrackedObjectIds PenIds
 Pen id container.
 
enum  TouchArea { TOUCH_CONTENT_BOX, TOUCH_PADDING_BOX, TOUCH_BORDER_BOX }
 Different areas in Widget that can be interacted with. More...
 

Valuable Attributes

float angular-damping = 1.F
 Set the angular damping of the widget, which controls how fast the the angular velocity (omega) will slow down when thrown. More...
 
float damping = 0.995000004F
 The damping of the Widget controls how quickly the Widget will slow down and stop when thrown. More...
 
float depth = 0.F
 Depth of the widget. More...
 
Widget::DisplayMode display = Widget::DISPLAY_BLOCK
 Controls widget visibility. More...
 
float extra-input-capture-radius = 0.F
 Extra radius (in widget coordinates) used when input is processed. More...
 
Radiant::FlagsT< Widget::Flagsflags = Widget::FLAGS_DEFAULT
 Widget flags define common behaviour of widget. More...
 
Radiant::FlagsT
< Widget::InputFlags
input-flags = Widget::INPUT_DEFAULT
 Current input processing parameters which determine how this widget will react to input. More...
 
float maximum-tap-motion = 50.F
 Adjusts the limit for recognizing taps within this Widget. More...
 
float maximum-tap-time = 0.5F
 Adjusts the time limit for recognizing taps. More...
 
float omega = 0.F
 Angular velocity of the widget in radians per second. More...
 
float opacity = 1.F
 Transparency factor that gets recursively applied to any child widgets this widget has. More...
 
Nimble::Vector2 origin = Nimble::Vector2f(0, 0)
 Relative origin of the widget coordinates. More...
 
float rotation = 0.F
 Clockwise rotation of the Widget in radians, relative to the parent. More...
 
float scale = 1.F
 Scale of the Widget. More...
 
float scale-damping = 1.F
 Set the scale damping of the widget. More...
 
Widget::TouchArea touch-area = Widget::TOUCH_BORDER_BOX
 Controls the default touchable area of the widget. More...
 
Nimble::Vector2f velocity = Nimble::Vector2f(0.F, 0.F)
 Return the current velocity of the Widget. More...
 
- Valuable Attributes inherited from Stylish::CSSBoxModel
Nimble::Vector2 location = Nimble::Vector2f(0.F, 0.F)
 The location of this object in pixels in its parent's coordinate system. More...
 
Nimble::Frame4f margin = Nimble::Vector4(0, 0, 0, 0)
 Size of the margin. More...
 
Nimble::Frame4f padding = Nimble::Vector4(0, 0, 0, 0)
 Size of the padding. More...
 
Nimble::SizeF size = Nimble::SizeF(100.F, 100.F)
 Box size in pixels. More...
 
- Valuable Attributes inherited from Stylish::Styleable
QString css-class = ""
 Get the CSS classes of the Styleable as a space separated string. More...
 
QString css-id = ""
 Get the CSS id of the Styleable. More...
 
- Valuable Attributes inherited from Valuable::Node
Node::Uuid id = generateId()
 Returns the unique id. More...
 

Node Events

[OUT] child-added (Node::Uuid childId)
 Sent when child was added to the widget. See also addChild.
 
[OUT] child-removed (Node::Uuid childId)
 Sent when child was removed from the widget. See also removeChild.
 
[OUT] deleted (Node::Uuid widgetId)
 The widget has been deleted, emitted during widget destructor processing. The removed widget id is given as a parameter.
 
[IN] deserialize (Qstring filename)
 Deserializes Widget from given XML-file and adds it to the child of Widget. See also Valuable::Serializer::deserializeXML.
 
[OUT] finger-down (int64_t id)
 User has touched the widget with a finger and the finger was given an identifier id.
 
[OUT] finger-up (int64_t id)
 User has released a finger that was previously given an identifier id.
 
[OUT] hand-down (int64_t id)
 User has touched the widget with a hand and the hand was given an identifier id.
 
[OUT] hand-up (int64_t id)
 User has released a hand that was previously given an identifier id.
 
[OUT] has-interaction (bool interaction)
 Sent when interaction with Widget is started/enden. Passed value is true if interaction began and false if ended.
 
[OUT] hidden
 Sent when the display attribute changes to none.
 
[IN] hide
 Hide the widget. Corresponds to function hide.
 
[OUT] interaction-begin
 User has started interacting with the widget. Event is sent just after interactionBegin is called.
 
[OUT] interaction-end
 User has stopped interacting with the widget. Event is sent just after interactionEnd is called.
 
[IN] lower-to-bottom (bool recursive=false)
 Lowers Widget to bottom. Corresponds to function lowerToBottom.
 
[OUT] marker-down (int64_t id)
 User has touched the widget with a marker and the marker was given an identifier id.
 
[OUT] marker-up (int64_t id)
 User has released a marker that was previously given an identifier id.
 
[OUT] orphan-tree-changed (bool isOrphan)
 Widget was orphaned or added back to hierarchy.
 
[OUT] parent-changed
 The widget's parent was changed.
 
[OUT] pen-down (int64_t id)
 User has touched the widget with a pen and the pen was given an identifier id.
 
[OUT] pen-up (int64_t id)
 User has released a pen that was previously given an identifier id.
 
[IN] raise-to-top (bool recursive=false)
 Raises Widget to top. Corresponds to function raiseToTop.
 
[IN] remove-from-parent
 Removes the widget from its parent. Corresponds to function removeFromParent.
 
[IN] serialize (QString filename)
 Serializes this Widget to given XML-file. See also Valuable::Serializer::serializeXML.
 
[IN] show
 Show the widget. Corresponds to function show.
 
[OUT] shown
 Sent when the display attribute changes to block.
 
[OUT] single-tap (Nimble::Vector2f location)
 User has performed a single-tap gesture. Event is sent just after singleTap is called.
 
[IN] touch
 Sets the last interaction time. Corresponds to function touch.
 
[OUT] tracked-object-down (int64_t id)
 User has touched the widget with any tracked object and the object was given an identifier id.
 
[OUT] tracked-object-up (int64_t id)
 User has released a tracked object that was previously given an identifier id.
 
[OUT] visual-focus-change
 Sent after visualFocusChange is called.
 

Public Member Functions

virtual void addChild (const WidgetPtr &w)
 Add a child to this widget. More...
 
void addOperator (OperatorPtr op)
 Add an operator to the Widget. More...
 
bool allowRotation () const
 Check whether the widget can be rotated. More...
 
float angularDamping () const
 Set the angular damping of the widget, which controls how fast the the angular velocity (omega) will slow down when thrown. More...
 
float angularVelocity () const
 Angular velocity of the widget in radians per second. More...
 
Animationanimation ()
 Get the animation controller for this widget. More...
 
const Animationanimation () const
 Get the animation controller for this widget. More...
 
bool autoRaiseToTop () const
 Returns whether the widget is automatically raised to top. More...
 
virtual Nimble::Rect boundingRect () const
 This function defines the outer bounds of the item as a rectangle in widget coordinates. More...
 
bool checkFlags (Radiant::FlagsT< Flags > flags) const
 Checks the given flags from flags -attribute. More...
 
bool checkInputFlags (Radiant::FlagsT< InputFlags > flags) const
 Checks the given input flags from input-flags -attribute. More...
 
WidgetPtr child (size_t i)
 Return the ith child widget. More...
 
ChildIterator childBegin ()
 Returns an iterator to the first child. More...
 
ConstChildIterator childBegin () const
 Returns an iterator to the first child. More...
 
ChildIterator childEnd ()
 Returns an iterator to the end of the children. More...
 
ConstChildIterator childEnd () const
 Returns an iterator to the end of the children. More...
 
Nimble::Rect childrenRect () const
 Returns the bounding box of this widget's children in widget coordinates. More...
 
ChildReverseIterator childReverseBegin ()
 Returns an iterator addressing the first child element in reverse order. More...
 
ConstChildReverseIterator childReverseBegin () const
 Returns an iterator addressing the first child element in reverse order. More...
 
ChildReverseIterator childReverseEnd ()
 Returns an iterator addressing the next item past the last child in a reversed order. More...
 
ConstChildReverseIterator childReverseEnd () const
 Returns an iterator addressing the next item past the last child in a reversed order. More...
 
void clearFlags (Radiant::FlagsT< Flags > flags)
 Sets the given widget flags to zero in flags. More...
 
void clearInputFlags (Radiant::FlagsT< InputFlags > flags)
 Sets the given widget input flags to zero in input-flags. More...
 
WidgetPtr clone () const
 Create a clone of the widget. More...
 
bool contains (const Widget &w) const
 Checks whether the given widget is fully inside the area of this widget. More...
 
float damping () const
 The damping of the Widget controls how quickly the Widget will slow down and stop when thrown. More...
 
float depth () const
 Depth of the widget. More...
 
virtual bool deserialize (const Valuable::ArchiveElement &element)
 Deserializes the widget's attributes and its descendants from given archive element. More...
 
DisplayMode display () const
 Controls widget visibility. More...
 
void dropAllGrabs (GrabManager &input)
 Drops all the grabs that this Widget has. More...
 
virtual void dumpInfo (FILE *f=nullptr, int indent=0)
 Dump information about this widget to the given file. More...
 
virtual void eventProcess (const QByteArray &id, Radiant::BinaryData &data)
 Entry point for incoming events Class specific behaviour to events is implemented in this function. More...
 
float extraInputCaptureRadius () const
 Extra radius (in widget coordinates) used when input is processed. More...
 
template<typename W = Widget>
QList< Radiant::IntrusivePtr< W > > find (const QString &cssSelector)
 Find all descendant widgets that match the given CSS selector and can be casted to given type. More...
 
template<>
QList< WidgetPtrfind (const QString &cssSelector)
 
virtual void fingerDown (MultiTouch::Finger f, MultiWidgets::GrabManager &gm)
 Called when a new finger is grabbed by the widget. More...
 
virtual void fingerUp (MultiTouch::Finger f, MultiWidgets::GrabManager &gm)
 Called when a finger is ungrabbed by the widget When this function is called the finger is already ubgrabbed by the widget and it does not lie anymore in array returned by grabbedFingers This function is meant to be overriden: the default implementation is empty. More...
 
Radiant::FlagsT< Flagsflags () const
 Widget flags define common behaviour of widget. More...
 
bool forceRendering () const
 See whether forced rendering is enabled. More...
 
OperatorPtr getOperator (size_t i)
 Returns the ith operator. More...
 
template<class T >
QList< std::shared_ptr< T > > getOperatorsOfType ()
 Returns all the operator pointers that contain operator of the given type. More...
 
FingerIds grabbedFingers () const
 Returns all grabbed fingers. More...
 
HandIds grabbedHands () const
 Returns a list of hand ids that are grabbed by this widget. More...
 
MarkerIds grabbedMarkers () const
 Returns a list of marker ids that are grabbed by this widget. More...
 
PenIds grabbedPens () const
 Returns a list of pen ids that are grabbed by this widget. More...
 
TrackedObjectIds grabbedTrackedObjects () const
 Shortcut for InputGrabber::grabbedObjects. More...
 
virtual void handDown (MultiTouch::Hand h, MultiWidgets::GrabManager &gm)
 Called when a hand is grabbed by the widget This function is meant to be overriden: the default implementation is empty. More...
 
virtual void handUp (MultiTouch::Hand h, MultiWidgets::GrabManager &gm)
 Called when a hand is ungrabbed by the widget This function is meant to be overriden: the default implementation is empty. More...
 
virtual bool hasActiveOperators (bool recursive)
 Returns true if the Widget currently has active operators. More...
 
bool hasChild (const WidgetPtr &w, bool recursive=false)
 Returns true if the widget has w as a child or descendant. More...
 
virtual bool hasInteraction (Radiant::FlagsT< MultiTouch::TrackedObjectType > types=MultiTouch::TYPE_ALL, bool recursive=false) const
 Check if the widget is currently being interacted with. More...
 
bool hasOperator (OperatorPtr op) const
 Checks if the given operator is attached to the widget. More...
 
template<typename T >
bool hasOperatorType () const
 Checks if the given operator type is present in the operators. More...
 
virtual float heightForWidth (float width) const
 Returns the height of the widget for the given width while maintaining aspect ratio. More...
 
virtual void hide ()
 Hide the widget. More...
 
virtual void input (MultiWidgets::GrabManager &gm, float dt) final
 Send input to a Widget. More...
 
Radiant::FlagsT< InputFlagsinputFlags () const
 Current input processing parameters which determine how this widget will react to input. More...
 
InputGrabberinputGrabber ()
 Get the input grabber for the widget. More...
 
const InputGrabberinputGrabber () const
 Get the input grabber for the widget. More...
 
bool inputMotion () const
 Check if this widget has any input motion flag enabled. More...
 
bool inputTaps () const
 Check if widget listens single-tap events. More...
 
Radiant::TimeStamp interactionBegan () const
 Returns the time when the last interaction started on the widget. More...
 
Nimble::Vector2 interactionCenter () const
 Current or previous interaction center in widget coordinates. More...
 
bool intersects (const Widget &w) const
 Check if this widget intersects referenced widget. More...
 
virtual Nimble::SizeF intrinsicSize () const
 The preferred size of the Widget without scaling. More...
 
bool isDisplayed () const
 Checks whether the value of display is not none. More...
 
bool isFixed () const
 Returns true if the widget has been set to immovable. More...
 
bool isGrabbed (MultiTouch::TrackedObject::Id id) const
 Checks if a given object is grabbed by this widget. More...
 
bool isInOrphanTree () const
 Is this widget a part of a subtree that is not connected to non-orphan widget.
 
virtual bool isInside (Nimble::Vector2f v) const
 Test if the given point is inside the Widget. More...
 
virtual bool isReady (bool recursive) const final
 Recursive version of isReady. More...
 
virtual bool isReady () const
 Is the widget ready to be displayed on screen. More...
 
bool isVisible () const
 Checks whether the value of display is not none. More...
 
virtual Radiant::TimeStamp lastInteractionTime (bool recursive=false) const
 Timestamp of the last interaction on this Widget. More...
 
void lower (int levels, bool force=false)
 Lower the widget below its siblings. More...
 
void lowerToBottom (bool recursive=false)
 Brings this Widget behind its siblings and its parent If the lock-depth flag has been raised, then this widget will not change its depth and only the recursive functionality will take effect. More...
 
Nimble::Vector2f mapFromParent (const Nimble::Vector2f &p) const
 Transform a point from parent coordinates to Widget coordinates. More...
 
Nimble::Vector2f mapFromScene (const Nimble::Vector2f &p) const
 Transform a point from scene coordinates to Widget coordinates. More...
 
Nimble::Vector2f mapToParent (const Nimble::Vector2f &p) const
 Transform a point from Widget coordinates to parent coordinates. More...
 
Nimble::Vector2f mapToParent (Widget &w, const Nimble::Vector2f &p) const
 Transform a point from Widget coordinates to its ancestor coordinates. More...
 
Nimble::Vector2f mapToScene (const Nimble::Vector2f &p) const
 Transform a point from Widget coordinates to scene coordinates. More...
 
virtual void markerDown (MultiTouch::Marker m, MultiWidgets::GrabManager &gm)
 Called when a new marker is grabbed by the widget. More...
 
virtual void markerUp (MultiTouch::Marker m, MultiWidgets::GrabManager &gm)
 Called when a marker is ungrabbed by the widget. More...
 
float maximumTapMotion () const
 Adjusts the limit for recognizing taps within this Widget. More...
 
float maximumTapTime () const
 Adjusts the time limit for recognizing taps. More...
 
size_t numChildren () const
 Returns the number of child Widgets. More...
 
float opacity () const
 Transparency factor that gets recursively applied to any child widgets this widget has. More...
 
size_t operatorCount () const
 Returns the number of operators applied to this Widget. More...
 
const Operatorsoperators () const
 
Nimble::Vector2 origin () const
 Relative origin of the widget coordinates. More...
 
WidgetPtr parent () const
 Get a pointer to the Widget's parent. More...
 
virtual void parentChanged (WidgetPtr oldParent)
 This is called after the parent has changed. More...
 
virtual void penDown (MultiTouch::Pen p, MultiWidgets::GrabManager &gm)
 Called when a pen is grabbed by the widget. More...
 
virtual void penUp (MultiTouch::Pen p, MultiWidgets::GrabManager &gm)
 Called when a pen is ungrabbed by the widget This function is meant to be overriden: the default implementation is empty. More...
 
virtual void processInput (MultiWidgets::GrabManager &gm, float dt)
 Do extra input processing. More...
 
void raise (int levels, bool force=false)
 Raise the widget above its sibings. More...
 
void raiseFlags (Radiant::FlagsT< Flags > flags)
 Raises the given widget flags. More...
 
void raiseInputFlags (Radiant::FlagsT< InputFlags > flags)
 Raises the given widget input flags. More...
 
void raiseToTop (bool recursive=false)
 Brings this Widget to the front of its siblings and its parent. More...
 
virtual void removeChild (const WidgetPtr &w)
 Removes the child from this widget's child list if present. More...
 
void removeChildren ()
 Remove all child widgets from the widget.
 
virtual void removeFromParent ()
 Removes this widget from its parent (if any).
 
bool removeOperator (OperatorPtr op)
 Removes the given operator from the widget. More...
 
template<class T >
void removeOperatorType ()
 Removes all operators of given type. More...
 
virtual void render (Luminous::RenderContext &r) const final
 Render the Widget and recursively its children This function calls the rest of the rendering functions that can be overridden to specialize parts of the Widget rendering. More...
 
void reparent (WidgetPtr newParent)
 Change the widget parent to a new one while maintaining the position of widget in the scene coordinates. More...
 
float rotation () const
 Clockwise rotation of the Widget in radians, relative to the parent. More...
 
float rotationTo (const Widget &ancestor) const
 Returns the rotation relative to the given ancestor of widget. More...
 
float scale () const
 Scale of the Widget. More...
 
float scaleDamping () const
 Set the scale damping of the widget. More...
 
Nimble::Rectangle sceneGeometry () const
 Return the Widget rectangle in scene coordinates. More...
 
float sceneRotation () const
 Return the rotation of the Widget relative to the scene. More...
 
float sceneScale () const
 Return the scale of the widget relative to the scene. More...
 
Nimble::Matrix3 sceneTransform () const
 Returns the Widget's scene transformation matrix. More...
 
void setAllowRotation (bool allowRotation)
 If allowed, the Widget can be rotated. More...
 
void setAngularDamping (float angularDamping)
 Setter for attribute angular-damping. More...
 
void setAngularVelocity (float angularVelocity)
 Setter for attribute omega. More...
 
void setAutoRaiseToTop (bool v)
 Set automatic raise-to-top behaviour. More...
 
virtual void setCenterLocation (Nimble::Vector2 location)
 Sets the location of the widget center in parent coordinates The same effect is achieved by setting origin to (0.5, 0.5) and then modifying the value of location. More...
 
void setDamping (float damping)
 Setter for attribute damping. More...
 
void setDepth (float z)
 
void setDisplay (DisplayMode mode)
 Setter for attribute display. More...
 
void setExtraInputCaptureRadius (float radius)
 Setter for attribute extra-input-capture-radius. More...
 
void setFixed ()
 If set to fixed, the widget can not be moved but it will still get input. More...
 
void setFlags (Radiant::FlagsT< Flags > flags)
 Setter for attribute flags. More...
 
void setForceRendering (bool v)
 Shortcut for raising or lowering force-rendering-flag in widget's flags. More...
 
void setInOrphanTree (bool value)
 Sets this widget and all its descendants to orphan tree.
 
void setInputFlags (Radiant::FlagsT< InputFlags > flags)
 Setter for attribute input-flags. More...
 
void setInputTransparent ()
 This function makes the widget pass all the input data to its children and operators if input-operators flag has been raised in input-flags. More...
 
void setMaximumTapMotion (float maxMotionPixels)
 Setter for attribute maximum-tap-motion. More...
 
void setMaximumTapTime (float maxTapTimeSeconds)
 Setter for attribute maximum-tap-time. More...
 
void setOpacity (float opacity)
 Setter for attribute opacity. More...
 
void setOrigin (const Nimble::Vector2 &origin)
 Setter for attribute origin. More...
 
void setPointLocation (Nimble::Vector2 location, Nimble::Vector2 pointOnWidget)
 Sets the location of a point on the widget widget center in parent coordinates of location. More...
 
void setRelativePointLocation (Nimble::Vector2 location, Nimble::Vector2 pointOnWidgetRelative)
 Sets the location of a point on the widget widget center in parent coordinates of location. More...
 
void setRotation (float r)
 Setter for attribute rotation. More...
 
void setRotationAboutCenter (float r)
 Set the rotation of the widget about its center. More...
 
void setRotationAboutPivot (float r, Nimble::Vector2 pivot)
 Set the rotation of the widget about a point relative to the widget size Will modify the values of rotation and location. More...
 
void setRotationAboutPivotAbsolute (float r, Nimble::Vector2 pivot)
 Set the rotation of the widget about an arbitrary point in widget coordinates. More...
 
void setRotationAboutScenePoint (float r, Nimble::Vector2 scenePt)
 Set the rotation of the widget about an arbitrary point in scene coordinates. More...
 
virtual void setScale (float s)
 Setter for attribute scale. More...
 
void setScaleAboutCenter (float s)
 Set the scale of the widget about its center. More...
 
void setScaleAboutPivotAbsolute (float s, Nimble::Vector2 pivot)
 Set the scale of the widget about an arbitrary point in widget coordinates. More...
 
void setScaleDamping (float scaleDamping)
 Setter for attribute scale-damping. More...
 
virtual bool setStyle (const Stylish::Style &style)
 Sets given style for the widget. More...
 
void setTouchArea (TouchArea area)
 Setter for attribute touch-area. More...
 
void setVelocity (const Nimble::Vector2f &v)
 Set the velocity of the Widget in pixels per second. More...
 
void setVelocity (float xvel, float yvel)
 Set the velocity of the Widget in pixels per second. More...
 
void setVisible (bool v)
 Hides or shows the widget. More...
 
virtual bool shouldGrab (GrabManager &gm, MultiTouch::TrackedObject obj) const
 Should this widget grab the given object during the input. More...
 
virtual void show ()
 Show the widget. More...
 
void stopMotion ()
 Stops all motion of the widget. More...
 
const
MultiWidgets::TrackedObjectIds
tapIds () const
 Returns a set of ids of fingers possibly tapping the widget. More...
 
bool tapIsPossible () const
 Check if the currently ongoing gesture (if any) is possibly a tap. More...
 
unsigned tapObjectCount () const
 Query the number of possible tap objects. More...
 
WidgetPtr topParent () const
 Return a pointer to the Widget's top-level parent. More...
 
void touch ()
 Set the last interaction time to current time. More...
 
TouchArea touchArea () const
 Controls the default touchable area of the widget. More...
 
virtual void trackedObjectDown (MultiTouch::TrackedObject o, MultiWidgets::GrabManager &gm)
 Called when a new tracked object is grabbed by the widget. More...
 
virtual void trackedObjectUp (MultiTouch::TrackedObject o, MultiWidgets::GrabManager &gm)
 Called when a new tracked object is ungrabbed by the widget This function is meant to be overriden: the default implementation is empty. More...
 
size_t transferGrabs (WidgetPtr target, GrabManager &gm, Radiant::FlagsT< MultiTouch::TrackedObjectType > types, bool recursive=false)
 Transfer grabs from this widget to another. More...
 
const Nimble::Matrix3transform () const
 Return this Widget's transformation matrix relative to its parent. More...
 
const Nimble::Matrix4ftransform3D () const
 Return this Widget's 3D transformation matrix relative to its parent. More...
 
virtual QByteArray type () const
 This returns the plugin name of this Widget. More...
 
virtual void update (const MultiWidgets::FrameInfo &frameInfo)
 Update widget state. More...
 
const Nimble::Vector2velocity () const
 Return the current velocity of the Widget. More...
 
virtual void visualFocusChange (bool gotFocus)
 Call-back function for informing the Widget of a change in users' visual focus This function is called by the application as deemed fit. More...
 
 Widget (WidgetPtr parent=nullptr)
 Construct a new Widget. More...
 
virtual ~Widget ()
 Destroys this Widget and frees references to all its children. More...
 
- Public Member Functions inherited from Stylish::CSSBoxModel
AttributeBackgroundbackground ()
 
const AttributeBackgroundbackground () const
  More...
 
Nimble::Rectf backgroundBox () const
 Background painting area, depends on background-clip value. More...
 
Radiant::Color backgroundColor () const
 
AttributeBorderborder ()
 
const AttributeBorderborder () const
  More...
 
Stylish::Border borderBottom () const
 Gets the bottom border that contains the width, style and color. More...
 
Nimble::Rectf borderBox () const
 Border box, rectangle that includes content, padding and border. More...
 
Nimble::Frame4f borderFrame () const
 Size of the border. More...
 
Stylish::Border borderLeft () const
 Gets the left border that contains the width, style and color. More...
 
Stylish::Border borderRight () const
 Gets the right border that contains the width, style and color. More...
 
Stylish::Border borderTop () const
 Gets the top border that contains the width, style and color. More...
 
float bottom () const
 Get the y coordinate of the bottom of the box.
 
Nimble::SizeF boxSize () const
 Calculates total amount of screen estate taken by the box by adding size, padding, border and margin together. More...
 
Nimble::Rectf contentBox () const
 Content box, rectangle that includes only the content area. More...
 
float height () const
 Height of this box in pixels.
 
Nimble::Vector2 location () const
 The location of this object in pixels in its parent's coordinate system. More...
 
Nimble::Frame4f margin () const
 Size of the margin. More...
 
Nimble::Rectf marginBox () const
 Margin box, rectangle that includes content, padding, border and margin. More...
 
Nimble::Frame4f padding () const
 Size of the padding. More...
 
Nimble::Rectf paddingBox () const
 Padding box, rectangle that includes content and padding but excludes border area. More...
 
void setBackgroundColor (Radiant::Color color)
 
void setBackgroundColor (float red, float green, float blue, float alpha)
 
virtual void setBorderColor (const Radiant::Color &c)
 Sets the color for all borders.
 
void setBorderColor (float r, float g, float b, float a)
 
virtual void setBorderFrame (const Nimble::Frame4f &border)
 Sets the width for all borders. More...
 
void setBorderStyle (Border::Style style)
 Sets the style for all borders.
 
void setBorderWidth (float width)
 Sets the width for all borders.
 
void setHeight (float height, ValueUnit unit=VU_PXS)
 Set the height of the box.
 
void setLocation (Nimble::Vector2 location)
 Setter for attribute location. More...
 
void setLocation (Nimble::Vector2 location, ValueUnit unit)
 Set the location of this object. More...
 
void setLocation (float x, float y)
 Set the location of this object. More...
 
void setLocation (float x, float y, ValueUnit unit)
 Set the location of this object. More...
 
void setMargin (const Nimble::Frame4f &margin)
 Setter for attribute margin. More...
 
void setMargin (float one_side_margin)
 Set the size of the margin for all sides to be equal.
 
virtual void setPadding (const Nimble::Frame4f &padding)
 Setter for attribute padding. More...
 
void setPadding (float oneSidePadding)
 Set the size of the padding for all sides to be equal. More...
 
void setSize (Nimble::SizeF size)
 Setter for attribute size. More...
 
void setSize (float width, float height, ValueUnit unit=VU_PXS)
 Set box size. More...
 
void setSize (Nimble::SizeF size, ValueUnit widthUnit, ValueUnit heightUnit)
 Set box size. More...
 
void setWidth (float width, ValueUnit unit=VU_PXS)
 Set the width of the box.
 
void setX (float x, ValueUnit unit=VU_PXS)
 Set the x component of the location of this box.
 
void setY (float y, ValueUnit unit=VU_PXS)
 Set the y component of the location of this box.
 
Nimble::SizeF size () const
 Box size in pixels. More...
 
float width () const
 Width of this box in pixels.
 
float x () const
 Get the x component of the location of this box in pixels.
 
float y () const
 Get the y component of the location of this box in pixels.
 
- Public Member Functions inherited from Stylish::Styleable
void addCSSClass (const QString &s)
 Adds the Styleable to CSS class s. More...
 
void addCSSClasses (const QStringList &classes)
 Adds the Styleable to given CSS classes. More...
 
QString attributeSource (const QByteArray &name) const
 Gets CSS declaration source location based on the attribute name For example if this object has "size" attribute that is set from a CSS file, attributeSource("size") would return "filename.css:line". More...
 
const Style & childStyle () const
 Cached style that should be applied to all children of this object.
 
const Radiant::ArraySet
< QByteArray > & 
cssClasses () const
 Get the CSS classes of the Styleable in lowercase.
 
const QString & cssClassStr () const
 Get the CSS classes of the Styleable as a space separated string. More...
 
QString cssId () const
 Get the CSS id of the Styleable. More...
 
const QByteArray & cssType () const
 Get the CSS type of the Styleable.
 
bool hasCSSClass (const QByteArray &s) const
 Does the Styleable belong to given CSS class. More...
 
bool match (const SimpleSelector &ss, int *specificityOut=nullptr) const
 Checks if SimpleSelector matches this object. More...
 
bool pseudoClass (const QByteArray &name) const
 Query if the Styleable has pseudo class called name.
 
void removeCSSClass (const QString &s)
 Remove the Styleable from CSS class s. More...
 
void setCSSClasses (const QString &s)
 Set the CSS classes as a space separated list You almost always want to use addCSSClass instead of this one. More...
 
void setCSSId (const QString &s)
 Set the CSS id of the Styleable. More...
 
void setCSSType (const QByteArray &s)
 Set the CSS type of the Styleable.
 
virtual bool setProperty (Valuable::Attribute &var, const Valuable::StyleValue &value, Layer layer)
 Converts the given Stylish::Value to Valuable::Attribute.
 
void setPseudoClass (const QByteArray &name, bool state)
 Disable or enable pseudo class.
 
virtual bool setStyle (const Style &style)
 Applies a style to the object. More...
 
QString simpleSelector (bool includePseudoClasses=true) const
 Returns a CSS simple selector that matches this Styleable.
 
const Style & style () const
 Returns the style for this object.
 
 Styleable (const QByteArray &name="Styleable")
 Constructor for Styleable. More...
 
- Public Member Functions inherited from Valuable::Node
bool acceptsEvent (const QByteArray &messageId) const
 Returns true if this object accepts event 'id' in eventProcess.
 
bool addAttribute (Attribute *const attribute)
 Adds a new Attribute to the list of attribute objects. More...
 
bool addAttribute (const QByteArray &name, Attribute *const attribute)
 Adds a new Attribute to the list of attribute objects.
 
template<typename Widget >
bool addAttribute (const QByteArray &name, const Radiant::IntrusivePtr< Widget > &attribute)
 Adds a new Attribute to the list of attribute objects. More...
 
long addListener (const QByteArray &attribute, v8::Persistent< v8::Function > func, int role=Attribute::CHANGE_ROLE)
 Add a JavaScript attribute listener to attribute belonging this Node. More...
 
virtual Attributeattribute (const QByteArray &name) const
 Gets an Attribute with the given name. More...
 
template<typename T >
AttributeT< T > * attribute (const QByteArray &name) const
 Gets an Attribute with the given name. More...
 
const containerattributes () const
 
void clearValues (Layer layer)
 Clears all Attribute values of the given layer. More...
 
void debugDump ()
 Prints the contents of this Attribute to the terminal.
 
void eventAddDeprecated (const QByteArray &deprecatedId, const QByteArray &newId)
 Register a deprecated event that is automatically converted to new event id and a warning is issued when it is used. More...
 
void eventAddIn (const QByteArray &messageId)
 Registers a new event that this class handles in eventProcess.
 
template<typename Widget >
long eventAddListener (const QByteArray &eventId, const QByteArray &messageId, Radiant::IntrusivePtr< Widget > &listener, ListenerType listenerType=DIRECT, const Radiant::BinaryData *defaultData=0)
 Add an event listener to this object. More...
 
long eventAddListener (const QByteArray &eventId, const QByteArray &messageId, Valuable::Node *listener, ListenerType listenerType=DIRECT, const Radiant::BinaryData *defaultData=0)
 Add an event listener to this object. More...
 
long eventAddListener (const QByteArray &eventId, ListenerFuncVoid func, ListenerType listenerType=DIRECT)
 Add an event listener to this object. More...
 
long eventAddListener (const QByteArray &eventId, Node *dstNode, ListenerFuncVoid func, ListenerType listenerType=DIRECT)
 
long eventAddListenerBd (const QByteArray &eventId, Node *dstNode, ListenerFuncBd func, ListenerType listenerType=DIRECT)
 
long eventAddListenerBd (const QByteArray &eventId, ListenerFuncBd func, ListenerType listenerType=DIRECT)
 Add an event listener to this object. More...
 
void eventAddOut (const QByteArray &eventId)
 Registers a new event this class can send with eventSend.
 
const QSet< QByteArray > & eventInNames () const
 Returns set of all registered IN events.
 
unsigned eventListenerCount () const
 Returns the number of event listeners.
 
const QSet< QByteArray > & eventOutNames () const
 Returns set of all registered OUT events.
 
void eventPassingEnable (bool enable)
 Control whether events are passed.
 
template<typename Widget >
int eventRemoveListener (Radiant::IntrusivePtr< Widget > &listener)
 Removes all events from this object to given listener. More...
 
template<typename Widget >
int eventRemoveListener (const QByteArray &eventId=QByteArray(), const QByteArray &messageId=QByteArray(), Radiant::IntrusivePtr< Widget > &listener=Radiant::IntrusivePtr< Widget >())
 Removes events from this object that match the parameters. More...
 
int eventRemoveListener (const QByteArray &eventId=QByteArray(), const QByteArray &messageId=QByteArray(), Valuable::Node *listener=0)
 Removes event listeners from this object. More...
 
int eventRemoveListener (Valuable::Node *listener)
 Removes all events from this object to given listener. More...
 
bool eventRemoveListener (long listenerId)
 Removes event listener with given id. More...
 
void eventSend (const QByteArray &eventId, Radiant::BinaryData &bd)
 Sends an event and bd to all listeners on this eventId.
 
void eventSend (const QByteArray &eventId)
 Sends an event to all listeners on this eventId.
 
template<typename P1 >
void eventSend (const QByteArray &eventId, const P1 &p1)
 Sends an event to all listeners on this eventId. More...
 
template<typename P1 , typename P2 >
void eventSend (const QByteArray &eventId, const P1 &p1, const P2 &p2)
 Sends an event to all listeners on this eventId. More...
 
template<typename P1 , typename P2 , typename P3 >
void eventSend (const QByteArray &eventId, const P1 &p1, const P2 &p2, const P3 &p3)
 Sends an event to all listeners on this eventId. More...
 
template<typename P1 , typename P2 , typename P3 , typename P4 >
void eventSend (const QByteArray &eventId, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4)
 Sends an event to all listeners on this eventId. More...
 
template<typename P1 , typename P2 , typename P3 , typename P4 , typename P5 >
void eventSend (const QByteArray &eventId, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5)
 Sends an event to all listeners on this eventId. More...
 
unsigned eventSourceCount () const
 Returns the number of event sources.
 
Uuid id () const
 Returns the unique id.
 
bool isBeingDestroyed () const
 Returns true if we are about to delete this object. More...
 
bool loadFromFileXML (const QString &filename)
 Reads this object (and its children) from an XML file.
 
bool loadFromMemoryXML (const QByteArray &buffer)
 Reads this object (and its children) from a memory buffer.
 
 Node (Node *host, const QByteArray &name="", bool transit=false)
 Constructs a new Node and adds it under the given host. More...
 
 Node (Node &&node)
 Moves a node, including all its attributes, events etc. More...
 
Nodeoperator= (Node &&node)
 Moves a node, replacing this. More...
 
virtual bool readElement (const ArchiveElement &element)
 Handles a serialization element that lacks automatic handlers. More...
 
void removeAttribute (Attribute *const attribute)
 Removes an Attribute from the list of attribute objects.
 
bool saveToFileXML (const QString &filename, unsigned int opts=SerializationOptions::DEFAULTS) const
 Saves this object (and its children) to an XML file.
 
bool saveToMemoryXML (QByteArray &buffer, unsigned int opts=SerializationOptions::DEFAULTS) const
 Saves this object (and its children) to binary data buffer.
 
virtual ArchiveElement serialize (Archive &doc) const
 Serializes this object (and its children) to a DOM node.
 
virtual void setAsDefaults ()
 Sets the current USER attribute value as the default value and clears the USER value. More...
 
void setId (Uuid newId)
 Sets the unique id. More...
 
template<class T >
bool setValue (const QByteArray &name, const T &v)
 Uses a query string to find a Attribute, and sets a new value to that if found. More...
 
bool setValue (const QByteArray &name, v8::Handle< v8::Value > v)
 Set attribute value from JavaScript. More...
 
- Public Member Functions inherited from Valuable::Attribute
long addListener (ListenerFunc func, int role=CHANGE_ROLE)
 Adds a listener that is invoked whenever the value is changed. More...
 
long addListener (Node *listener, ListenerFunc func, int role=CHANGE_ROLE)
 Adds a listener that is invoked whenever the value is changed. More...
 
long addListener (v8::Persistent< v8::Function > func, int role=CHANGE_ROLE)
 Adds a JavaScript listener that is invoked whenever the value is changed. More...
 
virtual float asFloat (bool *const ok=0, Layer layer=LAYER_CURRENT) const
 Converts the value object in a floating point number. More...
 
virtual int asInt (bool *const ok=0, Layer layer=LAYER_CURRENT) const
 Converts the value object in an integer. More...
 
virtual QString asString (bool *const ok=0, Layer layer=LAYER_CURRENT) const
 Converts the value object to a string. More...
 
 Attribute (const Attribute &o)
 Create a copy of the given Attribute WITHOUT the link to host, listeners, or the attribute name. More...
 
 Attribute (Node *host, const QByteArray &name, bool transit=false)
 Constructs a new value object and attaches it to its host. More...
 
virtual void clearValue (Layer layer)
 Unsets the value from a specific layer. More...
 
virtual void emitChange ()
 Invokes the change valueChanged function of all listeners.
 
void eventProcessFloat (const char *id, float v)
 Utility function for sending a float message to the object.
 
void eventProcessInt (const char *id, int v)
 Utility function for sending an int message to the object.
 
void eventProcessString (const char *id, const QString &str)
 Utility function for sending string message to the object.
 
void eventProcessString (const char *id, const char *str)
 Utility function for sending string message to the object.
 
void eventProcessVector2 (const char *id, Nimble::Vector2)
 Utility function for sending a Nimble::Vector2f message to the object.
 
void eventProcessVector3 (const char *id, Nimble::Vector3)
 Utility function for sending a Vector3 message to the object.
 
void eventProcessVector4 (const char *id, Nimble::Vector4)
 Utility function for sending a Vector4 message to the object.
 
virtual bool handleShorthand (const Valuable::StyleValue &value, Radiant::ArrayMap< Valuable::Attribute *, Valuable::StyleValue > &expanded)
 If attribute supports shorthand properties, this should be used to parse those. More...
 
Nodehost () const
 The host object of the value object (is any). More...
 
virtual bool isChanged () const
 
virtual bool isValueDefinedOnLayer (Layer layer) const
 Check if the given layer defines a value. More...
 
bool layerForSerialization (SerializationOptions flags, Layer &layer) const
 
const QByteArray & name () const
 Returns the name of the object.
 
const Attributeoperator= (const Attribute &)
 Create a copy of the given Attribute WITHOUT the link to host, listeners, or the attribute name. More...
 
AttributeownerShorthand () const
 
QByteArray path () const
 Returns the path (separated by '/'s) from the root.
 
void removeHost ()
 Sets the host pointer to zero and removes this object from the host. More...
 
bool removeListener (Node *listener, int role=ALL_ROLES)
 Removes a listener from the listener list. More...
 
bool removeListener (long id)
 Removes a listener from the listener list. More...
 
void removeListeners (int role=ALL_ROLES)
 Removes listeners from the listener list.
 
virtual bool set (float v, Layer layer=USER, ValueUnit unit=VU_UNKNOWN)
 Sets the value of the object.
 
virtual bool set (int v, Layer layer=USER, ValueUnit unit=VU_UNKNOWN)
 Sets the value of the object.
 
virtual bool set (const QString &v, Layer layer=USER, ValueUnit unit=VU_UNKNOWN)
 Sets the value of the object.
 
virtual bool set (const Nimble::Vector2f &v, Layer layer=USER, QList< ValueUnit > units=QList< ValueUnit >())
 Sets the value of the object.
 
virtual bool set (const Nimble::Vector3f &v, Layer layer=USER, QList< ValueUnit > units=QList< ValueUnit >())
 Sets the value of the object.
 
virtual bool set (const Nimble::Vector4f &v, Layer layer=USER, QList< ValueUnit > units=QList< ValueUnit >())
 Sets the value of the object.
 
virtual bool set (const StyleValue &value, Layer layer=USER)
 Sets the value of the object.
 
void setName (const QByteArray &s)
 Sets the name of the object.
 
void setOwnerShorthand (Attribute *owner)
 
- Public Member Functions inherited from Valuable::Serializable
virtual bool deserializeXML (const DOMElement &element)
 Deserializes (reads) this object from an XML element. More...
 
bool isSerializable () const
 
void setSerializable (bool v)
 

Static Public Member Functions

static std::vector< WidgetPtrallWidgets ()
 
static void calculateMotion (const FingerArray &fingers, Nimble::Vector2f &translate, float &scale, float &rotate, Nimble::Vector2f &prevCenter)
 Computes the translation, rotation, and scale to apply to widget based on the interacting fingers. More...
 
static void checkOrphanTrees ()
 
static WidgetPtr create (const Valuable::ArchiveElement &element)
 Creates and deserializes a widget from the given archive. More...
 
static WidgetPtr findById (Uuid id)
 Search Widget by its id. More...
 
static void listExistingWidgetsToTerminal ()
 List existing widgets to terminal, for debugging.
 
static std::size_t widgetCount ()
 Returns the number of widget instances in the application. More...
 

Protected Member Functions

virtual void inputChildrenBack (MultiWidgets::GrabManager &gm, float dt, MultiWidgets::Widget::ChildIterator it)
 Sends the input to children in front-to-back order. More...
 
virtual ChildIterator inputChildrenFront (MultiWidgets::GrabManager &gm, float dt)
 Sends the input to children in front-to-back order. More...
 
virtual void interactionBegin (MultiWidgets::GrabManager &gm)
 This function gets called when the widget gets any interaction on it when it previously didn't have one. More...
 
virtual void interactionEnd (MultiWidgets::GrabManager &gm)
 This function gets called when the widget stops having any interaction on it while it previously had some. More...
 
virtual void postConstruct ()
 Called just after widget is fully created and normal constructors have been called, but before MultiWidgets::create returns. More...
 
virtual void preDestroy ()
 Called just before the widget is deleted and before destructor is called. More...
 
virtual void processFingers (MultiWidgets::GrabManager &gm, const MultiWidgets::FingerArray &fingers, float dt)
 Processes the fingers that the Widget has grabbed. More...
 
virtual void processHands (MultiWidgets::GrabManager &gm, const MultiWidgets::HandArray &hands, float dt)
 Processes the grabbed hands. More...
 
virtual void processMarkers (MultiWidgets::GrabManager &gm, const MultiWidgets::MarkerArray &markers, float dt)
 Processes the grabbed markers. More...
 
virtual void processPens (MultiWidgets::GrabManager &gm, const MultiWidgets::PenArray &pens, float dt)
 Processes the grabbed pens Is meant to be overriden: the default implementation does nothing. More...
 
virtual void processTrackedObjects (MultiWidgets::GrabManager &gm, const MultiWidgets::TrackedObjects &grabbed, float dt)
 Processes all of the grabbed objects (hands, fingers, pens, markers). More...
 
virtual void renderBackground (Luminous::RenderContext &r) const
 Render the Widget background as specified in CSS3 Backgrounds and Border Module. More...
 
virtual void renderBorder (Luminous::RenderContext &r) const
 Render the border of the Widget. More...
 
virtual ConstChildReverseIterator renderChildrenBack (Luminous::RenderContext &r) const
 Render child widgets behind (depth < 0) this widget. More...
 
virtual void renderChildrenFront (Luminous::RenderContext &r, MultiWidgets::Widget::ConstChildReverseIterator start) const
 Render child widgets starting from given child. More...
 
virtual void renderContent (Luminous::RenderContext &r) const
 Render the content of the Widget. More...
 
void setTapIsPossible (bool possible)
 Notifies the widget if a tap gesture is still possible. More...
 
virtual void singleTap (MultiWidgets::GrabManager &gm, const MultiWidgets::TrackedObjectArray &objs)
 This virtual function is called when widget receives a single-tap event. More...
 
virtual void updateMotion (const MultiWidgets::FrameInfo &frameInfo)
 Simulate the attributes that affect widget motion. More...
 
virtual void updateStyle ()
 Updates style to this widget. More...
 

Friends

void intrusivePtrRelease (const Widget *)
 
class MultiWidgetFactory
 
class WidgetRenderer
 

Additional Inherited Members

- Protected Attributes inherited from Stylish::CSSBoxModel
AttributeBackground m_background
 Background for this box.
 
AttributeBorder m_cssBorder
 Borders for this box.
 
Valuable::AttributeFrame m_cssMargin
 Size of the margin for this box (top, right, bottom, left)
 
Valuable::AttributeFrame m_cssPadding
 Size of the padding (top, right, bottom, left)
 
Valuable::AttributeLocation2f m_location
 Location of the upper-left corner.
 
Valuable::AttributeSizeF m_size
 Size of the content-box of the widget.
 

Detailed Description

This class is the base class for all user interface elements in Cornerstone.

Widget's behaviour can be changed by modifying its attributes or by inheritance.

This class has the following CSS pseudo-state:

  • :active Widget has some form of interaction (fingers, pens, markers).

See the Widgets section in the developer guide for more detailed description of widgets in Cornerstone.

Examples:
AdvancedRenderingExample.cpp, AnimatorExample.cpp, CustomInputWidgetExample.cpp, CustomRenderWidgetExample.cpp, DropHandlerExample.cpp, EventsExample.cpp, LegacyGLExample.cpp, MarkerExample.cpp, MixedJavaScriptExample.js, PenExample.cpp, PluginExample.cpp, PositionalSoundsExample.cpp, and SamplePlayerExample.cpp.

Member Typedef Documentation

Iterator for children.

Validity: Iterators are valid during calls to the input, update, and render functions, even some of the child widgets would be deleted or moved elsewhere during these function calls. Thus one can safely iterate over the children, even if the widget tree is modified. The iterators may get invalidated between these function calls, so one should not keep the iterators as member functions.

Some caution needs to be used if the children are being modified at the same time. If the widget that is being pointed to by the current iterator is removed, then dereferencing the iterator returns null, which naturaly needs to be checked againts, before using the iterator.

For example:

for (ChildIterator it = widget->childBegin(); it != widget->childEnd(); ++it) {
it->hide();
...
}

Using operator* iterator dereferences to WidgetPtr. The usage of operator-> is recommended if one only needs to call member functions of iterated widgets.

Reverse iterator for children.

ChildReverseIterator can be used to iterate over the child widgets in reverse order.

For example:

for (ChildReverseIterator it = widget->childReverseBegin(); it != widget->childReverseEnd(); ++it) {
it->show();
...
}
See Also
ChildIterator

Iterator for children.

Validity: Iterators are valid during calls to the input, update, and render functions, even some of the child widgets would be deleted or moved elsewhere during these function calls. Thus one can safely iterate over the children, even if the widget tree is modified. The iterators may get invalidated between these function calls, so one should not keep the iterators as member functions.

Some caution needs to be used if the children are being modified at the same time. If the widget that is being pointed to by the current iterator is removed, then dereferencing the iterator returns null, which naturaly needs to be checked againts, before using the iterator.

For example:

for (ChildIterator it = widget->childBegin(); it != widget->childEnd(); ++it) {
it->hide();
...
}

Using operator* iterator dereferences to WidgetPtr. The usage of operator-> is recommended if one only needs to call member functions of iterated widgets.

Reverse iterator for children.

ChildReverseIterator can be used to iterate over the child widgets in reverse order.

For example:

for (ChildReverseIterator it = widget->childReverseBegin(); it != widget->childReverseEnd(); ++it) {
it->show();
...
}
See Also
ChildIterator

Member Enumeration Documentation

Determines how Widget is displayed,.

See Also
http://www.w3.org/TR/CSS2/visuren.html#display-prop and http://www.w3.org/TR/css-flexbox-1/#flex-containers
Enumerator
DISPLAY_NONE 

"none", Widget is not displayed, and it ignores input

DISPLAY_BLOCK 

"block", Widget is displayed normally

DISPLAY_FLEX 

"flex", Widget becomes flex container using SimpleFlexBoxLayout

Standard flags for the Widget.

The default value for all flags is off.

Enumerator
FLAGS_NONE 

"flags-none", No flags set

DEPTH_CHANGED 

"depth-changed", The depth of the widget has changed.

This flag is (no longer) used internally within the MultiWidgets framework. The flag is going to be removed completely at some point.

RENDER_CULL_CHILDREN 

"render-cull-children" In rendering phase, the widget may cull its children.

This flag can be raised when it is known that the children of this widget are going to stay inside the widget, and can be culled from rendering at the same time as this widget is culled. This behavior will give minor performance benefit in many cases.

AUTO_RAISE_TO_TOP 

"auto-raise-to-top", Automatic raise-to-top behaviour.

If enabled the Widget is raised to top by calling raiseToTop when interaction-begin event is fired.

FORCE_RENDERING 

"force-rendering", If enabled Widget ignores culling while rendering.

Note
This won't force rendering if this is set for some widget who has a parent that is getting culled and has render-cull-children raised in its flags.
LOCK_DEPTH 

"lock-depth" The widget will not change its depth when raiseToTop is called, but will pass the call to its parent.

This flag is useful when one does not want the internal order of widgets to change.

FLAGS_DEFAULT 

"default" Default flags has only auto-raise-to-top-flag enabled.

Flags that control input processing.

Enumerator
INPUT_NONE 

"input-none", All input is ignored

INPUT_TRANSLATE_X 

"input-translate-x", Allow horizontal motion (relative to the parent)

INPUT_TRANSLATE_Y 

"input-translate-y", Allow vertical motion (relative to the parent)

INPUT_TRANSLATE_XY 

"input-translate-xy", Allow horizontal and vertical motion

INPUT_TRANSLATE 

"input-translate", Same as INPUT_TRANSLATE_XY

INPUT_ROTATION 

"input-rotation", Allow rotation of the widget

INPUT_SCALE 

"input-scale", Allow scaling of the widget

INPUT_MOTION 

"input-motion", Allow typical multi-touch drag + pinch + rotate (translation, rotation and scale)

INPUT_SINGLE_TAPS 

"input-single-taps", Use single-taps

INPUT_PASS_TO_CHILDREN 

"input-pass-to-children", Pass input to children

INPUT_KEEP_GRABS 

"input-keep-grabs", Specifies if fingers should be kept grabbed after it's certain that the fingers can't generate a single tap event.

This has no effect if input-single-taps is not set.

See Also
maximum-tap-motion
maximum-tap-time
INPUT_ROTATE_ABOUT_INTERACTION_CENTER 

"input-rotate-about-interaction-center", By default widget with angular damping keeps rotating around its center when thrown.

With this flag the widget rotates about the interaction center.

INPUT_OPERATORS 

"input-operators", Feed input to operators

INPUT_INCLUDE_EVERYTHING_INSIDE 

"input-include-everything-inside", If this is set, process all the tracked objects which intersect with this Widget, even if they are already grabbed.

See Also
processTrackedObjects
INPUT_DEFAULT 

"input-default", The default flags that control input processing.

Equals to "input-motion input-single-taps input-pass-to-children input-operators input-keep-grabs"

Different areas in Widget that can be interacted with.

Enumerator
TOUCH_CONTENT_BOX 

Accept touch only in content-box, excluding padding and border area.

See Also
CSSBoxModel::contentBox
TOUCH_PADDING_BOX 

Accept touch in content and padding area, but not in border area.

See Also
CSSBoxModel::paddingBox
TOUCH_BORDER_BOX 

Accept touch in the full widget area, including content, padding and border boxes.

See Also
CSSBoxModel::borderBox

Constructor & Destructor Documentation

MultiWidgets::Widget::Widget ( WidgetPtr  parent = nullptr)
explicit

Construct a new Widget.

Parameters
parentParent widget or nullptr if widget has no parent
Examples:
MarkerExample.cpp, and PenExample.cpp.
virtual MultiWidgets::Widget::~Widget ( )
virtual

Destroys this Widget and frees references to all its children.

This is always called automatically when there doesn't exist any WidgetPtr to Widget anymore. One should not ever call this manually.

Member Function Documentation

virtual void MultiWidgets::Widget::addChild ( const WidgetPtr w)
virtual

Add a child to this widget.

This function automatically detaches the given widget from its old parent.

Parameters
wWidget to add child.
void MultiWidgets::Widget::addOperator ( OperatorPtr  op)

Add an operator to the Widget.

Parameters
opNew operator to add
bool MultiWidgets::Widget::allowRotation ( ) const

Check whether the widget can be rotated.

Examines input-rotation flag in input-flags.

Returns
Is rotation allowed?
See Also
setAllowRotation, input-flags
float Widget::angularDamping ( ) const

Set the angular damping of the widget, which controls how fast the the angular velocity (omega) will slow down when thrown.

Value of 0 means no damping at all (rotation never slows down) and 1 means that the widget stops immediately when rotated.

See Also
setAngularDamping, damping, scale-damping
Returns
Current value of the angular-damping attribute
float Widget::angularVelocity ( ) const

Angular velocity of the widget in radians per second.

This attribute controls the current angular velocity of the widget. Attribute angular-damping controls how fast this value will slow down.

See Also
setAngularVelocity, angular-damping
Returns
Current value of the omega attribute
Animation& MultiWidgets::Widget::animation ( )

Get the animation controller for this widget.

Returns
animation controller
const Animation& MultiWidgets::Widget::animation ( ) const

Get the animation controller for this widget.

Returns
animation controller
bool MultiWidgets::Widget::autoRaiseToTop ( ) const

Returns whether the widget is automatically raised to top.

If enabled, the widget is raised to top by calling raiseToTop when interaction-begin event is fired. Basically this just check whether the auto-raise-to-top-flag is raised in flags.

Returns
True if enabled, false otherwise.
See Also
setAutoRaiseToTop
virtual Nimble::Rect MultiWidgets::Widget::boundingRect ( ) const
virtual

This function defines the outer bounds of the item as a rectangle in widget coordinates.

The bounds are used to determine which widgets get input and are redrawn.

The bounding box is always rectangular and it is unaffected by the widget's transform().

See Also
CSS::borderBox
Returns
Bound rectangle in widget coordinates.

Reimplemented in MultiWidgets::ItemFlowWidget, MultiWidgets::DropShadowWidget, and MultiWidgets::JavaScriptWidget.

static void MultiWidgets::Widget::calculateMotion ( const FingerArray fingers,
Nimble::Vector2f translate,
float &  scale,
float &  rotate,
Nimble::Vector2f prevCenter 
)
static

Computes the translation, rotation, and scale to apply to widget based on the interacting fingers.

The returned values are in screen coordinates so the need to be mapped into the widget coordinates for example using GrabManager.

Parameters
[in]fingersarray of interacting fingers
[out]translatetranslation
[out]scalerotation
[out]rotaterotation
[out]prevCentercenter of the fingers
bool MultiWidgets::Widget::checkFlags ( Radiant::FlagsT< Flags flags) const

Checks the given flags from flags -attribute.

Parameters
flagsFlags to check,
Returns
True if any of the given flags is set, false if none of them is set.
bool MultiWidgets::Widget::checkInputFlags ( Radiant::FlagsT< InputFlags flags) const

Checks the given input flags from input-flags -attribute.

Parameters
flagsFlags to check
Returns
True if any of the given flags is set, false if none of them is set.
WidgetPtr MultiWidgets::Widget::child ( size_t  i)

Return the ith child widget.

The children are iterated in the same order as they are drawn, ie. from the greatest depth value to the lowest. As widget's children are actually located in a linked structure this function is not terribly fast. To iterate through the all the children you should use ChildIterator and functions childBegin and childEnd.

Parameters
iIndex of the child. Null is returned if i < 0 or i >= numChildren()
Returns
Pointer to the child widget or NULL if widget wasn't found
ChildIterator MultiWidgets::Widget::childBegin ( )

Returns an iterator to the first child.

That is, the child with the largest depth value.

Returns
Iterator to the first child item
See Also
childEnd
ConstChildIterator MultiWidgets::Widget::childBegin ( ) const

Returns an iterator to the first child.

That is, the child with the largest depth value.

Returns
Iterator to the first child item
See Also
childEnd
ChildIterator MultiWidgets::Widget::childEnd ( )

Returns an iterator to the end of the children.

In the true STL-style the returned iterator location is after the last actual child element.

Returns
Iterator to the one past-the-end child.
See Also
childBegin
ConstChildIterator MultiWidgets::Widget::childEnd ( ) const

Returns an iterator to the end of the children.

In the true STL-style the returned iterator location is after the last actual child element.

Returns
Iterator to the one past-the-end child.
See Also
childBegin
Nimble::Rect MultiWidgets::Widget::childrenRect ( ) const

Returns the bounding box of this widget's children in widget coordinates.

If the widget has no children, an empty bounding box is returned.

Note
This does not include the widget's own bounding box, only the accumulated bounding box of its children. If you need to include this widget's bounding box, you can expand the childrenRect() with boundingRect().
Returns
Bounding box of widget's children in widget coordinates.
ChildReverseIterator MultiWidgets::Widget::childReverseBegin ( )

Returns an iterator addressing the first child element in reverse order.

That is, the child that has the smallest depth value.

Returns
Reverse iterator to the first child in reverse order.
See Also
childReverseEnd
ConstChildReverseIterator MultiWidgets::Widget::childReverseBegin ( ) const

Returns an iterator addressing the first child element in reverse order.

That is, the child that has the smallest depth value.

Returns
Reverse iterator to the first child in reverse order.
See Also
childReverseEnd
ChildReverseIterator MultiWidgets::Widget::childReverseEnd ( )

Returns an iterator addressing the next item past the last child in a reversed order.

Returns
Reverse iterator to the one past-the-end child
See Also
childReverseEnd
ConstChildReverseIterator MultiWidgets::Widget::childReverseEnd ( ) const

Returns an iterator addressing the next item past the last child in a reversed order.

Returns
Reverse iterator to the one past-the-end child
See Also
childReverseEnd
void MultiWidgets::Widget::clearFlags ( Radiant::FlagsT< Flags flags)

Sets the given widget flags to zero in flags.

Parameters
flagsFlags to clear.
void MultiWidgets::Widget::clearInputFlags ( Radiant::FlagsT< InputFlags flags)

Sets the given widget input flags to zero in input-flags.

Parameters
flagsFlags to clear
WidgetPtr MultiWidgets::Widget::clone ( ) const

Create a clone of the widget.

This function will create a copy of the widget and its children recursively. The top-most cloned widget will not have a parent.

Returns
Clone of the widget.
bool MultiWidgets::Widget::contains ( const Widget w) const

Checks whether the given widget is fully inside the area of this widget.

Assumes that both of the widgets are rectangular.

Parameters
wWidget to check.
Returns
True if given widget is inside this widget's area, false otherwise
static WidgetPtr MultiWidgets::Widget::create ( const Valuable::ArchiveElement element)
static

Creates and deserializes a widget from the given archive.

Parameters
elementElement that is being deserialized.
Returns
Newly created Widget. Returns nullptr if could not deserialize.
float MultiWidgets::Widget::damping ( ) const

The damping of the Widget controls how quickly the Widget will slow down and stop when thrown.

It is used to model friction and drag. Greater damping values cause the widget to slow down more quickly and thus travel a smaller distance, while lower values cause more slower deceleration.

The damping coefficient basically tells how fast the velocity of the widget is decreased in one second. For example with the default value 0.995 the widget's velocity is decreased to 0.5% of the original speed in one second when thrown.

Value of 0 means no damping at all (never slows down) and 1 means that the widget stops immediately when thrown.

See Also
setDamping, angular-damping, scale-damping
float MultiWidgets::Widget::depth ( ) const

Depth of the widget.

Depth affects the stacking order of sibling widgets. Larger depth means the widget will be drawn on top of a widget with lower depth if they share the same parent. Children of a widget with positive depth will be drawn on top of the parent. The ones with negative depth will be drawn behind the parent. Siblings with identical depths will be drawn in an unspecified but constant order as long as the widgets live and are not interacted with. Changing the depth of the widget does not instantly change the order of the widgets, but the parent widget will re-order the widgets by itself during the update call.

virtual bool MultiWidgets::Widget::deserialize ( const Valuable::ArchiveElement element)
virtual

Deserializes the widget's attributes and its descendants from given archive element.

At this point widget needs to have already correct type.

Parameters
elementSource of the deserialized widget.
Returns
Was the deserialization successful.

Reimplemented from Valuable::Node.

Reimplemented in WebBrowserCef::BrowserWidget.

DisplayMode MultiWidgets::Widget::display ( ) const

Controls widget visibility.

If a widget's display mode is set to none it will not have any input processing done nor it will be rendered. The effect is recursive, so no input or rendering is performed on any child widgets either. When display is set to block widget's input and rendering is normal.

See Also
setDisplay
void MultiWidgets::Widget::dropAllGrabs ( GrabManager input)

Drops all the grabs that this Widget has.

Parameters
inputGrabManager managing the grabs.
virtual void MultiWidgets::Widget::dumpInfo ( FILE *  f = nullptr,
int  indent = 0 
)
virtual

Dump information about this widget to the given file.

This method is useful mostly as a debugging aid, as it will list all widgets in the hierarchy, including their core parameters (size, location, speed, color, operators etc.).

You should not rely on this function providing any specific data-formatting. In the general the data is presented in a human-readable form.

Parameters
fOutput file or nullptr for stdout.
indentIndenting level, used when calling dumpInfo recursively

Reimplemented in MultiWidgets::ViewWidget.

virtual void MultiWidgets::Widget::eventProcess ( const QByteArray &  id,
Radiant::BinaryData data 
)
virtual

Entry point for incoming events Class specific behaviour to events is implemented in this function.

See Event System -section in Developer Guide for in-depth discussion about events in Cornerstone.

Overriding: Inherited classes can override this function for implementing custom behaviour for events. When overriding this function one needs to remember to call base-class implementation for discarded events. Otherwise large portion of the inherited behaviour gets incomplete.

See example about overriding below:

class MyWidget : public BaseClassWidget {
typedef BaseClassWidget Parent;
...
};
virtual void MyWidget::eventProcess(const QByteArray & id, Radiant::BinaryData & data)
{
if(id == "play") play();
else if(id == "stop") stop();
else Parent::eventProcess(id, data); // <- This is important!
}
Parameters
idName of the incoming event.
dataData associated to the incoming event.

Reimplemented from Valuable::Attribute.

Reimplemented in MultiWidgets::KeyboardWidget, MultiWidgets::CloudWidget, MultiWidgets::VideoWidget, MultiWidgets::ItemFlowWidget, MultiWidgets::ListWidget, MultiWidgets::ImageWidget, MultiWidgets::TextEditWidget, MultiWidgets::ImageMovieWidget, MultiWidgets::TimerDialWidget, MultiWidgets::FlippingWidget, MultiWidgets::BrowserFrameWidget, MultiWidgets::JavaScriptWidget, and MultiWidgets::BookWidget.

Examples:
EventsExample.cpp, and MixedJavaScriptExample.js.
float Widget::extraInputCaptureRadius ( ) const

Extra radius (in widget coordinates) used when input is processed.

This increases the size of the widget when conducting checks during the input handling. The radius is uniformly applied to every direction from the widget and it will get scaled with widget scaling.

See Also
setExtraInputCaptureRadius
Returns
Current value of the extra-input-capture-radius attribute
template<typename W >
QList< Radiant::IntrusivePtr< W > > Widget::find ( const QString &  cssSelector)
inline

Find all descendant widgets that match the given CSS selector and can be casted to given type.

Parameters
cssSelectorCSS-selector string.
Returns
List of matched widgets.
Template Parameters
WRestrict search to widgets having this in their inheritance hierarchy.
static WidgetPtr MultiWidgets::Widget::findById ( Uuid  id)
static

Search Widget by its id.

All of the widgets belonging to application are checked.

Parameters
idNode id of the widget to be searched.
Returns
Widget with the given id. If not found nullptr is returned.
virtual void MultiWidgets::Widget::fingerDown ( MultiTouch::Finger  f,
MultiWidgets::GrabManager gm 
)
virtual

Called when a new finger is grabbed by the widget.

When this function is called the finger is already grabbed by the widget and is stored in array returned by grabbedFingers. This function is meant to be overriden: the default implementation is empty.

Parameters
fThe new finger
gmGrabManager holding the current input frame
See Also
fingerUp, trackedObjectDown, penDown, handDown, markerDown

Reimplemented in MultiWidgets::KeyboardWidget2.

virtual void MultiWidgets::Widget::fingerUp ( MultiTouch::Finger  f,
MultiWidgets::GrabManager gm 
)
virtual

Called when a finger is ungrabbed by the widget When this function is called the finger is already ubgrabbed by the widget and it does not lie anymore in array returned by grabbedFingers This function is meant to be overriden: the default implementation is empty.

Parameters
fthe finger leaving the widget
gmthe GrabManager holding the current input frame
See Also
fingerDown

Reimplemented in MultiWidgets::FlippingWidget, and MultiWidgets::KeyboardWidget2.

Radiant::FlagsT<Flags> MultiWidgets::Widget::flags ( ) const

Widget flags define common behaviour of widget.

See Also
setFlags, raiseFlags, clearFlags, checkFlags
bool MultiWidgets::Widget::forceRendering ( ) const

See whether forced rendering is enabled.

If enabled widget ignores culling while rendering. This is shortcut for checking the status of force-rendering-flag in widget's flags.

See Also
setForceRendering
Returns
True if forced rendering is enabled, false otherwise.
OperatorPtr MultiWidgets::Widget::getOperator ( size_t  i)

Returns the ith operator.

If given index exeeds operatorCount, nullptr is returned.

Parameters
iIndex for operator
Returns
Operator associated with the given index.
template<class T >
QList<std::shared_ptr<T> > MultiWidgets::Widget::getOperatorsOfType ( )
inline

Returns all the operator pointers that contain operator of the given type.

Template Parameters
TType of operators to search.
Returns
List of operators with requested type attached to this widget.
FingerIds MultiWidgets::Widget::grabbedFingers ( ) const

Returns all grabbed fingers.

Returns
Ids of all grabbed fingers.
HandIds MultiWidgets::Widget::grabbedHands ( ) const

Returns a list of hand ids that are grabbed by this widget.

Returns
Ids of all grabbed hands
MarkerIds MultiWidgets::Widget::grabbedMarkers ( ) const

Returns a list of marker ids that are grabbed by this widget.

Returns
Ids of all grabbed markers
PenIds MultiWidgets::Widget::grabbedPens ( ) const

Returns a list of pen ids that are grabbed by this widget.

Returns
Ids of all grabbed pens
TrackedObjectIds MultiWidgets::Widget::grabbedTrackedObjects ( ) const

Shortcut for InputGrabber::grabbedObjects.

Returns
Ids of all grabbed objects
virtual void MultiWidgets::Widget::handDown ( MultiTouch::Hand  h,
MultiWidgets::GrabManager gm 
)
virtual

Called when a hand is grabbed by the widget This function is meant to be overriden: the default implementation is empty.

Parameters
hThe new hand
gmGrabManager holding the current input frame
See Also
handUp, trackedObjectDown, fingerDown, markerDown, penDown
virtual void MultiWidgets::Widget::handUp ( MultiTouch::Hand  h,
MultiWidgets::GrabManager gm 
)
virtual

Called when a hand is ungrabbed by the widget This function is meant to be overriden: the default implementation is empty.

Parameters
hthe new hand
gmGrabManager holding the current input frame
See Also
handDown
virtual bool MultiWidgets::Widget::hasActiveOperators ( bool  recursive)
virtual

Returns true if the Widget currently has active operators.

Parameters
recursiveIf true, perform the check recursive to all child widgets.
Returns
True if the widget has active operators.
See Also
Operator::isActive
bool MultiWidgets::Widget::hasChild ( const WidgetPtr w,
bool  recursive = false 
)

Returns true if the widget has w as a child or descendant.

Parameters
wWidget to check.
recursiveIf true all the descendants are searched, otherwise only children are searched.
Returns
True if the given widget was found, false otherwise.
virtual bool MultiWidgets::Widget::hasInteraction ( Radiant::FlagsT< MultiTouch::TrackedObjectType types = MultiTouch::TYPE_ALL,
bool  recursive = false 
) const
virtual

Check if the widget is currently being interacted with.

Event has-interaction is sent every time when this state changes.

Parameters
typesTypes of tracked objects to query for.
recursiveShould the query be recursive, ie. are the children inspected.
Returns
True if the widget has interaction, false otherwise.

Reimplemented in MultiWidgets::ViewWidget.

bool MultiWidgets::Widget::hasOperator ( OperatorPtr  op) const

Checks if the given operator is attached to the widget.

Parameters
opOperator to check.
Returns
True if operator is attached to the widget, false othwerwise.
template<typename T >
bool MultiWidgets::Widget::hasOperatorType ( ) const
inline

Checks if the given operator type is present in the operators.

The following call would check whether there is StayInsideParentOperators attached to this widget.

hasOperatorType<StayInsideParentOperator>();
Template Parameters
TType of operators to search.
Returns
True if the widget has an operator of type T
virtual float MultiWidgets::Widget::heightForWidth ( float  width) const
virtual

Returns the height of the widget for the given width while maintaining aspect ratio.

Parameters
widthWidth to get the height for.
Returns
Height for the given width.

Reimplemented from Stylish::CSSBoxModel.

Reimplemented in MultiWidgets::TextWidget, and MultiWidgets::VideoControlWidget.

virtual void MultiWidgets::Widget::hide ( )
virtual

Hide the widget.

Identical to calling setDisplay(DISPLAY_NONE).

virtual void MultiWidgets::Widget::input ( MultiWidgets::GrabManager gm,
float  dt 
)
finalvirtual

Send input to a Widget.

This function is the entry-point for touch-screen input processing. By itself it only performs matrix stack management, and calls other functions to perform the actual input operations, like gesture recognition, etc. This is called automatically by input processing framework.

Overriding: One should not never override this function. If there is a need to perform something for all of the input processInput should be overriden.

Parameters
gmGrab manager holding the current input frame.
dtTime since last input frame in seconds
virtual void MultiWidgets::Widget::inputChildrenBack ( MultiWidgets::GrabManager gm,
float  dt,
MultiWidgets::Widget::ChildIterator  it 
)
protectedvirtual

Sends the input to children in front-to-back order.

Calls input for all the widgets starting from the given iterator. Unlike inputChildrenFront this function does not care abotu the value of depth.

Parameters
gmGrabManager to use for calls of input
dtTime difference parameter to use with input
itIterator to child that is processed first.
See Also
inputChildrenFront

Reimplemented in MultiWidgets::FlippingWidget.

virtual ChildIterator MultiWidgets::Widget::inputChildrenFront ( MultiWidgets::GrabManager gm,
float  dt 
)
protectedvirtual

Sends the input to children in front-to-back order.

Calls input for all the widgets that have depth value greater or equal to zero. This function is called automatically in input.

Parameters
gmGrabManager to use for calls of input
dtTime difference parameter to use with input
Returns
Iterator to child which has the greatest depth value below zero.
See Also
inputChildrenBack

Reimplemented in MultiWidgets::FlippingWidget.

Radiant::FlagsT< Widget::InputFlags > Widget::inputFlags ( ) const

Current input processing parameters which determine how this widget will react to input.

See Also
setFixed, allowRotation, setInputTransparent, setInputFlags
Returns
Current value of the input-flags attribute
InputGrabber& MultiWidgets::Widget::inputGrabber ( )

Get the input grabber for the widget.

Returns
InputGrabber of this widget
const InputGrabber& MultiWidgets::Widget::inputGrabber ( ) const

Get the input grabber for the widget.

Returns
InputGrabber of this widget
bool MultiWidgets::Widget::inputMotion ( ) const

Check if this widget has any input motion flag enabled.

Shortcut for checking if some of the input-motion flags are raised in input-flags.

Returns
True if any of the input motion flags are true.
bool MultiWidgets::Widget::inputTaps ( ) const

Check if widget listens single-tap events.

Shortcut for checking if input-single-taps flas is raised in input-flags.

Returns
True if this widget listens for taps, false otherwise.
Radiant::TimeStamp MultiWidgets::Widget::interactionBegan ( ) const

Returns the time when the last interaction started on the widget.

Returns
When the previous interaction for the widget started.
virtual void MultiWidgets::Widget::interactionBegin ( MultiWidgets::GrabManager gm)
protectedvirtual

This function gets called when the widget gets any interaction on it when it previously didn't have one.

All tracked object types count as interaction, be it markers, hands, fingers, or pens. Is meant to be overriden: the default implementation does nothing.

Parameters
gmGrabManager used in input handling.
See Also
interactionEnd, interaction-begin
Nimble::Vector2 MultiWidgets::Widget::interactionCenter ( ) const

Current or previous interaction center in widget coordinates.

Interaction center is the point around which the widget is rotated or scaled.

Returns
Point in widget coordinates
virtual void MultiWidgets::Widget::interactionEnd ( MultiWidgets::GrabManager gm)
protectedvirtual

This function gets called when the widget stops having any interaction on it while it previously had some.

Is meant to be overriden: the default implementation does nothing.

Parameters
gmGrabManager used in input handling.
See Also
interactionBegin, interaction-end

Reimplemented in MultiWidgets::KeyboardWidget, MultiWidgets::BookWidget, and MultiWidgets::KeyboardWidget2.

bool MultiWidgets::Widget::intersects ( const Widget w) const

Check if this widget intersects referenced widget.

Assumes that both of the widgets are rectangular.

Parameters
wWidget to check the intersection against.
Returns
True if this widget intersects referenced widget.
virtual Nimble::SizeF MultiWidgets::Widget::intrinsicSize ( ) const
inlinevirtual

The preferred size of the Widget without scaling.

Used for layout purposes. For example in ImageWidget this is the native seze of the displayed image.

Returns
The native size of the widget

Reimplemented in MultiWidgets::ImageWidget, MultiWidgets::ImageMovieWidget, and MultiWidgets::VideoWidget.

bool MultiWidgets::Widget::isDisplayed ( ) const

Checks whether the value of display is not none.

Returns
False if widget's input and rendering are disabled.
bool MultiWidgets::Widget::isFixed ( ) const

Returns true if the widget has been set to immovable.

Shortcut for checking if some of the input-motion flags are raised in input-flags.

See Also
setFixed, input-flags
bool MultiWidgets::Widget::isGrabbed ( MultiTouch::TrackedObject::Id  id) const

Checks if a given object is grabbed by this widget.

Parameters
idThe id of the object to check (for example, a finger id).
Returns
True if the widget grabs the given hand
virtual bool MultiWidgets::Widget::isInside ( Nimble::Vector2f  v) const
virtual

Test if the given point is inside the Widget.

The point is provided in Widget coordinates. The interaction engine calls this function to determine if a given location is inside this widget. That information is used to select which fingers should affect this widget.

Overriding: This function is typically overridden in cases where the widget has a special shape (i.e. it is not a rectangle like the default widgets).

Parameters
vPoint in Widget coordinates to test.
Returns
True if the point is inside the Widget, false otherwise.

Reimplemented in MultiWidgets::ImageMovieWidget, MultiWidgets::FlippingWidget, MultiWidgets::ImageWidget, MultiWidgets::TimerDialWidget, MultiWidgets::BookWidget, MultiWidgets::JavaScriptWidget, MultiWidgets::WheelWidget, and MultiWidgets::KeyboardWidget2.

virtual bool MultiWidgets::Widget::isReady ( bool  recursive) const
finalvirtual

Recursive version of isReady.

Parameters
recursiveIf true, recursively check child widgets
Returns
True if the whole widget subtree is ready
virtual bool MultiWidgets::Widget::isReady ( ) const
virtual

Is the widget ready to be displayed on screen.

Widgets that require some initialization or data that is provided using asynchronous methods may not be ready for rendering before the initialization is complete. This function should be overriden in derived classes if they require time to setup before they can be rendered.

There exists different types of readiness for the built-in media widgets. See their common base class BaseMediaWidget for more information.

Returns
True for the default implementation

Reimplemented in MultiWidgets::BaseMediaWidget.

bool MultiWidgets::Widget::isVisible ( ) const
inline

Checks whether the value of display is not none.

Returns
False if widget's input and rendering are disabled.
virtual Radiant::TimeStamp MultiWidgets::Widget::lastInteractionTime ( bool  recursive = false) const
virtual

Timestamp of the last interaction on this Widget.

Parameters
recursiveIf this argument is true, then the timestamp of all children will be checked as well, and the latest timestamp is returned.
Returns
Last interaction timestamp or 0 if no interaction has occurred.

Reimplemented in MultiWidgets::ViewWidget.

void MultiWidgets::Widget::lower ( int  levels,
bool  force = false 
)

Lower the widget below its siblings.

This function lowers the widget below the given amount of its sibling widgets. The functionality is achieved by manipulating widget's depth. For example, if there are three widgets in the scene and lower(1) is called to the top-most widget, it will move between the two other widgets. Calling lower(2) would make the top-most widget the bottom widget.

Parameters
levelsamount to lower
forceLower the widget even if lock-depth has been set
See Also
raise, raiseToTop, lowerToBottom
void MultiWidgets::Widget::lowerToBottom ( bool  recursive = false)

Brings this Widget behind its siblings and its parent If the lock-depth flag has been raised, then this widget will not change its depth and only the recursive functionality will take effect.

When recursive lower-to-bottom operation will reach as far as there are parent widgets available.

Note
that ViewWidget cuts the parent-graph so this function cannot reach beyond views.
Parameters
recursiveOnly work with siblings of the widget if false, otherwise lower all the widgets in the path from this widget to the root widget.
See Also
raiseToTop, raise, lower
Nimble::Vector2f MultiWidgets::Widget::mapFromParent ( const Nimble::Vector2f p) const

Transform a point from parent coordinates to Widget coordinates.

Parameters
pPoint in parent's coordinates.
Returns
Point p mapped to this widget's coordinate system.
Nimble::Vector2f MultiWidgets::Widget::mapFromScene ( const Nimble::Vector2f p) const

Transform a point from scene coordinates to Widget coordinates.

Parameters
pPoint in scene's coordinate system.
Returns
Point p mapped to this widget's coordinate system.
Nimble::Vector2f MultiWidgets::Widget::mapToParent ( const Nimble::Vector2f p) const

Transform a point from Widget coordinates to parent coordinates.

Parameters
pPoint to transform that is in this widget's coordinates.
Returns
Point mapped to parent cordinates.
Nimble::Vector2f MultiWidgets::Widget::mapToParent ( Widget w,
const Nimble::Vector2f p 
) const

Transform a point from Widget coordinates to its ancestor coordinates.

Parameters
wAncestor of this widget. The point is mapped to this widget's coordinate system.
pPoint to transform that is in this widget's coordinates.
Returns
Point mapped to ancestor coordinates
Nimble::Vector2f MultiWidgets::Widget::mapToScene ( const Nimble::Vector2f p) const

Transform a point from Widget coordinates to scene coordinates.

Parameters
pPoint in widget's coordinate system.
Returns
Point p mapped to the scene's coordinate system.
virtual void MultiWidgets::Widget::markerDown ( MultiTouch::Marker  m,
MultiWidgets::GrabManager gm 
)
virtual

Called when a new marker is grabbed by the widget.

This function is meant to be overriden: the default implementation is empty.

Parameters
mThe new marker
gmGrabManager holding the current input frame
See Also
markerUp, trackedObjectDown, fingerDown, penDown, handDown

Reimplemented in MultiWidgets::MarkerLauncherWidget.

virtual void MultiWidgets::Widget::markerUp ( MultiTouch::Marker  m,
MultiWidgets::GrabManager gm 
)
virtual

Called when a marker is ungrabbed by the widget.

This function is meant to be overriden: the default implementation is empty.

Parameters
mThe new marker
gmGrabManager holding the current input frame
See Also
markerDown

Reimplemented in MultiWidgets::MarkerLauncherWidget.

float Widget::maximumTapMotion ( ) const

Adjusts the limit for recognizing taps within this Widget.

A gesture is not recognized as a tap if the finger has moved more than maximum-tap-motion pixels away from the first point of contact.

See Also
setMaximumTapMotion, maximum-tap-time
Returns
Current value of the maximum-tap-motion attribute
float Widget::maximumTapTime ( ) const

Adjusts the time limit for recognizing taps.

A gesture is not recognized as a tap if the finger contact has exceeded this time. The value is in seconds.

See Also
setMaximumTapTime, maximum-tap-motion
Returns
Current value of the maximum-tap-time attribute
size_t MultiWidgets::Widget::numChildren ( ) const

Returns the number of child Widgets.

Returns
The number of children.
float MultiWidgets::Widget::opacity ( ) const

Transparency factor that gets recursively applied to any child widgets this widget has.

This makes it easy to implement, for example, fade effects.

See Also
setOpacity
size_t MultiWidgets::Widget::operatorCount ( ) const

Returns the number of operators applied to this Widget.

Returns
Number of operators attached to this widget.
Nimble::Vector2 MultiWidgets::Widget::origin ( ) const

Relative origin of the widget coordinates.

Coordinate (0,0) is upper left and (1,1) is bottom right. This will affect how the values of rotation, scale and location will affect to widget.

Note
The origin can be outside the widget, so the coordinates aren't required to be in unit interval.
See Also
setOrigin
WidgetPtr MultiWidgets::Widget::parent ( ) const

Get a pointer to the Widget's parent.

Returns
Widget's parent of nullptr if the Widget has no parent or the parent reference count is still zero (we are in parent constructor).
virtual void MultiWidgets::Widget::parentChanged ( WidgetPtr  oldParent)
virtual

This is called after the parent has changed.

This function is meant for overriding. By default the implementation is empty.

Parameters
oldParentThe previous parent.

Reimplemented in MultiWidgets::VideoWidget, MultiWidgets::BrowserWidget, MultiWidgets::VideoControlWidget, and MultiWidgets::DropShadowWidget.

virtual void MultiWidgets::Widget::penDown ( MultiTouch::Pen  p,
MultiWidgets::GrabManager gm 
)
virtual

Called when a pen is grabbed by the widget.

This function is meant to be overriden: the default implementation is empty.

Parameters
pThe new pen
gmGrabManager holding the current input frame
See Also
penUp, trackedObjectDown, fingerDown, markerDown, handDown
virtual void MultiWidgets::Widget::penUp ( MultiTouch::Pen  p,
MultiWidgets::GrabManager gm 
)
virtual

Called when a pen is ungrabbed by the widget This function is meant to be overriden: the default implementation is empty.

Parameters
pThe new pen
gmGrabManager holding the current input frame
See Also
penDown
virtual void MultiWidgets::Widget::postConstruct ( )
protectedvirtual

Called just after widget is fully created and normal constructors have been called, but before MultiWidgets::create returns.

The default implementation does nothing.

virtual void MultiWidgets::Widget::preDestroy ( )
protectedvirtual

Called just before the widget is deleted and before destructor is called.

This is triggered from intrusivePtrRelease. This will shut down style system and remove event listeners where the target is this widget, if you override this, remember to call the base class version.

virtual void MultiWidgets::Widget::processFingers ( MultiWidgets::GrabManager gm,
const MultiWidgets::FingerArray fingers,
float  dt 
)
protectedvirtual

Processes the fingers that the Widget has grabbed.

The default implementation implements the typical input gestures (drag, zoom, scale, rotate).

Overriding: This function can be overriden in derived classes. If the derived class needs to have default drag/scale/rotate gestures, this function has to be called in the overriding function.

Parameters
gmGrabManager used in input handling
fingersArray of fingers grabbed by the widget
dtTime from last frame in seconds

Reimplemented in MultiWidgets::KeyboardWidget, MultiWidgets::ImageMovieWidget, MultiWidgets::FlippingWidget, MultiWidgets::RippleOverlayWidget, MultiWidgets::SliderWidget, MultiWidgets::WheelWidget, MultiWidgets::BookWidget, MultiWidgets::CloudWidget, and MultiWidgets::KeyboardWidget2.

virtual void MultiWidgets::Widget::processHands ( MultiWidgets::GrabManager gm,
const MultiWidgets::HandArray hands,
float  dt 
)
protectedvirtual

Processes the grabbed hands.

Is meant to be overriden: the default implementation does nothing.

Parameters
gmGrabManager used in input handling
handsArray of hands currently on the widget
dtTime from last frame in seconds
virtual void MultiWidgets::Widget::processInput ( MultiWidgets::GrabManager gm,
float  dt 
)
virtual

Do extra input processing.

This function can be used to perform extra input processing. The default implementation does nothing. This function is always called during the input phase, if display is set to block. This function is always called, even if there is no interaction on it.

Parameters
gmGrab manager holding the current input frame,
dtTime since last input frame in seconds

Reimplemented in MultiWidgets::InputVisualizerWidget, MultiWidgets::ViewWidget, and MultiWidgets::JavaScriptWidget.

virtual void MultiWidgets::Widget::processMarkers ( MultiWidgets::GrabManager gm,
const MultiWidgets::MarkerArray markers,
float  dt 
)
protectedvirtual

Processes the grabbed markers.

Is meant to be overriden: the default implementation does nothing.

Parameters
gmGrabManager used in input handling
markersArray of markers currently grabbed by the widget
dtTime from last frame in seconds

Reimplemented in MultiWidgets::BrowserWidget.

virtual void MultiWidgets::Widget::processPens ( MultiWidgets::GrabManager gm,
const MultiWidgets::PenArray pens,
float  dt 
)
protectedvirtual

Processes the grabbed pens Is meant to be overriden: the default implementation does nothing.

Parameters
gmGrabManager used in input handling
pensArray of pens currently grabbed by the widget
dtTime from last frame in seconds
virtual void MultiWidgets::Widget::processTrackedObjects ( MultiWidgets::GrabManager gm,
const MultiWidgets::TrackedObjects grabbed,
float  dt 
)
protectedvirtual

Processes all of the grabbed objects (hands, fingers, pens, markers).

The default implementation calls the various sub-routines for different tracked object types, like processFingers, processMarkers, processPens and processHands. Overriding: Generally it is not recommended to override this function because it forwards the input handling to specific functions which are more. suitable for overriding.

Parameters
gmGrabManager used in input handling
grabbedArray of objects currently grabbed by the widget
dtTime from last frame in seconds

Reimplemented in MultiWidgets::InputVisualizerWidget.

void MultiWidgets::Widget::raise ( int  levels,
bool  force = false 
)

Raise the widget above its sibings.

This function raises the widget above the given amount of its sibling widgets. For example, if there are three widgets in the scene and raise(1) is called to the bottom widget, it will move between the two other widgets. Calling raise(2) would make the bottom widget the top-most widget.

Parameters
levelsAmount to raise
forceRaise the widget even if lock-depth has been set
See Also
lower, raiseToTop, lowerToBottom
void MultiWidgets::Widget::raiseFlags ( Radiant::FlagsT< Flags flags)

Raises the given widget flags.

Sets value of flags to be given flags combined with current value of flags using logical or.

Parameters
flagsFlags to raise
void MultiWidgets::Widget::raiseInputFlags ( Radiant::FlagsT< InputFlags flags)

Raises the given widget input flags.

Sets value of input-flags to be given flags combined with current value of flags using logical or.

Parameters
flagsFlags to raise.
void MultiWidgets::Widget::raiseToTop ( bool  recursive = false)

Brings this Widget to the front of its siblings and its parent.

If the lock-depth flag has been raised, then only the recursive functionality of this function will take effect and depth of the widget is left untouched.

When recursive raise-to-top operation will reach as far as there are parent widgets available.

Note
ViewWidget cuts the parent-graph so this function cannot reach beyond views.
Parameters
recursiveIf set to true, the raiseToTop action will be carried out recursively to parent widgets.
See Also
lowerToBottom, lower, raise
virtual void MultiWidgets::Widget::removeChild ( const WidgetPtr w)
virtual

Removes the child from this widget's child list if present.

Parameters
wChild to remove.
bool MultiWidgets::Widget::removeOperator ( OperatorPtr  op)

Removes the given operator from the widget.

Parameters
opOperator to remove.
Returns
False if operator wasn't found in the widget, true if found and removed.
template<class T >
void MultiWidgets::Widget::removeOperatorType ( )
inline

Removes all operators of given type.

The following call would remove all StayInsideParentOperators attached to this widget.

removeOperatorType<StayInsideParentOperator>();
Template Parameters
TType of operetors to remove.
virtual void MultiWidgets::Widget::render ( Luminous::RenderContext r) const
finalvirtual

Render the Widget and recursively its children This function calls the rest of the rendering functions that can be overridden to specialize parts of the Widget rendering.

See Rendering Engine section of the developer guide for more discussion about rendering in Cornerstone.

Thread safety: The rendering functions must be thread-safe, so that multi-threaded rendering engine works in the expected way.

Timing: Render is always called after update.

Overriding: This function should never be overriden. For the custom rendering one can override functions renderBackground, renderContent and renderBorder.

Parameters
rRender context of the rendering thread
virtual void MultiWidgets::Widget::renderBackground ( Luminous::RenderContext r) const
protectedvirtual

Render the Widget background as specified in CSS3 Backgrounds and Border Module.

This function is called from the main render function. The end result of this function is controlled background-attribute.

See Also
http://www.w3.org/TR/css3-background/

Overriding: This can be overriden for rendering the background of widget. If overriden, background defined in CSS won't get drawn unless renderBackground of the base class is explicitly called.

Parameters
rRender context of the rendering thread

Reimplemented in MultiWidgets::TimerDialWidget, and MultiWidgets::JavaScriptWidget.

virtual void MultiWidgets::Widget::renderBorder ( Luminous::RenderContext r) const
protectedvirtual

Render the border of the Widget.

This function is called from the main render function. The end result of this function is by default controlled by border-attribute.

Overriding: This can be overriden for rendering the borders of widget. If overriden, borders defined in CSS won't get drawn unless renderBorder of the base class is explicitly called.

Parameters
rRender context of the rendering thread

Reimplemented in MultiWidgets::JavaScriptWidget.

virtual ConstChildReverseIterator MultiWidgets::Widget::renderChildrenBack ( Luminous::RenderContext r) const
protectedvirtual

Render child widgets behind (depth < 0) this widget.

The function returns an iterator to the first child in front this widget which is usually passed to Widget::renderChildren(Luminous::RenderContext & r, ConstChildReverseIterator)

Parameters
rCurrent render context.
Returns
Iterator to the first child in front of this widget.

Reimplemented in MultiWidgets::FlippingWidget.

virtual void MultiWidgets::Widget::renderChildrenFront ( Luminous::RenderContext r,
MultiWidgets::Widget::ConstChildReverseIterator  start 
) const
protectedvirtual

Render child widgets starting from given child.

This function is usually used together with renderChildrenBack to split rendering of child widgets to ones behind the current widget and in front of it. The rendering order must back-to-front with the widget itself rendered between the two calls to renderChildren to guarantee correct output of translucent widgets.

Note
This function just renders the rest of the given widgets regardless of the value of depth.
Parameters
rCurrent render context
Startiterator to the first child to render.

Reimplemented in MultiWidgets::RippleOverlayWidget, and MultiWidgets::FlippingWidget.

virtual void MultiWidgets::Widget::renderContent ( Luminous::RenderContext r) const
protectedvirtual
void MultiWidgets::Widget::reparent ( WidgetPtr  newParent)

Change the widget parent to a new one while maintaining the position of widget in the scene coordinates.

Changes the parent and the transformation of the widget so its location in the scene does not change.

If new parent is null Widget will be just detached from its current parent. If the widget doesn't have parent its own transform is interpreted as a scene transfrom.

Parameters
newParentNew parent widget.
float MultiWidgets::Widget::rotation ( ) const

Clockwise rotation of the Widget in radians, relative to the parent.

The rotation happens about the origin of the widget. The value is automatically normalized to be between zero and two pi.

See Also
setRotation
float MultiWidgets::Widget::rotationTo ( const Widget ancestor) const

Returns the rotation relative to the given ancestor of widget.

If given Widget is not ancestor for this widget the result is equivalent to sceneRotation

Parameters
ancestorAncestor for this widget. The returned rotation is relative to this.
Returns
Rotation relative to the given ancestor.
float MultiWidgets::Widget::scale ( ) const

Scale of the Widget.

The scaling happens about the origin of the widget. Scaling factor 1.0 means no scaling. This needs to be strictly positive.

See Also
setScale
float Widget::scaleDamping ( ) const

Set the scale damping of the widget.

If the value is less than one the scale of the widget continues its scaling movement after the scaling gesture.

Value of 0 means no damping at all (scaling never slows down) and 1 means that the widget scaling stops immediately when scaled.

See Also
setScaleDamping, damping, angular-damping
Returns
Current value of the scale-damping attribute
Nimble::Rectangle MultiWidgets::Widget::sceneGeometry ( ) const

Return the Widget rectangle in scene coordinates.

Returns
Widget rectangle in scene coordinates.
float MultiWidgets::Widget::sceneRotation ( ) const

Return the rotation of the Widget relative to the scene.

This method takes into account all transformations up to the root widget. If the widget is inside ViewWidget that is rotated, then this method may return incorrect results, as the top-most widget is not in fact the root widget.

Returns
Rotation in radians
float MultiWidgets::Widget::sceneScale ( ) const

Return the scale of the widget relative to the scene.

This method takes into account all transformations up to the root widget. If the widget is inside ViewWidget, then this method may return incorrect results, as the top-most widget ius not in fact the root widget.

Returns
Scale relative to scene.
Nimble::Matrix3 MultiWidgets::Widget::sceneTransform ( ) const

Returns the Widget's scene transformation matrix.

This matrix can be used to transform coordinates from the Widget's coordinate system to the scene's coordinate system. To transform coordinates from scene coordinates to Widget coordinates, use the inverse of this matrix.

Returns
Transformation matrix from widget to scene coordinate system
void MultiWidgets::Widget::setAllowRotation ( bool  allowRotation)

If allowed, the Widget can be rotated.

This function raises or clears input-rotation flag in input-flags.

Parameters
allowRotationIs rotation allowed.
See Also
allowRotation, input-flags
void Widget::setAngularDamping ( float  angularDamping)

Setter for attribute angular-damping.

See Also
angularDamping
Parameters
angularDampingnew attribute value
void Widget::setAngularVelocity ( float  angularVelocity)

Setter for attribute omega.

See Also
angularVelocity
Parameters
angularVelocitynew attribute value
void MultiWidgets::Widget::setAutoRaiseToTop ( bool  v)

Set automatic raise-to-top behaviour.

Shortcut for raising or lowering auto-raise-to-top-flag in flags.

Parameters
Truefor raising the flag, false for lowering it.
See Also
autoRaiseToTop
virtual void MultiWidgets::Widget::setCenterLocation ( Nimble::Vector2  location)
virtual

Sets the location of the widget center in parent coordinates The same effect is achieved by setting origin to (0.5, 0.5) and then modifying the value of location.

Parameters
locationLocation in the parent coordinates.
void Widget::setDamping ( float  damping)

Setter for attribute damping.

See Also
damping
Parameters
dampingnew attribute value
void MultiWidgets::Widget::setDepth ( float  z)
See Also
depth
void Widget::setDisplay ( DisplayMode  mode)

Setter for attribute display.

See Also
display
Parameters
modenew attribute value
void Widget::setExtraInputCaptureRadius ( float  radius)

Setter for attribute extra-input-capture-radius.

See Also
extraInputCaptureRadius
Parameters
radiusnew attribute value
void MultiWidgets::Widget::setFixed ( )

If set to fixed, the widget can not be moved but it will still get input.

This is shortcut for clearing all input-motion flags in input-flags.

See Also
isFixed, input-flags
void Widget::setFlags ( Radiant::FlagsT< Flags flags)

Setter for attribute flags.

See Also
flags
Parameters
flagsnew attribute value
void MultiWidgets::Widget::setForceRendering ( bool  v)

Shortcut for raising or lowering force-rendering-flag in widget's flags.

See Also
forceRendering
Parameters
Enableor disable forced rendering.
void Widget::setInputFlags ( Radiant::FlagsT< InputFlags flags)

Setter for attribute input-flags.

See Also
inputFlags
Parameters
flagsnew attribute value
void MultiWidgets::Widget::setInputTransparent ( )

This function makes the widget pass all the input data to its children and operators if input-operators flag has been raised in input-flags.

See Also
input-flags
void Widget::setMaximumTapMotion ( float  maxMotionPixels)

Setter for attribute maximum-tap-motion.

See Also
maximumTapMotion
Parameters
maxMotionPixelsnew attribute value
void Widget::setMaximumTapTime ( float  maxTapTimeSeconds)

Setter for attribute maximum-tap-time.

See Also
maximumTapTime
Parameters
maxTapTimeSecondsnew attribute value
void Widget::setOpacity ( float  opacity)

Setter for attribute opacity.

See Also
opacity
Parameters
opacitynew attribute value
void Widget::setOrigin ( const Nimble::Vector2 origin)

Setter for attribute origin.

See Also
origin
Parameters
originnew attribute value
void MultiWidgets::Widget::setPointLocation ( Nimble::Vector2  location,
Nimble::Vector2  pointOnWidget 
)

Sets the location of a point on the widget widget center in parent coordinates of location.

Parameters
locationLocation in the parent coordinates.
pointOnWidgetPoint to be used in the widget coordinates
void MultiWidgets::Widget::setRelativePointLocation ( Nimble::Vector2  location,
Nimble::Vector2  pointOnWidgetRelative 
)

Sets the location of a point on the widget widget center in parent coordinates of location.

Parameters
locationLocation in the parent coordinates.
pointOnWidgetRelativePoint to be used in the widget coordinates, usually and X/Y are in the range [0,1].
void Widget::setRotation ( float  rotation)

Setter for attribute rotation.

See Also
rotation
Parameters
rotationnew attribute value
void MultiWidgets::Widget::setRotationAboutCenter ( float  r)

Set the rotation of the widget about its center.

Will modify the values of rotation and location. attributes.

Parameters
rThe new rotation value (radians)
void MultiWidgets::Widget::setRotationAboutPivot ( float  r,
Nimble::Vector2  pivot 
)

Set the rotation of the widget about a point relative to the widget size Will modify the values of rotation and location.

Parameters
rThe new rotation value (radians)
pivotThe pivot point, in relative coordinates, typically in range 0-1
void MultiWidgets::Widget::setRotationAboutPivotAbsolute ( float  r,
Nimble::Vector2  pivot 
)

Set the rotation of the widget about an arbitrary point in widget coordinates.

Will modify the values of rotation and location.

Parameters
rThe new rotation value in radians.
pivotThe pivot point in widget coordinates.
void MultiWidgets::Widget::setRotationAboutScenePoint ( float  r,
Nimble::Vector2  scenePt 
)

Set the rotation of the widget about an arbitrary point in scene coordinates.

Will modify the values of rotation and location.

Parameters
rThe new rotation value in radians.
scenePtVector in scene coordinates.
void Widget::setScale ( float  s)
virtual

Setter for attribute scale.

See Also
scale
Parameters
snew attribute value
void MultiWidgets::Widget::setScaleAboutCenter ( float  s)

Set the scale of the widget about its center.

Location is adjusted accordingly so the scaling is performed about the center of the Widget and not about the upper left corner.

Parameters
sNew scaling factor, 1.0 meaning no scaling
See Also
setScaleAboutPivotAbsolute
void MultiWidgets::Widget::setScaleAboutPivotAbsolute ( float  s,
Nimble::Vector2  pivot 
)

Set the scale of the widget about an arbitrary point in widget coordinates.

Location is adjusted accordingly.

Parameters
sNew scaling factor, 1.0 meaning no scaling
pivotScaling center point in widget coordinates
See Also
setScaleAboutCenter
void Widget::setScaleDamping ( float  scaleDamping)

Setter for attribute scale-damping.

See Also
scaleDamping, damping, angular-damping
Parameters
scaleDampingnew attribute value
virtual bool MultiWidgets::Widget::setStyle ( const Stylish::Style &  style)
virtual

Sets given style for the widget.

The style of the children is updated recursively based on the style for this widget. This function is automatically called for the root widget of the application which sets the style for all of the widgets belonging to the scene (widget hierarchy starting from the root widget owned by Application).

If the widget is in the scene there is no need to call this manually. The style of the widget can't be broken into pieces. If calling setStyle, then all previous style declarations will be overriden.

If the Widget is not in the scene one needs to call this explicitly with the correct style or, in most of the cases, let ViewWidget handle the calls for this function automatically.

Overriding: For the very rare cases one should override this version of the function. This needs to be overriden only when Widget owns widgets that are not its children. Then it is necessary to set the style for them manually. ViewWidget is an example of this situation.

Parameters
styleNew style for this object.

Reimplemented in MultiWidgets::ViewWidget.

void MultiWidgets::Widget::setTapIsPossible ( bool  possible)
protected

Notifies the widget if a tap gesture is still possible.

Useful if you want to create custom tap gestures.

Parameters
possibleTrue if tap gesture should be still possible, false if not.
void Widget::setTouchArea ( TouchArea  area)

Setter for attribute touch-area.

See Also
touchArea
Parameters
areanew attribute value
void Widget::setVelocity ( const Nimble::Vector2f v)

Set the velocity of the Widget in pixels per second.

Setter for attribute velocity.

Parameters
vVelocity to set
See Also
setVelocity(float, float), velocity
Parameters
vnew attribute value
void MultiWidgets::Widget::setVelocity ( float  xvel,
float  yvel 
)

Set the velocity of the Widget in pixels per second.

Parameters
xvelHorizontal velocity
yvelVertival velocity
See Also
setVelocity(const Nimble::Vector2f&), velocity
void MultiWidgets::Widget::setVisible ( bool  v)
inline

Hides or shows the widget.

See Also
hide
show
virtual bool MultiWidgets::Widget::shouldGrab ( GrabManager gm,
MultiTouch::TrackedObject  obj 
) const
virtual

Should this widget grab the given object during the input.

The default implementation is following:

return isInside(gm.transform(obj.location()));

It checks if the location of the object is inside this widget when projected according the given GrabManager. This can be overriden if overriding isInside is not enough.

Parameters
gmGrabManager, which has the input transformation of this widget applied.
objObject to check

Implements MultiWidgets::InputGrabListener.

virtual void MultiWidgets::Widget::show ( )
virtual

Show the widget.

Restores display to what it was before calling hide()

virtual void MultiWidgets::Widget::singleTap ( MultiWidgets::GrabManager gm,
const MultiWidgets::TrackedObjectArray objs 
)
protectedvirtual

This virtual function is called when widget receives a single-tap event.

Is meant to be overriden: the default implementation does nothing.

Parameters
gmGrabManager used in input handling.
objsTracked objects that caused the tap gesture.
See Also
single-tap

Reimplemented in MultiWidgets::VideoWidget, and MultiWidgets::ListWidget.

void MultiWidgets::Widget::stopMotion ( )

Stops all motion of the widget.

Sets the movement accumulators and current velocity to zero

const MultiWidgets::TrackedObjectIds& MultiWidgets::Widget::tapIds ( ) const

Returns a set of ids of fingers possibly tapping the widget.

All of the fingers that may be tapping the widget are first inserted here.

See Also
tapFingerCount
Returns
Set of fingers possibly tapping the widget.
bool MultiWidgets::Widget::tapIsPossible ( ) const

Check if the currently ongoing gesture (if any) is possibly a tap.

Returns
true if a tap gesture is still possible
See Also
tapIds
unsigned MultiWidgets::Widget::tapObjectCount ( ) const

Query the number of possible tap objects.

See Also
tapIds
Returns
The number of possible tap objects.
WidgetPtr MultiWidgets::Widget::topParent ( ) const

Return a pointer to the Widget's top-level parent.

If the Widget has no parent, 0 is returned.

Note
If this widget is inside a ViewWidget, the parent path stops just before the view. The reason for this is that views are not parents to the widgets that are inside them.
Returns
Pointer to the top-level parent or nullptr if we are in top parent, constructor or widget has no parent. If the widget is in application's widget hierarchy this will always return the root widget.
void MultiWidgets::Widget::touch ( )

Set the last interaction time to current time.

See Also
lastInteractionTime
Widget::TouchArea Widget::touchArea ( ) const

Controls the default touchable area of the widget.

This will determine the behaviour of isInside-function.

See Also
setTouchArea
Returns
Current value of the touch-area attribute
virtual void MultiWidgets::Widget::trackedObjectDown ( MultiTouch::TrackedObject  o,
MultiWidgets::GrabManager gm 
)
virtual

Called when a new tracked object is grabbed by the widget.

This function is meant to be overriden: the default implementation is empty.

Parameters
oThe new tracked object.
gmGrabManager holding the current input frame.
See Also
trackedObjectUp, fingerDown, penDown, handDown, markerDown
virtual void MultiWidgets::Widget::trackedObjectUp ( MultiTouch::TrackedObject  o,
MultiWidgets::GrabManager gm 
)
virtual

Called when a new tracked object is ungrabbed by the widget This function is meant to be overriden: the default implementation is empty.

Parameters
oThe new tracked object
gmGrabManager holding the current input frame
See Also
trackedObjectDown
size_t MultiWidgets::Widget::transferGrabs ( WidgetPtr  target,
GrabManager gm,
Radiant::FlagsT< MultiTouch::TrackedObjectType types,
bool  recursive = false 
)

Transfer grabs from this widget to another.

Parameters
targetWidget which will receive the grabs
gmGrabManager used in input handling
typesFlags indicating which object types should be transferred
recursiveAre The grabs of this widget moved recursively (grabs of all of its descendants)
Returns
Number of grabbed objects transferred
const Nimble::Matrix3& MultiWidgets::Widget::transform ( ) const

Return this Widget's transformation matrix relative to its parent.

This matrix is computed from the location, rotation, and scale of the Widget.

See Also
sceneTransform, transform
Returns
Transformation matrix from widget to parent coordinate system
const Nimble::Matrix4f& MultiWidgets::Widget::transform3D ( ) const

Return this Widget's 3D transformation matrix relative to its parent.

This matrix is computed from the location, rotation, and scale of the Widget.

See Also
sceneTransform, transform3D
Returns
3D transformation matrix from widget to parent coordinate system.
virtual QByteArray MultiWidgets::Widget::type ( ) const
virtual

This returns the plugin name of this Widget.

Works automatically for all plugin widgets.

Returns
Typename of the plugin.

Reimplemented from Valuable::Attribute.

virtual void MultiWidgets::Widget::update ( const MultiWidgets::FrameInfo frameInfo)
virtual

Update widget state.

This function is called by the application during its update step. This function may be called several times per rendered frame. This function is always called after input() and before render(). If you need to know if this call is the last update for this rendered frame, use the FrameInfo::isLastUpdate(). The default implementation is empty.

Parameters
frameInfoFrame information since last update call

Reimplemented in MultiWidgets::KeyboardWidget, MultiWidgets::VideoWidget, MultiWidgets::ImageWidget, MultiWidgets::ItemFlowWidget, MultiWidgets::DropShadowWidget, MultiWidgets::RippleOverlayWidget, MultiWidgets::ImageMovieWidget, MultiWidgets::SliderWidget, MultiWidgets::TextEditWidget, MultiWidgets::TextWidget, MultiWidgets::TimerDialWidget, MultiWidgets::FlippingWidget, MultiWidgets::BrowserFrameWidget, MultiWidgets::JavaScriptWidget, MultiWidgets::ViewWidget, MultiWidgets::ResizeHandleWidget, MultiWidgets::WheelWidget, MultiWidgets::CloudWidget, MultiWidgets::BookWidget, MultiWidgets::DocumentWidget, MultiWidgets::ScrollAreaWidget, and MultiWidgets::KeyboardWidget2.

Examples:
PluginExample.cpp.
virtual void MultiWidgets::Widget::updateMotion ( const MultiWidgets::FrameInfo frameInfo)
protectedvirtual

Simulate the attributes that affect widget motion.

The default implementation updates the widget position and both linear and angular velocities unless the widget is interacted with. This function is called before update() during application update.

Parameters
frameInfoFrame information since last update call.
virtual void MultiWidgets::Widget::updateStyle ( )
protectedvirtual

Updates style to this widget.

Note
Do not override this function

Reimplemented from Stylish::Styleable.

const Nimble::Vector2& MultiWidgets::Widget::velocity ( ) const

Return the current velocity of the Widget.

Returns
Current velocity in pixels per second.
See Also
setVelocity(const Nimble::Vector2f&), setVelocity(float, float)
virtual void MultiWidgets::Widget::visualFocusChange ( bool  gotFocus)
virtual

Call-back function for informing the Widget of a change in users' visual focus This function is called by the application as deemed fit.

A typical example is ItemFlowWidget, that will call this function when a new widget is dragged to/from the center. This allows the widget to perform any operations that it wants do based on the newly gained visual focus. As a typical example VideoWidget can start video playback when receiving visual focus and stop the playback when losing the focus. Likewise a game widget could start (or continue) a new game when it gets the focus and stop/pause the game when losing focus.

Any number of widgets may get the visual focus at one time. This is simply due to the fact that there can be many users on a single screen at once, and there is no reason to assume that only one could have visual focus at one time.

The default implementation will call the visualFocusChange function for all the child widgets.

Parameters
gotFocusTrue if got focus, false if just lost it

Reimplemented in MultiWidgets::VideoWidget.

static std::size_t MultiWidgets::Widget::widgetCount ( )
static

Returns the number of widget instances in the application.

Returns
Number of the widgets belonging to application.