MyGUI
3.4.3
Main Page
Related Pages
Namespaces
Data Structures
Files
Examples
File List
Globals
MyGUIEngine
include
MyGUI_EditBox.h
Go to the documentation of this file.
1
/*
2
* This source file is part of MyGUI. For the latest info, see http://mygui.info/
3
* Distributed under the MIT License
4
* (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5
*/
6
7
#ifndef MYGUI_EDIT_BOX_H_
8
#define MYGUI_EDIT_BOX_H_
9
10
#include "
MyGUI_Prerequest.h
"
11
#include "
MyGUI_TextBox.h
"
12
#include "
MyGUI_TextChangeHistory.h
"
13
#include "
MyGUI_TextIterator.h
"
14
#include "
MyGUI_EventPair.h
"
15
#include "
MyGUI_ScrollViewBase.h
"
16
17
namespace
MyGUI
18
{
19
20
using
EventHandle_EditPtr
=
delegates::MultiDelegate<EditBox*>
;
21
25
class
MYGUI_EXPORT
EditBox
:
public
TextBox
,
public
ScrollViewBase
,
public
MemberObsolete
<EditBox>
26
{
27
MYGUI_RTTI_DERIVED
(
EditBox
)
28
29
public
:
30
EditBox
();
31
33
void
setTextIntervalColour(
size_t
_start,
size_t
_count,
const
Colour
& _colour);
34
36
size_t
getTextSelectionStart()
const
;
37
39
size_t
getTextSelectionEnd()
const
;
40
42
size_t
getTextSelectionLength()
const
;
43
44
// возвращает текст с тегами
46
UString
getTextInterval(
size_t
_start,
size_t
_count)
const
;
47
52
void
setTextSelection(
size_t
_start,
size_t
_end);
53
55
void
deleteTextSelection();
56
58
UString
getTextSelection()
const
;
59
61
bool
isTextSelection()
const
;
62
64
void
setTextSelectionColour(
const
Colour
& _colour);
65
67
void
setTextCursor(
size_t
_index);
69
size_t
getTextCursor()
const
;
70
71
73
void
setCaption(
const
UString
& _value)
override
;
75
const
UString
& getCaption()
const override
;
76
78
void
setOnlyText(
const
UString
& _text);
80
UString
getOnlyText()
const
;
81
86
size_t
getTextLength()
const
;
87
89
void
setOverflowToTheLeft(
bool
_value);
91
bool
getOverflowToTheLeft()
const
;
92
94
void
setMaxTextLength(
size_t
_value);
96
size_t
getMaxTextLength()
const
;
97
99
void
insertText(
const
UString
& _text,
size_t
_index = ITEM_NONE);
101
void
addText(
const
UString
& _text);
103
void
eraseText(
size_t
_start,
size_t
_count = 1);
104
109
void
setEditReadOnly(
bool
_value);
111
bool
getEditReadOnly()
const
;
112
117
void
setEditPassword(
bool
_password);
119
bool
getEditPassword()
const
;
120
126
void
setEditMultiLine(
bool
_value);
128
bool
getEditMultiLine()
const
;
129
134
void
setEditStatic(
bool
_value);
136
bool
getEditStatic()
const
;
137
139
void
setPasswordChar(
Char
_char);
141
void
setPasswordChar(
const
UString
& _value);
143
Char
getPasswordChar()
const
;
144
150
void
setEditWordWrap(
bool
_value);
152
bool
getEditWordWrap()
const
;
153
159
void
setTabPrinting(
bool
_value);
161
bool
getTabPrinting()
const
;
162
164
bool
getInvertSelected()
const
;
168
void
setInvertSelected(
bool
_value);
169
171
void
setPosition(
const
IntPoint
& _point)
override
;
173
void
setSize(
const
IntSize
& _size)
override
;
175
void
setCoord(
const
IntCoord
& _coord)
override
;
176
177
using
Widget::setPosition;
178
using
Widget::setSize;
179
using
Widget::setCoord;
180
182
void
setVisibleVScroll(
bool
_value);
184
bool
isVisibleVScroll()
const
;
191
size_t
getVScrollRange()
const
;
193
size_t
getVScrollPosition()
const
;
195
void
setVScrollPosition(
size_t
_index);
196
198
void
setVisibleHScroll(
bool
_value);
200
bool
isVisibleHScroll()
const
;
206
size_t
getHScrollRange()
const
;
208
size_t
getHScrollPosition()
const
;
210
void
setHScrollPosition(
size_t
_index);
211
212
214
void
setFontName(std::string_view _value)
override
;
216
void
setFontHeight(
int
_value)
override
;
218
int
getFontHeight()
const override
;
219
221
void
setTextAlign(
Align
_value)
override
;
223
void
setTextColour(
const
Colour
& _value)
override
;
224
226
IntCoord
getTextRegion()
const override
;
227
229
IntSize
getTextSize()
const override
;
230
232
void
setTextShadowColour(
const
Colour
& _value)
override
;
233
235
void
setTextShadow(
bool
_value)
override
;
236
237
/*events:*/
242
EventPair<EventHandle_WidgetVoid, EventHandle_EditPtr>
eventEditSelectAccept
;
243
248
EventPair<EventHandle_WidgetVoid, EventHandle_EditPtr>
eventEditTextChange
;
249
250
protected
:
251
void
initialiseOverride()
override
;
252
void
shutdownOverride()
override
;
253
254
void
onMouseDrag(
int
_left,
int
_top,
MouseButton
_id)
override
;
255
void
onKeyLostFocus(
Widget
* _new)
override
;
256
void
onKeySetFocus(
Widget
* _old)
override
;
257
void
onKeyButtonPressed(
KeyCode
_key,
Char
_char)
override
;
258
259
// потом убрать все нотифи в сраку
260
void
notifyMouseSetFocus(
Widget
* _sender,
Widget
* _old);
261
void
notifyMouseLostFocus(
Widget
* _sender,
Widget
* _new);
262
void
notifyMousePressed(
Widget
* _sender,
int
_left,
int
_top,
MouseButton
_id);
263
void
notifyMouseReleased(
Widget
* _sender,
int
_left,
int
_top,
MouseButton
_id);
264
void
notifyMouseDrag(
Widget
* _sender,
int
_left,
int
_top,
MouseButton
_id);
265
void
notifyMouseButtonDoubleClick(
Widget
* _sender);
266
267
void
notifyScrollChangePosition(
ScrollBar
* _sender,
size_t
_position);
268
void
notifyMouseWheel(
Widget
* _sender,
int
_rel);
269
270
// обновление представления
271
void
updateView();
272
void
updateViewWithCursor();
273
274
void
eraseView();
275
276
void
setPropertyOverride(std::string_view _key, std::string_view _value)
override
;
277
278
private
:
279
// устанавливает текст
280
void
setText(
const
UString
& _caption,
bool
_history);
281
// удаляет все что выделенно
282
bool
deleteTextSelect(
bool
_history);
283
// вставляет текст в указанную позицию
284
void
insertText(
const
UString
& _text,
size_t
_start,
bool
_history);
285
// удаляет текст
286
void
eraseText(
size_t
_start,
size_t
_count,
bool
_history);
287
// выделяет цветом выделение
288
void
setTextSelectColour(
const
Colour
& _colour,
bool
_history);
289
// выделяет цветом диапазон
290
void
_setTextColour(
size_t
_start,
size_t
_count,
const
Colour
& _colour,
bool
_history);
291
292
void
frameEntered(
float
_frame);
293
294
void
updateEditState();
295
296
// обновляет курсор по координате
297
void
updateSelectText();
298
299
void
resetSelect();
300
301
// запись в историю данных о позиции
302
void
commandPosition(
size_t
_undo,
size_t
_redo,
size_t
_length,
VectorChangeInfo
* _info =
nullptr
);
303
304
// команнды отмена и повтор
305
bool
commandRedo();
306
bool
commandUndo();
307
// объединяет последние две комманды
308
void
commandMerge();
309
// очистка
310
void
commandResetRedo();
311
void
commandResetHistory();
312
void
saveInHistory(
VectorChangeInfo
* _info =
nullptr
);
313
314
// clipboard commands
315
void
commandCut();
316
void
commandCopy()
const
;
317
void
commandPaste();
318
319
const
UString
& getRealString()
const
;
320
321
void
setRealString(
const
UString
& _caption);
322
323
void
updateCursorPosition();
324
325
// размер данных
326
IntSize
getContentSize()
const override
;
327
// смещение данных
328
IntPoint
getContentPosition()
const override
;
329
void
setContentPosition(
const
IntPoint
& _point)
override
;
330
// размер окна, через которые видно данные
331
IntSize
getViewSize()
const override
;
332
// размер на который прокручиваются данные при щелчке по скролу
333
size_t
getVScrollPage()
const override
;
334
size_t
getHScrollPage()
const override
;
335
336
Align
getContentAlign()
const override
;
337
338
protected
:
339
// нажата ли кнопка
340
bool
mIsPressed{
false
};
341
// в фокусе ли кнопка
342
bool
mIsFocus{
false
};
343
344
bool
mCursorActive{
false
};
345
float
mCursorTimer{0};
346
float
mActionMouseTimer{0};
347
348
// позиция курсора
349
size_t
mCursorPosition{0};
350
// максимальное колличество
351
size_t
mTextLength{0};
352
353
// выделение
354
size_t
mStartSelect{
ITEM_NONE
};
355
size_t
mEndSelect{0};
356
357
// списоки изменений для отмены и повтора
358
DequeUndoRedoInfo
mVectorUndoChangeInfo
;
359
DequeUndoRedoInfo
mVectorRedoChangeInfo
;
360
361
bool
mMouseLeftPressed{
false
};
362
363
bool
mModeReadOnly{
false
};
364
bool
mModePassword{
false
};
365
bool
mModeMultiline{
false
};
366
bool
mModeStatic{
false
};
367
bool
mModeWordWrap{
false
};
368
369
bool
mTabPrinting{
false
};
370
371
// настоящий текст, закрытый за звездочками
372
UString
mPasswordText
;
373
374
// для поддержки режима статик, где курсор не нужен
375
std::string
mOriginalPointer
;
376
377
Char
mCharPassword{
'*'
};
378
379
bool
mOverflowToTheLeft{
false
};
380
size_t
mMaxTextLength
;
381
382
ISubWidgetText
* mClientText{
nullptr
};
383
};
384
385
}
// namespace MyGUI
386
387
#endif
// MYGUI_EDIT_BOX_H_
MyGUI_EventPair.h
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition
MyGUI_Platform.h:77
MyGUI_Prerequest.h
MYGUI_RTTI_DERIVED
#define MYGUI_RTTI_DERIVED(DerivedType)
Definition
MyGUI_RTTI.h:69
MyGUI_ScrollViewBase.h
MyGUI_TextBox.h
MyGUI_TextChangeHistory.h
MyGUI_TextIterator.h
MyGUI::EditBox
widget description should be here.
Definition
MyGUI_EditBox.h:26
MyGUI::EditBox::mVectorUndoChangeInfo
DequeUndoRedoInfo mVectorUndoChangeInfo
Definition
MyGUI_EditBox.h:358
MyGUI::EditBox::mMaxTextLength
size_t mMaxTextLength
Definition
MyGUI_EditBox.h:380
MyGUI::EditBox::mPasswordText
UString mPasswordText
Definition
MyGUI_EditBox.h:372
MyGUI::EditBox::eventEditTextChange
EventPair< EventHandle_WidgetVoid, EventHandle_EditPtr > eventEditTextChange
Definition
MyGUI_EditBox.h:248
MyGUI::EditBox::mVectorRedoChangeInfo
DequeUndoRedoInfo mVectorRedoChangeInfo
Definition
MyGUI_EditBox.h:359
MyGUI::EditBox::mOriginalPointer
std::string mOriginalPointer
Definition
MyGUI_EditBox.h:375
MyGUI::EditBox::eventEditSelectAccept
EventPair< EventHandle_WidgetVoid, EventHandle_EditPtr > eventEditSelectAccept
Definition
MyGUI_EditBox.h:242
MyGUI::EventPair
Definition
MyGUI_EventPair.h:99
MyGUI::ISubWidgetText
Definition
MyGUI_ISubWidgetText.h:19
MyGUI::MemberObsolete
Definition
MyGUI_DeprecatedTypes.h:14
MyGUI::ScrollBar
widget description should be here.
Definition
MyGUI_ScrollBar.h:24
MyGUI::ScrollViewBase
Definition
MyGUI_ScrollViewBase.h:17
MyGUI::TextBox
widget description should be here.
Definition
MyGUI_TextBox.h:20
MyGUI::UString
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
Definition
MyGUI_UString.h:144
MyGUI::Widget
widget description should be here.
Definition
MyGUI_Widget.h:40
MyGUI::delegates::MultiDelegate
Definition
MyGUI_Delegate.h:190
MyGUI
Definition
MyGUI_ActionController.h:15
MyGUI::VectorChangeInfo
std::vector< TextCommandInfo > VectorChangeInfo
Definition
MyGUI_TextChangeHistory.h:58
MyGUI::Char
unsigned int Char
Definition
MyGUI_Types.h:50
MyGUI::ITEM_NONE
constexpr size_t ITEM_NONE
Definition
MyGUI_Macros.h:19
MyGUI::DequeUndoRedoInfo
std::deque< VectorChangeInfo > DequeUndoRedoInfo
Definition
MyGUI_TextChangeHistory.h:59
MyGUI::Align
Definition
MyGUI_Align.h:20
MyGUI::Colour
Definition
MyGUI_Colour.h:17
MyGUI::KeyCode
Definition
MyGUI_KeyCode.h:16
MyGUI::MouseButton
Definition
MyGUI_MouseButton.h:16
MyGUI::types::TCoord< int >
MyGUI::types::TPoint< int >
MyGUI::types::TSize< int >
Generated by
1.12.0