9 #include "tb_widgets_common.h"
11 #include "tb_style_edit.h"
89 bool GetMultiline()
const {
return m_style_edit.packed.multiline_on; }
93 bool GetStyling()
const {
return m_style_edit.packed.styling_on; }
99 bool GetReadOnly()
const {
return m_style_edit.packed.read_only; }
103 bool GetWrapping()
const {
return m_style_edit.packed.wrapping; }
110 bool GetAdaptToContentSize()
const {
return m_adapt_to_content_size; }
119 int GetVirtualWidth()
const {
return m_virtual_width; }
127 EDIT_TYPE GetEditType() {
return m_edit_type; }
140 TB_TEXT_ALIGN GetTextAlign()
const {
return m_style_edit.align; }
149 virtual bool SetText(
const TBStr & text) {
return m_style_edit.SetText(text, TB_CARET_POS_BEGINNING); }
150 virtual bool GetText(
TBStr &text)
const {
return m_style_edit.GetText(text); }
158 {
return m_style_edit.SetText(text, pos); }
162 virtual bool GetPlaceholderText(
TBStr &text)
const {
return m_placeholder.GetText(text); }
166 const TBStr & GetFormat()
const {
return m_format; }
168 virtual void ScrollTo(
int x,
int y);
173 virtual void OnPaint(
const PaintProps &paint_props);
180 virtual void OnResized(
int old_w,
int old_h);
195 bool m_adapt_to_content_size;
197 void UpdateScrollbarVisibility(
bool multiline);
200 virtual void OnChange();
201 virtual bool OnEnter();
203 virtual void DrawString(int32_t x, int32_t y,
TBFontFace *font,
const TBColor &color,
const char *str, int32_t len);
204 virtual void DrawRect(
const TBRect &rect,
const TBColor &color);
205 virtual void DrawRectFill(
const TBRect &rect,
const TBColor &color);
206 virtual void DrawTextSelectionBg(
const TBRect &rect);
207 virtual void DrawContentSelectionFg(
const TBRect &rect);
208 virtual void DrawCaret(
const TBRect &rect);
209 virtual void Scroll(int32_t dx, int32_t dy);
210 virtual void UpdateScrollbars();
211 virtual void CaretBlinkStart();
212 virtual void CaretBlinkStop();
217 #endif // TB_EDITFIELD_H
void SetAlign(TB_TEXT_ALIGN align)
Set the default text alignment and all currently selected blocks, or the block of the current caret p...
Definition: tb_style_edit.cpp:1964
virtual TBWidget::ScrollInfo GetScrollInfo()
If this is a widget that scroll children (see GetChildTranslation), it should return the current scro...
Definition: tb_editfield.cpp:203
void SetWrapping(bool wrapping)
Set to true if the text should wrap if multi line is enabled (See SetMultiline).
Definition: tb_editfield.cpp:135
void SetTextAlign(TB_TEXT_ALIGN align)
Set which alignment the text should have if the space given when painting is larger than the text...
Definition: tb_editfield.h:139
Listener for TBStyleEdit.
Definition: tb_style_edit.h:24
bool SetText(const TBStr &text, TB_CARET_POS pos)
< Make Invalidate in base class available.
Definition: tb_editfield.h:157
virtual void OnPaint(const PaintProps &paint_props)
Callback for painting this widget.
Definition: tb_editfield.cpp:308
Content for a non-text TBTextFragment.
Definition: tb_style_edit_content.h:17
void SetStyling(bool styling)
Set if styling should be enabled or not.
Definition: tb_editfield.cpp:121
TBFontFace represents a loaded font that can measure and render strings.
Definition: tb_font_renderer.h:142
virtual TBWidget * GetScrollRoot()
If this widget is implementing ScrollTo and GetScrollInfo but the corresponding GetChildTranslation i...
Definition: tb_editfield.h:170
TBEditField is a one line or multi line textfield that is editable or read-only.
Definition: tb_editfield.h:74
TB_TEXT_ALIGN
TB_TEXT_ALIGN specifies horizontal text alignment.
Definition: tb_widgets_common.h:22
virtual void ScrollTo(int x, int y)
If this is a widget that scroll children (see GetChildTranslation), it should scroll to the coordinat...
Definition: tb_editfield.cpp:193
void SetVirtualWidth(int virtual_width)
The virtual width is only used if the size is adapting to content size (See SetAdaptToContentSize) an...
Definition: tb_editfield.cpp:100
The default content factory for embedded content in TBEditField with styling enabled.
Definition: tb_editfield.h:44
double atof() const
Call atof() on the string.
Definition: tb_str.h:96
virtual PreferredSize OnCalculatePreferredContentSize(const SizeConstraints &constraints)
Calculate the preferred content size for this widget.
Definition: tb_editfield.cpp:379
Specifies size constraints used during size calculations.
Definition: tb_widgets.h:321
virtual bool GetCustomSkinCondition(const TBSkinCondition::CONDITION_INFO &info)
Support custom skin condition properties.
Definition: tb_editfield.cpp:157
virtual bool GetText(TBStr &text) const
Get the text of this widget.
Definition: tb_editfield.h:150
virtual void OnAdded()
Called when this widget has been added to a parent (after calling OnChildAdded on parent)...
Definition: tb_editfield.cpp:353
virtual TBTextFragmentContent * CreateFragmentContent(const char *text, int text_len)
Create content for a string previosly consumed by calling GetContent.
Definition: tb_editfield.cpp:632
EDIT_TYPE
EDIT_TYPE - These types does not restrict input (may change in the future).
Definition: tb_editfield.h:18
Edit and formats TBTextFragment's.
Definition: tb_style_edit.h:319
void SetMultiline(bool multiline)
Set if multiple lines should be allowed or not.
Definition: tb_editfield.cpp:110
WIDGET_HIT_STATUS
Hit status return value for TBWidget::GetHitStatus.
Definition: tb_widgets.h:398
virtual void OnFontChanged()
Called when the font has changed.
Definition: tb_editfield.cpp:358
virtual void OnFocusChanged(bool focused)
Called when the focus has changed.
Definition: tb_editfield.cpp:363
virtual TBWidget * GetContentRoot()
Get this widget or a child widget that should be root for other children.
Definition: tb_editfield.h:181
INFLATE_INFO contains info passed to TBWidget::OnInflate during resource loading. ...
Definition: tb_widgets_reader.h:21
TBMessageHandler handles a list of pending messages posted to itself.
Definition: tb_msg.h:72
TBStr is a simple string class.
Definition: tb_str.h:62
virtual void OnMessageReceived(TBMessage *msg)
Called when a message is delivered.
Definition: tb_editfield.cpp:433
virtual void SetValueDouble(double value)
Set the value in double precision.
Definition: tb_editfield.cpp:179
Simple rectangle class.
Definition: tb_geometry.h:25
Creates TBTextFragmentContent if the sequence of text matches known content.
Definition: tb_style_edit.h:46
virtual void OnInflate(const INFLATE_INFO &info)
Called when this widget is inflated from resources, before any children have been inflated...
Definition: tb_widgets_reader.cpp:397
TBMessage is a message created and owned by TBMessageHandler.
Definition: tb_msg.h:47
TBColor contains a 32bit color.
Definition: tb_color.h:21
TBRect GetVisibleRect()
Get the visible rect (the GetPaddingRect() minus any scrollbars)
Definition: tb_editfield.cpp:75
void SetFormat(TBStr format)
The printf formatting string, used for formatting Set*Value().
Definition: tb_editfield.cpp:186
TBStyleEdit * GetStyleEdit()
Get the TBStyleEdit object that contains more functions and settings.
Definition: tb_editfield.h:122
virtual void OnPaintChildren(const PaintProps &paint_props)
Callback for painting child widgets.
Definition: tb_editfield.cpp:339
virtual double GetValueDouble() const
Return the value in double precision.
Definition: tb_editfield.h:147
virtual bool SetText(const TBStr &text)
Set the text of this widget.
Definition: tb_editfield.h:149
virtual int GetContent(const char *text)
Should return then length of the text that represents content that can be created by this factory...
Definition: tb_editfield.cpp:627
virtual bool OnEvent(const TBWidgetEvent &ev)
Callback for handling events.
Definition: tb_editfield.cpp:215
void SetReadOnly(bool readonly)
Set if read only mode should be enabled.
Definition: tb_editfield.cpp:126
PreferredSize contains size preferences for a TBWidget.
Definition: tb_widgets.h:277
void SetAdaptToContentSize(bool adapt)
Set to true if the preferred size of this editfield should adapt to the size of the content (disabled...
Definition: tb_editfield.cpp:92
virtual void OnDeflate(const INFLATE_INFO &info)
Called when this widget is deflated to a node, before any children have been deflated.
Definition: tb_widgets_reader.cpp:431
virtual void OnResized(int old_w, int old_h)
Called when this widget has been resized.
Definition: tb_editfield.cpp:368
void SetEditType(EDIT_TYPE type)
Set the edit type that is a hint for virtual keyboards about what the content should be...
Definition: tb_editfield.cpp:147
virtual bool SetPlaceholderText(const TBStr &text)
Set the placeholder text.
Definition: tb_editfield.h:161