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 "SpecialSymDlg.h" 00036 #endif 00037 00038 // includes 00039 #include "mg/mgprec.h" 00040 00041 #ifndef mgPRECOMP 00042 //#include <wx/minibtn.h> 00043 #include "mg/GUIUtils.h" 00044 #include "mg/SpecialSymDlg.h" 00045 #endif 00046 00047 00048 00049 // setup static vars 00050 #if wxUSE_UNICODE 00051 00052 // 0x2264: less or equal than 00053 // 0x2260: different from 00054 // 0x2265: greater or equal than 00055 wxString mgSpecialSymPanel::strSymbols = 00056 wxString((wxChar)mcMMRO_LESS_OR_EQUAL, 1) + //wxString("\x2264<=\x2260>\x2265"); 00057 wxString((wxChar)mcMMRO_LESS, 1) + 00058 wxString((wxChar)mcMMRO_EQUAL, 1) + 00059 wxString((wxChar)mcMMRO_NOT_EQUAL, 1) + 00060 wxString((wxChar)mcMMRO_GREATER, 1) + 00061 wxString((wxChar)mcMMRO_GREATER_OR_EQUAL, 1); 00062 #else 00063 00064 // use a simple ANSI string 00065 wxString mgSpecialSymPanel::strSymbols = wxT("<=>"); 00066 #endif 00067 00068 wxString mgSpecialSymPanel::strSymbolsTooltip[] = { wxT("Less or equal than"), 00069 wxT("Less than"), wxT("Equal to"), wxT("Different from"), wxT("Greater than"), 00070 wxT("Greater or equal than") }; 00071 00072 00073 // event table for mgSpecialSymPanel 00074 BEGIN_EVENT_TABLE(mgSpecialSymPanel, mgButtonListPanel) 00075 00076 // buttons 00077 EVT_COMMAND_RANGE(IDC_SPECIALSYMDLG_BUTTONS, 00078 (IDC_SPECIALSYMDLG_BUTTONS+mgSpecialSymPanel::strSymbols.Len()), 00079 wxEVT_COMMAND_BUTTON_CLICKED, mgSpecialSymPanel::OnButtons) 00080 00081 END_EVENT_TABLE() 00082 00083 00084 00085 00086 // ------------------- 00087 // mgSPECIALSYMPANEL 00088 // ------------------- 00089 00090 mgSpecialSymPanel::mgSpecialSymPanel(wxWindow *parent, wxWindow *client, 00091 mgMathWnd *mathwnd, 00092 mgMathBox *mathbox, wxWindowID id, 00093 const wxPoint &position, 00094 const wxSize& size, long style) : 00095 // init base class 00096 mgButtonListPanel(parent, client, mathwnd, mathbox, 00097 SPECIALSYMDLG_COLUMNS, SPECIALSYMDLG_ROWS, IDC_SPECIALSYMDLG_BUTTONS, 00098 id, position, size, style) 00099 { 00100 // set up the font containing the greek symbols 00101 m_fButtons = mcElementHelpers::gui_GetDefaultStyle(0)->GetTextSettingsFor(mcET_ADDOP)->m_hFont; 00102 //mcElementHelpers::gui_GetDefaultStyle(0)->GetSpecialTextSettings()->m_hFont; 00103 m_fButtons.SetPointSize(SPECIALSYMDLG_FONT_POINTSIZE); 00104 00105 // build all the buttons 00106 BuildSizer(); 00107 BuildButtons(); 00108 BuildPanel(); 00109 } 00110 00111 void mgSpecialSymPanel::BuildButtons() 00112 { 00113 // add the buttons to the main sizer 00114 wxSize size = FindBiggestLetter(strSymbols); 00115 size.x = (int)(size.x*1.5); 00116 size.y = (int)(size.y/2.0); 00117 AddButtonsToSizer(0, strSymbols.Len(), size); 00118 } 00119 00120 void mgSpecialSymPanel::OnButtons( wxCommandEvent &ev ) 00121 { 00122 // just send the symbol to the mathbox 00123 SendSpecialKeyEvent(this, strSymbols.GetChar(GetButtonID(ev))); 00124 } 00125 00126 00127 00128 00129 00130 // --------------------- 00131 // mgSPECIALSYMPALETTE 00132 // --------------------- 00133 00134 void mgSpecialSymPalette::Build(wxWindow *client, mgMathWnd *mathwnd, mgMathBox *mathbox) 00135 { 00136 /*wxPanel *main = new wxPanel(this); 00137 wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); 00138 00139 // create a sizer containing both the mgSmallGreekPanel & the 00140 // mgCapitalGreekPanel panels separed by an horizontal line 00141 sizer->Add(new mgSmallGreekPanel(main, client, mathwnd, mathbox), 00142 1, wxGROW | wxALL, 5); 00143 sizer->Add(new wxStaticLine(main, -1), 00144 0, wxGROW | wxLEFT | wxRIGHT, 5); 00145 sizer->Add(new mgCapitalGreekPanel(main, client, mathwnd, mathbox), 00146 1, wxGROW | wxALL, 5); 00147 00148 main->SetSizer(sizer); 00149 sizer->SetSizeHints(main); 00150 00151 SetClient(main);*/ 00152 00153 #ifdef mgUSE_PALETTEFRM 00154 SetClient(new mgSpecialSymPanel(this, client, mathwnd, mathbox)); 00155 AddMiniButton(new wxCollapseBox(this)); 00156 SetSizeHintsUsingClientHints(); 00157 #else 00158 new mgSpecialSymPanel(this, client, mathwnd, mathbox); 00159 SetSize(200, 130); // an arbitrary size 00160 #endif 00161 }
[ Top ] |