📄 ceguimultilineeditbox.h
字号:
*************************************************************************/
/*!
\brief
Constructor for the MultiLineEditbox base class.
*/
MultiLineEditbox(const String& type, const String& name);
/*!
\brief
Destructor for the MultiLineEditbox base class.
*/
virtual ~MultiLineEditbox(void);
protected:
/*************************************************************************
Implementation Methods (abstract)
*************************************************************************/
/*!
\brief
Return a Rect object describing, in un-clipped pixels, the window relative area
that the text should be rendered in to.
\return
Rect object describing the area of the Window to be used for rendering text.
*/
//virtual Rect getTextRenderArea_impl(void) const = 0;
/*************************************************************************
Implementation Methods
*************************************************************************/
/*!
\brief
Format the text into lines as needed by the current formatting options.
*/
void formatText(void);
/*!
\brief
Return the length of the next token in String \a text starting at index \a start_idx.
\note
Any single whitespace character is one token, any group of other characters is a token.
\return
The code point length of the token.
*/
size_t getNextTokenLength(const String& text, size_t start_idx) const;
/*!
\brief
display required integrated scroll bars according to current state of the edit box and update their values.
*/
void configureScrollbars(void);
/*!
\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
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
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 handleDocHome(uint sysKeys);
/*!
\brief
Processing to move carat to the end of the text
*/
void handleDocEnd(uint sysKeys);
/*!
\brief
Processing to move carat to the start of the current line.
*/
void handleLineHome(uint sysKeys);
/*!
\brief
Processing to move carat to the end of the current line
*/
void handleLineEnd(uint sysKeys);
/*!
\brief
Processing to move carat up a line.
*/
void handleLineUp(uint sysKeys);
/*!
\brief
Processing to move carat down a line.
*/
void handleLineDown(uint sysKeys);
/*!
\brief
Processing to insert a new line / paragraph.
*/
void handleNewLine(uint sysKeys);
/*!
\brief
Processing to move caret one page up
*/
void handlePageUp(uint sysKeys);
/*!
\brief
Processing to move caret one page down
*/
void handlePageDown(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=="MultiLineEditBox") ||
(class_name=="MultiLineEditbox"))
{
return true;
}
return Window::testClassName_impl(class_name);
}
/*!
\brief
Internal handler that is triggered when the user interacts with the scrollbars.
*/
bool handle_scrollChange(const EventArgs& args);
// validate window renderer
virtual bool validateWindowRenderer(const String& name) const
{
return (name == EventNamespace);
}
/*************************************************************************
New event handlers
*************************************************************************/
/*!
\brief
Handler called when the read-only state of the edit box changes
*/
void onReadOnlyChanged(WindowEventArgs& e);
/*!
\brief
Handler called when the word wrap mode for the the edit box changes
*/
void onWordWrapModeChanged(WindowEventArgs& e);
/*!
\brief
Handler called when the maximum text length for the edit box changes
*/
void onMaximumTextLengthChanged(WindowEventArgs& e);
/*!
\brief
Handler called when the carat moves.
*/
void onCaratMoved(WindowEventArgs& e);
/*!
\brief
Handler called when the text selection changes
*/
void onTextSelectionChanged(WindowEventArgs& e);
/*!
\brief
Handler called when the edit box is full
*/
void onEditboxFullEvent(WindowEventArgs& e);
/*!
\brief
Handler called when the 'always show' setting for the vertical scroll bar changes.
*/
void onVertScrollbarModeChanged(WindowEventArgs& e);
/*!
\brief
Handler called when 'always show' setting for the horizontal scroll bar changes.
*/
void onHorzScrollbarModeChanged(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);
virtual void onSized(WindowEventArgs& e);
virtual void onMouseWheel(MouseEventArgs& e);
/*************************************************************************
Implementation data
*************************************************************************/
bool d_readOnly; //!< true if the edit box is in read-only mode
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.
bool d_dragging; //!< true when a selection is being dragged.
size_t d_dragAnchorIdx; //!< Selection index for drag selection anchor point.
static String d_lineBreakChars; //!< Holds what we consider to be line break characters.
bool d_wordWrap; //!< true when formatting uses word-wrapping.
LineList d_lines; //!< Holds the lines for the current formatting.
float d_widestExtent; //!< Holds the extent of the widest line as calculated in the last formatting pass.
// component widget settings
bool d_forceVertScroll; //!< true if vertical scrollbar should always be displayed
bool d_forceHorzScroll; //!< true if horizontal scrollbar should always be displayed
// images
const Image* d_selectionBrush; //!< Image to use as the selection brush (should be set by derived class).
private:
/*************************************************************************
Static Properties for this class
*************************************************************************/
static MultiLineEditboxProperties::ReadOnly d_readOnlyProperty;
static MultiLineEditboxProperties::WordWrap d_wordWrapProperty;
static MultiLineEditboxProperties::CaratIndex d_caratIndexProperty;
static MultiLineEditboxProperties::SelectionStart d_selectionStartProperty;
static MultiLineEditboxProperties::SelectionLength d_selectionLengthProperty;
static MultiLineEditboxProperties::MaxTextLength d_maxTextLengthProperty;
static MultiLineEditboxProperties::SelectionBrushImage d_selectionBrushProperty;
/*************************************************************************
Private methods
*************************************************************************/
void addMultiLineEditboxProperties(void);
};
} // End of CEGUI namespace section
#if defined(_MSC_VER)
# pragma warning(pop)
#endif
#endif // end of guard _CEGUIMultiLineEditbox_h_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -