#include <Text.h>
Inheritance diagram for mcTextHelpers:
This is entirely defined & implemented through macros.
Definition at line 56 of file Text.h.
Public Member Functions | |
mcTextHelpers () | |
virtual | ~mcTextHelpers () |
void | data_DeepCopy (const mcElementHelpers *p) |
Deep copies all the info contained in this class. | |
int | data_GetChildrenCount () const |
Returns the number of children attached to this tree node. | |
const mcElement & | data_GetConstChild (int n) const |
mcDecorationHelpers have no children (by default). | |
void | data_SetChild (int n, const mcElement &newchild) |
math_Replaces the idx-th child of this element with a copy of the given one. | |
bool | data_isArrayEmpty () const |
Returns TRUE if the array of this element is empty. | |
bool | data_isToReject (wxChar c) const |
Returns TRUE if the given char must be rejected by the current filter. | |
bool | math_CompareThisOnly (const mcElement &p, long flags) const |
This is one of the few math functions which applies on a mcText object... | |
bool | io_isBeginTag (const wxXml2Node &tag) const |
Returns a positive value if the given MathML content tag marks the begin of this element; FALSE otherwise. | |
bool | io_isBeginChar (const wxString &str) const |
Returns a positive value if the given inlined expression marks the begin of this element; FALSE otherwise. | |
wxXml2Node | io_GetMathML (bool bGetPresentation) const |
Returns the MathML code for this element as presentation markup (http://www.w3.org/TR/MathML2/chapter3.html) or as content markup (http://www.w3.org/TR/MathML2/chapter4.html). | |
wxString | io_GetInlinedExpr () const |
Returns the inlined expression for this element as a wxString. | |
bool | io_ImportPresentationMathML (wxXml2Node tag, wxString &pErr) |
Imports presentation MathML reading the contents of the given XML node (without modifying it). | |
bool | io_ImportInlinedExpr (const wxString &, int *count, wxString &pErr) |
Imports an inlined expression. | |
SET functions. | |
SET functions not overloaded from base class. | |
void | data_SetText (const wxString &str) |
Sets the text associated with this class. | |
void | data_SetAsMultiline () |
Enables the multiline mode. | |
void | data_SetAsSingleline () |
Disables the multiline mode. | |
void | data_SetFilter (const wxString &str) |
Sets the given string as the current filter; use an empty string to diable input filtering. | |
GET functions. | |
GET functions not overloaded from base class. | |
wxString | data_GetText () const |
Returns the text stored in this class. | |
wxString | data_GetLongestStr () const |
Returns the longest string stored in this object. | |
wxString | data_GetFilter () const |
Returns the filter in use. | |
int | data_GetRowCount () const |
Returns the number of rows stored in this object; if this class is working in single-line mode, the result is one. | |
mcText specific functions | |
int | gui_GetRowHeight (wxDC *dc, int i) const |
Returns the height of the i-th row stored in this object. | |
int | gui_GetRowWidth (wxDC *dc, int i) const |
mcElement overloaded functions | |
bool | gui_isBeginKey (const mcKey &ev) const |
Always returns FALSE: decorations generally are created by the program itself... | |
bool | gui_isEndKey (const mcKey &ev) const |
Always returns FALSE: mcEmptyBox::gui_Input function handles all the keypresses returning mcIR_DELETE_this-> Empty boxes infact, should always be replaced by a new class. | |
void | gui_GetCursorPos (mcCursorPos &) const |
Returns the cursor position as Cursor Position flag. | |
void | gui_DoRecalcSize () |
This function is called by mcElement and non-mcElement functions when the internal size variable must be updated due to a change in the structure of the element. | |
void | gui_OnSelect (wxDC &dc, wxRect &rc) |
This function is called when the bounding box of this element intersects with the selection rectangle created by the user with the mouse cursor. | |
void | gui_SetCursorPos (const mcCursorPos &code) |
Sets the cursor position inside the element using Cursor Position flags. | |
int | gui_GetRelCursorPos (wxDC &dc, wxPoint *pt) const |
Returns the height of the cursor and the (x;y) position of the cursor (in the given pointer) relative to the top-left point of this element. | |
mcMoveCursorRes | gui_MoveCursor (mcMoveCursorFlag flag, long modifiers) |
This function is called to move the cursor which is inside the element, one 'step' left, right, up or down (when flag=mcMCF_LEFT/mcMCF_RIGHT/mcMCF_UP/mcMCF_DOWN). | |
int | gui_MoveCursorUsingPoint (wxDC &dc, const wxPoint &p) |
Moves the cursor inside this element in the closest available position to the given point. | |
mcInputRes | gui_Input (const mcKey &ev, mcElement *newelem) |
This function is called when the cursor is inside the element and the user presses a key (which is not the element's end tag). | |
int | gui_Draw (wxDC &dc, int x, int y, long flags, int w, wxColour *color) const |
int | gui_Draw (wxDC &dc, int x, int y, long flags, const wxPoint &pt) const |
element must be drawn with mcElementHelpers::sgui_m_pActivationBrush background brush; if this pointer is equal to mcDRW_NONACTIVE, the function must simply draw everything with default transparent mode; if the pointer is not one of the previous values, the function must use the pointer to find the subelement where it lies. | |
void | gui_UpdateExpDepth () |
Called by mcElement's standard functions to update the exponent depth of member classes. | |
Public Attributes | |
bool | mgui_bDrawEmptyBoxIfEmpty |
If TRUE, an empty box is drawn when the class is empty. | |
mcEmptyBox * | mgui_pEmptyBox |
The empty box which is used to draw this element when it's empty and m_bgui_DrawEmptyBoxIfEmpty == TRUE. | |
Static Public Attributes | |
static mcText * | smath_pEmpty = NULL |
Protected Member Functions | |
void | gui_Init () |
Inits this section of the element. | |
Protected Attributes | |
wxArrayString | mdata_arrStr |
The text contained by the class. | |
wxString | mdata_strFilter |
The string used to filter the input; if the string is an empty string, no filter is used. | |
bool | mdata_bMultiline |
TRUE if this is a multiline control. | |
int | mgui_nCursorPos |
The cursor position: zero when cursor is on the left of the first character of the string. | |
int | mgui_nRowPos |
If multiline is TRUE, this variable contains the zero-based row index where the cursor is set, and mgui_nCursorPos is the zero-based column index. | |
Private Member Functions | |
mcDEFINE_REFERENCE_DATA (mcText, mcET_TEXT) |
|
|
|
Definition at line 120 of file Text.h. References mcSAFE_DELETE. |
|
Deep copies all the info contained in this class. The mcElement implementation should be enough because all the element's data should be contained inside the associated mcElementData derived class. In fact, mcElementData does not provide a standard implementation of the DeepCopy() function. mcElement-derived classes, instead, should not contain any other variable, so this function should be enough.... Reimplemented from mcDecorationHelpers. Definition at line 67 of file Text.cpp. References mcSAFE_DELETE, mdata_arrStr, mdata_bMultiline, mdata_strFilter, mgui_bDrawEmptyBoxIfEmpty, mgui_nCursorPos, mgui_nRowPos, and mgui_pEmptyBox. |
|
Returns the number of children attached to this tree node. This function can be used on *any* mcElement node because this is a virtual function which is overridden by container classes which thus return the correct number of children. This function is used by various mcElement functions like data_Check() const data_GetElemFromID(), ... which must call some standard mcElement functions on all nodes attached to this element. Reimplemented from mcElementHelpers. Definition at line 141 of file Text.h. References mcElementHelpers::data_GetChildrenCount(). |
|
mcDecorationHelpers have no children (by default).
Reimplemented from mcDecorationHelpers. Definition at line 148 of file Text.h. References mcEmptyElement, and mcRETURN_ELEMENT_CHILD. |
|
Returns the filter in use.
|
|
Returns the longest string stored in this object.
Definition at line 224 of file Text.h. Referenced by gui_DoRecalcSize(). |
|
Returns the number of rows stored in this object; if this class is working in single-line mode, the result is one.
Definition at line 239 of file Text.h. Referenced by gui_DoRecalcSize(), gui_Draw(), gui_GetCursorPos(), gui_Input(), gui_MoveCursor(), and gui_MoveCursorUsingPoint(). |
|
Returns the text stored in this class.
Definition at line 216 of file Text.h. Referenced by math_CompareThisOnly(). |
|
Returns TRUE if the array of this element is empty.
Definition at line 165 of file Text.h. Referenced by gui_DoRecalcSize(), gui_Draw(), gui_GetRelCursorPos(), gui_Input(), gui_MoveCursor(), gui_MoveCursorUsingPoint(), and gui_SetCursorPos(). |
|
Returns TRUE if the given char must be rejected by the current filter.
Definition at line 171 of file Text.h. Referenced by gui_Input(). |
|
Enables the multiline mode.
|
|
Disables the multiline mode. The lines present after the fist, if present, are deleted. |
|
math_Replaces the idx-th child of this element with a copy of the given one.
Reimplemented from mcElementHelpers. Definition at line 155 of file Text.h. References mcASSERT, mcET_EMPTYBOX, mcSAFE_DELETE, and mcSET_ELEMENT_CHILD. |
|
Sets the given string as the current filter; use an empty string to diable input filtering.
|
|
Sets the text associated with this class.
Definition at line 87 of file Text.cpp. References gui_SetCursorPos(), mcASSERT, mcCP_END, mdata_arrStr, and mdata_bMultiline. Referenced by io_ImportInlinedExpr(). |
|
This function is called by mcElement and non-mcElement functions when the internal size variable must be updated due to a change in the structure of the element. This function should be as fast and accurate as possible and it must store the new size in the mgui_sz variable.
Implements mcElementHelpers. Definition at line 371 of file Text.cpp. References data_GetLongestStr(), data_GetRowCount(), data_isArrayEmpty(), gui_GetRowHeight(), mcElement::gui_GetSize(), mcElementHelpers::gui_GetWidthOf(), mcElement::gui_RecalcSize(), mcElementHelpers::gui_SelectStyle(), mgui_bDrawEmptyBoxIfEmpty, and mgui_pEmptyBox. |
|
element must be drawn with mcElementHelpers::sgui_m_pActivationBrush background brush; if this pointer is equal to mcDRW_NONACTIVE, the function must simply draw everything with default transparent mode; if the pointer is not one of the previous values, the function must use the pointer to find the subelement where it lies. Then, only the subelement's gui_Draw() function must be called with the initial pointer. The subelements must be called with mcDRW_ALLACTIVE flag only for special reasons.
Implements mcElementHelpers. |
|
Definition at line 324 of file Text.cpp. References mcElementHelpers::data_GetID(), data_GetRowCount(), data_isArrayEmpty(), mcElement::gui_Draw(), gui_GetRowHeight(), mcElementHelpers::gui_SelectStyle(), mcDRW_NONACTIVE, mdata_arrStr, mgui_bDrawEmptyBoxIfEmpty, and mgui_pEmptyBox. |
|
Returns the cursor position as Cursor Position flag. It must return mcCP_BEGIN if cursor is at the leftmost point of the element, mcCP_END if the cursor is at the rightmost point of the element, mcCP_INSIDE otherwise. When this function is called the cursor is always inside the element. Reimplemented from mcDecorationHelpers. Definition at line 413 of file Text.cpp. References data_GetRowCount(), mcCursorPos::gui_Push(), mcCP_BEGIN, mcCP_END, mdata_arrStr, mgui_nCursorPos, and mgui_nRowPos. |
|
Returns the height of the cursor and the (x;y) position of the cursor (in the given pointer) relative to the top-left point of this element. The function must fill the wxPoint pointer using coordinates relative to the top-left point of its bounding rectangle. When this function is called, the cursor is always inside the element.
Reimplemented from mcDecorationHelpers. Definition at line 344 of file Text.cpp. References data_isArrayEmpty(), mcElement::gui_GetRelCursorPos(), gui_GetRowHeight(), mcElementHelpers::gui_GetWidthOf(), mcElementHelpers::gui_SelectStyle(), mdata_arrStr, mgui_bDrawEmptyBoxIfEmpty, mgui_nCursorPos, mgui_nRowPos, and mgui_pEmptyBox. |
|
Returns the height of the i-th row stored in this object.
Definition at line 257 of file Text.h. Referenced by gui_DoRecalcSize(), gui_Draw(), gui_GetRelCursorPos(), and gui_MoveCursorUsingPoint(). |
|
Definition at line 263 of file Text.h. Referenced by gui_MoveCursorUsingPoint(). |
|
Inits this section of the element. Acts like a constructor (it's called by mcElementHelpers). Reimplemented from mcDecorationHelpers. Definition at line 122 of file Text.cpp. References mcDecorationHelpers::gui_Init(), mgui_bDrawEmptyBoxIfEmpty, mgui_nCursorPos, mgui_nRowPos, and mgui_pEmptyBox. |
|
This function is called when the cursor is inside the element and the user presses a key (which is not the element's end tag). The way the element should process the given character is dependent to the element type: a mcNumber will insert vk next to the cursor position if vk is a digit. If vk is not acceptable, the function should call the MathCore error-handler function, mcMathCore::Get()->SyntaxError. This function should return one of the values defined for mcInputRes: mcIR_OKAY, mcIR_DELETE_THIS, mcIR_DIRECT_DELETE, mcIR_DELETE_NEXT.
Reimplemented from mcDecorationHelpers. Definition at line 132 of file Text.cpp. References data_GetRowCount(), data_isArrayEmpty(), data_isToReject(), mcMathCore::Get(), gui_SetCursorPos(), mcASSERT, mcCP_END, mcIR_DELETE_NEXT, mcIR_DELETE_THIS, mcIR_OKAY, mdata_arrStr, mdata_bMultiline, mgui_nCursorPos, mgui_nRowPos, and mcMathCore::SyntaxError(). |
|
Always returns FALSE: decorations generally are created by the program itself...
Reimplemented from mcDecorationHelpers. |
|
Always returns FALSE: mcEmptyBox::gui_Input function handles all the keypresses returning mcIR_DELETE_this-> Empty boxes infact, should always be replaced by a new class.
Reimplemented from mcDecorationHelpers. |
|
This function is called to move the cursor which is inside the element, one 'step' left, right, up or down (when flag=mcMCF_LEFT/mcMCF_RIGHT/mcMCF_UP/mcMCF_DOWN). Elements which cannot move the cursor in the given direction, should call mcMathCore::Get()->SyntaxError() function. If the cursor must 'exit' the element (because its at the end, for example) the function must return mcMCR_SETFOCUS_PREVIOUS or mcMCR_SETFOCUS_NEXT. This function must always return the code mcMCR_SETFOCUS_* or mcMCR_OKAY. When this function is called, cursor is always inside the element.
Reimplemented from mcDecorationHelpers. Definition at line 245 of file Text.cpp. References data_GetRowCount(), data_isArrayEmpty(), mcElement::gui_MoveCursor(), mcMCF_DOWN, mcMCF_LEFT, mcMCF_RIGHT, mcMCF_UP, mcMCR_OKAY, mcMCR_SETFOCUS_ABOVE, mcMCR_SETFOCUS_BELOW, mcMCR_SETFOCUS_NEXT, mcMCR_SETFOCUS_PREVIOUS, mdata_arrStr, mgui_bDrawEmptyBoxIfEmpty, mgui_nCursorPos, mgui_nRowPos, and mgui_pEmptyBox. |
|
Moves the cursor inside this element in the closest available position to the given point. The function must use the given point to set its internal cursor-position variables (when this function is called, the given point is always inside the bounding rectangle of the element, but maybe the cursor is not).
Reimplemented from mcDecorationHelpers. Definition at line 291 of file Text.cpp. References data_GetRowCount(), data_isArrayEmpty(), gui_GetRowHeight(), gui_GetRowWidth(), mcElementHelpers::gui_SelectStyle(), mcMCR_CANNOT_SETFOCUS, mcMCR_OKAY, mdata_arrStr, mgui_bDrawEmptyBoxIfEmpty, mgui_nCursorPos, and mgui_nRowPos. |
|
This function is called when the bounding box of this element intersects with the selection rectangle created by the user with the mouse cursor. The standard implementation just selects this element. If you are implementing a container element, you must override this function and check contained elements' bounding boxes and then call the gui_OnSelect() function of the contained elements whose bounding boxes intersect the given selection rectangle. Reimplemented from mcElementHelpers. |
|
Sets the cursor position inside the element using Cursor Position flags. When it's called to set the cursor at the end of the base, code==mcCP_END and data_hasProperty(mcEP_HASEXPONENT) == FALSE, when it's called to set the cursor at the beginning of the base, code==mcCP_BEGIN. The function doesnt need to care for the third Cursor Position flag: mcCP_INSIDE, actually this function will never be called with this code. Reimplemented from mcDecorationHelpers. Definition at line 392 of file Text.cpp. References data_isArrayEmpty(), mcASSERT, mdata_arrStr, mgui_nCursorPos, and mgui_nRowPos. Referenced by data_SetText(), and gui_Input(). |
|
Called by mcElement's standard functions to update the exponent depth of member classes. Override this function if you need to update member variables when the exponent level of this element changes (this happens each time gui_SetExpDepth() function is called; thus this happens each time gui_SetAsExpOf or gui_SetAtSameLevelOf functions are called).
Reimplemented from mcElementHelpers. Definition at line 424 of file Text.cpp. References mcElement::gui_SetAtSameLevelOf(), mcElementHelpers::gui_UpdateExpDepth(), and mgui_pEmptyBox. |
|
Returns the inlined expression for this element as a wxString. "Inlined expression" means a math representation of the data in a single line: to allow such a restriction (everything must be on one text line), some standard conventions (and many brackets !!!) are used:
Reimplemented from mcDecorationHelpers. Definition at line 452 of file Text.cpp. References mdata_arrStr. |
|
Returns the MathML code for this element as presentation markup (http://www.w3.org/TR/MathML2/chapter3.html) or as content markup (http://www.w3.org/TR/MathML2/chapter4.html).
Reimplemented from mcDecorationHelpers. Definition at line 443 of file Text.cpp. References mcASSERT, mdata_arrStr, and mdata_bMultiline. |
|
Imports an inlined expression.
"Inlined expression" means a string containing an encoded representation of math data: 234^2*ax+6y/2=0 is an inlined expression. This is the form which is used to input and output math data by a lot of math programs. Compability with these programs is crucial. However, because of the nature of this representation, the algorithm which recognizes (through io_isBeginChar functions) the elements to create, needs to know the lenght of the token which encodes this element; this is accomplished with the
Reimplemented from mcDecorationHelpers. Definition at line 465 of file Text.cpp. References data_SetText(). |
|
Imports presentation MathML reading the contents of the given XML node (without modifying it).
This function is called only if io_isBeginTag function returns a positive value for the name of parent tag of
Reimplemented from mcDecorationHelpers. |
|
Returns a positive value if the given inlined expression marks the begin of this element; FALSE otherwise. The begin tag cannot be dependent from any variable; it must be always the same. Reimplemented from mcDecorationHelpers. |
|
Returns a positive value if the given MathML content tag marks the begin of this element; FALSE otherwise. The begin tag cannot be dependent from any variable; it must be always the same.
Reimplemented from mcDecorationHelpers. |
|
This is one of the few math functions which applies on a mcText object...
Reimplemented from mcElementHelpers. Definition at line 480 of file Text.cpp. References data_GetText(). |
|
|
|
The text contained by the class.
Definition at line 64 of file Text.h. Referenced by data_DeepCopy(), data_SetText(), gui_Draw(), gui_GetCursorPos(), gui_GetRelCursorPos(), gui_Input(), gui_MoveCursor(), gui_MoveCursorUsingPoint(), gui_SetCursorPos(), io_GetInlinedExpr(), and io_GetMathML(). |
|
TRUE if this is a multiline control.
Definition at line 71 of file Text.h. Referenced by data_DeepCopy(), data_SetText(), gui_Input(), and io_GetMathML(). |
|
The string used to filter the input; if the string is an empty string, no filter is used.
Definition at line 68 of file Text.h. Referenced by data_DeepCopy(). |
|
If TRUE, an empty box is drawn when the class is empty.
Definition at line 102 of file Text.h. Referenced by data_DeepCopy(), gui_DoRecalcSize(), gui_Draw(), gui_GetRelCursorPos(), gui_Init(), gui_MoveCursor(), and gui_MoveCursorUsingPoint(). |
|
The cursor position: zero when cursor is on the left of the first character of the string.
Reimplemented from mcDecorationHelpers. Definition at line 88 of file Text.h. Referenced by data_DeepCopy(), gui_GetCursorPos(), gui_GetRelCursorPos(), gui_Init(), gui_Input(), gui_MoveCursor(), gui_MoveCursorUsingPoint(), and gui_SetCursorPos(). |
|
If multiline is TRUE, this variable contains the zero-based row index where the cursor is set, and mgui_nCursorPos is the zero-based column index.
Definition at line 93 of file Text.h. Referenced by data_DeepCopy(), gui_GetCursorPos(), gui_GetRelCursorPos(), gui_Init(), gui_Input(), gui_MoveCursor(), gui_MoveCursorUsingPoint(), and gui_SetCursorPos(). |
|
The empty box which is used to draw this element when it's empty and m_bgui_DrawEmptyBoxIfEmpty == TRUE.
Definition at line 106 of file Text.h. Referenced by data_DeepCopy(), gui_DoRecalcSize(), gui_Draw(), gui_GetRelCursorPos(), gui_Init(), gui_MoveCursor(), and gui_UpdateExpDepth(). |
|
|
[ Top ] |