00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00030
00031
00032 #ifndef PALETTEDLG_H
00033 #define PALETTEDLG_H
00034
00035
00036
00037
00038 #include "mg/MathBoxWndUser.h"
00039
00040
00041 #ifdef mgUSE_PALETTEFRM
00042 #include <wx/palettefrm.h>
00043 #include <wx/minibtn.h>
00044 #else
00045
00046 #define wxPaletteFrame wxMiniFrame
00047 #define wxPALETTEFRM_DEFAULT_STYLE wxDEFAULT_FRAME_STYLE
00048 #include <wx/minifram.h>
00049
00050 class wxMainFrame : public wxFrame
00051 {
00052 public:
00053 wxMainFrame(wxWindow* parent, wxWindowID id, const wxString& title,
00054 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
00055 long style = wxDEFAULT_FRAME_STYLE, const wxString& name = wxT("frame"))
00056 : wxFrame(parent, id, title, pos, size, style, name) {}
00057
00058 void InitPalContextMenu() {}
00059 };
00060
00061 #endif
00062
00063
00064
00065 #ifdef __GNUG__
00066 #pragma interface "PaletteDlg.h"
00067 #endif
00068
00069
00070 #define BUTTONLISTPANEL_MAX_HORIZONTAL_LINES 10
00071
00072
00081
00092 class mgButtonListPanel : public wxPanel, public mgMathBoxWndUser
00093 {
00094 protected:
00095
00098
00099
00100 int m_nColumns, m_nRows;
00101 int m_nBaseID;
00102
00106 wxWindow *m_pClientWnd;
00107
00110 bool m_bBuildComplete;
00111
00113 wxFont m_fButtons;
00114 float m_fButtonFontRatio;
00115 bool m_bEnableFontButtonUpdate;
00116
00117
00118 protected:
00119
00123
00126 virtual void BuildPanel(int border = 5, int proportion = 30);
00127
00130 virtual void BuildSizer();
00131
00133 void AddHorizontalSpacer();
00134
00138 void AddButtonsToSizer(int idoffset, int num, wxSize sz);
00139
00142 wxSize FindBiggestLetter(const wxString &str);
00143
00146 int GetDefaultWidth(const wxString &str) {
00147 wxScreenDC dc;
00148 dc.SetFont(m_fButtons);
00149 return FindBiggestLetter(str).GetWidth()*GetColCount();
00150 }
00151
00152 int GetDefaultHeight(const wxString &str) {
00153 wxScreenDC dc;
00154 dc.SetFont(m_fButtons);
00155 return FindBiggestLetter(str).GetHeight()*GetRowCount();
00156 }
00157
00158 void SetFontButtonPointSize(int pointsize);
00159 void UpdateFontButton();
00160 void OnSize(wxSizeEvent &);
00161
00164 void SetClientWindow(wxWindow *p) { m_pClientWnd = p; }
00165
00168 virtual int GetButtonID(wxCommandEvent &) const;
00169
00170 int GetColCount() const { return m_nColumns; }
00171 int GetRowCount() const { return m_nRows; }
00172
00176 int GetBaseID() const { return m_nBaseID; }
00177
00179
00180
00181
00185
00187 virtual wxString GetButtonLabel(int n) = 0;
00188
00190 virtual wxString GetButtonTooltip(int n) = 0;
00191
00193
00194
00195 public:
00196
00203 mgButtonListPanel(
00204 wxWindow *parent,
00205 wxWindow *client,
00206 mgMathWnd *mathwnd,
00207 mgMathBox *mathbox,
00208 int cols, int rows,
00209 int baseid,
00210 wxWindowID id = -1,
00211 const wxPoint &pos = wxDefaultPosition,
00212 const wxSize &size = wxDefaultSize,
00213 long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) :
00214 wxPanel(parent, id, pos, size, style),
00215 mgMathBoxWndUser(mathwnd, mathbox) {
00216
00217 m_nColumns = cols;
00218 m_nRows = rows;
00219 m_nBaseID = baseid;
00220 m_pClientWnd = client;
00221 m_bBuildComplete = FALSE;
00222 m_bEnableFontButtonUpdate = FALSE;
00223 m_fButtonFontRatio = 0.0;
00224
00225 }
00226
00227 virtual ~mgButtonListPanel() {
00228
00229 }
00230
00231
00232 private:
00233 DECLARE_CLASS(mgButtonListPanel)
00234 DECLARE_EVENT_TABLE()
00235 };
00236
00237
00238 #endif
00239