00001 00002 // MathGUI = 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 // // 00030 00031 00032 00033 #ifndef MATHWND_H 00034 #define MATHWND_H 00035 00036 // required because mgMathWnd uses heavily mgMathBoxes 00037 #include "mg/GUIUtils.h" 00038 #include "mg/MathBox.h" 00039 00040 00041 // optimization for GCC compiler 00042 #ifdef __GNUG__ 00043 #pragma interface "MathWnd.h" 00044 #endif 00045 00047 WX_DECLARE_OBJARRAY(mgResizeableBox, wxMathBoxArray); 00048 //WX_DECLARE_OBJARRAY(mgResizeableTextBox, wxTextBoxArray); 00049 00050 00052 class mgMathWnd : public wxScrolledWindow 00053 { 00055 wxMathBoxArray m_arrMathBox; 00056 //wxTextBoxArray m_arrTextBox; 00057 00058 // various 00059 wxSize m_szClient; 00060 int m_nSelBox; 00061 int m_nActiveElemID; 00062 00065 wxMemoryDC m_hMemDC; 00066 00068 wxPoint m_ptOrigin; 00069 00071 wxRect m_rcSelection; 00072 00074 //int m_nCmdID[MAXMENU_ITEMS]; 00075 00076 public: 00077 00079 mgMathWnd(wxWindow *parent, 00080 wxWindowID id = -1, 00081 const wxPoint &pos = wxPoint(0, 0)); 00082 00084 virtual ~mgMathWnd(); 00085 00086 00087 00088 00090 void UpdateScrollRange(); 00091 00094 void Clean(); 00095 00097 wxString GetDebug(); 00098 00100 void SetStyleArray(mcStyleArray *) {} 00101 00120 bool Export(bool bXHTML, const wxString &filename, const wxString &title, 00121 bool bUpperTag = FALSE, bool bMathPlayerSupport = FALSE, bool bUseNS = FALSE, 00122 const wxString &ns = wxEmptyString, const wxString &href = wxEmptyString, 00123 int indentstep = 2); 00124 00125 bool Export(bool bXHTML, wxOutputStream &stream, const wxString &title, bool bPreview, 00126 bool bUpperTag = FALSE, bool bMathPlayerSupport = FALSE, bool bUseNS = FALSE, 00127 const wxString &ns = wxEmptyString, const wxString &href = wxEmptyString, 00128 int indentstep = 2); 00129 00130 wxString GetExportPreview(bool bXHTML, const wxString &title, 00131 bool bUpperTag = FALSE, bool bMathPlayerSupport = FALSE, 00132 bool bUseNS = FALSE, const wxString &ns = wxEmptyString, 00133 const wxString &href = wxEmptyString, int indentstep = 2); 00134 00135 bool Import(int type, const wxString &filename, wxString *pDesc = NULL); 00136 00137 00138 00139 00143 00144 void OnSetFocus(wxFocusEvent &); // focus event 00145 void OnFocusLost(wxFocusEvent &); 00146 00147 void OnTimer(wxTimerEvent &); // miscellaneous events 00148 void OnPaint(wxPaintEvent &); 00149 00150 void OnLDown(wxMouseEvent &); // mouse events 00151 void OnRDown(wxMouseEvent &); 00152 void OnLUp(wxMouseEvent &); 00153 void OnRUp(wxMouseEvent &); 00154 void OnMouseMove(wxMouseEvent &); 00155 00156 void OnCtxMenuItem(wxCommandEvent &); 00157 00158 void OnChar(wxKeyEvent &); // keyboard events 00159 void OnSize(wxSizeEvent &); 00160 00162 void OnChildWindowChange(wxCommandEvent &); 00163 00165 00166 00167 00168 00172 00178 void SelectBox(int n); 00179 00182 void SelectBoxByPoint(wxPoint &pt); 00183 00191 void AddBox(bool bMath, bool bCopyLast); 00192 00194 void DeleteBox(int n); 00195 00197 00198 00199 00204 /* 00205 int GetSelBoxId() { return m_nSelBox; } 00206 int GetBoxCount() { return GetChildren().GetCount(); } 00207 mgResizeableBox *GetBox(int n) { return (mgResizeableBox *)((GetChildren().Item(n))->GetData()); } 00208 mgResizeableBox *GetSelBox() { return GetBox(m_nSelBox); } 00209 */ 00210 int GetSelBoxId() { return m_nSelBox; } 00211 int GetBoxCount() { return m_arrMathBox.GetCount(); } 00212 mgResizeableBox *GetBox(int n) { return &(m_arrMathBox.Item(n)); } 00213 mgResizeableBox *GetSelBox() { return GetBox(m_nSelBox); } 00214 00216 00217 00218 // as wxWindow, an event table is required 00219 DECLARE_CLASS(mgMathWnd) 00220 DECLARE_EVENT_TABLE() 00221 }; 00222 00223 00224 #endif // MATHWND_H 00225
[ Top ] |