]> Creatis software - bbtkGEditor.git/blob - appli/bbEditor/bbEditor.cxx
no message
[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 printf("EED wxBBEditorApp::OnInit 0\n");
42         iegbbs = new bbtk::wxGUIEditorGraphicBBS(NULL);
43 printf("EED wxBBEditorApp::OnInit 1\n");
44         SetTopWindow(iegbbs);
45         iegbbs->Show(true);
46 printf("EED wxBBEditorApp::OnInit 2\n");
47
48         return true;
49 }
50
51
52 #if defined(_WIN32)
53
54 //  How to have a Console and wxWidgets
55 //  http://www.wxwidgets.org/wiki/index.php/MSVC_Setup_Guide
56 //   In Visual C++ 6 (7 should be similar), to create an application that is both a console application
57 //  (cout's to the console are visible) and has a wxWidgets GUI,
58 //  you need to use the linker option "/subsystem:console" and the following code:
59 int main(int argc, char* argv[])
60 {
61         return WinMain(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), SW_SHOWNORMAL);
62 }
63
64 #endif // defined(_WIN32)
65
66
67 #else
68 //==========================================================================
69 // WITHOUT WX
70 //==========================================================================
71 #include <iostream>
72 int main(int argc, char* argv[])
73 {
74   std::cout << "bbStudio was not compiled with wxWidgets : ciao !" <<std::endl;
75   return 0;
76 }
77
78 // EOF
79 #endif //#ifdef _USE_WXWIDGETS_
80
81
82