#ifdef _USE_WXWIDGETS_ //========================================================================== // WITH WX //========================================================================== #include "bbtkInterpreter.h" #include "bbtkWxGUIHtmlBrowser.h" #include "bbtkWxGUIPackageBrowser2.h" #include "../../src/icons/cc_run.xpm" #include "../../src/icons/cc_exit.xpm" using namespace bbtk; class /*BBTK_EXPORT*/ WxGUIHelp : public wxFrame // public InterpreterUser { public: WxGUIHelp( wxWindow *parent, wxString title, wxSize size ); ~WxGUIHelp(); void OnButtonRun(wxCommandEvent& WXUNUSED(event)); void OnButtonQuit(wxCommandEvent& WXUNUSED(event)); // WxGUIHtmlBrowser* mWxGUIHtmlBrowser; WxGUIPackageBrowser2* mWxGUIPackageBrowser; // wxButton* mwxButtonRun; wxButton* mwxButtonQuit; // bool InterpreterUserHasOwnHtmlPageViewer() { return false; } // void InterpreterUserViewHtmlPage(const std::string&) {} DECLARE_EVENT_TABLE(); }; enum { ID_Button_Run, ID_Button_Quit }; WxGUIHelp::WxGUIHelp( wxWindow *parent, wxString title, wxSize size ) : wxFrame((wxFrame *)parent, -1, title, wxDefaultPosition, size) // InterpreterUser() { wxBoxSizer *helpsizer = new wxBoxSizer(wxVERTICAL); // mWxGUIHtmlBrowser = new WxGUIHtmlBrowser(this,wxSize(200,0)); // helpsizer->Add (mWxGUIHtmlBrowser,1, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5 ); mWxGUIPackageBrowser = new WxGUIPackageBrowser2(this); helpsizer->Add (mWxGUIPackageBrowser,1, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5 ); wxBoxSizer *btnsizer = new wxBoxSizer(wxHORIZONTAL); /* wxBitmap bmp_run(cc_run_xpm); mwxButtonRun = new wxBitmapButton(this,ID_Button_Run,bmp_run); btnsizer->Add( mwxButtonRun, 0, wxALL, 5 ); */ wxBitmap bmp_quit(cc_exit_xpm); mwxButtonQuit = new wxBitmapButton(this,ID_Button_Quit,bmp_quit); btnsizer->Add( mwxButtonQuit, 0, wxALL, 5 ); helpsizer->Add( btnsizer ); // Creates and sets the parent window of all bbtk windows /* wxWindow* top = new wxPanel(this,-1);//,_T("top")); top->Hide(); Wx::SetTopWindow(top); */ SetSizer(helpsizer); SetAutoLayout(true); Layout(); // mWxGUIHtmlBrowser->GoHome(); mWxGUIPackageBrowser->IncludeAll(); } WxGUIHelp::~WxGUIHelp() {} /* void WxGUIHelp::OnButtonRun(wxCommandEvent& WXUNUSED(event)) { //std::string filename = wx2std(mWxGUIHtmlBrowser->GetCurrentPage()); std::string filename = mWxGUIHtmlBrowser->GetCurrentPage(); size_t s = filename.length(); Interpreter::Pointer I = Interpreter::New(); I->SetThrow(true); if ((s>3) && (filename[s-1]=='s') && (filename[s-2]=='b') && (filename[s-3]=='b') && (filename[s-4]=='.')) { try { I->InterpretFile(filename); } catch (QuitException e) { std::cout << "QuitException caught"<Show(true); return true; } /* #if defined(_WIN32) // How to have a Console and wxWidgets // http://www.wxwidgets.org/wiki/index.php/MSVC_Setup_Guide // In Visual C++ 6 (7 should be similar), to create an application that is both a console application // (cout's to the console are visible) and has a wxWidgets GUI, // you need to use the linker option "/subsystem:console" and the following code: int main(int argc, char* argv[]) { return WinMain(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), SW_SHOWNORMAL); } #endif // defined(_WIN32) */ #else //========================================================================== // WITHOUT WX //========================================================================== int main(int argc, char* argv[]) { return 0; } // EOF #endif //#ifdef _USE_WXWIDGETS_