29 #ifndef _CEGUIEditbox_h_
30 #define _CEGUIEditbox_h_
32 #include "CEGUI/Base.h"
33 #include "CEGUI/Window.h"
34 #include "CEGUI/RegexMatcher.h"
37 # pragma warning(push)
38 # pragma warning(disable : 4251)
45 class CEGUIEXPORT EditboxWindowRenderer :
public WindowRenderer
49 EditboxWindowRenderer(
const String& name);
63 virtual size_t getTextIndexFromPosition(
const Vector2f& pt)
const = 0;
75 static const String EventNamespace;
77 static const String WidgetTypeName;
83 static const String EventReadOnlyModeChanged;
89 static const String EventMaskedRenderingModeChanged;
96 static const String EventMaskCodePointChanged;
102 static const String EventValidationStringChanged;
108 static const String EventMaximumTextLengthChanged;
122 static const String EventTextValidityChanged;
128 static const String EventCaretMoved;
134 static const String EventTextSelectionChanged;
140 static const String EventEditboxFull;
147 static const String EventTextAccepted;
157 bool hasInputFocus(
void)
const;
167 bool isReadOnly(
void)
const
179 bool isTextMasked(
void)
const
221 const String& getValidationString(
void)
const
222 {
return d_validationString;}
231 size_t getCaretIndex(
void)
const;
242 size_t getSelectionStartIndex(
void)
const;
252 size_t getSelectionEndIndex(
void)
const;
263 size_t getSelectionLength(
void)
const;
275 {
return d_maskCodePoint; }
290 size_t getMaxTextLength(
void)
const
291 {
return d_maxTextLen;}
304 void setReadOnly(
bool setting);
318 void setTextMasked(
bool setting);
341 void setValidationString(
const String& validation_string);
355 void setCaretIndex(
size_t caret_pos);
374 void setSelection(
size_t start_pos,
size_t end_pos);
387 void setSelectionStart(
size_t start_pos);
399 void setSelectionLength(
size_t length);
431 void setMaxTextLength(
size_t max_len);
450 void setValidator(RegexMatcher* matcher);
453 virtual bool performCopy(Clipboard& clipboard);
456 virtual bool performCut(Clipboard& clipboard);
459 virtual bool performPaste(Clipboard& clipboard);
462 Editbox(
const String& type,
const String& name);
465 virtual ~Editbox(
void);
480 size_t getTextIndexFromPosition(
const Vector2f& pt)
const;
483 void clearSelection(
void);
493 void eraseSelectedText(
bool modify_text =
true);
500 MatchState getStringMatchState(
const String& str)
const;
510 bool handleValidityChangeForString(
const String& str);
513 void handleBackspace(
void);
516 void handleDelete(
void);
519 void handleCharLeft(uint sysKeys);
522 void handleWordLeft(uint sysKeys);
525 void handleCharRight(uint sysKeys);
528 void handleWordRight(uint sysKeys);
531 void handleHome(uint sysKeys);
534 void handleEnd(uint sysKeys);
537 virtual bool validateWindowRenderer(
const WindowRenderer* renderer)
const;
543 virtual void onReadOnlyChanged(WindowEventArgs& e);
550 virtual void onMaskedRenderingModeChanged(WindowEventArgs& e);
557 virtual void onMaskCodePointChanged(WindowEventArgs& e);
563 virtual void onValidationStringChanged(WindowEventArgs& e);
569 virtual void onMaximumTextLengthChanged(WindowEventArgs& e);
576 virtual void onTextValidityChanged(RegexMatchStateEventArgs& e);
582 virtual void onCaretMoved(WindowEventArgs& e);
588 virtual void onTextSelectionChanged(WindowEventArgs& e);
595 virtual void onEditboxFullEvent(WindowEventArgs& e);
602 virtual void onTextAcceptedEvent(WindowEventArgs& e);
605 void onMouseButtonDown(MouseEventArgs& e);
606 void onMouseButtonUp(MouseEventArgs& e);
607 void onMouseDoubleClicked(MouseEventArgs& e);
608 void onMouseTripleClicked(MouseEventArgs& e);
609 void onMouseMove(MouseEventArgs& e);
610 void onCaptureLost(WindowEventArgs& e);
611 void onCharacter(KeyEventArgs& e);
612 void onKeyDown(KeyEventArgs& e);
613 void onTextChanged(WindowEventArgs& e);
626 size_t d_selectionStart;
628 size_t d_selectionEnd;
630 String d_validationString;
632 RegexMatcher* d_validator;
634 bool d_weOwnValidator;
638 size_t d_dragAnchorIdx;
642 bool d_previousValidityChangeResponse;
646 void addEditboxProperties(
void);
651 #if defined(_MSC_VER)
652 # pragma warning(pop)
655 #endif // end of guard _CEGUIEditbox_h_