]> Creatis software - bbtkGEditor.git/blob - appli/bbEditor/bbEditor.cxx
88dd4c1c78a395328ea6613e913f264d40e871b1
[bbtkGEditor.git] / appli / bbEditor / bbEditor.cxx
1 #ifdef _USE_WXWIDGETS_
2
3 //==========================================================================
4 // WITH WX
5 //==========================================================================
6
7 #include "bbtkwxGUIEditorGraphicBBS.h"
8
9 #include <wx/cmdline.h>
10 #include <wx/app.h>
11 #include <wx/sysopt.h>
12
13 class wxBBEditorApp : public wxApp
14 {
15 public:
16   bool OnInit( );
17   int  OnExit() { return true; }
18 };
19
20 IMPLEMENT_APP(wxBBEditorApp);
21
22
23
24 // ----------------------------------------------------------------------------
25 // The `main program' equivalent, creating the windows and returning the
26 // main frame
27 bool wxBBEditorApp::OnInit( )
28 {
29 #ifdef MACOSX
30         /* assume this is OSX */
31         wxSystemOptions::SetOption("mac.listctrl.always_use_generic", 1);
32 #endif
33
34         wxApp::OnInit();
35 #ifdef __WXGTK__
36   //See http://www.wxwindows.org/faqgtk.htm#locale
37   setlocale(LC_NUMERIC, "C");
38 #endif
39
40         bbtk::wxGUIEditorGraphicBBS *iegbbs;
41         iegbbs = new bbtk::wxGUIEditorGraphicBBS(NULL);
42         SetTopWindow(iegbbs);
43         iegbbs->Show(true);
44
45         return true;
46 }
47
48
49 #if defined(_WIN32)
50
51 //  How to have a Console and wxWidgets
52 //  http://www.wxwidgets.org/wiki/index.php/MSVC_Setup_Guide
53 //   In Visual C++ 6 (7 should be similar), to create an application that is both a console application
54 //  (cout's to the console are visible) and has a wxWidgets GUI,
55 //  you need to use the linker option "/subsystem:console" and the following code:
56 int main(int argc, char* argv[])
57 {
58         return WinMain(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), SW_SHOWNORMAL);
59 }
60
61 #endif // defined(_WIN32)
62
63
64 #else
65 //==========================================================================
66 // WITHOUT WX
67 //==========================================================================
68 #include <iostream>
69 int main(int argc, char* argv[])
70 {
71   std::cout << "bbStudio was not compiled with wxWidgets : ciao !" <<std::endl;
72   return 0;
73 }
74
75 // EOF
76 #endif //#ifdef _USE_WXWIDGETS_
77
78
79