]> Creatis software - bbtkGEditor.git/blob - appli/bbEditor/bbEditor.cxx
292a4c8183863a9eb1850f14e1f6a1918d1d46a0
[bbtkGEditor.git] / appli / bbEditor / bbEditor.cxx
1 /*
2 # ---------------------------------------------------------------------
3 #
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image 
5 #                        pour la Santé)
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 #
8 #  This software is governed by the CeCILL-B license under French law and 
9 #  abiding by the rules of distribution of free software. You can  use, 
10 #  modify and/ or redistribute the software under the terms of the CeCILL-B 
11 #  license as circulated by CEA, CNRS and INRIA at the following URL 
12 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
13 #  or in the file LICENSE.txt.
14 #
15 #  As a counterpart to the access to the source code and  rights to copy,
16 #  modify and redistribute granted by the license, users are provided only
17 #  with a limited warranty  and the software's author,  the holder of the
18 #  economic rights,  and the successive licensors  have only  limited
19 #  liability. 
20 #
21 #  The fact that you are presently reading this means that you have had
22 #  knowledge of the CeCILL-B license and that you accept its terms.
23 # ------------------------------------------------------------------------   
24 */
25
26 #ifdef _USE_WXWIDGETS_
27
28 //==========================================================================
29 // WITH WX
30 //==========================================================================
31
32 #include "bbtkwxGUIEditorGraphicBBS.h"
33
34 #include <wx/cmdline.h>
35 #include <wx/app.h>
36 #include <wx/sysopt.h>
37
38 class wxBBEditorApp : public wxApp
39 {
40 public:
41   bool OnInit( );
42   int  OnExit() { return true; }
43 };
44
45 IMPLEMENT_APP(wxBBEditorApp);
46
47
48
49 // ----------------------------------------------------------------------------
50 // The `main program' equivalent, creating the windows and returning the
51 // main frame
52 bool wxBBEditorApp::OnInit( )
53 {
54 #ifdef MACOSX
55         /* assume this is OSX */
56         wxSystemOptions::SetOption("mac.listctrl.always_use_generic", 1);
57 #endif
58
59         wxApp::OnInit();
60 #ifdef __WXGTK__
61   //See http://www.wxwindows.org/faqgtk.htm#locale
62   setlocale(LC_NUMERIC, "C");
63 #endif
64
65         bbtk::wxGUIEditorGraphicBBS *iegbbs;
66         iegbbs = new bbtk::wxGUIEditorGraphicBBS(NULL);
67         SetTopWindow(iegbbs);
68         iegbbs->Show(true);
69
70         return true;
71 }
72
73
74 #if defined(_WIN32)
75
76 //  How to have a Console and wxWidgets
77 //  http://www.wxwidgets.org/wiki/index.php/MSVC_Setup_Guide
78 //   In Visual C++ 6 (7 should be similar), to create an application that is both a console application
79 //  (cout's to the console are visible) and has a wxWidgets GUI,
80 //  you need to use the linker option "/subsystem:console" and the following code:
81 int main(int argc, char* argv[])
82 {
83         return WinMain(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), SW_SHOWNORMAL);
84 }
85
86 #endif // defined(_WIN32)
87
88
89 #else
90 //==========================================================================
91 // WITHOUT WX
92 //==========================================================================
93 #include <iostream>
94 int main(int argc, char* argv[])
95 {
96   std::cout << "bbStudio was not compiled with wxWidgets : ciao !" <<std::endl;
97   return 0;
98 }
99
100 // EOF
101 #endif //#ifdef _USE_WXWIDGETS_
102
103
104