Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

mcBracketHelpers Class Reference

#include <Bracket.h>

Inheritance diagram for mcBracketHelpers:

Inheritance graph
[legend]
Collaboration diagram for mcBracketHelpers:

Collaboration graph
[legend]
List of all members.

Detailed Description

A little class containing the DATA, MATH, GUI and IO sections of this element (as instances and not pointers).

This is entirely defined & implemented through macros.

Definition at line 58 of file Bracket.h.

mcBracketGUI specific functions.

Some utilities + some overrides.

void gui_DoRecalcBaseSize ()
 Calculates (in the m_szBase variable) the size of the base only.
mcInputRes gui_OnRemoveLeftBracket (mcElement *)
mcInputRes gui_OnRemoveRightBracket (mcElement *)
static wxFont gui_RebuildFont (const mcElementHelpers *elem, int h)

Public Member Functions

virtual int gui_GetSpaceAboveBelow () const
 The additional space added above and below the parentheses.
virtual int gui_GetSpaceLeftRight () const
 mcBracketHelpers ()
virtual ~mcBracketHelpers ()
int data_GetBracketDepth () const
 Returns a code which is used internally by mcBracket to auto-determine the 'bracket depth' of this instance, which is used to choose among normal, square and curly brackets.
wxString data_GetBracketLeftSymbol (int n=-1) const
wxString data_GetBracketRightSymbol (int n=-1) const
int data_ChooseBracketType () const
mcExpSimRes math_RemoveExp ()
mcExpSimRes math_ExpandContents (long flags, mcElement *newelem)
mcExpSimRes math_SimplifyContents (long flags, mcElement *newelem)
mcBasicOpRes math_MakeReciprocal (mcElement *)
 Calculates the reciprocal of this element; tipically, this function creates a mcFraction whose numerator is 1 and the denominator contains *this.
mcRealValue math_GetBaseLenght () const
int math_GetOrderPos () const
 Returns the order position for this element.
bool io_isBeginChar (const wxString &str) const
 Returns a positive value if the given inlined expression marks the begin of this element; FALSE otherwise.
wxString io_GetBaseInlinedExpr () const
bool io_ImportBaseInlinedExpr (const wxString &str, int *, wxString &)
mcExpContainer and mcExpElement abstract functions.
Functions required by compiler to be present.

bool gui_isBeginKey (const mcKey &ev) const
 Returns a positive value if the given character marks the begin of this element; FALSE otherwise.
mcInputRes gui_BaseInput (const mcKey &key, mcElement *pnew)
 Works as mcExpContainer::gui_BaseInput but it have two other tasks: 1) to change, eventually, the type of brackets drawn by this function to reflect the input.
mcInputRes gui_HandleContentInput (mcInputRes r, mcElement *)
 Handles the input result flag returned by the contained element.
int gui_GetContentOffsetX () const
int gui_GetContentOffsetY () const
bool gui_isLeftPosEnabled () const
bool gui_isRightPosEnabled () const
void gui_DrawContainer (wxDC &dc, int x, int y, long flags, const wxPoint &pt) const

Static Public Member Functions

static bool gui_isLeftParenthesis (const wxChar c)
 Returns TRUE if the given character is a left parenthesis.
static bool gui_isRightParenthesis (const wxChar c)
 Returns TRUE if the given character is a right parenthesis.
static bool io_isBracketBeginChar (const wxString &str)

Public Attributes

bool mgui_bRemoveLeftBracket
 Is the LEFT or RIGHT bracket being removed ?

Static Public Attributes

static bool sgui_bCreateBothSymbols = FALSE
 If TRUE, then, when the user types wxT('('), wxT('[') or '{', also the other symbol wxT(')'), wxT(']') or '}' is automatically created and the content is automatically set as empty.
static int sgui_nSpaceAboveBelow = 0
static int sgui_nSpaceLeftRight = 0
static wxString sgui_strLeftParentheses = wxT("([{")
static wxString sgui_strRightParentheses = wxT(")]}")

Protected Member Functions

wxString io_GetMathMLPresentationTag () const
 Returns the name of the container TAG for this element.

Protected Attributes

wxFont mgui_fLastFont
 Font used to draw the parentheses (it's updated each time the content changes its height).
wxSize mgui_szBracket
 Size of the '(' bracket symbol.

Private Member Functions

 mcDEFINE_REFERENCE_DATA (mcBracket, mcET_BRACKET)


Constructor & Destructor Documentation

mcBracketHelpers::mcBracketHelpers  )  [inline]
 

Definition at line 111 of file Bracket.h.

References mcElementHelpers::data_Init().

virtual mcBracketHelpers::~mcBracketHelpers  )  [inline, virtual]
 

Definition at line 112 of file Bracket.h.


Member Function Documentation

int mcBracketHelpers::data_ChooseBracketType  )  const
 

Definition at line 103 of file Bracket.cpp.

References mcElementArray::data_Get(), mcExpContainerHelpers::data_GetContent(), mcElementArray::data_GetCount(), mcElement::data_GetType(), mcBRACKET_SIMPLE_BRACKETS, mcET_BRACKET, and mcET_MONOMIAL.

Referenced by data_GetBracketDepth(), data_GetBracketLeftSymbol(), data_GetBracketRightSymbol(), gui_BaseInput(), and io_GetBaseInlinedExpr().

int mcBracketHelpers::data_GetBracketDepth  )  const [inline]
 

Returns a code which is used internally by mcBracket to auto-determine the 'bracket depth' of this instance, which is used to choose among normal, square and curly brackets.

Definition at line 133 of file Bracket.h.

References data_ChooseBracketType().

wxString mcBracketHelpers::data_GetBracketLeftSymbol int  n = -1  )  const
 

Definition at line 73 of file Bracket.cpp.

References data_ChooseBracketType(), mcBRACKET_SIMPLE_BRACKETS, and mcBRACKET_SQUARE_BRACKETS.

Referenced by gui_DoRecalcBaseSize(), gui_DrawContainer(), and io_GetBaseInlinedExpr().

wxString mcBracketHelpers::data_GetBracketRightSymbol int  n = -1  )  const
 

Definition at line 88 of file Bracket.cpp.

References data_ChooseBracketType(), mcBRACKET_SIMPLE_BRACKETS, and mcBRACKET_SQUARE_BRACKETS.

Referenced by gui_DrawContainer(), and io_GetBaseInlinedExpr().

mcInputRes mcBracketHelpers::gui_BaseInput const mcKey key,
mcElement pnew
[virtual]
 

Works as mcExpContainer::gui_BaseInput but it have two other tasks: 1) to change, eventually, the type of brackets drawn by this function to reflect the input.

2) if bCreateBothSymbols == FALSE, to intercept the ')' keypresses.

Reimplemented from mcExpContainerHelpers.

Definition at line 224 of file Bracket.cpp.

References data_ChooseBracketType(), mcExpContainerHelpers::gui_BaseInput(), gui_OnRemoveLeftBracket(), gui_OnRemoveRightBracket(), mcEXPCONTAINER_INSIDEEXPR, mcEXPCONTAINER_LEFTMOST, mcEXPCONTAINER_RIGHTMOST, and sgui_bCreateBothSymbols.

void mcBracketHelpers::gui_DoRecalcBaseSize  )  [virtual]
 

Calculates (in the m_szBase variable) the size of the base only.

It's very important not to modify the m_sz variable: m_sz is handled by mcExpElement functions: the base must modify ONLY *m_szBase*.

Implements mcExpElementHelpers.

Definition at line 180 of file Bracket.cpp.

References data_GetBracketLeftSymbol(), mcExpContainerHelpers::data_GetContent(), mcElement::gui_GetSize(), mcElementHelpers::gui_GetSizeOf(), gui_GetSpaceAboveBelow(), gui_GetSpaceLeftRight(), gui_RebuildFont(), mcASSERT, mgui_fLastFont, and mgui_szBracket.

void mcBracketHelpers::gui_DrawContainer wxDC &  dc,
int  x,
int  y,
long  flags,
const wxPoint &  pt
const [virtual]
 

Implements mcExpContainerHelpers.

Definition at line 203 of file Bracket.cpp.

References data_GetBracketLeftSymbol(), data_GetBracketRightSymbol(), mcExpContainerHelpers::data_GetContent(), mcElement::gui_GetWidth(), mcElementHelpers::gui_SelectStyle(), mcUNUSED, mgui_fLastFont, and mgui_szBracket.

int mcBracketHelpers::gui_GetContentOffsetX  )  const [virtual]
 

Implements mcExpContainerHelpers.

Definition at line 150 of file Bracket.cpp.

References mgui_szBracket.

int mcBracketHelpers::gui_GetContentOffsetY  )  const [virtual]
 

Implements mcExpContainerHelpers.

Definition at line 144 of file Bracket.cpp.

References mcExpContainerHelpers::data_GetContent(), mcElement::gui_GetHeight(), and mgui_szBracket.

virtual int mcBracketHelpers::gui_GetSpaceAboveBelow  )  const [inline, virtual]
 

The additional space added above and below the parentheses.

Reimplemented from mcExpContainerHelpers.

Definition at line 75 of file Bracket.h.

References sgui_nSpaceAboveBelow.

Referenced by gui_DoRecalcBaseSize().

virtual int mcBracketHelpers::gui_GetSpaceLeftRight  )  const [inline, virtual]
 

Reimplemented from mcExpContainerHelpers.

Definition at line 76 of file Bracket.h.

References sgui_nSpaceLeftRight.

Referenced by gui_DoRecalcBaseSize().

mcInputRes mcBracketHelpers::gui_HandleContentInput mcInputRes  r,
mcElement
[virtual]
 

Handles the input result flag returned by the contained element.

The value which is returned by this function is also the value of the gui_BaseInput() function.

Reimplemented from mcExpContainerHelpers.

Definition at line 266 of file Bracket.cpp.

References mcExpContainerHelpers::gui_HandleContentInput(), gui_OnRemoveLeftBracket(), gui_OnRemoveRightBracket(), mcIR_DELETE_NEXT, mcIR_DELETE_PREVIOUS, and sgui_bCreateBothSymbols.

bool mcBracketHelpers::gui_isBeginKey const mcKey ev  )  const [inline, virtual]
 

Returns a positive value if the given character marks the begin of this element; FALSE otherwise.

The begin character cannot be dependent from any variable; it must be always the same. The character is given both as ASCII code and as virtual key code.

Parameters:
ev The wxWidgets key event for the keypress. It contains the untraslated code for the input key; see wxWidgets KeyCodes for more info.
Returns:
A value identifying the subclass of this element that matched the given character; if the element has no subclasses it should return a null value when the given character is the begin character of the element. See MathCore::NewElem for more info.

Implements mcElementHelpers.

Definition at line 157 of file Bracket.h.

References sgui_bCreateBothSymbols.

static bool mcBracketHelpers::gui_isLeftParenthesis const wxChar  c  )  [inline, static]
 

Returns TRUE if the given character is a left parenthesis.

Definition at line 81 of file Bracket.h.

References sgui_strLeftParentheses.

bool mcBracketHelpers::gui_isLeftPosEnabled  )  const [inline, virtual]
 

Implements mcExpContainerHelpers.

Definition at line 179 of file Bracket.h.

static bool mcBracketHelpers::gui_isRightParenthesis const wxChar  c  )  [inline, static]
 

Returns TRUE if the given character is a right parenthesis.

Definition at line 86 of file Bracket.h.

References sgui_strRightParentheses.

bool mcBracketHelpers::gui_isRightPosEnabled  )  const [inline, virtual]
 

Implements mcExpContainerHelpers.

Definition at line 180 of file Bracket.h.

mcInputRes mcBracketHelpers::gui_OnRemoveLeftBracket mcElement  ) 
 

Definition at line 259 of file Bracket.cpp.

References mcElementHelpers::mcElement, mcIR_DISTRIBUTE, and mgui_bRemoveLeftBracket.

Referenced by gui_BaseInput(), and gui_HandleContentInput().

mcInputRes mcBracketHelpers::gui_OnRemoveRightBracket mcElement  ) 
 

Definition at line 252 of file Bracket.cpp.

References mcElementHelpers::mcElement, mcIR_DISTRIBUTE, and mgui_bRemoveLeftBracket.

Referenced by gui_BaseInput(), and gui_HandleContentInput().

wxFont mcBracketHelpers::gui_RebuildFont const mcElementHelpers elem,
int  h
[static]
 

Definition at line 156 of file Bracket.cpp.

References mcET_ADDOP, and sgui_nSpaceAboveBelow.

Referenced by gui_DoRecalcBaseSize(), and mcParenthesisHelpers::gui_RebuildFont().

wxString mcBracketHelpers::io_GetBaseInlinedExpr  )  const [virtual]
 

Implements mcExpElementHelpers.

Definition at line 285 of file Bracket.cpp.

References data_ChooseBracketType(), data_GetBracketLeftSymbol(), data_GetBracketRightSymbol(), mcExpContainerHelpers::data_GetContent(), and mcElement::io_GetInlinedExpr().

wxString mcBracketHelpers::io_GetMathMLPresentationTag  )  const [inline, protected, virtual]
 

Returns the name of the container TAG for this element.

Reimplemented from mcExpContainerHelpers.

Definition at line 226 of file Bracket.h.

bool mcBracketHelpers::io_ImportBaseInlinedExpr const wxString &  str,
int *  ,
wxString & 
[virtual]
 

Implements mcExpElementHelpers.

Definition at line 297 of file Bracket.cpp.

References mcExpContainerHelpers::data_GetContent(), mcElement::io_ImportInlinedExpr(), and mcASSERT.

bool mcBracketHelpers::io_isBeginChar const wxString &  str  )  const [inline, virtual]
 

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.

Implements mcElementHelpers.

Definition at line 230 of file Bracket.h.

References io_isBracketBeginChar().

static bool mcBracketHelpers::io_isBracketBeginChar const wxString &  str  )  [inline, static]
 

Definition at line 234 of file Bracket.h.

Referenced by io_isBeginChar().

mcExpSimRes mcBracketHelpers::math_ExpandContents long  flags,
mcElement newelem
[virtual]
 

Implements mcExpContainerHelpers.

Definition at line 395 of file Bracket.cpp.

References math_RemoveExp(), mcElementHelpers::mcElement, mcESR_DISTRIBUTE, mcESR_DONE, mcESR_INVALID_DATA, and mcESR_NOTFINISHED.

mcRealValue mcBracketHelpers::math_GetBaseLenght  )  const [inline, virtual]
 

Reimplemented from mcExpContainerHelpers.

Definition at line 215 of file Bracket.h.

References mcExpContainerHelpers::math_GetBaseLenght().

int mcBracketHelpers::math_GetOrderPos  )  const [inline, virtual]
 

Returns the order position for this element.

Implements mcElementHelpers.

Definition at line 216 of file Bracket.h.

mcBasicOpRes mcBracketHelpers::math_MakeReciprocal mcElement  )  [virtual]
 

Calculates the reciprocal of this element; tipically, this function creates a mcFraction whose numerator is 1 and the denominator contains *this.

This should be the default behaviour. A simple multiplication of the current exponent by -1 should be avoided when possible.

Note:
The math_RaiseTo function could be used instead of this one but this function should be preferred over math_RaiseTo(mcPolynomial(-1)); because this function ?????????? FIXME

Reimplemented from mcExpElementHelpers.

Definition at line 408 of file Bracket.cpp.

References mcExpContainerHelpers::data_GetContent(), mcFraction::data_SetDen(), and mcBOR_REMOVE_OPERAND.

mcExpSimRes mcBracketHelpers::math_RemoveExp  ) 
 

Definition at line 372 of file Bracket.cpp.

References mcExpElementHelpers::data_DestroyExpSub(), mcExpContainerHelpers::data_GetContent(), mcExpElementHelpers::math_GetExp(), mcExpElementHelpers::math_hasExp(), mcElement::math_RaiseTo(), mcESR_DONE, mcESR_INVALID_DATA, mcESR_NOTFINISHED, mcMATHLOG, mcTXT, and mcTXTTHIS.

Referenced by math_ExpandContents(), and math_SimplifyContents().

mcExpSimRes mcBracketHelpers::math_SimplifyContents long  flags,
mcElement newelem
[virtual]
 

Implements mcExpContainerHelpers.

Definition at line 327 of file Bracket.cpp.

References mcExpContainerHelpers::data_GetContent(), mcElement::math_ContainsSymbols(), mcPolynomial::math_Get(), mcPolynomial::math_isFactorized(), mcElementArray::math_isWrappingOnly(), math_RemoveExp(), mcElementHelpers::mcElement, mcESR_DISTRIBUTE, mcESR_DONE, mcESR_INVALID_DATA, mcESR_NOTFINISHED, mcET_BRACKET, mcEXPSIM_KEEP_FACTORIZATION, mcMATHLOG, and mcTXTTHIS.

mcBracketHelpers::mcDEFINE_REFERENCE_DATA mcBracket  ,
mcET_BRACKET 
[private]
 


Member Data Documentation

bool mcBracketHelpers::mgui_bRemoveLeftBracket
 

Is the LEFT or RIGHT bracket being removed ?

Definition at line 103 of file Bracket.h.

Referenced by gui_OnRemoveLeftBracket(), and gui_OnRemoveRightBracket().

wxFont mcBracketHelpers::mgui_fLastFont [protected]
 

Font used to draw the parentheses (it's updated each time the content changes its height).

Definition at line 94 of file Bracket.h.

Referenced by gui_DoRecalcBaseSize(), and gui_DrawContainer().

wxSize mcBracketHelpers::mgui_szBracket [protected]
 

Size of the '(' bracket symbol.

It is supposed to be equal to the size of the ')' character.

Definition at line 98 of file Bracket.h.

Referenced by gui_DoRecalcBaseSize(), gui_DrawContainer(), gui_GetContentOffsetX(), and gui_GetContentOffsetY().

bool mcBracketHelpers::sgui_bCreateBothSymbols = FALSE [static]
 

If TRUE, then, when the user types wxT('('), wxT('[') or '{', also the other symbol wxT(')'), wxT(']') or '}' is automatically created and the content is automatically set as empty.

If FALSE, then the contents of the bracket is automatically set as everything which follows the '(' symbol.

Definition at line 59 of file Bracket.cpp.

Referenced by gui_BaseInput(), gui_HandleContentInput(), and gui_isBeginKey().

int mcBracketHelpers::sgui_nSpaceAboveBelow = 0 [static]
 

Definition at line 58 of file Bracket.cpp.

Referenced by gui_GetSpaceAboveBelow(), and gui_RebuildFont().

int mcBracketHelpers::sgui_nSpaceLeftRight = 0 [static]
 

Definition at line 57 of file Bracket.cpp.

Referenced by gui_GetSpaceLeftRight().

wxString mcBracketHelpers::sgui_strLeftParentheses = wxT("([{") [static]
 

Definition at line 60 of file Bracket.cpp.

Referenced by gui_isLeftParenthesis().

wxString mcBracketHelpers::sgui_strRightParentheses = wxT(")]}") [static]
 

Definition at line 61 of file Bracket.cpp.

Referenced by gui_isRightParenthesis().


The documentation for this class was generated from the following files:

Documentation generated with Doxygen on Sun Feb 6 17:12:21 2005
Visit MathStudio home page for more info

[ Top ]