It provides primitive text rendering.
Types
TextChangedHandler = proc (self: LabelRef; text: string)
LabelObj = object of ControlRef on_text_changed*: TextChangedHandler text_align*: AnchorObj text*: StyleText
LabelRef = ref LabelObj
Lets
text_changed_handler = proc (self: LabelRef; text: string) = discard
Methods
method draw(self: LabelRef; w, h: GLfloat) {...}{. raises: [GLerror, Exception, ResourceError], tags: [RootEffect].}
- This uses in the window.nim.
method duplicate(self: LabelRef): LabelRef {...}{.base, raises: [], tags: [].}
- Duplicates Label object and create a new Label.
method getText(self: LabelRef): string {...}{.base, raises: [], tags: [].}
-
Returns StyleText as string.
See also:
method handle(self: LabelRef; event: InputEvent; mouse_on: var NodeRef) {...}{. raises: [Exception, ValueError, OSError], tags: [RootEffect, ExecIOEffect, ReadEnvEffect].}
- Handles user input. Thi uses in the window.nim.
method setText(self: LabelRef; text: string; save_properties: bool = false) {...}{. base, raises: [GLerror, Exception], tags: [RootEffect].}
-
Changes text.
Arguments:
- text is a new Label text.
- save_properties - saves old text properties, if true.
See also:
method setTextAlign(self: LabelRef; x1, y1, x2, y2: float) {...}{.base, raises: [], tags: [].}
-
Changes text alignment.
Arguments:
- x1 y1 - parent anchor.
- x2 y2 - self anchor.
See also:
method setTextAlign(self: LabelRef; align: AnchorObj) {...}{.base, raises: [], tags: [].}
-
Changes text alignment.
See also:
method setTextColor(self: LabelRef; color: ColorRef) {...}{.base, raises: [], tags: [].}
-
Changes text color.
Arguments:
- color - new text color.
method setTextFont(self: LabelRef; font: FontPtr) {...}{.base, raises: [], tags: [].}
-
Changes text font.
Arguments:
- font - new text font.
method setStyle(self: LabelRef; s: StyleSheetRef) {...}{. raises: [ValueError, RegexError, ResourceError, GLerror], tags: [].}
-
Changes Label stylesheet.
Styles:
- text-align - text alignment. 0.5; 1 0 1 0.
- color - text color. #ffef; rgba(1, 1, 1, 1); rgb(1, 1, 1).