JugiMap Framework
|
The GuiTextField class provides a widget for displaying text. More...
#include <jmGuiTextWidgets.h>
Inherits GuiWidget.
Public Types | |
enum | Alignment { LEFT, JUSTIFY } |
The text alignment. More... | |
enum | DrawingDelay { NONE, BY_ROWS, BY_WORDS, BY_CHARACTERS } |
The drawing delay of displayed text. More... | |
enum | ScrollingMode { NORMAL, FIXED_STEP } |
Public Member Functions | |
GuiTextField (VectorShape *_vectorShape, Map *_map) | |
Construct a new GuiTextField from the given *_vectorShape* in the *_map*. More... | |
void | SetDisabled (bool _disabled) override |
Set the disabled state of this widget. More... | |
void | SetVisible (bool _visible) override |
Set the visibility of this widget. More... | |
TextSegment * | GetTextSegment () |
Returns the text segment if exists; otherwise returns nullptr. More... | |
int | GetTextSegmentHeight (TextSegment *_textSegment) |
Returns the height of the given *_textSegment* in this text field. More... | |
std::string | GetClickedButtonName () |
Returns the name of the clicked button if such event happens; otherwise returns an empty string. More... | |
void | SetScrollingMode (ScrollingMode _scrollingMode) |
Set the scrolling mode. More... | |
ScrollingMode | GetScrollingMode () |
Returns the scrolling mode of this text field. More... | |
void | SetScrollingModeFixedStepProperties (int _numberOfLines, int _lineHeight, float _scrollDurationMS) |
Set the scrolling properties if scrolling mode is ScrollingMode::FIXED_STEP. More... | |
void | SetDrawingDelay (DrawingDelay _drawingDelay, int _drawingdelayMS) |
Set the drawing delay to the given *_drawingDelay* and duration to *_drawingdelayMS* (in milliseconds). More... | |
DrawingDelay | GetDrawingDelay () |
Returns the drawing delay of this text field. More... | |
void | SetTextAlignment (Alignment _textAlignment) |
Set the text alignment to the given *_textAlignment*. More... | |
Alignment | GetTextAlignment () |
Returns the text alignment of this text field. More... | |
void | SetAlphaFadeAtMargin (bool _alphaFadeAtMargin) |
Set to true if alpha fade at margin between box and visible box is used. More... | |
void | SetTextRect (Recti _box) |
Set the text area rectangle. More... | |
Recti | GetTextRect () |
Returns the text area rectangle. More... | |
void | SetVisibleRect (Recti _visibleBox) |
Set the visible area rectangle. More... | |
Recti | GetVisibleRect () |
Returns the visible area rectangle. More... | |
void | SetClickableRect (Recti _clickableBox) |
Set the clickable area rectangle. More... | |
Recti | GetClickableRect () |
Returns the clickable area rectangle. More... | |
void | SetLocalLinesSpacingFactor (float _spacingFactor) |
Set the local factor for vertical lines spacing. More... | |
void | Start (TextSegment *_textSegment) |
Start displaying the given *_textSegment*. More... | |
void | Reset () |
Reset the text field. More... | |
bool | IsDelayedDrawingActive () |
Returns true if a text segment is currently being drawn by the drawing delay; otherwise returns false. More... | |
void | SkipDelay () |
Skip drawing delay of a text segment and show entire text immediately. More... | |
bool | ScrollTextUp () |
Scroll the segment text up and returns true. If scrolling is not possible returns false. More... | |
bool | ScrollTextDown () |
Scroll the segment text down and return true. If scrolling is not possible returns false. More... | |
bool | IsTextSegmentFirstLineDisplayed () |
Returns true if the first line of the text segement is displayed; otherwise returns false. More... | |
bool | IsTextSegmentLastLineDisplayed () |
Returns true if the last line of the text segement is displayed; otherwise returns false. More... | |
![]() | |
bool | IsCursorDown () |
Returns true if the cursor is hold down over this widget; otherwise returns false. More... | |
bool | IsCursorOver () |
Returns true if the cursor is over this widget; otherwise returns false. More... | |
bool | IsPressed () |
Returns true if the cursor is pressed while over this widget; otherwise returns false. More... | |
bool | IsValueChanged () |
Returns true if this widget's value is changed; otherwise returns false. More... | |
bool | IsDisabled () |
Returns true if this widget is disabled; otherwise returns false. More... | |
bool | IsVisible () |
Returns true if this widget is visible; otherwise returns false. More... | |
void | SetName (const std::string &_name) |
Set the name of this widget. More... | |
std::string | GetName () |
Returns the name of this widget. More... | |
void | SetTag (int _tag) |
Set the tag of this widget. More... | |
int | GetTag () |
Returns the tag of this widget. More... | |
GuiWidgetKind | GetKind () |
Returns the kind of this widget. More... | |
std::string | GetDesignKind () |
Returns the design kind of this widget. More... | |
void | AssignCustomObject (CustomObject *_customObject) |
Assign the given *_customObject* to this widget. More... | |
CustomObject * | GetCustomObject () |
Returns the custom object of this widget or nullptr if none. More... | |
void | AssignCallback (GuiWidgetCallback *_callback) |
Assign the given *_callback* to this widget. More... | |
GuiWidgetCallback * | GetCallback () |
Returns the callback of this widget or nullptr if none. More... | |
Static Public Attributes | |
static float | globalLinesSpacingFactor = 0.1 |
Global factor for vertical lines spacing. More... | |
Additional Inherited Members | |
![]() | |
static GuiWidget * | GetInteracted () |
Returns the interacted widget. More... | |
static GuiWidget * | GetInteracted (const std::string &_name) |
Returns the interacted widget with the given *_name*. More... | |
static GuiWidget * | GetInteracted (int _tag) |
Returns the interacted widget with the given *_tag*. More... | |
static GuiWidget * | GetInteracted (CustomObject *_customObject) |
Returns the interacted widget which has assigned the given *_customObject*. More... | |
static GuiWidget * | GetInteracted_Pressed () |
Returns the interacted widget which is pressed. More... | |
static GuiWidget * | GetInteracted_Pressed (const std::string &_name) |
Returns the interacted widget with the given *_name* which is pressed. More... | |
static GuiWidget * | GetInteracted_Pressed (int _tag) |
Returns the interacted widget with the given *_tag* which is pressed. More... | |
static GuiWidget * | GetInteracted_Pressed (CustomObject *_customObject) |
Returns the interacted widget with assigned *_customObject* which is pressed. More... | |
static GuiWidget * | GetInteracted_ValueChanged () |
Returns the interacted widget which has changed value. More... | |
static GuiWidget * | GetInteracted_ValueChanged (const std::string &_name) |
Returns the interacted widget with the given *_name* which has changed value. More... | |
static GuiWidget * | GetInteracted_ValueChanged (int _tag) |
Returns the interacted widget with the given *_tag* which has changed value. More... | |
static GuiWidget * | GetInteracted_ValueChanged (CustomObject *_customObject) |
Returns the interacted widget with assigned *_customObject* which has changed value. More... | |
static GuiWidget * | GetInteracted_CursorOver () |
Returns the interacted widget which has the cursor over. More... | |
static GuiWidget * | GetInteracted_CursorOver (const std::string &_name) |
Returns the interacted widget with the given *_name* which has the cursor over. More... | |
static GuiWidget * | GetInteracted_CursorOver (int _tag) |
Returns the interacted widget with the given *_tag* which has the cursor over. More... | |
static GuiWidget * | GetInteracted_CursorOver (CustomObject *_customObject) |
Returns the interacted widget with assigned *_customObject* which has the cursor over. More... | |
static GuiWidget * | GetInteracted_cursorDown () |
Returns the interacted widget which has the cursor hold down. More... | |
static GuiWidget * | GetInteracted_CursorDown (const std::string &_name) |
Returns the interacted widget with the given *_name* which has the cursor hold down. More... | |
static GuiWidget * | GetInteracted_CursorDown (int _tag) |
Returns the interacted widget with the given *_tag* which has the cursor hold down. More... | |
static GuiWidget * | GetInteracted_CursorDown (CustomObject *_customObject) |
Returns the interacted widget with assigned *_customObject* which has the cursor hold down. More... | |
The GuiTextField class provides a widget for displaying text.
|
strong |
|
strong |
|
strong |
The scrolling mode of displayed text. This parameter allow different ways to display text segments which does not fit vertically into the text field.
Enumerator | |
---|---|
NORMAL | Scrolling range is determined from the text height and the height of the text field. This is a standard mode used with the scrolling slider and is suitable for general texts. |
FIXED_STEP | Scrolling range is a fixed number of lines. This ensure that on every scroll command unique lines get displayed. In practice this mode works better with texts like dialogs where repeated lines would be distracting. This mode does not work with the scrolling slider but require external calls to GuiTextField::ScrollTextUp or GuiTextField::ScrollTextDown. It is also not suitable for texts where different fonts with too much difference in size are used. |
GuiTextField | ( | VectorShape * | _vectorShape, |
Map * | _map | ||
) |
Construct a new GuiTextField from the given *_vectorShape* in the *_map*.
The widget properties are obtained from the vector shape custom parameters.
|
overridevirtual |
|
overridevirtual |
Set the visibility of this widget.
This function is not available for GuiTextField.
Reimplemented from GuiWidget.
|
inline |
Returns the text segment if exists; otherwise returns nullptr.
int GetTextSegmentHeight | ( | TextSegment * | _textSegment | ) |
Returns the height of the given *_textSegment* in this text field.
This function can be used if you want to manually set the height of the text field to fit a particular text segment. Calling this function will reset the text field so use it accordingly.
|
inline |
Returns the name of the clicked button if such event happens; otherwise returns an empty string.
This a querry function for text segments with defined buttons.
void SetScrollingMode | ( | ScrollingMode | _scrollingMode | ) |
Set the scrolling mode.
|
inline |
Returns the scrolling mode of this text field.
void SetScrollingModeFixedStepProperties | ( | int | _numberOfLines, |
int | _lineHeight, | ||
float | _scrollDurationMS | ||
) |
Set the scrolling properties if scrolling mode is ScrollingMode::FIXED_STEP.
_numberOfLines | Number of scrolled lines. |
_lineHeight | The height of the lines. |
_scrollDurationMS | Duration of scrolling in milliseconds. |
void SetDrawingDelay | ( | DrawingDelay | _drawingDelay, |
int | _drawingdelayMS | ||
) |
Set the drawing delay to the given *_drawingDelay* and duration to *_drawingdelayMS* (in milliseconds).
|
inline |
Returns the drawing delay of this text field.
void SetTextAlignment | ( | Alignment | _textAlignment | ) |
Set the text alignment to the given *_textAlignment*.
|
inline |
Returns the text alignment of this text field.
|
inline |
Set to true if alpha fade at margin between box and visible box is used.
void SetTextRect | ( | Recti | _box | ) |
Set the text area rectangle.
Important! The border Y-coordinates for text positioning are the minimum and maximum Y-coordinate of the text box. The used text sprites have their handle Y-coordinate in the middle. This means that half of their height reach out of the text area. Take this into account when designing the text field rectangle size.
A call to this function resets the text field.
|
inline |
Returns the text area rectangle.
void SetVisibleRect | ( | Recti | _visibleBox | ) |
Set the visible area rectangle.
The visible area can be bigger (only height matters) then the text area in which case the text can alpha fade in and out at margins. Use function GuiTextField::SetAlphaFadeAtMargin to enable or disable alpha fade. By default the visible area has the same size as the text area.
A call to this function resets the text field.
|
inline |
Returns the visible area rectangle.
void SetClickableRect | ( | Recti | _clickableBox | ) |
Set the clickable area rectangle.
This is the area where the cursor interaction get registered to this text field. By default the clickable area has the same size as the text area.
|
inline |
Returns the clickable area rectangle.
|
inline |
Set the local factor for vertical lines spacing.
This factor is added to the global factor GuiTextField::globalLinesSpacingFactor. It provides additional spacing between lines. The spacing is obtained by multiplying this factor with the text line height. A negative value will cause negative (reduced) spacing.
void Start | ( | TextSegment * | _textSegment | ) |
Start displaying the given *_textSegment*.
A call to this function resets the text field.
void Reset | ( | ) |
Reset the text field.
Calling this function is usually not needed as other function call it if required.
|
inline |
Returns true if a text segment is currently being drawn by the drawing delay; otherwise returns false.
void SkipDelay | ( | ) |
Skip drawing delay of a text segment and show entire text immediately.
bool ScrollTextUp | ( | ) |
Scroll the segment text up and returns true. If scrolling is not possible returns false.
This function scroll the text segement that does not fit into the text area. The scrolling up is possible until the last line of text is displayed.
bool ScrollTextDown | ( | ) |
Scroll the segment text down and return true. If scrolling is not possible returns false.
This function scroll the text segement that does not fit into the text area. The scrolling down is possible until the first line of text is displayed.
bool IsTextSegmentFirstLineDisplayed | ( | ) |
Returns true if the first line of the text segement is displayed; otherwise returns false.
bool IsTextSegmentLastLineDisplayed | ( | ) |
Returns true if the last line of the text segement is displayed; otherwise returns false.
|
static |
Global factor for vertical lines spacing.
This factor provides additional spacing between lines. The spacing is obtained by multiplying this factor with the text line height. A negative value will cause negative (reduced) spacing.