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

EmptyBox.h

Go to the documentation of this file.
00001 
00002 // MathCore = a WYSIWYG equation editor + a powerful math engine     //
00003 // Copyright (C) 2003 by Francesco Montorsi                          //
00004 //                                                                   //
00005 // This library is free software; you can redistribute it and/or     //
00006 // modify it under the terms of the GNU Lesser General Public        //
00007 // License as published by the Free Software Foundation; either      //
00008 // version 2.1 of the License, or (at your option) any later         //
00009 // version.                                                          //
00010 //                                                                   //
00011 // This library is distributed in the hope that it will be useful,   //
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of    //
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the      //
00014 // GNU Lesser General Public License for more details.               //
00015 //                                                                   //
00016 // You should have received a copy of the GNU Lesser General Public  //
00017 // License along with this program; if not, write to the Free        //
00018 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,   //
00019 // MA 02111-1307, USA.                                               //
00020 //                                                                   //
00021 // For any comment, suggestion or feature request, please contact    //
00022 // the administrator of the project at frm@users.sourceforge.net     //
00023 //                                                                   //
00031 
00032 
00033 
00034 #ifndef EMPTYBOX_H
00035 #define EMPTYBOX_H
00036 
00037 
00038 // optimization for GCC compiler
00039 #ifdef __GNUG__
00040 #pragma interface "EmptyBox.h"
00041 #endif
00042 
00043 // required includes
00044 #include "mc/Decoration.h"
00045 
00046 
00047 mcDEFINE_HELPER_CLASSES(mcEmptyBox)
00048 
00049 
00050 
00051 
00052 
00053 class mcEmptyBoxHelpers : public mcDecorationHelpers
00054 {
00055 public:
00056  mcDEFINE_REFERENCE_DATA(mcEmptyBox, mcET_EMPTYBOX);
00057 
00058 public:
00059  mcEmptyBoxHelpers() { data_Init(); }
00060  virtual ~mcEmptyBoxHelpers() {}
00061 
00062 
00063 #ifdef mcENABLE_DATA
00064 public:
00065 
00066 #ifdef __MCDEBUG__
00067 
00069  wxString data_Debug(long flags) const  { return wxT("mcEmptyBox\n"); }
00070 
00071 #endif
00072 #endif  // mcENABLE_DATA
00073 
00074 
00075 
00076 #ifdef mcENABLE_GUI
00077 public:    // customizable variables
00078   
00083  static float sgui_fEmptyBoxCharWidth;
00084 
00086  static float sgui_fEmptyBoxCharHeight;
00087 
00089  static wxBrush *sgui_pEmptyBoxBrush;
00090 
00092  static mcKey *sgui_pNewEmptyBox;
00093 
00094 
00095 public:
00096 
00104  
00107  bool gui_isBeginKey(const mcKey &key) const {
00108   if (key.MatchKey(*sgui_pNewEmptyBox))
00109    return TRUE;
00110   return FALSE;
00111  }
00112  
00116  bool gui_isEndKey(const mcKey &key) const;
00117   
00118  int gui_Draw(wxDC &dc, int x, int y, long flags, const wxPoint &pt) const;
00119  mcInputRes gui_Input(const mcKey &key, mcElement *pnew);
00120  mcInsertRes gui_Insert(const mcElement &, mcElement *);
00121  mcMoveCursorRes gui_MoveCursor(mcMoveCursorFlag flag, long modifiers);
00122  int gui_MoveCursorUsingPoint(wxDC &dc, const wxPoint &p);
00123  int gui_GetRelCursorPos(wxDC &dc, wxPoint *pt) const;
00124  void gui_DoRecalcSize();
00125 
00126  void gui_SetCursorPos(const mcCursorPos &code) {}
00127  void gui_GetCursorPos(mcCursorPos &p) const
00128   { p.gui_Push(mcCP_BEGINEND); }
00129 
00131 
00132 #endif  // mcENABLE_GUI
00133 
00134 
00135 
00136 #ifdef mcENABLE_IO
00137 public:
00138 
00139  bool io_isBeginTag(const wxXml2Node &tag) const {
00140   if (tag.GetName() == wxT("memptybox"))
00141    return TRUE;
00142   return FALSE;
00143  }
00144 
00148  static wxString io_GetInlinedExprTag() { return wxT("[~]"); }
00149 
00150  wxXml2Node io_GetMathML(bool bGetPresentation) const;
00151  wxString io_GetInlinedExpr() const; 
00152 
00153  bool io_ImportPresentationMathML(wxXml2Node tag, wxString &pErr); 
00154 
00155 #endif  // mcENABLE_IO
00156 };
00157 
00158 
00161 class mcEmptyBox : public mcDecoration 
00162 {
00163  // this class doesn't have any specific variable; it's just a place
00164  // where all the empty boxes' behaviours are described by the
00165  // following functions...
00166  mcDEFINE_MAIN_CLASS(EmptyBox, mcDecoration);
00167  
00168 public:
00169 
00170  bool data_isValidContainerFor(mcElementType t) const
00171   { return t == mcET_EMPTYBOX; }
00172 };
00173 
00174 #endif // EMPTYBOX_H
00175 
00176 
00177 
00178 
00179 


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

[ Top ]