00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef MECHSYS_WXGUI_H
00023 #define MECHSYS_WXGUI_H
00024
00025 #include <iostream>
00026 #include "wx/wx.h"
00027 #include "wx/grid.h"
00028
00029 #include "gui/wxiconbox.h"
00030
00031 #define ICONS_PHI26_USE32
00032 #include "gui/icons.phi26.h"
00033
00034
00035
00036 class App : public wxApp
00037 {
00038 public:
00039 virtual bool OnInit();
00040 };
00041
00042
00043
00044 class Frame : public wxFrame
00045 {
00046 public:
00047
00048 Frame(wxString const & Title);
00049 ~Frame();
00050
00051 void OnQuit (wxCommandEvent & Event);
00052 void OnAbout (wxCommandEvent & Event);
00053 private:
00054
00055 DECLARE_EVENT_TABLE()
00056
00057 WxIconBox * _icon_box;
00058 };
00059
00060
00062
00063
00064
00065
00066 inline bool App::OnInit()
00067 {
00068 Frame * frame = new Frame(_("Minimal wxWidgets GUI App"));
00069 frame->Show(true);
00070 return true;
00071 }
00072
00073 DECLARE_APP (App)
00074
00075
00076
00077
00078 enum
00079 {
00080 ID_RUN = 100,
00081 ID_INP_1 = 110,
00082 ID_INP_2 = 120,
00083 ID_INP_3 = 130
00084 };
00085
00086 inline Frame::Frame(wxString const & Title)
00087 : wxFrame( NULL, wxID_ANY, Title)
00088 {
00089
00090 wxMenuBar * mnu_bar = new wxMenuBar;
00091 wxMenu * mnu_file = new wxMenu;
00092 wxMenu * mnu_run = new wxMenu;
00093 wxMenu * mnu_help = new wxMenu;
00094 mnu_file->Append(wxID_EXIT , _("&Quit\tCtrl-Q") , _("Quit this program"));
00095 mnu_run ->Append(ID_RUN , _("&Run\tCtrl-R") , _("Run simulation"));
00096 mnu_help->Append(wxID_ABOUT, _("&About\tF1") , _("Show about dialog"));
00097 mnu_bar ->Append(mnu_file , _("&File"));
00098 mnu_bar ->Append(mnu_run , _("&Run"));
00099 mnu_bar ->Append(mnu_help , _("&Help"));
00100 SetMenuBar(mnu_bar);
00101
00102
00103 CreateStatusBar(2);
00104 SetStatusText(_("Welcome !"));
00105
00106
00107 _icon_box = new WxIconBox(this, wxID_ANY, wxDefaultPosition, 300, 6);
00108 _icon_box->Add(wxIcon(s32_crit_TR_phi_26),_(" (TR) Tresca "));
00109 _icon_box->Add(wxIcon(s32_crit_VM_phi_26),_(" (VM) von Mises "));
00110 _icon_box->Add(wxIcon(s32_crit_MC_phi_26),_(" (MC) Mohr-Coulomb "));
00111 _icon_box->Add(wxIcon(s32_crit_LD_phi_26),_(" (LD) Lade-Duncan "));
00112 _icon_box->Add(wxIcon(s32_crit_DP_phi_26),_(" (DP) Drucker-Prager "));
00113 _icon_box->Add(wxIcon(s32_crit_MN_phi_26),_(" (MN) Matsuoka-Nakai "));
00114 _icon_box->Add(wxIcon(s32_crit_SM_phi_26),_(" (SM) SMP (Novo) "));
00115 _icon_box->Add(wxIcon(s32_crit_AR_phi_26),_(" (AR) Argyris-Sheng et al. "));
00116
00117
00118 wxBoxSizer * bsz0 = new wxBoxSizer (wxVERTICAL);
00119 bsz0 -> Add (_icon_box, 0, wxALIGN_LEFT|wxALL, 5);
00120 this -> SetSizer (bsz0);
00121 bsz0 -> Fit (this);
00122 bsz0 -> SetSizeHints (this);
00123
00124 }
00125
00126 inline Frame::~Frame()
00127 {
00128 }
00129
00130 inline void Frame::OnQuit(wxCommandEvent & Event)
00131 {
00132 Close();
00133 }
00134
00135 inline void Frame::OnAbout(wxCommandEvent & Event)
00136 {
00137 wxString msg;
00138 msg.Printf(_("Hello and welcome to %s"), wxVERSION_STRING);
00139 wxMessageBox(msg, _("About Minimal"), wxOK | wxICON_INFORMATION, this);
00140 }
00141
00142 BEGIN_EVENT_TABLE(Frame, wxFrame)
00143 EVT_MENU (wxID_EXIT , Frame::OnQuit )
00144 EVT_MENU (wxID_ABOUT, Frame::OnAbout )
00145 END_EVENT_TABLE()
00146
00147 #endif // MECHSYS_WXGUI_H
00148
00149