MyGUI
3.4.2
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
typedef
delegates::CMultiDelegate1<EditBox*>
EventHandle_EditPtr
;
21
25
class
MYGUI_EXPORT
EditBox
:
26
public
TextBox
,
27
public
ScrollViewBase
,
28
public
MemberObsolete
<EditBox>
29
{
30
MYGUI_RTTI_DERIVED
(
EditBox
)
31
32
public
:
33
EditBox
();
34
36
void
setTextIntervalColour(
size_t
_start
,
size_t
_count
,
const
Colour
&
_colour
);
37
39
size_t
getTextSelectionStart()
const
;
40
42
size_t
getTextSelectionEnd()
const
;
43
45
size_t
getTextSelectionLength()
const
;
46
47
// возвращает текст с тегами
49
UString
getTextInterval(
size_t
_start
,
size_t
_count
)
const
;
50
55
void
setTextSelection(
size_t
_start
,
size_t
_end
);
56
58
void
deleteTextSelection();
59
61
UString
getTextSelection()
const
;
62
64
bool
isTextSelection()
const
;
65
67
void
setTextSelectionColour(
const
Colour
&
_value
);
68
70
void
setTextCursor(
size_t
_index
);
72
size_t
getTextCursor()
const
;
73
74
76
void
setCaption(
const
UString
&
_value
)
override
;
78
const
UString
& getCaption()
const override
;
79
81
void
setOnlyText(
const
UString
&
_value
);
83
UString
getOnlyText()
const
;
84
89
size_t
getTextLength()
const
;
90
92
void
setOverflowToTheLeft(
bool
_value
);
94
bool
getOverflowToTheLeft()
const
;
95
97
void
setMaxTextLength(
size_t
_value
);
99
size_t
getMaxTextLength()
const
;
100
102
void
insertText(
const
UString
&
_text
,
size_t
_index
= ITEM_NONE);
104
void
addText(
const
UString
&
_text
);
106
void
eraseText(
size_t
_start
,
size_t
_count
= 1);
107
112
void
setEditReadOnly(
bool
_value
);
114
bool
getEditReadOnly()
const
;
115
120
void
setEditPassword(
bool
_value
);
122
bool
getEditPassword()
const
;
123
129
void
setEditMultiLine(
bool
_value
);
131
bool
getEditMultiLine()
const
;
132
137
void
setEditStatic(
bool
_value
);
139
bool
getEditStatic()
const
;
140
142
void
setPasswordChar(
Char
_value
);
144
void
setPasswordChar(
const
UString
&
_char
);
146
Char
getPasswordChar()
const
;
147
153
void
setEditWordWrap(
bool
_value
);
155
bool
getEditWordWrap()
const
;
156
162
void
setTabPrinting(
bool
_value
);
164
bool
getTabPrinting()
const
;
165
167
bool
getInvertSelected()
const
;
171
void
setInvertSelected(
bool
_value
);
172
174
void
setPosition(
const
IntPoint
&
_value
)
override
;
176
void
setSize(
const
IntSize
&
_value
)
override
;
178
void
setCoord(
const
IntCoord
&
_value
)
override
;
179
180
using
Widget::setPosition;
181
using
Widget::setSize;
182
using
Widget::setCoord;
183
185
void
setVisibleVScroll(
bool
_value
);
187
bool
isVisibleVScroll()
const
;
194
size_t
getVScrollRange()
const
;
196
size_t
getVScrollPosition()
const
;
198
void
setVScrollPosition(
size_t
_index
);
199
201
void
setVisibleHScroll(
bool
_value
);
203
bool
isVisibleHScroll()
const
;
209
size_t
getHScrollRange()
const
;
211
size_t
getHScrollPosition()
const
;
213
void
setHScrollPosition(
size_t
_index
);
214
215
217
void
setFontName(
const
std::string&
_value
)
override
;
219
void
setFontHeight(
int
_value
)
override
;
221
int
getFontHeight()
const override
;
222
224
void
setTextAlign(
Align
_value
)
override
;
226
void
setTextColour(
const
Colour
&
_value
)
override
;
227
229
IntCoord
getTextRegion()
const override
;
230
232
IntSize
getTextSize()
const override
;
233
235
void
setTextShadowColour(
const
Colour
&
_value
)
override
;
236
238
void
setTextShadow(
bool
_value
)
override
;
239
240
/*events:*/
245
EventPair<EventHandle_WidgetVoid, EventHandle_EditPtr>
eventEditSelectAccept
;
246
251
EventPair<EventHandle_WidgetVoid, EventHandle_EditPtr>
eventEditTextChange
;
252
253
protected
:
254
void
initialiseOverride()
override
;
255
void
shutdownOverride()
override
;
256
257
void
onMouseDrag(
int
_left
,
int
_top
,
MouseButton
_id
)
override
;
258
void
onKeyLostFocus(
Widget
*
_new
)
override
;
259
void
onKeySetFocus(
Widget
*
_old
)
override
;
260
void
onKeyButtonPressed(
KeyCode
_key
,
Char
_char
)
override
;
261
262
// потом убрать все нотифи в сраку
263
void
notifyMouseSetFocus(
Widget
*
_sender
,
Widget
*
_old
);
264
void
notifyMouseLostFocus(
Widget
*
_sender
,
Widget
*
_new
);
265
void
notifyMousePressed(
Widget
*
_sender
,
int
_left
,
int
_top
,
MouseButton
_id
);
266
void
notifyMouseReleased(
Widget
*
_sender
,
int
_left
,
int
_top
,
MouseButton
_id
);
267
void
notifyMouseDrag(
Widget
*
_sender
,
int
_left
,
int
_top
,
MouseButton
_id
);
268
void
notifyMouseButtonDoubleClick(
Widget
*
_sender
);
269
270
void
notifyScrollChangePosition(
ScrollBar
*
_sender
,
size_t
_position
);
271
void
notifyMouseWheel(
Widget
*
_sender
,
int
_rel
);
272
273
// обновление представления
274
void
updateView();
275
void
updateViewWithCursor();
276
277
void
eraseView();
278
279
void
setPropertyOverride(
const
std::string&
_key
,
const
std::string&
_value
)
override
;
280
281
private
:
282
// устанавливает текст
283
void
setText(
const
UString
&
_text
,
bool
_history
);
284
// удаляет все что выделенно
285
bool
deleteTextSelect(
bool
_history
);
286
// вставляет текст в указанную позицию
287
void
insertText(
const
UString
&
_text
,
size_t
_index
,
bool
_history
);
288
// удаляет текст
289
void
eraseText(
size_t
_start
,
size_t
_count
,
bool
_history
);
290
// выделяет цветом выделение
291
void
setTextSelectColour(
const
Colour
&
_colour
,
bool
_history
);
292
// выделяет цветом диапазон
293
void
_setTextColour(
size_t
_start
,
size_t
_count
,
const
Colour
&
_colour
,
bool
_history
);
294
295
void
frameEntered(
float
_frame
);
296
297
void
updateEditState();
298
299
// обновляет курсор по координате
300
void
updateSelectText();
301
302
void
resetSelect();
303
304
// запись в историю данных о позиции
305
void
commandPosition(
size_t
_undo
,
size_t
_redo
,
size_t
_length
,
VectorChangeInfo
*
_info
=
nullptr
);
306
307
// команнды отмена и повтор
308
bool
commandRedo();
309
bool
commandUndo();
310
// объединяет последние две комманды
311
void
commandMerge();
312
// очистка
313
void
commandResetRedo();
314
void
commandResetHistory();
315
void
saveInHistory(
VectorChangeInfo
*
_info
=
nullptr
);
316
317
// работа с буфером обмена
318
void
commandCut();
319
void
commandCopy();
320
void
commandPast();
321
322
const
UString
& getRealString()
const
;
323
324
void
setRealString(
const
UString
&
_caption
);
325
326
void
updateCursorPosition();
327
328
// размер данных
329
IntSize
getContentSize()
const override
;
330
// смещение данных
331
IntPoint
getContentPosition()
const override
;
332
void
setContentPosition(
const
IntPoint
&
_point
)
override
;
333
// размер окна, через которые видно данные
334
IntSize
getViewSize()
const override
;
335
// размер на который прокручиваются данные при щелчке по скролу
336
size_t
getVScrollPage()
const override
;
337
size_t
getHScrollPage()
const override
;
338
339
Align
getContentAlign()
const override
;
340
341
protected
:
342
// нажата ли кнопка
343
bool
mIsPressed
;
344
// в фокусе ли кнопка
345
bool
mIsFocus
;
346
347
bool
mCursorActive
;
348
float
mCursorTimer
;
349
float
mActionMouseTimer
;
350
351
// позиция курсора
352
size_t
mCursorPosition
;
353
// максимальное колличество
354
size_t
mTextLength
;
355
356
// выделение
357
size_t
mStartSelect
;
358
size_t
mEndSelect
;
359
360
// списоки изменений для отмены и повтора
361
DequeUndoRedoInfo
mVectorUndoChangeInfo
;
362
DequeUndoRedoInfo
mVectorRedoChangeInfo
;
363
364
bool
mMouseLeftPressed
;
365
366
bool
mModeReadOnly
;
367
bool
mModePassword
;
368
bool
mModeMultiline
;
369
bool
mModeStatic
;
370
bool
mModeWordWrap
;
371
372
bool
mTabPrinting
;
373
374
// настоящий текст, закрытый за звездочками
375
UString
mPasswordText
;
376
377
// для поддержки режима статик, где курсор не нужен
378
std::string
mOriginalPointer
;
379
380
Char
mCharPassword
;
381
382
bool
mOverflowToTheLeft
;
383
size_t
mMaxTextLength
;
384
385
ISubWidgetText
*
mClientText
;
386
};
387
388
}
// namespace MyGUI
389
390
#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:48
MyGUI_ScrollViewBase.h
MyGUI_TextBox.h
MyGUI_TextChangeHistory.h
MyGUI_TextIterator.h
MyGUI::EditBox
widget description should be here.
Definition
MyGUI_EditBox.h:29
MyGUI::EditBox::mVectorUndoChangeInfo
DequeUndoRedoInfo mVectorUndoChangeInfo
Definition
MyGUI_EditBox.h:361
MyGUI::EditBox::mTabPrinting
bool mTabPrinting
Definition
MyGUI_EditBox.h:372
MyGUI::EditBox::mClientText
ISubWidgetText * mClientText
Definition
MyGUI_EditBox.h:385
MyGUI::EditBox::mModeMultiline
bool mModeMultiline
Definition
MyGUI_EditBox.h:368
MyGUI::EditBox::mOverflowToTheLeft
bool mOverflowToTheLeft
Definition
MyGUI_EditBox.h:382
MyGUI::EditBox::mMaxTextLength
size_t mMaxTextLength
Definition
MyGUI_EditBox.h:383
MyGUI::EditBox::mPasswordText
UString mPasswordText
Definition
MyGUI_EditBox.h:375
MyGUI::EditBox::eventEditTextChange
EventPair< EventHandle_WidgetVoid, EventHandle_EditPtr > eventEditTextChange
Definition
MyGUI_EditBox.h:251
MyGUI::EditBox::mMouseLeftPressed
bool mMouseLeftPressed
Definition
MyGUI_EditBox.h:364
MyGUI::EditBox::mCursorTimer
float mCursorTimer
Definition
MyGUI_EditBox.h:348
MyGUI::EditBox::mIsFocus
bool mIsFocus
Definition
MyGUI_EditBox.h:345
MyGUI::EditBox::mCharPassword
Char mCharPassword
Definition
MyGUI_EditBox.h:380
MyGUI::EditBox::mVectorRedoChangeInfo
DequeUndoRedoInfo mVectorRedoChangeInfo
Definition
MyGUI_EditBox.h:362
MyGUI::EditBox::mOriginalPointer
std::string mOriginalPointer
Definition
MyGUI_EditBox.h:378
MyGUI::EditBox::mEndSelect
size_t mEndSelect
Definition
MyGUI_EditBox.h:358
MyGUI::EditBox::mTextLength
size_t mTextLength
Definition
MyGUI_EditBox.h:354
MyGUI::EditBox::mStartSelect
size_t mStartSelect
Definition
MyGUI_EditBox.h:357
MyGUI::EditBox::mIsPressed
bool mIsPressed
Definition
MyGUI_EditBox.h:343
MyGUI::EditBox::mActionMouseTimer
float mActionMouseTimer
Definition
MyGUI_EditBox.h:349
MyGUI::EditBox::mModeWordWrap
bool mModeWordWrap
Definition
MyGUI_EditBox.h:370
MyGUI::EditBox::mModePassword
bool mModePassword
Definition
MyGUI_EditBox.h:367
MyGUI::EditBox::eventEditSelectAccept
EventPair< EventHandle_WidgetVoid, EventHandle_EditPtr > eventEditSelectAccept
Definition
MyGUI_EditBox.h:245
MyGUI::EditBox::mModeStatic
bool mModeStatic
Definition
MyGUI_EditBox.h:369
MyGUI::EditBox::mModeReadOnly
bool mModeReadOnly
Definition
MyGUI_EditBox.h:366
MyGUI::EditBox::mCursorActive
bool mCursorActive
Definition
MyGUI_EditBox.h:347
MyGUI::EditBox::mCursorPosition
size_t mCursorPosition
Definition
MyGUI_EditBox.h:352
MyGUI::Enumerator
Definition
MyGUI_Enumerator.h:49
MyGUI::ISubWidgetText
Definition
MyGUI_ISubWidgetText.h:20
MyGUI::MemberObsolete
Definition
MyGUI_DeprecatedTypes.h:14
MyGUI::ScrollBar
widget description should be here.
Definition
MyGUI_ScrollBar.h:26
MyGUI::ScrollViewBase
Definition
MyGUI_ScrollViewBase.h:17
MyGUI::TextBox
widget description should be here.
Definition
MyGUI_TextBox.h:21
MyGUI::UString
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
Definition
MyGUI_UString.h:145
MyGUI::Widget
widget description should be here.
Definition
MyGUI_Widget.h:37
MyGUI
Definition
MyGUI_ActionController.h:15
MyGUI::EventHandle_EditPtr
delegates::CMultiDelegate1< EditBox * > EventHandle_EditPtr
Definition
MyGUI_EditBox.h:20
MyGUI::Char
unsigned int Char
Definition
MyGUI_Types.h:50
MyGUI::DequeUndoRedoInfo
std::deque< VectorChangeInfo > DequeUndoRedoInfo
Definition
MyGUI_TextChangeHistory.h:59
MyGUI::VectorChangeInfo
std::vector< TextCommandInfo > VectorChangeInfo
Definition
MyGUI_TextChangeHistory.h:58
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.9.8