|
CoreComponents 4.0.0
A Modern C++ Toolkit
|
Plain text display. More...
#include <cc/PlainText>
Public Types | |
| using | GetColor = Function< Color(int)> |
| Get color for a given byte offset. | |
Public Types inherited from View | |
| using | Id = double |
| View identifier | |
Public Types inherited from Object | |
| using | NullAccess = cc::NullAccess |
| Error thrown when trying to access a null object. | |
| using | VirginityTestFailed = cc::VirginityTestFailed |
| Error thrown when trying to initialize an object with a non-virgin state. | |
Public Member Functions | |
| PlainText (Out< PlainText > self=None{}) | |
| Create a plain text display. | |
| PlainText (const String &text, Out< PlainText > self=None{}) | |
| Create a plain text display. | |
| PlainText (const String &text, Font font, Out< PlainText > self=None{}) | |
| Create a plain text display. | |
| PlainText & | associate (Out< PlainText > self) |
| Get a weak reference in self. | |
| String | text () const |
| Get text. | |
| PlainText & | text (const String &newValue) |
| Set text | |
| PlainText & | text (Definition< String > &&f) |
| Define text. | |
| Font | font () const |
| Get font. | |
| PlainText & | font (Font newValue) |
| Set font | |
| PlainText & | font (Definition< Font > &&f) |
| Define font. | |
| Color | color () const |
| Get text color. | |
| PlainText & | color (Color newValue) |
| Set text color | |
| PlainText & | color (Definition< Color > &&f) |
| Define text color. | |
| Size | margin () const |
| Get inside margins. | |
| PlainText & | margin (Size newValue) |
| Set inside margins | |
| PlainText & | margin (Definition< Size > &&f) |
| Define inside margins. | |
| double | maxWidth () const |
| Get maximum width. | |
| PlainText & | maxWidth (double newValue) |
| Set maximum width | |
| PlainText & | maxWidth (Definition< double > &&f) |
| Define maximum width. | |
| PlainText & | getInk (GetColor &&f) |
| Set function to colorize the foreground | |
| PlainText & | getPaper (GetColor &&f) |
| Set function to colorize the background | |
Public Member Functions inherited from View | |
| View ()=default | |
| Create a primordial view. | |
| View (Out< View > self) | |
| Create a view. | |
| View (const Size &size, Out< View > self=None{}) | |
| Create a view of initial size. | |
| View (double width, double height, Out< View > self=None{}) | |
| Create a view of initial size (width, height) | |
| View (const Layout &layout, Out< View > self=None{}) | |
| Create a view organizing its children with layout. | |
| View & | associate (Out< View > self) |
| Get a weak reference in self. | |
| View & | populate (const Function< void(View)> &&f) |
| Invoke custom initialization function f. | |
| void | touch () |
| Materialize if this view is still primordial. | |
| void | show () |
| Convenience method to show this view. | |
| int | run () |
| Convenience method to show this view and run the application loop. | |
| Color | paper () const |
| Get/bind value of # paper | |
| auto | paper (this auto &&self, Color newValue) -> decltype(auto) |
| Set value of # paper | |
| auto | paper (this auto &&self, Definition< Color > &&f) -> decltype(auto) |
| Define value of # paper | |
| bool | visible () const |
| Get/bind value of # visible | |
| auto | visible (this auto &&self, bool newValue) -> decltype(auto) |
| Set value of # visible | |
| auto | visible (this auto &&self, Definition< bool > &&f) -> decltype(auto) |
| Define value of # visible | |
| double | opacity () const |
| Get/bind value of # opacity | |
| auto | opacity (this auto &&self, double newValue) -> decltype(auto) |
| Set value of # opacity | |
| auto | opacity (this auto &&self, Definition< double > &&f) -> decltype(auto) |
| Define value of # opacity | |
| auto | opacityEasing (this auto &&self, const EasingCurve &curve, double duration, Function< bool()> &&direct=nullptr) -> decltype(auto) |
| Set the easing curve and duration of # opacity | |
| bool | clip () const |
| Get/bind value of # clip | |
| auto | clip (this auto &&self, bool newValue) -> decltype(auto) |
| Set value of # clip | |
| auto | clip (this auto &&self, Definition< bool > &&f) -> decltype(auto) |
| Define value of # clip | |
| bool | moving () const |
| Get/bind value of # moving | |
| auto | moving (this auto &&self, bool newValue) -> decltype(auto) |
| Set value of # moving | |
| auto | moving (this auto &&self, Definition< bool > &&f) -> decltype(auto) |
| Define value of # moving | |
| Point | pos () const |
| Get/bind value of # pos | |
| auto | pos (this auto &&self, Point newValue) -> decltype(auto) |
| Set value of # pos | |
| auto | pos (this auto &&self, Definition< Point > &&f) -> decltype(auto) |
| Define value of # pos | |
| auto | posEasing (this auto &&self, const EasingCurve &curve, double duration, Function< bool()> &&direct=nullptr) -> decltype(auto) |
| Set the easing curve and duration of # pos | |
| Size | size () const |
| Get/bind value of # size | |
| auto | size (this auto &&self, Size newValue) -> decltype(auto) |
| Set value of # size | |
| auto | size (this auto &&self, Definition< Size > &&f) -> decltype(auto) |
| Define value of # size | |
| auto | sizeEasing (this auto &&self, const EasingCurve &curve, double duration, Function< bool()> &&direct=nullptr) -> decltype(auto) |
| Set the easing curve and duration of # size | |
| Padding | padding () const |
| Get/bind value of # padding | |
| auto | padding (this auto &&self, Padding newValue) -> decltype(auto) |
| Set value of # padding | |
| auto | padding (this auto &&self, Definition< Padding > &&f) -> decltype(auto) |
| Define value of # padding | |
| Point | pivot () const |
| Get/bind value of # pivot | |
| auto | pivot (this auto &&self, Point newValue) -> decltype(auto) |
| Set value of # pivot | |
| auto | pivot (this auto &&self, Definition< Point > &&f) -> decltype(auto) |
| Define value of # pivot | |
| auto | pivotEasing (this auto &&self, const EasingCurve &curve, double duration, Function< bool()> &&direct=nullptr) -> decltype(auto) |
| Set the easing curve and duration of # pivot | |
| double | angle () const |
| Get/bind value of # angle | |
| auto | angle (this auto &&self, double newValue) -> decltype(auto) |
| Set value of # angle | |
| auto | angle (this auto &&self, Definition< double > &&f) -> decltype(auto) |
| Define value of # angle | |
| auto | angleEasing (this auto &&self, const EasingCurve &curve, double duration, Function< bool()> &&direct=nullptr) -> decltype(auto) |
| Set the easing curve and duration of # angle | |
| double | scale () const |
| Get/bind value of # scale | |
| auto | scale (this auto &&self, double newValue) -> decltype(auto) |
| Set value of # scale | |
| auto | scale (this auto &&self, Definition< double > &&f) -> decltype(auto) |
| Define value of # scale | |
| auto | scaleEasing (this auto &&self, const EasingCurve &curve, double duration, Function< bool()> &&direct=nullptr) -> decltype(auto) |
| Set the easing curve and duration of # scale | |
| View | decoration () const |
| Get/bind value of # decoration | |
| auto | decoration (this auto &&self, View newValue) -> decltype(auto) |
| Set value of # decoration | |
| auto | decoration (this auto &&self, Definition< View > &&f) -> decltype(auto) |
| Define value of # decoration | |
| View & | paint (Definition< void > &&f) |
| Define the foreground. | |
| double | x () const |
| Get pos()[0]. | |
| double | y () const |
| Get pos()[1]. | |
| double | width () const |
| Get size()[0]. | |
| double | height () const |
| Get size()[1]. | |
| double | innerWidth () const |
| Get inner width. | |
| double | innerHeight () const |
| Get inner height. | |
| Size | preferredSize () const |
| Get preferred size. | |
| Size | minSize () const |
| Get minimal size. | |
| Size | maxSize () const |
| Get maximal size. | |
| Color | basePaper () const |
| Get the background paper. | |
| const char * | objectName () const |
| Get the object name (for debugging) | |
| View & | objectName (const char *name) |
| Set the object name | |
| bool | hasWindow () const |
| Check if this view is already shown in a window. | |
| Window | window () const |
| Get the window this view is shown in. | |
| bool | isHandheld () const |
| Get window().display().isHandheld() | |
| Id | id () const |
| Get view identifier. | |
| List< Id > | fullId () const |
| Get view identifier heritage list. | |
| bool | operator== (const View &other) const |
| Equality operator. | |
| std::strong_ordering | operator<=> (const View &other) const |
| Ordering operator. | |
| bool | hasParent () const |
| Check if this is a child view. | |
| View | parent () const |
| Get parent view. | |
| View | root () const |
| Get the root view of this window. | |
| long | childrenCount () const |
| Number of children. | |
| long | count () const |
| Number of children. | |
| bool | hasChildren () const |
| Check if there are any children. | |
| auto | add (this auto &&self, const View &child) -> decltype(auto) |
| Add new child placed visually above all existing children. | |
| auto | addAbove (this auto &&self, const View &child) -> decltype(auto) |
| Add new child placed visually above all existing children. | |
| auto | addBelow (this auto &&self, const View &child) -> decltype(auto) |
| Add child place visually below all existing children. | |
| auto | insertAt (this auto &&self, Locator target, const View &child) -> decltype(auto) |
| Insert new child at target. | |
| auto | insertAt (this auto &&self, long index, const View &child) -> decltype(auto) |
| Insert new child at index. | |
| void | remove (const View &child) |
| Remove a child. | |
| auto | operator() (this auto &&self, const View &child) -> decltype(auto) |
| Syntax sugar for adding a child. | |
| auto | push (this auto &&self, const View &child) -> decltype(auto) |
| Add new child placed visually above all existing children. | |
| void | pop () |
| Remove the top-most visible child. | |
| void | deplete () |
| Remove all children. | |
| void | moveToTop () |
| Make this view be visible above any other visible sibling. | |
| void | moveToBottom () |
| Make this view be visible beneath any other visible sibling. | |
| const Set< View > & | children () const |
| Get all child views. | |
| const Set< View > & | visibleChildren () const |
| Get visible child views. | |
| Rect | childrenRect () const |
| Get bounding box containing all visible child views including their paddings. | |
| Point | mapToGlobal (Point l) const |
| Map view coordinates l to window coordinates | |
| Point | mapToLocal (Point g) const |
| Map window coordinates g to view coordinates | |
| Point | mapToChild (const View &child, Point l) const |
| Map local coordinates l to child coordinates | |
| Point | mapToParent (const View &parent, Point l) const |
| Map local coordinates l to parent coordinates | |
| bool | containsLocal (Point l) const |
| Check if local point l lays inside this view. | |
| bool | containsGlobal (Point g) const |
| Check if global point l lays inside this view. | |
| View | findChild (Point l) const |
| Find the first child which contains local point l. | |
| Control | findControl (Point l) const |
| Find the first control which contains local point l. | |
| bool | isParentOf (const View &other) const |
| Check if this view is parent of other. | |
| bool | laysInsideOf (const View &other, double margin) const |
| Check if this view is fully visible inside other with given surrounding margin. | |
| void | update () |
| Manually force repaint. | |
| template<class T > | |
| void | collectVisible (InOut< List< T > > collection) const |
| Get a list of all visible children in this view tree which are of type T. | |
| Layout | layout () const |
| Get layout. | |
| auto | layout (this auto &&self, const Layout &newValue) -> decltype(auto) |
| Set layout | |
| void | renderTo (Image &image) const |
| Capture a rendered image of this view (including its children) as rendered on the screen. | |
| double | top () const |
| Get y-coordinate of this view's top border. | |
| double | bottom () const |
| Get y-coordinate of this view's bottom border. | |
| double | left () const |
| Get x-coordinate of this view's left border. | |
| double | right () const |
| Get x-coordinate of this view's right border. | |
| Point | topLeft () const |
| Get this view's top-left corner. | |
| Point | topCenter () const |
| Get this view's top-center point. | |
| Point | topRight () const |
| Get this view's top-right corner. | |
| Point | bottomLeft () const |
| Get this view's bottom-left corner. | |
| Point | bottomCenter () const |
| Get this view's bottom-center point. | |
| Point | bottomRight () const |
| Get this view's bottom-right corner. | |
| Point | centerLeft () const |
| Get this view's center-left point. | |
| Point | centerRight () const |
| Get this view's center-right point. | |
| auto | topLeft (this auto &&self, Point newValue) -> decltype(auto) |
| Make this view's top-left match newValue. | |
| auto | topCenter (this auto &&self, Point newValue) -> decltype(auto) |
| Make this view's top-center match newValue. | |
| auto | topRight (this auto &&self, Point newValue) -> decltype(auto) |
| Make this view's top-right match newValue. | |
| auto | bottomLeft (this auto &&self, Point newValue) -> decltype(auto) |
| Make this view's bottom-left match newValue. | |
| auto | bottomCenter (this auto &&self, Point newValue) -> decltype(auto) |
| Make this view's bottom-center match newValue. | |
| auto | bottomRight (this auto &&self, Point newValue) -> decltype(auto) |
| Make this view's bottom-right match newValue. | |
| auto | centerLeft (this auto &&self, Point newValue) -> decltype(auto) |
| Make this view's center-left match newValue. | |
| auto | centerRight (this auto &&self, Point newValue) -> decltype(auto) |
| Make this view's center-right match newValue. | |
| auto | center (this auto &&self, Point newValue) -> decltype(auto) |
| Make this view's center match newValue. | |
| auto | topLeft (this auto &&self, Definition< Point > &&a) -> decltype(auto) |
| Anchor the top-left corner to a | |
| auto | topCenter (this auto &&self, Definition< Point > &&a) -> decltype(auto) |
| Anchor the top-center corner to a | |
| auto | topRight (this auto &&self, Definition< Point > &&a) -> decltype(auto) |
| Anchor the top-right corner to a | |
| auto | bottomLeft (this auto &&self, Definition< Point > &&a) -> decltype(auto) |
| Anchor the bottom-left corner to a | |
| auto | bottomCenter (this auto &&self, Definition< Point > &&a) -> decltype(auto) |
| Anchor the bottom-center corner to a | |
| auto | bottomRight (this auto &&self, Definition< Point > &&a) -> decltype(auto) |
| Anchor the bottom-right corner to a | |
| auto | centerLeft (this auto &&self, Definition< Point > &&a) -> decltype(auto) |
| Anchor the center-left to a | |
| auto | centerRight (this auto &&self, Definition< Point > &&a) -> decltype(auto) |
| Anchor the center-right to a | |
| auto | center (this auto &&self, Definition< Point > &&a) -> decltype(auto) |
| Anchor the center to a | |
| auto | centerInParent (this auto &&self) -> decltype(auto) |
| Anchor this view's center to its parent's center. | |
| auto | onWindowEntered (this auto &&self, Function< void()> &&f) -> decltype(auto) |
| Handle window enter event | |
| auto | onWindowLeft (this auto &&self, Function< void()> &&f) -> decltype(auto) |
| Handle window leave event | |
| auto | onPointerPressed (this auto &&self, Filter< PointerEvent > &&f) -> decltype(auto) |
| Handle pointer pressed event | |
| auto | onPointerReleased (this auto &&self, Filter< PointerEvent > &&f) -> decltype(auto) |
| Handle pointer release event | |
| auto | onPointerMoved (this auto &&self, Filter< PointerEvent > &&f) -> decltype(auto) |
| Handle pointer moved event | |
| auto | onMousePressed (this auto &&self, Filter< MouseEvent > &&f) -> decltype(auto) |
| Handle mouse pressed event | |
| auto | onMouseReleased (this auto &&self, Filter< MouseEvent > &&f) -> decltype(auto) |
| Handle mouse release event | |
| auto | onMouseMoved (this auto &&self, Filter< MouseEvent > &&f) -> decltype(auto) |
| Handle mouse moved event | |
| auto | onFingerPressed (this auto &&self, Filter< FingerEvent > &&f) -> decltype(auto) |
| Handle finger pressed event | |
| auto | onFingerReleased (this auto &&self, Filter< FingerEvent > &&f) -> decltype(auto) |
| Handle finger released event | |
| auto | onFingerMoved (this auto &&self, Filter< FingerEvent > &&f) -> decltype(auto) |
| Handle finger moved event | |
| auto | onPenMoved (this auto &&self, Filter< PenEvent > &&f) -> decltype(auto) |
| Handle pen touched/moved event | |
| auto | onPenHovered (this auto &&self, Filter< PenEvent > &&f) -> decltype(auto) |
| Handle pen hovered event | |
| auto | onPenPressed (this auto &&self, Filter< PenEvent > &&f) -> decltype(auto) |
| Handle pen button pressed event | |
| auto | onPenReleased (this auto &&self, Filter< PenEvent > &&f) -> decltype(auto) |
| Handle pen button released event | |
| auto | onWheelMoved (this auto &&self, Filter< WheelEvent > &&f) -> decltype(auto) |
| Handle mouse wheel moved event | |
| auto | onKeyPressed (this auto &&self, Filter< KeyEvent > &&f) -> decltype(auto) |
| Handle key pressed event | |
| auto | onKeyReleased (this auto &&self, Filter< KeyEvent > &&f) -> decltype(auto) |
| Handle key released event | |
| auto | onEndOfLife (this auto &&self, Function< void()> &&f) -> decltype(auto) |
| Get notified when the View's lifetime ends. | |
| auto | attach (this auto &&self, const Object &other) -> decltype(auto) |
| Attach a non-visual object (e.g. | |
| auto | attach (this auto &&self, Function< void()> &&f) -> decltype(auto) |
| Convenience method for attaching a monitor. | |
Public Member Functions inherited from Surface | |
| Surface ()=default | |
| Create a null surface. | |
| void | nextPage (bool clear=true) |
| Open next page. | |
| cairo_surface_t * | cairoSurface () |
| Get a pointer to the underlying Cairo surface. | |
| void | polish () |
| Prepare surface before start painting. | |
Public Member Functions inherited from Object | |
| Object ()=default | |
| Create a null object. | |
| operator bool () const | |
| Check if this is a non-null object. | |
| bool | isNull () const |
| Check if this is a null object. | |
| int | useCount () const |
| Reference count. | |
| template<class T > | |
| bool | is () const |
| Check if this object is of type T. | |
| template<class T > | |
| T | as () const |
| Cast this object to type T. | |
| bool | isWeak () const |
| Check if the underlying object reference is weak. | |
| bool | operator== (const Object &other) const |
| Equality operator. | |
| std::strong_ordering | operator<=> (const Object &other) const |
| Ordering operator. | |
Additional Inherited Members | |
Protected Types inherited from View | |
| using | CreateState = State *() |
Protected Member Functions inherited from View | |
| View (State *newState) | |
| Initialize view. | |
| View (CreateState onDemand) | |
| Initialize view. | |
| template<class T > | |
| T | grab () |
| Get a weak reference version of this object. | |
| template<class T > | |
| T & | associate (Out< T > self) |
| Convenience method to associate a weak reference to this objet. | |
| template<class T > | |
| T & | get () |
| Get access to the object's state (create it if needed) | |
| template<class T > | |
| const T & | get () const |
| Get access to the object's state (create it if needed) | |
| State & | me () |
| const State & | me () const |
| bool | operator== (const State *other) const |
Protected Member Functions inherited from Surface | |
| Surface (State *newState) | |
| State & | me () |
| const State & | me () const |
Protected Member Functions inherited from Object | |
| template<class T > | |
| T | weak () const |
| template<class T > | |
| void | initOnce () |
| Create the object state when called the first time. | |
| template<class T > | |
| void | initOncePerThread () |
| Create a distinct object state for each thread when called the first time in that thread. | |
| Object (State *newState) | |
| Initialize object with newState. | |
| Object (State *state, Alias) | |
| Object (State *state, Weak) | |
| Object & | operator= (std::nullptr_t) |
Static Protected Member Functions inherited from View | |
| template<class T > | |
| static View::State * | onDemand () |
Static Protected Member Functions inherited from Object | |
| template<class T > | |
| static T | alias (const State *state) |
| Create an alias object for the given state. | |
| template<class T > | |
| static T | weak (const State *state) |
Protected Attributes inherited from Object | |
| Handle< State > | me |
| Internal object state | |
Plain text display.
A PlainText shows a single span of text. When maxWidth() is set the text will be automatically wrapped if necessary onto multiple lines.
Create a plain text display.
| text | Initial text |
Create a plain text display.
| text | Initial text |
| font | Initial font |
| String text | ( | ) | const |
Get text.
| PlainText & text | ( | Definition< String > && | f | ) |
Define text.
| Font font | ( | ) | const |
Get font.
| PlainText & font | ( | Definition< Font > && | f | ) |
Define font.
| Color color | ( | ) | const |
Get text color.
| PlainText & color | ( | Definition< Color > && | f | ) |
Define text color.
| Size margin | ( | ) | const |
Get inside margins.
| PlainText & margin | ( | Definition< Size > && | f | ) |
Define inside margins.
| double maxWidth | ( | ) | const |
Get maximum width.
| PlainText & maxWidth | ( | double | newValue | ) |
Set maximum width
| PlainText & maxWidth | ( | Definition< double > && | f | ) |
Define maximum width.