Rose
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
rose::TextField Class Reference

An Widget to edit a small amount of text. More...

#include <TextField.h>

Inheritance diagram for rose::TextField:
Inheritance graph
[legend]
Collaboration diagram for rose::TextField:
Collaboration graph
[legend]

Classes

struct  FieldSettings
 

Public Member Functions

 TextField (const TextField &)=delete
 
 TextField (TextField &&)=delete
 
TextFieldoperator= (const TextField &)=delete
 
TextFieldoperator= (TextField &&)=delete
 
 TextField (int maxLength, PointSize pointSize=PointSize(), const std::string &fontName="")
 Constructor. More...
 
 TextField (int maxLength, const std::string &text, const std::string &suffix="", PointSize pointSize=PointSize(), const std::string &fontName="")
 Constructor. More...
 
 TextField (Id id, int maxLength, const std::string &suffix="", PointSize pointSize=PointSize(), const std::string &fontName="")
 Constructor. More...
 
void draw (gm::Context &context, const Position< int > &containerPosition) override
 Draw the visual.
 
void addedToContainer () override
 Called when a Node is added to a Container. More...
 
void keyboardFocusReceive (bool hasFocus)
 
void textInputEvent (const std::string &text)
 
void keyboardInput (const SDL_KeyboardEvent &keyEvent)
 
 TextField (TextField &&)=delete
 
 TextField (const TextField &)=delete
 
TextFieldoperator= (TextField &&)=delete
 
TextFieldoperator= (const TextField &)=delete
 
 TextField (int maxLength, int padding=0, FontSize fontSize=0, const string &fontName="")
 Constructor. More...
 
 TextField (int maxLenght, const std::string &text, const std::string &suffix="", const std::string &prefix="", int padding=0, FontSize fontSize=0, const string &fontName="")
 Constructor. More...
 
 TextField (Id id, int padding=0, FontSize fontSize=0, const string &fontName="")
 Constructor. More...
 
void setPair (const Id &pairId, std::shared_ptr< TextField > &pair)
 Set up a pair of TextField widgets. More...
 
Rectangle widgetLayout (sdl::Renderer &renderer, Rectangle available, uint layoutStage) override
 See Frame::widgetLayout()
 
void draw (sdl::Renderer &renderer, Rectangle parentRect) override
 See Frame::draw()
 
void initializeComposite () override
 See Widget::initializeComposite();.
 
void setFontSize (FontSize fontSize) override
 Set the font size in pixels.
 
void setFontName (const std::string &fontName)
 Set the font name.
 
bool textInputEvent (const std::string &text) override
 Handle text input events.
 
bool keyboardFocusEvent (bool focus) override
 Handle keyboard focus events.
 
bool keyboardEvent (uint state, uint repeat, SDL_Keysym keysym) override
 Handle KeyboardEvent.
 
void setRegex (std::shared_ptr< std::regex > regex)
 Set the validation regex. More...
 
void setToUpper (bool toUpper)
 Set the ToUpper flag. More...
 
bool isModified () const
 
- Public Member Functions inherited from rose::Frame
 Frame (bool invert) noexcept
 
 Frame (int padding) noexcept
 
std::string_view nodeId () const noexcept override
 
void drawAnimate (gm::Context &context, const Position< int > &containerPosition)
 
Rectangle layout (gm::Context &context, const Rectangle &screenRect) override
 Layout the visual.
 
- Public Member Functions inherited from rose::Manager
 Manager (const Manager &)=delete
 
 Manager (Manager &&)=delete
 
Manageroperator= (const Manager &)=delete
 
Manageroperator= (Manager &&)=delete
 
std::string_view nodeId () const noexcept override
 
void add (const std::shared_ptr< Node > &node) override
 Add a Node to the contents of the Manager. More...
 
void draw (gm::Context &context, const Position< int > &containerPosition) override
 Draw the manager and contents. More...
 
Rectangle layout (gm::Context &context, const Rectangle &screenRect) override
 Layout the Manager and contents. More...
 
void setLayoutManager (std::unique_ptr< LayoutManager > &&layoutManager)
 Set the layout manager. More...
 
std::unique_ptr< LayoutManager > & layoutManager ()
 Get the LayoutManager. More...
 
- Public Member Functions inherited from rose::Widget
 Widget (const Widget &)=delete
 
 Widget (Widget &&)=delete
 
Widgetoperator= (const Widget &)=delete
 
Widgetoperator= (Widget &&)=delete
 
std::shared_ptr< WidgetpointerWidget (const Position< int > &position, const Position< int > &containerPosition)
 Search for the Widget within which the position lies. More...
 
Position< int > computeScreenPosition ()
 Recursively compute the Widget Position on the Screen. More...
 
bool contains (const Position< int > &position)
 Determine if a given Screen Position is within the Widget Rectangle. More...
 
ApplicationgetApplication ()
 Get a reference to the Application object. More...
 
ApplicationgetApplication () const
 const version of getApplication()
 
std::shared_ptr< WindowgetWindow ()
 Get the Window ancestor of a Widget. More...
 
std::shared_ptr< WindowgetWindow () const
 const version of getWindow().
 
bool enterEvent ()
 Notify Widget of mouse pointer enter event. More...
 
void setEnterLeaveEventCallback (EventCallback eventCallback)
 Set the enter callback.
 
bool leaveEvent ()
 Notify Widget of mouse pointer leave event. More...
 
void setLeaveEventCallback (EventCallback eventCallback)
 Set the leave callback.
 
bool buttonEvent (bool pressed, uint button, uint clicks, bool passed)
 Notify Widget of mouse button events. More...
 
void setButtonEventCallback (ButtonCallback buttonCallback)
 Set the button callback.
 
bool mouseMotionEvent (bool pressed, uint button, const Position< int > &mousePos, const Position< int > &relativePos, bool passed)
 Notify Widget of mouse motion events. More...
 
void setMouseMotionEventCallback (MouseMotionCallback mouseMotionCallback)
 Set the mouse motion callback.
 
bool mouseScrollEvent (const Position< int > &deltaPos, bool passed)
 Notify Widget of mouse scroll wheel events. More...
 
void setMouseScrollEventCallback (ScrollCallback scrollCallback)
 Set the mouse scroll callback.
 
bool keyboardShortcutEvent (uint32_t shortcutCode, bool state, uint repeat)
 Notify the Widget of a keyboard shortcut invocation. More...
 
void setKeyboardShortcutCallback (KeyboardShortcutCallback keyboardShortcutCallback)
 Set the keyboard shortcut callback.
 
bool keyTextInputEvent (const std::string &text)
 Notify the Widget of text input. More...
 
void setTextInputCallback (TextInputCallback textInputCallback)
 Set the text input callback.
 
bool supportsKeyboardFocus () const
 
bool keyboardFocusEvent (bool hasFocus)
 Notify the Widget when it gains or looses keyboard focus. More...
 
void setKeyboardFocusCallback (KeyboardFocusCallback keyboardFocusCallback)
 Set the keyboard focus callback.
 
bool keyboardEvent (const SDL_KeyboardEvent &keyboardEvent)
 
void setKeyboardEvent (KeyboardEventCallback keyboardEventCallback)
 
- Public Member Functions inherited from rose::Visual
void setScreenRectangle (const Position< int > &containerPosition)
 Compute the screen rectangle from the Container screen Position. More...
 
Rectangle getScreenRectangle (const Position< int > &containerPosition) const
 Get the rectangle occupied by the Visual. More...
 
Position< int > drawPadding (const Position< int > &containerPosition)
 Pad the drawing location.
 
Rectangle layoutPadding (const Rectangle &screenRect)
 Pad the layout.
 
void setSize (const Size &size)
 Set preferred Size.
 
Size getSize () const
 Get the preferred size.
 
void setPosition (const Position< int > &position)
 Set preferred Position.
 
Position< int > getPosition () const
 Get the preferred Position.
 
void setPadding (const Padding &padding)
 Set Padding.
 
void setScreenRectangle (const Rectangle &screenRect)
 Set Screen Rectangle.
 
constexpr bool isVisible () const noexcept
 Check visibility.
 
void setVisible (bool visible) noexcept
 Set visibility.
 
void setLayoutHint (const LayoutHint &hint)
 Add a LayoutHint.
 
std::optional< int > getAttachmentHint (LayoutHint::Attachment attachment)
 Get an AttachmentHint value given a LayoutHint::Attachment. More...
 
std::optional< int > getGridHint (LayoutHint::GridLayoutHint gridLayoutHint)
 Get a GridLayoutHint value given a LayoutHint::GridLayoutHint. More...
 
template<size_t HintClass>
std::optional< const ValueMapgetHintMap () const
 
SemanticGesture supportedSemanticGestures () const
 Get supported SemanticGestures.
 
- Public Member Functions inherited from rose::Container
void remove (const std::shared_ptr< Node > &node)
 
- Public Member Functions inherited from rose::Node
 Node (const std::shared_ptr< Container > &container)
 Create a node and add it to a Container. More...
 
void setId (const Id &nodeId) noexcept
 Set Id.
 
std::string_view getId () const
 Get Id.
 
IdPath getIdPath () const
 Get the Id Path.
 
std::shared_ptr< Containercontainer ()
 
std::shared_ptr< Containercontainer () const
 
template<typename C >
std::shared_ptr< C > containerAs ()
 
template<typename C >
std::shared_ptr< C > containerAs () const
 
std::shared_ptr< const NodegetNode () const
 Get a const std::shared_ptr to this node. More...
 
std::shared_ptr< NodegetNode ()
 Get a std::shared_ptr to this node. More...
 
template<typename NodeType >
std::shared_ptr< const NodegetNode () const
 Get a std::shared_ptr<const NodeType> to this node. More...
 
template<typename NodeType >
std::shared_ptr< NodeType > getNode ()
 Get a std::shared_ptr<NodeType> to this node. More...
 
std::shared_ptr< Noderemove ()
 
- Public Member Functions inherited from rose::FrameElements
 FrameElements (int padding)
 
void set (const CornerStyle cornerStyle)
 Set the CornerStyle.
 
void setState (bool state)
 Set the state, true = inverted.
 
void setAnimateColor (const color::RGBA &color)
 Set the active color.
 
void setInactiveColor (const color::RGBA &color)
 Set the background color.
 
bool getState () const
 
void frameSettings (const FrameSettings &frameSettings)
 
- Public Member Functions inherited from rose::Animation
void setActionCurve (std::unique_ptr< ActionCurves::ActionCurve > &&actionCurve)
 
void setAnimationEnable (AnimationEnable animationEnable)
 
- Public Member Functions inherited from rose::TextLabel
 TextLabel (const TextLabel &)=delete
 
 TextLabel (TextLabel &&)=delete
 
TextLabeloperator= (const TextLabel &)=delete
 
TextLabeloperator= (TextLabel &&)=delete
 
 TextLabel (const std::string &text) noexcept
 
 TextLabel (const char *text)
 
 TextLabel (const std::string_view &text)
 
 TextLabel (const Id &id) noexcept
 
std::string_view nodeId () const noexcept override
 
- Public Member Functions inherited from rose::TextButton
 TextButton (const TextButton &)=delete
 
 TextButton (TextButton &&)=delete
 
TextButtonoperator= (const TextButton &)=delete
 
TextButtonoperator= (TextButton &&)=delete
 
 TextButton (ButtonType buttonType=ButtonType::PushButton) noexcept
 
 TextButton (const std::string &text, ButtonType buttonType=ButtonType::PushButton)
 
 TextButton (const char *text, ButtonType buttonType=ButtonType::PushButton)
 
 TextButton (const std::string_view &text, ButtonType buttonType=ButtonType::PushButton)
 
 TextButton (const Id &id, ButtonType buttonType=ButtonType::PushButton)
 
 TextButton (const Id &id, ButtonStateChangeCallback stateChangeCB, ButtonType buttonType=ButtonType::PushButton)
 
 TextButton (const std::string &text, ButtonStateChangeCallback stateChangeCB, ButtonType buttonType=ButtonType::PushButton)
 
 TextButton (const char *text, ButtonStateChangeCallback stateChangeCB, ButtonType buttonType=ButtonType::PushButton)
 
 TextButton (const std::string_view &text, ButtonStateChangeCallback stateChangeCB, ButtonType buttonType=ButtonType::PushButton)
 
Rectangle layout (gm::Context &context, const Rectangle &screenRect) override
 Layout the text button. More...
 
- Public Member Functions inherited from rose::ButtonFrame
 ButtonFrame (const ButtonFrame &)=delete
 
 ButtonFrame (ButtonFrame &&)=delete
 
ButtonFrameoperator= (const ButtonFrame &)=delete
 
ButtonFrameoperator= (ButtonFrame &&)=delete
 
 ButtonFrame (ButtonType buttonType) noexcept
 
void setButtonCommandCallback (uint commandId, ButtonCommandCallback buttonCommandCallback)
 
 ButtonFrame (ButtonFrame &&)=delete
 
 ButtonFrame (const ButtonFrame &)=delete
 
ButtonFrameoperator= (ButtonFrame &&)=delete
 
ButtonFrameoperator= (const ButtonFrame &)=delete
 
 ButtonFrame (int padding=0)
 
 ButtonFrame (Padding padding)
 
void initializeComposite () override
 See Widget::initializeComposite.
 
void setSelectState (ButtonSetState state)
 Set the button select state. More...
 
ButtonSetState getSelectState () const
 Access the button select state. More...
 
void setStateId (const StateId &stateId) override
 Set the ButtonFrame StateId.
 
- Public Member Functions inherited from rose::Text
 Text (const Text &)=delete
 
 Text (Text &&)=delete
 
Textoperator= (const Text &)=delete
 
Textoperator= (Text &&)=delete
 
Status createTextureBlended (gm::Context &context)
 Create a Blended Texture from text. More...
 
void setPointSize (int pointSize)
 Set the font point size.
 
void setFontName (const std::string &fontName)
 Set the font name.
 
bool setText (const std::string &text)
 Set the text displayed. More...
 
bool textUpdated ()
 
void setSuffix (const std::string &suffix)
 
void setTextMaxSize (int maxSize, char em='\0')
 
void setTextValidationPattern (const std::string &regex)
 

Static Public Member Functions

template<size_t N>
static void Settings (std::unique_ptr< rose::Settings > &db, const std::array< FieldSettings, N > &settings)
 
- Static Public Member Functions inherited from rose::Node
template<typename NodeType >
static std::shared_ptr< NodeType > create ()
 Create a Node with no arguments. More...
 
template<typename NodeType , typename ... Args>
static std::shared_ptr< NodeType > create (Args ... args)
 Create a Node with arguments. More...
 
template<typename NodeType , typename ContainerType , typename ... Args>
static std::shared_ptr< NodeType > add (ContainerType container, Args ... args)
 Create a Node with arguments and add to a Container. More...
 
- Static Public Member Functions inherited from rose::FrameElements
static gm::Texture createBackgroundMask (gm::Context &context, Size size, int frameWidth, bool roundCorners=false)
 
static void colorBackgroundMask (gm::Context &context, gm::Texture &mask, const color::RGBA &base, const color::RGBA &active, float value)
 
- Static Public Member Functions inherited from rose::Animation
static void setAnimation (const std::shared_ptr< Window > &window, std::shared_ptr< Animation > animation, const Position< int > &position)
 
static void removeAnimation (const std::shared_ptr< Window > &window, std::shared_ptr< Animation > animation)
 

Public Attributes

bool toUpperCase {false}
 If true input is forced to upper case.
 
- Public Attributes inherited from rose::Visual
std::map< size_t, ValueMapmHintsMap {}
 The std::map of hint class to ValueMap.
 
- Public Attributes inherited from rose::Animation
std::unique_ptr< ActionCurves::ActionCurvemActionCurve {}
 
- Public Attributes inherited from rose::ButtonFrame
std::shared_ptr< Slot< SignalType > > rxPushed
 A Slot to receive Pushed signals on. More...
 
Signal< SignalTypetxPushed
 A Signal to transmit Pusehd signals on. More...
 
std::shared_ptr< Slot< SignalType > > rxState
 A Slot to receive State signals on. More...
 
Signal< SignalTypetxState
 A Signal to transmit.
 

Protected Member Functions

void eraseChar (int location)
 Erase the character as if the caret is at the specified location and Backspace is used.
 
void saveValue ()
 
- Protected Member Functions inherited from rose::FrameElements
void renderSelectedSides (gm::Context &context, FrameElements::SelectedSides selectedSides, BorderStyle useBorder, ImageId corner, const Size &size, int extend=0)
 Render sides as part of a border around the frame. More...
 
void drawBackground (gm::Context &context, Rectangle &src, Rectangle &dst)
 Draw the background for the Frame. More...
 
gm::Texture createBackgroundTexture (gm::Context &context, Rectangle &src, Rectangle &dst, const color::RGBA &color)
 
std::tuple< UseBorder, SelectedCornersdecoration ()
 
void drawFrame (gm::Context &context, Rectangle widgetRect)
 Draw the Frame and background. More...
 
void buttonDisplayStateChange (ButtonDisplayState buttonDisplayState)
 Make visual changes to FrameElements for button display. More...
 
- Protected Member Functions inherited from rose::TextButton
Rectangle layoutContent (gm::Context &context, const Rectangle &screenRect)
 
- Protected Member Functions inherited from rose::ButtonFrame
bool mouseButtonEvent (const Position &mousePos, int button, bool down, int modifiers) override
 Handle mouse button events. More...
 
bool clickTransactionCancel (const Position &mousePos, int button, bool down, int modifiers) override
 Handle a click transaction cancel event (default implementation: propagate to children)
 
void updateStateSetting (ButtonSetState state)
 Update the button state in the Setting database.
 
- Protected Member Functions inherited from rose::Text
void setEditingMode (bool editing, int carret)
 Set the editing mode.
 

Static Protected Member Functions

static void enterSettings (std::unique_ptr< rose::Settings > &db, const FieldSettings &setting)
 
- Static Protected Member Functions inherited from rose::FrameElements
static void trimCorners (gm::Surface &surface, color::RGBA color, FrameElements::SelectedCorners selectedCorners, Size cornerSize, Size frameSize)
 Trim corners on a background surface to allow for rounded corners. More...
 
static void renderSelectedCorners (gm::Context &context, SelectedCorners selectedCorners, ImageId corner, const Size &size)
 Render corner images as part of a border around the frame. More...
 

Protected Attributes

DataType mDataType {DataType::Unset}
 The type of data expected by the TextField.
 
char mEm {'M'}
 The largest Glyph that will be in the text.
 
bool mModified {}
 True when the value has been modified.
 
bool mValidEntry {}
 True if the current value passes validation.
 
bool mHasFocus {}
 True if the TextField has keyboard focus.
 
bool mToUpper {}
 Convert chars to upper case.
 
int mMaxLength {}
 The maximum length of the text.
 
FontSize mFontSize {}
 The font size in pixels.
 
std::string mFontName {}
 The font name.
 
FontPointer mFont {}
 FontPointer to font in use.
 
FontMetrics mFontMetrics {}
 The metrics of the current font.
 
color::RGBA mTextColor {}
 Text foreground color.
 
color::RGBA mErrorColor {}
 The color used when validation fails.
 
color::RGBA mUnmodifiedColor {}
 The color used when data is unmodified.
 
std::string mPrefix {}
 The prefix to the text.
 
std::string mSuffix {}
 The suffix to the text.
 
std::string mText {}
 The current text value.
 
std::string::iterator mCaretLoc
 The caret location in mText (one past).
 
Size mPrefixSize {}
 The size of the rendered Prefix.
 
Size mSuffixSize {}
 The size of the rendered Suffix.
 
Size mTextSize {}
 The size of the rendered Text.
 
int mTextMaxGlyph {}
 The width of mEm.
 
int mGlyphAdvance {}
 The advance of mEm.
 
sdl::Texture mPrefixTexture {}
 Texture to render the Prefix;.
 
sdl::Texture mSuffixTexture {}
 Texture to render the Suffix;.
 
sdl::Texture mTextTexture {}
 Texture to render the Text;.
 
std::shared_ptr< std::regex > mValidationPattern {}
 Regular expression to validate content.
 
std::shared_ptr< TextFieldmPair {}
 The companion in a TextField pair.
 
Id mPairId {}
 The Id of the pair.
 
size_t mPairIdx {}
 The index of this object in the pair (0 or 1).
 
- Protected Attributes inherited from rose::Manager
std::unique_ptr< LayoutManagermLayoutManager {}
 The layout manager which determines the presentation of contained Widgets.
 
- Protected Attributes inherited from rose::Widget
EventCallback mEnterEventCallback {}
 The pointer has entered the Widget.
 
EventCallback mLeaveEventCallback {}
 The pointer has left the Widget.
 
ButtonCallback mButtonEventCallback {}
 The pointer button has been pressed with the pointer inside the Widget.
 
MouseMotionCallback mMouseMotionCallback {}
 The pointer is in motion, inside the Widget with a button pressed.
 
ScrollCallback mMouseScrollCallback {}
 The mouse scroll wheel has moved with the pointer inside the Widget.
 
KeyboardShortcutCallback mKeyboardShortcutCallback {}
 A keyboard button event while the Widget has keyboard focus.
 
TextInputCallback mTextInputCallback {}
 A text input event while the Widget has keyboard focus.
 
KeyboardFocusCallback mKeyboardFocusCallback {}
 Notification that this Widget has gained or lost keyboard focus.
 
KeyboardEventCallback mKeyboardEventCallback {}
 Notification that this Widget has received a keyboard event.
 
- Protected Attributes inherited from rose::Visual
SemanticGesture mSemanticGesture {}
 
Position< int > mPos {}
 Position relative to the container, arrived at by layout.
 
Size mSize {}
 The size on screen, arrived at by layout.
 
Position< int > mPreferredPos {}
 The preferred position.
 
Size mPreferredSize {}
 The preferred size.
 
Rectangle mScreenRect {}
 The screen Rectangle computed at drawing time.
 
Padding mPadding {}
 Immediately around the Visual, used for separation and alignment.
 
State mState {}
 The object state Id string.
 
bool mVisible {true}
 If true the object is visible.
 
- Protected Attributes inherited from rose::Node
std::weak_ptr< ContainermContainer {}
 The Container that holds the Node. More...
 
Id mId {}
 
- Protected Attributes inherited from rose::FrameElements
color::RGBA mBaseColor
 
color::RGBA mInvertColor
 
color::RGBA mTopColor
 
color::RGBA mBotColor
 
color::RGBA mLeftColor
 
color::RGBA mRightColor
 
color::RGBA mActiveColor
 
color::RGBA mInactiveColor
 
float mColorValue {}
 
int mFrameWidth {2}
 
Padding mFramePadding {}
 
CornerStyle mCornerStyle {CornerStyle::Round}
 
bool mInvert {}
 
gm::Texture mBorder {}
 
gm::Texture mInactiveBG {}
 
gm::Texture mAnimatedBG {}
 
FrameSettings mFrameSettings {}
 
- Protected Attributes inherited from rose::Animation
Callback mAnimationCallback
 
Enable mAnimationEnableStateCallback
 
AnimationEnable mAnimationEnableState {AnimationEnable::Disable}
 
- Protected Attributes inherited from rose::ButtonFrame
bool mCentreHorizontal {false}
 
bool mCentreVertical {false}
 
std::unique_ptr< ButtonSemanticsmButtonSemantics {}
 
ButtonDisplayCallback mButtonDisplayCallback {}
 
ButtonStateChangeCallback mButtonStateChangeCallback {}
 
SignalSerialNumber mSignalSerialNumber {}
 The button serial number.
 
ButtonType mButtonType {}
 The button type.
 
bool mSelectProgress {}
 True when button selection is in progress.
 
ButtonSetState mButtonSelectState {}
 The current selected state of the button.
 
std::shared_ptr< Slot< std::string > > mSettingsUpdateRx {}
 Slot to receive settings updates on.
 
- Protected Attributes inherited from rose::Text
std::string mText {}
 The UTF8 or ASCII text to render.
 
std::string mSuffix {}
 The UTF8 or ASCII suffix.
 
color::RGBA mTextFgColor
 The foreground color to use.
 
color::RGBA mTextBgColor
 The background color to use if rendering Shaded.
 
color::RGBA mCaretColor {}
 The color of the caret when editing.
 
color::RGBA mRegexFail {}
 The text colour for regex validation failure.
 
color::RGBA mDataSaved {}
 The text colour when the data has been saved to settings.
 
float mCaretAlpha {0.f}
 The alpha value of the caret during animation.
 
RenderStyle mRenderStyle {Blended}
 The style of rendering Solid, Shaded, or Blended.
 
std::string mFontName
 The name of the True Type Font to use.
 
std::shared_ptr< _TTF_Font > mFont {}
 The cached font used.
 
int mPointSize
 The point (pixel) size of the font.
 
gm::Texture mTexture {}
 The generated Texture.
 
Size mTextSize {}
 The size of the Texture in pixels.
 
Status mStatus {OK}
 The Status of the last operation.
 
int mCaretLocation {0}
 The location of the caret.
 
bool mEditingActive {false}
 True when the text is being edited.
 
bool mEditable {false}
 The label text is editable.
 
bool mTextValidated {true}
 Ture when the content validates by mValidationPatter.
 
bool mSaveToSettings {false}
 Set to true when modifications have been saved.
 
int mMaxSize {0}
 The maximum number of characters to be held, 0 indicates variable.
 
char eM {'N'}
 The character used to compute the maximum screen rectangle width.
 
std::unique_ptr< std::regex > mValidationPattern {}
 Regular expression to validate content.
 

Additional Inherited Members

- Public Types inherited from rose::Visual
using ValueMap = std::map< int, int >
 The std::map type for each hint class.
 
- Public Types inherited from rose::Node
using NodePtr = std::shared_ptr< Node >
 
- Public Types inherited from rose::Animation
using Callback = std::function< void(gm::Context &context, const Position< int > &, uint32_t frame)>
 
using Enable = std::function< void(AnimationEnable animationEnable)>
 
- Public Types inherited from rose::ButtonFrame
using SignalType = std::pair< bool, SignalToken >
 The content type of ButtonFrame signals and slots.
 
- Public Types inherited from rose::Text
enum  RenderStyle { Blended, Shaded, Solid }
 
enum  Status {
  OK, TextEmpty, FontError, SurfaceError,
  TextureError
}
 
- Static Public Attributes inherited from rose::Frame
static constexpr std::string_view id = "Frame"
 
- Static Public Attributes inherited from rose::Manager
static constexpr std::string_view id = "Manager"
 
- Static Public Attributes inherited from rose::Widget
static constexpr std::string_view id = "Widget"
 
- Static Public Attributes inherited from rose::Container
static constexpr std::string_view id = "Container"
 
- Static Public Attributes inherited from rose::Node
static constexpr std::string_view id = "Node"
 
- Static Public Attributes inherited from rose::TextLabel
static constexpr std::string_view id = "TextLabel"
 
- Static Public Attributes inherited from rose::TextButton
static constexpr std::string_view id = "TextButton"
 
- Static Public Attributes inherited from rose::ButtonFrame
static constexpr std::string_view id = "ButtonFrame"
 
- Protected Types inherited from rose::FrameElements
enum  SelectedCorners : uint32_t {
  NoCorners = 0, TopLeftCorner = 0x8, TopRightCorner = 0x4, TopCorners = TopLeftCorner | TopRightCorner,
  BottomLeftCorner = 0x2, BottomRightCorner = 0x1, BottomCorners = BottomLeftCorner | BottomRightCorner, LeftCorners = TopLeftCorner | BottomLeftCorner,
  RightCorners = TopRightCorner | BottomRightCorner, AllCorners = 0xf
}
 Specify corners selected for some process, usually drawing.
 
enum  SelectedSides : uint32_t {
  NoSides = 0, TopSide = 1, BotSide = 2, LeftSide = 4,
  RightSide = 8, AllSides = TopSide | BotSide | LeftSide | RightSide, TabTopSides = TopSide | LeftSide | RightSide
}
 Specify sides selected for some process, usually drawing.
 

Detailed Description

An Widget to edit a small amount of text.

An editable, single line, text field.

The text may have a validation regular expression.

Constructor & Destructor Documentation

◆ TextField() [1/6]

rose::TextField::TextField ( int  maxLength,
PointSize  pointSize = PointSize(),
const std::string &  fontName = "" 
)
explicit

Constructor.

Parameters
maxLengthThe maximum number of characters in the editable text.
paddingThe padding around the text.
fontSizeThe font size in pixels, defaults to Theme value,
fontNameThe font name, defaults to Theme value.

◆ TextField() [2/6]

rose::TextField::TextField ( int  maxLength,
const std::string &  text,
const std::string &  suffix = "",
PointSize  pointSize = PointSize(),
const std::string &  fontName = "" 
)

Constructor.

Parameters
maxLengthThe maximum number of characters in the editable text.
prefixA prefix string displayed before the editable text.
suffix
paddingThe padding around the text.
fontSizeThe font size in pixels, defaults to Theme value,
fontNameThe font name, defaults to Theme value.

◆ TextField() [3/6]

rose::TextField::TextField ( Id  id,
int  maxLength,
const std::string &  suffix = "",
PointSize  pointSize = PointSize(),
const std::string &  fontName = "" 
)
explicit

Constructor.

Create a TextField with parameters taken from the Settings database. Settings must be previously set by a call to TextField::Settings(). This has the added benefit of enabling automatic saving and propagation of values.

Parameters
idThe Id used to identify the TextFiled and its settings.

◆ TextField() [4/6]

rose::TextField::TextField ( int  maxLength,
int  padding = 0,
FontSize  fontSize = 0,
const string &  fontName = "" 
)
explicit

Constructor.

Parameters
maxLengthThe maximum number of characters in the editable text.
paddingThe padding around the text.
fontSizeThe font size in pixels, defaults to Theme value,
fontNameThe font name, defaults to Theme value.

◆ TextField() [5/6]

rose::TextField::TextField ( int  maxLenght,
const std::string &  text,
const std::string &  suffix = "",
const std::string &  prefix = "",
int  padding = 0,
FontSize  fontSize = 0,
const string &  fontName = "" 
)

Constructor.

Parameters
maxLengthThe maximum number of characters in the editable text.
prefixA prefix string displayed before the editable text.
suffix
paddingThe padding around the text.
fontSizeThe font size in pixels, defaults to Theme value,
fontNameThe font name, defaults to Theme value.

◆ TextField() [6/6]

rose::TextField::TextField ( Id  id,
int  padding = 0,
FontSize  fontSize = 0,
const string &  fontName = "" 
)
explicit

Constructor.

Create a TextField with parameters taken from the Settings database. Settings must be previously set by a call to TextField::Settings(). This has the added benefit of enabling automatic saving and propagation of values.

Parameters
idThe Id used to identify the TextFiled and its settings.

Member Function Documentation

◆ addedToContainer()

void rose::TextField::addedToContainer ( )
overridevirtual

Called when a Node is added to a Container.

By default it is ignored but can be used to perform initialization that is required when a Node is placed in a Container.

Reimplemented from rose::Node.

◆ setPair()

void rose::TextField::setPair ( const Id pairId,
std::shared_ptr< TextField > &  pair 
)

Set up a pair of TextField widgets.

A pair of TextField widgets cooperate in editing a pair of integer or real values. This pair takes index = 0.

Parameters
pairThe other member of the pair.

◆ setRegex()

void rose::TextField::setRegex ( std::shared_ptr< std::regex >  regex)
inline

Set the validation regex.

Parameters
regexThe validation pattern.

◆ setToUpper()

void rose::TextField::setToUpper ( bool  toUpper)
inline

Set the ToUpper flag.

Parameters
toUpperThe ToUpper value.

The documentation for this class was generated from the following files: