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 // optimization for GCC compiler 00034 #ifdef __GNUG__ 00035 #pragma implementation "MathBoxWndUser.h" 00036 #endif 00037 00038 // includes 00039 #include "mg/mgprec.h" 00040 00041 #ifndef mgPRECOMP 00042 #include "mg/MathBoxWndUser.h" 00043 #endif 00044 00045 00046 00047 00048 00049 // ------------------------------ 00050 // mgMATHBOXWNDUSER 00051 // ------------------------------ 00052 00053 bool mgMathBoxWndUser::isUsingMathWnd() 00054 { 00055 // do a simple check 00056 if (m_pMathWnd) 00057 return TRUE; 00058 return FALSE; 00059 } 00060 00061 mgMathBox *mgMathBoxWndUser::GetBox() 00062 { 00063 if (isUsingMathWnd()) 00064 return (mgMathBox*)(m_pMathWnd->GetSelBox()->GetChild()); 00065 return m_pMathBox; 00066 } 00067 00068 00069 00070 void mgMathBoxWndUser::SendKeyEvent(wxObject *p, wxKeyEvent &key) 00071 { 00072 // setup the event key... 00073 key.SetEventObject(p); 00074 key.SetId(GetBox()->GetId()); 00075 key.SetEventType(wxEVT_CHAR); 00076 00077 // and send it 00078 GetBox()->AddPendingEvent(key); 00079 } 00080 00081 void mgMathBoxWndUser::SendSpecialKeyEvent(wxObject *p, wxKeyEvent &key) 00082 { 00083 // we don't need to setup all the attributes of the wxKeyEvent 00084 // because we won't use the wxEvtHandler::AddPendingEvent 00085 // function because we cannot send through that function 00086 // the "special char" information... 00087 GetBox()->OnSpecialChar(key); 00088 //GetBox()->SetFocus(); 00089 } 00090 00091 00092 void mgMathBoxWndUser::SendKeyEvent(wxObject *p, wxChar c) 00093 { 00094 // just build a wxKeyEvent object 00095 wxKeyEvent key; 00096 00097 // set its char 00098 key.m_keyCode = c; 00099 00100 // and send it 00101 SendKeyEvent(p, key); 00102 } 00103 00104 void mgMathBoxWndUser::SendSpecialKeyEvent(wxObject *p, wxChar c) 00105 { 00106 wxKeyEvent key; 00107 key.m_keyCode = c; 00108 00109 SendSpecialKeyEvent(p, key); 00110 } 00111 00112
[ Top ] |