📄 richtextctrl.h
字号:
virtual bool EndStyle() { return GetBuffer().EndStyle(); } /// End all styles virtual bool EndAllStyles() { return GetBuffer().EndAllStyles(); } /// Begin using bold bool BeginBold() { return GetBuffer().BeginBold(); } /// End using bold bool EndBold() { return GetBuffer().EndBold(); } /// Begin using italic bool BeginItalic() { return GetBuffer().BeginItalic(); } /// End using italic bool EndItalic() { return GetBuffer().EndItalic(); } /// Begin using underline bool BeginUnderline() { return GetBuffer().BeginUnderline(); } /// End using underline bool EndUnderline() { return GetBuffer().EndUnderline(); } /// Begin using point size bool BeginFontSize(int pointSize) { return GetBuffer().BeginFontSize(pointSize); } /// End using point size bool EndFontSize() { return GetBuffer().EndFontSize(); } /// Begin using this font bool BeginFont(const wxFont& font) { return GetBuffer().BeginFont(font); } /// End using a font bool EndFont() { return GetBuffer().EndFont(); } /// Begin using this colour bool BeginTextColour(const wxColour& colour) { return GetBuffer().BeginTextColour(colour); } /// End using a colour bool EndTextColour() { return GetBuffer().EndTextColour(); } /// Begin using alignment bool BeginAlignment(wxTextAttrAlignment alignment) { return GetBuffer().BeginAlignment(alignment); } /// End alignment bool EndAlignment() { return GetBuffer().EndAlignment(); } /// Begin left indent bool BeginLeftIndent(int leftIndent, int leftSubIndent = 0) { return GetBuffer().BeginLeftIndent(leftIndent, leftSubIndent); } /// End left indent bool EndLeftIndent() { return GetBuffer().EndLeftIndent(); } /// Begin right indent bool BeginRightIndent(int rightIndent) { return GetBuffer().BeginRightIndent(rightIndent); } /// End right indent bool EndRightIndent() { return GetBuffer().EndRightIndent(); } /// Begin paragraph spacing bool BeginParagraphSpacing(int before, int after) { return GetBuffer().BeginParagraphSpacing(before, after); } /// End paragraph spacing bool EndParagraphSpacing() { return GetBuffer().EndParagraphSpacing(); } /// Begin line spacing bool BeginLineSpacing(int lineSpacing) { return GetBuffer().BeginLineSpacing(lineSpacing); } /// End line spacing bool EndLineSpacing() { return GetBuffer().EndLineSpacing(); } /// Begin numbered bullet bool BeginNumberedBullet(int bulletNumber, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_ARABIC|wxTEXT_ATTR_BULLET_STYLE_PERIOD) { return GetBuffer().BeginNumberedBullet(bulletNumber, leftIndent, leftSubIndent, bulletStyle); } /// End numbered bullet bool EndNumberedBullet() { return GetBuffer().EndNumberedBullet(); } /// Begin symbol bullet bool BeginSymbolBullet(const wxString& symbol, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_SYMBOL) { return GetBuffer().BeginSymbolBullet(symbol, leftIndent, leftSubIndent, bulletStyle); } /// End symbol bullet bool EndSymbolBullet() { return GetBuffer().EndSymbolBullet(); } /// Begin standard bullet bool BeginStandardBullet(const wxString& bulletName, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_STANDARD) { return GetBuffer().BeginStandardBullet(bulletName, leftIndent, leftSubIndent, bulletStyle); } /// End standard bullet bool EndStandardBullet() { return GetBuffer().EndStandardBullet(); } /// Begin named character style bool BeginCharacterStyle(const wxString& characterStyle) { return GetBuffer().BeginCharacterStyle(characterStyle); } /// End named character style bool EndCharacterStyle() { return GetBuffer().EndCharacterStyle(); } /// Begin named paragraph style bool BeginParagraphStyle(const wxString& paragraphStyle) { return GetBuffer().BeginParagraphStyle(paragraphStyle); } /// End named character style bool EndParagraphStyle() { return GetBuffer().EndParagraphStyle(); } /// Begin named list style bool BeginListStyle(const wxString& listStyle, int level = 1, int number = 1) { return GetBuffer().BeginListStyle(listStyle, level, number); } /// End named character style bool EndListStyle() { return GetBuffer().EndListStyle(); } /// Begin URL bool BeginURL(const wxString& url, const wxString& characterStyle = wxEmptyString) { return GetBuffer().BeginURL(url, characterStyle); } /// End URL bool EndURL() { return GetBuffer().EndURL(); } /// Sets the default style to the style under the cursor bool SetDefaultStyleToCursorStyle(); /// Clear the selection virtual void SelectNone(); /// Select the word at the given character position virtual bool SelectWord(long position); /// Get/set the selection range in character positions. -1, -1 means no selection. /// The range is in API convention, i.e. a single character selection is denoted /// by (n, n+1) wxRichTextRange GetSelectionRange() const; void SetSelectionRange(const wxRichTextRange& range); /// Get/set the selection range in character positions. -1, -1 means no selection. /// The range is in internal format, i.e. a single character selection is denoted /// by (n, n) const wxRichTextRange& GetInternalSelectionRange() const { return m_selectionRange; } void SetInternalSelectionRange(const wxRichTextRange& range) { m_selectionRange = range; } /// Add a new paragraph of text to the end of the buffer virtual wxRichTextRange AddParagraph(const wxString& text); /// Add an image virtual wxRichTextRange AddImage(const wxImage& image); /// Layout the buffer: which we must do before certain operations, such as /// setting the caret position. virtual bool LayoutContent(bool onlyVisibleRect = false); /// Move the caret to the given character position virtual bool MoveCaret(long pos, bool showAtLineStart = false); /// Move right virtual bool MoveRight(int noPositions = 1, int flags = 0); /// Move left virtual bool MoveLeft(int noPositions = 1, int flags = 0); /// Move up virtual bool MoveUp(int noLines = 1, int flags = 0); /// Move up virtual bool MoveDown(int noLines = 1, int flags = 0); /// Move to the end of the line virtual bool MoveToLineEnd(int flags = 0); /// Move to the start of the line virtual bool MoveToLineStart(int flags = 0); /// Move to the end of the paragraph virtual bool MoveToParagraphEnd(int flags = 0); /// Move to the start of the paragraph virtual bool MoveToParagraphStart(int flags = 0); /// Move to the start of the buffer virtual bool MoveHome(int flags = 0); /// Move to the end of the buffer virtual bool MoveEnd(int flags = 0); /// Move n pages up virtual bool PageUp(int noPages = 1, int flags = 0); /// Move n pages down virtual bool PageDown(int noPages = 1, int flags = 0); /// Move n words left virtual bool WordLeft(int noPages = 1, int flags = 0); /// Move n words right virtual bool WordRight(int noPages = 1, int flags = 0); /// Returns the buffer associated with the control. wxRichTextBuffer& GetBuffer() { return m_buffer; } const wxRichTextBuffer& GetBuffer() const { return m_buffer; } /// Start batching undo history for commands. virtual bool BeginBatchUndo(const wxString& cmdName) { return m_buffer.BeginBatchUndo(cmdName); } /// End batching undo history for commands. virtual bool EndBatchUndo() { return m_buffer.EndBatchUndo(); } /// Are we batching undo history for commands? virtual bool BatchingUndo() const { return m_buffer.BatchingUndo(); } /// Start suppressing undo history for commands. virtual bool BeginSuppressUndo() { return m_buffer.BeginSuppressUndo(); } /// End suppressing undo history for commands. virtual bool EndSuppressUndo() { return m_buffer.EndSuppressUndo(); } /// Are we suppressing undo history for commands? virtual bool SuppressingUndo() const { return m_buffer.SuppressingUndo(); } /// Test if this whole range has character attributes of the specified kind. If any /// of the attributes are different within the range, the test fails. You /// can use this to implement, for example, bold button updating. style must have /// flags indicating which attributes are of interest. virtual bool HasCharacterAttributes(const wxRichTextRange& range, const wxTextAttrEx& style) const { return GetBuffer().HasCharacterAttributes(range.ToInternal(), style); } virtual bool HasCharacterAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const { return GetBuffer().HasCharacterAttributes(range.ToInternal(), style); } /// Test if this whole range has paragraph attributes of the specified kind. If any /// of the attributes are different within the range, the test fails. You /// can use this to implement, for example, centering button updating. style must have /// flags indicating which attributes are of interest. virtual bool HasParagraphAttributes(const wxRichTextRange& range, const wxTextAttrEx& style) const { return GetBuffer().HasParagraphAttributes(range.ToInternal(), style); } virtual bool HasParagraphAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const { return GetBuffer().HasParagraphAttributes(range.ToInternal(), style); } /// Is all of the selection bold? virtual bool IsSelectionBold(); /// Is all of the selection italics? virtual bool IsSelectionItalics(); /// Is all of the selection underlined? virtual bool IsSelectionUnderlined(); /// Is all of the selection aligned according to the specified flag? virtual bool IsSelectionAligned(wxTextAttrAlignment alignment); /// Apply bold to the selection virtual bool ApplyBoldToSelection(); /// Apply italic to the selection virtual bool ApplyItalicToSelection(); /// Apply underline to the selection virtual bool ApplyUnderlineToSelection(); /// Apply alignment to the selection virtual bool ApplyAlignmentToSelection(wxTextAttrAlignment alignment); /// Apply a named style to the selection virtual bool ApplyStyle(wxRichTextStyleDefinition* def); /// Set style sheet, if any void SetStyleSheet(wxRichTextStyleSheet* styleSheet) { GetBuffer().SetStyleSheet(styleSheet); } wxRichTextStyleSheet* GetStyleSheet() const { return GetBuffer().GetStyleSheet(); } /// Push style sheet to top of stack bool PushStyleSheet(wxRichTextStyleSheet* styleSheet) { return GetBuffer().PushStyleSheet(styleSheet); } /// Pop style sheet from top of stack wxRichTextStyleSheet* PopStyleSheet() { return GetBuffer().PopStyleSheet(); } /// Apply the style sheet to the buffer, for example if the styles have changed. bool ApplyStyleSheet(wxRichTextStyleSheet* styleSheet = NULL);// Command handlers void Command(wxCommandEvent& event); void OnDropFiles(wxDropFilesEvent& event); void OnCut(wxCommandEvent& event); void OnCopy(wxCommandEvent& event); void OnPaste(wxCommandEvent& event); void OnUndo(wxCommandEvent& event); void OnRedo(wxCommandEvent& event); void OnSelectAll(wxCommandEvent& event); void OnClear(wxCommandEvent& event); void OnUpdateCut(wxUpdateUIEvent& event); void OnUpdateCopy(wxUpdateUIEvent& event); void OnUpdatePaste(wxUpdateUIEvent& event); void OnUpdateUndo(wxUpdateUIEvent& event); void OnUpdateRedo(wxUpdateUIEvent& event); void OnUpdateSelectAll(wxUpdateUIEvent& event); void OnUpdateClear(wxUpdateUIEvent& event); // Show a context menu for Rich Edit controls (the standard // EDIT control has one already) void OnContextMenu(wxContextMenuEvent& event);// Event handlers /// Painting void OnPaint(wxPaintEvent& event); void OnEraseBackground(wxEraseEvent& event); /// Left-click void OnLeftClick(wxMouseEvent& event); /// Left-up void OnLeftUp(wxMouseEvent& event); /// Motion
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -