📄 ceguieditbox.h
字号:
\param code_point
utf32 code point value representing the Unicode code point that should be rendered instead of the Editbox text
when rendering in masked mode.
\return
Nothing.
*/
void setMaskCodePoint(utf32 code_point);
/*!
\brief
set the maximum text length for this Editbox.
\param max_len
The maximum number of code points (characters) that can be entered into this Editbox.
\note
Depending on the validation string set, the actual length of text that can be entered may be less than the value
set here (it will never be more).
\return
Nothing.
*/
void setMaxTextLength(size_t max_len);
/*************************************************************************
Construction / Destruction
*************************************************************************/
/*!
\brief
Constructor for Editbox class.
*/
Editbox(const String& type, const String& name);
/*!
\brief
Destructor for Editbox class.
*/
virtual ~Editbox(void);
protected:
/*************************************************************************
Implementation functions
*************************************************************************/
/*!
\brief
Return the text code point index that is rendered closest to screen position \a pt.
\param pt
Point object describing a position on the screen in pixels.
\return
Code point index into the text that is rendered closest to screen position \a pt.
*/
size_t getTextIndexFromPosition(const Point& pt) const;
/*!
\brief
Return the text code point index that is rendered closest to screen position \a pt.
\param pt
Point object describing a position on the screen in pixels.
\return
Code point index into the text that is rendered closest to screen position \a pt.
*/
//virtual size_t getTextIndexFromPosition_impl(const Point& pt) const = 0;
/*!
\brief
Clear the current selection setting
*/
void clearSelection(void);
/*!
\brief
Erase the currently selected text.
\param modify_text
when true, the actual text will be modified. When false, everything is done except erasing the characters.
*/
void eraseSelectedText(bool modify_text = true);
/*!
\brief
return true if the given string matches the validation regular expression.
*/
bool isStringValid(const String& str) const;
/*!
\brief
Processing for backspace key
*/
void handleBackspace(void);
/*!
\brief
Processing for Delete key
*/
void handleDelete(void);
/*!
\brief
Processing to move carat one character left
*/
void handleCharLeft(uint sysKeys);
/*!
\brief
Processing to move carat one word left
*/
void handleWordLeft(uint sysKeys);
/*!
\brief
Processing to move carat one character right
*/
void handleCharRight(uint sysKeys);
/*!
\brief
Processing to move carat one word right
*/
void handleWordRight(uint sysKeys);
/*!
\brief
Processing to move carat to the start of the text.
*/
void handleHome(uint sysKeys);
/*!
\brief
Processing to move carat to the end of the text
*/
void handleEnd(uint sysKeys);
/*!
\brief
Return whether this window was inherited from the given class name at some point in the inheritance hierarchy.
\param class_name
The class name that is to be checked.
\return
true if this window was inherited from \a class_name. false if not.
*/
virtual bool testClassName_impl(const String& class_name) const
{
if (class_name=="Editbox") return true;
return Window::testClassName_impl(class_name);
}
// validate window renderer
virtual bool validateWindowRenderer(const String& name) const
{
return (name == "Editbox");
}
/*************************************************************************
New event handlers
*************************************************************************/
/*!
\brief
Event fired internally when the read only state of the Editbox has been changed
*/
virtual void onReadOnlyChanged(WindowEventArgs& e);
/*!
\brief
Event fired internally when the masked rendering mode (password mode) has been changed
*/
virtual void onMaskedRenderingModeChanged(WindowEventArgs& e);
/*!
\brief
Event fired internally when the code point to use for masked rendering has been changed.
*/
virtual void onMaskCodePointChanged(WindowEventArgs& e);
/*!
\brief
Event fired internally when the validation string is changed.
*/
virtual void onValidationStringChanged(WindowEventArgs& e);
/*!
\brief
Event fired internally when the maximum text length for the edit box is changed.
*/
virtual void onMaximumTextLengthChanged(WindowEventArgs& e);
/*!
\brief
Event fired internally when something has caused the current text to now fail validation
This can be caused by changing the validation string or setting a maximum length that causes the
current text to be truncated.
*/
virtual void onTextInvalidatedEvent(WindowEventArgs& e);
/*!
\brief
Event fired internally when the user attempted to make a change to the edit box that would
have caused it to fail validation.
*/
virtual void onInvalidEntryAttempted(WindowEventArgs& e);
/*!
\brief
Event fired internally when the carat (insert point) position changes.
*/
virtual void onCaratMoved(WindowEventArgs& e);
/*!
\brief
Event fired internally when the current text selection changes.
*/
virtual void onTextSelectionChanged(WindowEventArgs& e);
/*!
\brief
Event fired internally when the edit box text has reached the set maximum length.
*/
virtual void onEditboxFullEvent(WindowEventArgs& e);
/*!
\brief
Event fired internally when the user accepts the edit box text by pressing Return, Enter, or Tab.
*/
virtual void onTextAcceptedEvent(WindowEventArgs& e);
/*************************************************************************
Overridden event handlers
*************************************************************************/
virtual void onMouseButtonDown(MouseEventArgs& e);
virtual void onMouseButtonUp(MouseEventArgs& e);
virtual void onMouseDoubleClicked(MouseEventArgs& e);
virtual void onMouseTripleClicked(MouseEventArgs& e);
virtual void onMouseMove(MouseEventArgs& e);
virtual void onCaptureLost(WindowEventArgs& e);
virtual void onCharacter(KeyEventArgs& e);
virtual void onKeyDown(KeyEventArgs& e);
virtual void onTextChanged(WindowEventArgs& e);
/*************************************************************************
Implementation data
*************************************************************************/
bool d_readOnly; //!< True if the editbox is in read-only mode
bool d_maskText; //!< True if the editbox text should be rendered masked.
utf32 d_maskCodePoint; //!< Code point to use when rendering masked text.
size_t d_maxTextLen; //!< Maximum number of characters for this Editbox.
size_t d_caratPos; //!< Position of the carat / insert-point.
size_t d_selectionStart; //!< Start of selection area.
size_t d_selectionEnd; //!< End of selection area.
String d_validationString; //!< Copy of validation reg-ex string.
RegexValidator* d_validator; //!< RegEx String used for validation of text.
bool d_dragging; //!< true when a selection is being dragged.
size_t d_dragAnchorIdx; //!< Selection index for drag selection anchor point.
private:
/*************************************************************************
Static Properties for this class
*************************************************************************/
static EditboxProperties::ReadOnly d_readOnlyProperty;
static EditboxProperties::MaskText d_maskTextProperty;
static EditboxProperties::MaskCodepoint d_maskCodepointProperty;
static EditboxProperties::ValidationString d_validationStringProperty;
static EditboxProperties::CaratIndex d_caratIndexProperty;
static EditboxProperties::SelectionStart d_selectionStartProperty;
static EditboxProperties::SelectionLength d_selectionLengthProperty;
static EditboxProperties::MaxTextLength d_maxTextLengthProperty;
/*************************************************************************
Private methods
*************************************************************************/
void addEditboxProperties(void);
};
} // End of CEGUI namespace section
#if defined(_MSC_VER)
# pragma warning(pop)
#endif
#endif // end of guard _CEGUIEditbox_h_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -