1 /*=========================================================================
7 =========================================================================*/
9 /* ---------------------------------------------------------------------
11 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
12 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
14 * This software is governed by the CeCILL-B license under French law and
15 * abiding by the rules of distribution of free software. You can use,
16 * modify and/ or redistribute the software under the terms of the CeCILL-B
17 * license as circulated by CEA, CNRS and INRIA at the following URL
18 * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
19 * or in the file LICENSE.txt.
21 * As a counterpart to the access to the source code and rights to copy,
22 * modify and redistribute granted by the license, users are provided only
23 * with a limited warranty and the software's author, the holder of the
24 * economic rights, and the successive licensors have only limited
27 * The fact that you are presently reading this means that you have had
28 * knowledge of the CeCILL-B license and that you accept its terms.
29 * ------------------------------------------------------------------------ */
33 * \brief Class bbtk::WxInterfaceEditorGraphicBBS .
36 #include "bbtkwxGUIEditorGraphicBBS.h"
42 //=========================================================================
43 wxGUIEditorGraphicBBS::wxGUIEditorGraphicBBS(wxFrame *parent)
44 : wxFrame(parent, -1, _T("bbtkGEditor"),wxDefaultPosition, wxSize(1200,800))
46 _frameAUIMgr = new wxAuiManager(this);
49 //std::string datadir( crea::System::GetExecutablePath() );
50 std::string datadir (".");
51 cout<<"RaC //------------------"<<endl;
52 cout<<"RaC //TODO wxGUIEditorGraphicBBS constructor.Initialize datadir with crea::System::GetExecutablePath() ."<<endl;
53 cout<<"RaC //------------------"<<endl;
55 #ifdef LINUX /* assume this is OSX */
56 datadir=datadir+"/../share/creaContours";
59 #ifdef MACOSX /* assume this is OSX */
60 datadir=datadir+"/../../../../share/creaContours";
67 initTabPanelsManager();
69 initHelpHTMLBrowser();
72 _frameAUIMgr->Update();
76 //=========================================================================
77 wxGUIEditorGraphicBBS::~wxGUIEditorGraphicBBS()
79 _frameAUIMgr->UnInit();
82 //=========================================================================
83 void wxGUIEditorGraphicBBS::initToolbar()
85 //std::string filename= _dataDir + "/data/icons/wxart_new.xpm";
86 wxBitmap bmp_new(new_xpm);
88 wxToolBar *_toolbar = new wxToolBar(this, wxID_ANY);
90 //Adds a tool btn to the toolbar
91 _toolbar->AddTool(wxID_NEW,_T("New"),bmp_new, wxNullBitmap, wxITEM_NORMAL,_T("New tab"), _T("Create a new panel tab"));
93 _toolbar->SetMargins( 2, 2 );
97 // connect command event handlers
98 Connect(wxID_NEW,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnToolLeftClick));
101 //=========================================================================
102 void wxGUIEditorGraphicBBS::initHelpHTMLBrowser()
105 _helpHtmlBrowser = new WxGUIHtmlBrowser(this,wxSize(200,0));
106 _frameAUIMgr->AddPane(_helpHtmlBrowser,wxAuiPaneInfo().Right().MinSize(200,200));
109 //=========================================================================
110 void wxGUIEditorGraphicBBS::initMenu()
113 wxMenu *fileMenu = new wxMenu;
115 // the "About" item should be in the help menu
116 wxMenu *helpMenu = new wxMenu;
117 helpMenu->Append(wxID_ABOUT, _T("&About..."), _T("About"));
118 fileMenu->Append(wxID_EXIT, _T("E&xit"), _T("Exit"));
120 Connect(wxID_EXIT,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnExit));
122 // now append the freshly created menu to the menu bar...
123 wxMenuBar *menuBar = new wxMenuBar();
124 menuBar->Append(fileMenu, _T("&File"));
125 menuBar->Append(helpMenu, _T("&Help"));
127 // attach this menu bar to the frame
131 //=========================================================================
132 void wxGUIEditorGraphicBBS::initTabPanelsManager()
134 wxAuiNotebook *notebook = new wxAuiNotebook(this,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxAUI_NB_TOP|wxAUI_NB_TAB_MOVE|wxAUI_NB_CLOSE_ON_ACTIVE_TAB|wxAUI_NB_TAB_FIXED_WIDTH|wxAUI_NB_WINDOWLIST_BUTTON);
135 _tabsMgr = new wxTabPanelsManager(notebook);
136 _frameAUIMgr->AddPane(notebook,wxAuiPaneInfo().CenterPane());
140 //=========================================================================
141 void wxGUIEditorGraphicBBS::initPackageBrowser()
143 _pkgBrowser = new WxGUIPackageBrowser2(this);
144 _pkgBrowser->IncludeAll();
145 _frameAUIMgr->AddPane(_pkgBrowser,wxAuiPaneInfo().Left().MinSize(200,200).CloseButton(false));
148 /*****************************************************
150 /*****************************************************/
152 void wxGUIEditorGraphicBBS::OnToolLeftClick(wxCommandEvent& event)
154 switch (event.GetId())
157 std::cout<<"RaC New"<<std::endl;
158 _tabsMgr->addNewTab();
163 void wxGUIEditorGraphicBBS::OnExit(wxCommandEvent& event)
169 } // EO namespace bbtk