(new in Rev4.00)
MQMemo class manages a memo to input multi-line text. It inherits MQWidgetBase class.
Please refer the inherited class about member functions declared in the inherited class.
Class | |
MQMemo | Constructor |
~MQMemo | Destructor |
Member functions | |
GetText | Get a displayed text |
GetTextLength | Get a length of a displayed text |
SetText | Set a displayed text |
GetFontName | Get a font name |
SetFontName | Set a font name |
GetFontBold | Get a bold font |
SetFontBold | Set a bold font |
GetFontScale | Get a font scaling |
SetFontScale | Set a font scaling |
GetReadOnly | Get a read-only mode |
SetReadOnly | Set a read-only mode |
GetPriorMenuShortcut | Get a priority to menu shortcut |
SetPriorMenuShortcut | Set a priority to menu shortcut |
GetHorzBarStatus | Get a status of horizontal bar |
SetHorzBarStatus | Set a status of horizontal bar |
GetVertBarStatus | Get a status of vertical bar |
SetVertBarStatus | Set a status of vertical bar |
GetFocus | Get a focus |
SetFocus | Set a focus |
GetCaretPos | Get a caret position |
SetCaretPos | Set a caret position |
GetTabColumn | Get a tab width |
SetTabColumn | Set a tab width |
GetAutoIndent | Get an auto indent |
SetAutoIndent | Set an auto indent |
GetShowTabMark | Get a visibility of tab marks |
SetShowTabMark | Set a visibility of tab marks |
GetShowReturnMark | Get a visibility of return marks |
SetShowReturnMark | Set a visibility of return marks |
GetShowLineNumber | Get a visibility of line numbers |
SetShowLineNumber | Set a visibility of line numbers |
GetChanged | Get a modified flag |
SetChanged | Set a modified flag |
Member functions - Syntax highlight | |
GetSyntaxHighlight | Get a syntax highlight |
SetSyntaxHighlight | Set a syntax highlight |
GetMarkCharacters | Get mark characters |
SetMarkCharacters | Set mark characters |
AddSyntaxKeyword | Add a keyword for syntax highlight |
ClearSyntaxKeyword | Clear keywords for syntax highlight |
AddRadixPrefix | Add a prefix string for radix |
ClearRadixPrefix | Clear prefix strings for radix |
GetSyntaxComment | Get a string for a comment |
SetSyntaxComment | Set a string for a comment |
AddSyntaxMultiLineComment | Add a string for multi-line comment |
ClearSyntaxMultiLineComment | Clear strings for multi-line comment |
AddSyntaxString | Add a string for syntax highlight |
ClearSyntaxString | Clear strings for syntax highlight |
Member functions - Select, Position | |
SelectAll | Select all text |
SelectRange | Select text in specified range |
GetSelectedRange | Get a selected range of text |
CutSelection | Cut a selected text |
CopySelection | Copy a selected text |
PasteFromClipboard | Paste a text |
ReplaceSelectedText | Replace a selected text |
FindString | Find a string |
FindStringFromCaretPos | Find a string from a caret position |
FindNextWordBreak | Find a next word break |
GetLineColumnByCaretPos | Get line and column number by caret position |
GetCaretPosByLineColumn | Get caret position by line and column number |
Member functions - Undo | |
CanUndo | Get undoable |
CanRedo | Get redoable |
Undo | Execute an undo |
Redo | Execute a redo |
Events | |
AddChangedEvent | Add an event after finishing to change a text |
AddChangingEvent | Add an event while changing a text |
AddDrawItemEvent | Add an event for drawing an item |
MQMemo::MQMemo();
MQMemo::MQMemo(int id);
It is a constructor.
virtual MQMemo::~MQMemo();
This method is a destructor. It is defined as a virtual function.
std::wstring MQMemo::GetText();
It returns a text displayed in the input area.
size_t MQMemo::GetTextLength();
(new in Rev4.64)
It returns a length of a text.
This function is faster than GetText() if you want a length only.
void MQMemo::SetText(const std::wstring& text);
It specifies a text displayed in the input area.
std::wstring MQMemo::GetFontName();
It returns a font name for displaying a text.
void MQMemo::SetFontName(const std::wstring& value);
It specifies a font name for displaying a text.
bool MQMemo::GetFontBold();
It returns whether a displayed font is bold or not.
void MQMemo::SetFontBold(bool value);
It specifies whether a displayed font is bold or not.
double MQMemo::GetFontScale();
It returns a font scaling ratio for a default font size.
A default value is 1.0.
void MQMemo::SetFontScale(double value);
It specifies a font scaling ratio for a default font size.
bool MQMemo::GetReadOnly();
It returns whether to input characters by keys (false) or reject key inputs (true).
void MQMemo::SetReadOnly(bool value);
It returns whether to input characters by keys (false) or reject key inputs (true).
bool MQMemo::GetPriorMenuShortcut();
It returns whether to prior a shortcut key for a menu or not when a key is pressed.
void MQMemo::SetPriorMenuShortcut(bool value);
It specifies whether to prior a shortcut key for a menu or not when a key is pressed.
MQBarStatus MQMemo::GetHorzBarStatus();
(new in Rev4.64)
It returns a status of a horizontal scroll bar.
void MQMemo::SetHorzBarStatus(MQBarStatus value);
(new in Rev4.64)
It specifies a status of a horizontal scroll bar.
MQBarStatus MQMemo::GetVertBarStatus();
(new in Rev4.64)
It returns a status of a horizontal scroll bar.
void MQMemo::SetVertBarStatus(MQBarStatus value);
(new in Rev4.64)
It specifies a status of a vertical scroll bar.
bool MQMemo::GetFocus();
(new in Rev4.64)
It returns whether this widget is focused or not now.
void MQMemo::SetFocus(bool value);
It focuses this widget.
When this widget is focused, keyboard messages are notified to this widget.
When other widget has a focus and 'true' is specified, the focus will move from the widget to this.
size_t MQMemo::GetCaretPos();
(new in Rev4.64)
It returns a position of a caret
void MQMemo::SetCaretPos(size_t value);
(new in Rev4.64)
It specifies a position of a caret
int MQMemo::GetTabColumn();
(new in Rev4.64)
It returns a width of a tab.
void MQMemo::SetTabColumn(int value);
(new in Rev4.64)
It specifies a width of a tab.
bool MQMemo::GetAutoIndent();
(new in Rev4.64)
It returns whether an indent is automatically inserted or not when a new line starts.
void MQMemo::SetAutoIndent(bool value);
(new in Rev4.64)
It specifies whether an indent is automatically inserted or not when a new line starts.
bool MQMemo::GetShowTabMark();
(new in Rev4.64)
It returns whether to show tab marks or not.
void MQMemo::SetShowTabMark(bool value);
(new in Rev4.64)
It specifies whether to show tab marks or not.
bool MQMemo::GetShowReturnMark();
(new in Rev4.64)
It returns whether to show return marks or not.
void MQMemo::SetShowReturnMark(bool value);
(new in Rev4.64)
It specifies whether to show return marks or not.
bool MQMemo::GetShowLineNumber();
(new in Rev4.64)
It returns whether to show line numbers or not.
void MQMemo::SetShowLineNumber(bool value);
(new in Rev4.64)
It specifies whether to show line numbers or not.
bool MQMemo::GetSyntaxHighlight();
(new in Rev4.64)
It returns whether syntax highlight is enabled or disable.
void MQMemo::SetSyntaxHighlight(bool value);
(new in Rev4.64)
It specifies whether to enable or disable syntax highlight.
bool MQMemo::GetChanged();
(new in Rev4.64)
It return whether a text has been modified or not.
void MQMemo::SetChanged(bool value);
(new in Rev4.64)
It specifies whether a text has been modified or not.
std::wstring MQMemo::GetMarkCharacters();
(new in Rev4.64)
It returns characters used as marks for syntax highlight and finding a word
void MQMemo::SetMarkCharacters(const std::wstring& text);
(new in Rev4.64)
It specifies characters used as marks for syntax highlight and finding a word
void MQMemo::AddSyntaxKeyword(const std::wstring& text);
(new in Rev4.64)
It adds a keyword for syntax highlight.
Example: 'for', 'break' and so on in C and Python
void MQMemo::ClearSyntaxKeyword();
(new in Rev4.64)
It clears all keywords for syntax highlight.
void MQMemo::AddRadixPrefix(const std::wstring& text);
(new in Rev4.64)
It adds a prefix string for radix.
Example: 0x in C and Python
void MQMemo::ClearRadixPrefix();
(new in Rev4.64)
It clears all prefix strings for radix.
std::wstring MQMemo::GetSyntaxComment();
(new in Rev4.64)
It returns a string for a single line comment.
Example: // in C++, # in Python
void MQMemo::SetSyntaxComment(const std::wstring& text);
(new in Rev4.64)
It specifies a string for a single line comment.
void MQMemo::AddSyntaxMultiLineComment(const std::wstring& start, const std::wstring& end);
(new in Rev4.64)
It adds a pair of start and end string used as a multi-line comment in syntax highlight.
Example: /* and */ in C, and """ and """ in Python
void MQMemo::ClearSyntaxMultiLineComment();
(new in Rev4.64)
It clears all pair of start and end strings used as a multi-line comment in syntax highlight.
void MQMemo::AddSyntaxString(const std::wstring& start, const std::wstring& end);
(new in Rev4.64)
It adds a pair of start and end strings used as a text in syntax highlight.
Example: " and " in C and Python.
void MQMemo::ClearSyntaxString();
(new in Rev4.64)
It clears all strings used as a text.
void MQMemo::SelectAll();
(new in Rev4.64)
It selects all text.
void MQMemo::SelectRange(size_t start, size_t end);
(new in Rev4.64)
It selects a text in the specified range.
bool MQMemo::GetSelectedRange(size_t& start, size_t& end);
(new in Rev4.64)
It returns a selected range of a text.
void MQMemo::CutSelection();
(new in Rev4.64)
It cuts a text in the selected range, and send to clipboard.
void MQMemo::CopySelection();
(new in Rev4.64)
It copies a text in the selected range to clipboard.
void MQMemo::PasteFromClipboard();
(new in Rev4.64)
It pastes a text from clipboard.
void MQMemo::ReplaceSelectedText(const std::wstring& text);
(new in Rev4.64)
It replaces a selected range with a specified text.
size_t MQMemo::FindString(const std::wstring& text, size_t start_pos, bool forward, bool matchcase, bool word);
(new in Rev4.64)
It searches a first position matched with the text under the specified condition.
size_t MQMemo::FindStringFromCaretPos(const std::wstring& text, bool forward, bool matchcase, bool word);
(new in Rev4.64)
It searches a first position matched with the text from a current caret position under the specified condition.
size_t MQMemo::FindNextWordBreak(size_t pos, bool forward);
(new in Rev4.64)
It searches a position of next word wrap from the specified position.
bool MQMemo::GetLineColumnByCaretPos(size_t pos, int& line, int& column);
(new in Rev4.64)
It returns line and column number at the specified position.
bool MQMemo::GetCaretPosByLineColumn(int line, int column, size_t& pos);
(new in Rev4.64)
It returns a position from line and column number.
bool MQMemo::CanUndo();
(new in Rev4.64)
It returns whether to be able to execute an undo or not.
bool MQMemo::CanRedo();
(new in Rev4.64)
It returns whether to be able to execute a redo or not.
void MQMemo::Undo();
(new in Rev4.64)
It executes an undo operation.
void MQMemo::Redo();
(new in Rev4.64)
It executes a redo operation.
template<typename T> void MQMemo::AddChangedEvent(T *p, BOOL (T::*f)(MQWidgetBase*, MQDocument), bool prior = false)
It adds events notified when a text has been changed by user's operation.
An event by AddChangingEvent() is invoked when characters are modified by key input, and an event by AddChangedEvent() is invoked when Enter key is pressed or a focus removed by Tab key or a mouse operation.
template<typename T> void MQMemo::AddChangingEvent(T *p, BOOL (T::*f)(MQWidgetBase*, MQDocument), bool prior = false)
It adds events notified when a text is changing by user's operation.
An event by AddChangingEvent() is invoked when characters are modified by key input, and an event by AddChangedEvent() is invoked when Enter key is pressed or a focus removed by Tab key or a mouse operation.
template<typename T> void MQMemo::AddDrawItemEvent(T *p, BOOL (T::*f)(MQWidgetBase*, MQDocument, MQMemoDrawItemParam&), bool prior = false)
(new in Rev4.64)
It add an event for drawing each line.
A member function 'f' must have the following options and return value.
BOOL T::f(MQWidgetBase* sender, MQDocument doc, MQMemoDrawItemParam& param);
struct MQMemoDrawItemParam { MQCanvas *Canvas; int Line; size_t StartPos; size_t EndPos; int X; int Y; int Width; int Height; };