7#ifndef MYGUI_EDIT_BOX_H_
8#define MYGUI_EDIT_BOX_H_
33 void setTextIntervalColour(
size_t _start,
size_t _count,
const Colour& _colour);
36 size_t getTextSelectionStart()
const;
39 size_t getTextSelectionEnd()
const;
42 size_t getTextSelectionLength()
const;
45 UString getTextInterval(
size_t _start,
size_t _count)
const;
51 void setTextSelection(
size_t _start,
size_t _end);
54 void deleteTextSelection();
57 UString getTextSelection()
const;
60 bool isTextSelection()
const;
63 void setTextSelectionColour(
const Colour& _colour);
66 void setTextCursor(
size_t _index);
68 size_t getTextCursor()
const;
72 void setCaption(
const UString& _value)
override;
74 const UString& getCaption()
const override;
77 void setOnlyText(
const UString& _text);
79 UString getOnlyText()
const;
85 size_t getTextLength()
const;
88 void setOverflowToTheLeft(
bool _value);
90 bool getOverflowToTheLeft()
const;
93 void setMaxTextLength(
size_t _value);
95 size_t getMaxTextLength()
const;
98 void insertText(
const UString& _text,
size_t _index =
ITEM_NONE);
100 void addText(
const UString& _text);
102 void eraseText(
size_t _start,
size_t _count = 1);
108 void setEditReadOnly(
bool _value);
110 bool getEditReadOnly()
const;
118 void setEditPassword(
bool _password);
120 bool getEditPassword()
const;
127 void setEditMultiLine(
bool _value);
129 bool getEditMultiLine()
const;
135 void setEditStatic(
bool _value);
137 bool getEditStatic()
const;
140 void setPasswordChar(
Char _char);
142 void setPasswordChar(
const UString& _value);
144 Char getPasswordChar()
const;
151 void setEditWordWrap(
bool _value);
153 bool getEditWordWrap()
const;
160 void setTabPrinting(
bool _value);
162 bool getTabPrinting()
const;
165 bool getInvertSelected()
const;
169 void setInvertSelected(
bool _value);
172 void setPosition(
const IntPoint& _point)
override;
174 void setSize(
const IntSize& _size)
override;
176 void setCoord(
const IntCoord& _coord)
override;
178 using Widget::setPosition;
179 using Widget::setSize;
180 using Widget::setCoord;
183 void setVisibleVScroll(
bool _value);
185 bool isVisibleVScroll()
const;
192 size_t getVScrollRange()
const;
194 size_t getVScrollPosition()
const;
196 void setVScrollPosition(
size_t _index);
199 void setVisibleHScroll(
bool _value);
201 bool isVisibleHScroll()
const;
207 size_t getHScrollRange()
const;
209 size_t getHScrollPosition()
const;
211 void setHScrollPosition(
size_t _index);
215 void setFontName(std::string_view _value)
override;
217 void setFontHeight(
int _value)
override;
219 int getFontHeight()
const override;
222 void setTextAlign(Align _value)
override;
224 void setTextColour(
const Colour& _value)
override;
227 IntCoord getTextRegion()
const override;
230 IntSize getTextSize()
const override;
233 void setTextShadowColour(
const Colour& _value)
override;
236 void setTextShadow(
bool _value)
override;
252 void initialiseOverride()
override;
253 void shutdownOverride()
override;
255 void onMouseDrag(
int _left,
int _top, MouseButton _id)
override;
256 void onKeyLostFocus(Widget* _new)
override;
257 void onKeySetFocus(Widget* _old)
override;
258 void onKeyButtonPressed(KeyCode _key,
Char _char)
override;
261 void notifyMouseSetFocus(Widget* _sender, Widget* _old);
262 void notifyMouseLostFocus(Widget* _sender, Widget* _new);
263 void notifyMousePressed(Widget* _sender,
int _left,
int _top, MouseButton _id);
264 void notifyMouseReleased(Widget* _sender,
int _left,
int _top, MouseButton _id);
265 void notifyMouseDrag(Widget* _sender,
int _left,
int _top, MouseButton _id);
266 void notifyMouseButtonDoubleClick(Widget* _sender);
268 void notifyScrollChangePosition(ScrollBar* _sender,
size_t _position);
269 void notifyMouseWheel(Widget* _sender,
int _rel);
272 void updateViewWithCursor();
276 void setPropertyOverride(std::string_view _key, std::string_view _value)
override;
279 void setText(
const UString& _caption,
bool _history);
280 bool deleteTextSelect(
bool _history);
281 void insertText(
const UString& _text,
size_t _start,
bool _history);
282 void eraseText(
size_t _start,
size_t _count,
bool _history);
283 void setTextSelectColour(
const Colour& _colour,
bool _history);
284 void _setTextColour(
size_t _start,
size_t _count,
const Colour& _colour,
bool _history);
286 void frameEntered(
float _frame);
288 void updateEditState();
291 void updateSelectText();
296 void commandPosition(
size_t _undo,
size_t _redo,
size_t _length,
VectorChangeInfo* _info =
nullptr);
302 void commandResetRedo();
303 void commandResetHistory();
305 void moveCursorVertical(
int _delta,
size_t _clampTarget);
309 void commandCopy()
const;
312 const UString& getRealString()
const;
314 void setRealString(
const UString& _caption);
316 void updateCursorPosition();
318 IntSize getContentSize()
const override;
319 IntPoint getContentPosition()
const override;
320 void setContentPosition(
const IntPoint& _point)
override;
321 IntSize getViewSize()
const override;
322 size_t getVScrollPage()
const override;
323 size_t getHScrollPage()
const override;
325 Align getContentAlign()
const override;
328 bool mIsPressed{
false};
329 bool mIsFocus{
false};
331 bool mCursorActive{
false};
332 float mCursorTimer{0};
333 float mActionMouseTimer{0};
335 size_t mCursorPosition{0};
336 size_t mTextLength{0};
339 size_t mEndSelect{0};
345 bool mMouseLeftPressed{
false};
347 bool mModeReadOnly{
false};
348 bool mModePassword{
false};
349 bool mModeMultiline{
false};
350 bool mModeStatic{
false};
351 bool mModeWordWrap{
false};
353 bool mTabPrinting{
false};
356 UString mPasswordText;
359 std::string mOriginalPointer;
361 Char mCharPassword{
'*'};
363 bool mOverflowToTheLeft{
false};
364 size_t mMaxTextLength;
366 ISubWidgetText* mClientText{
nullptr};
#define MYGUI_RTTI_DERIVED(DerivedType)
types::TPoint< int > IntPoint
std::vector< TextCommandInfo > VectorChangeInfo
constexpr size_t ITEM_NONE
types::TCoord< int > IntCoord
types::TSize< int > IntSize
std::deque< VectorChangeInfo > DequeUndoRedoInfo
delegates::MultiDelegate< EditBox * > EventHandle_EditPtr