1 #include <creaImageIOWxGimmickView.h>
2 #include <creaImageIOWxTreeView.h>
3 #include <creaImageIOSystem.h>
6 #include "../src/icons/database.xpm"
7 #include "../src/icons/folder.xpm"
8 #include "../src/icons/dicomdir.xpm"
9 #include "../src/icons/patient.xpm"
10 #include "../src/icons/study.xpm"
11 #include "../src/icons/series.xpm"
12 #include "../src/icons/image.xpm"
13 #include "../src/icons/root.xpm"
15 #include <wx/imaglist.h>
19 //======================================================================
20 // The ids of the different tools
25 //======================================================================
27 //================================================================
29 const int icon_number = 8;
43 //================================================================
45 //================================================================
47 const icon_id Icon[5] = { Icon_Database,
53 //================================================================
56 //======================================================================
58 WxGimmickView::WxGimmickView(Gimmick* gimmick,
61 const wxPoint& pos, const wxSize& size,
63 int number_of_threads)
64 : wxPanel(parent,id,pos,size),
67 GimmickDebugMessage(1,"WxGimmickView::WxGimmickView"
69 // Create the list of icons (mIcon)
73 wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
75 // Create the tool bar
77 sizer->Add( mToolBar ,0, wxGROW ,0);
79 // Split part below toolbar into notebook for views and panel
80 // for preview, messages...
81 mSplitter = new wxSplitterWindow( this , -1);
85 mNotebook = new wxNotebook(mSplitter,
86 -1,wxDefaultPosition, wxDefaultSize, 0);
92 mBottomPanel = new wxPanel(mSplitter,-1);
95 int hsize = size.GetHeight();
96 int bottom_minsize = 200;
98 mSplitter->SetMinimumPaneSize( viewsminsize );
99 mSplitter->SplitHorizontally( mNotebook, mBottomPanel,
100 hsize - bottom_minsize);
102 sizer->Add( mSplitter,1,wxGROW ,0);
110 //======================================================================
112 //======================================================================
114 WxGimmickView::~WxGimmickView()
116 GimmickDebugMessage(1,"WxGimmickView::~WxGimmickView"
119 //======================================================================
121 //======================================================================
122 /// Creates the tool bar
123 void WxGimmickView::CreateToolBar()
125 long style = wxTB_HORIZONTAL | wxNO_BORDER;
126 mToolBar = new wxToolBar(this,-1,wxDefaultPosition,wxDefaultSize,
129 mToolAddFile = mToolBar->AddTool( TOOL_ADDFILE_ID,
131 mIcon->GetBitmap(Icon_Database),
134 //const wxBitmap& bitmap1, const wxString& shortHelpString = "", wxItemKind kind = wxITEM_NORMAL)
138 //======================================================================
141 //======================================================================
142 /// Create the tree view for TreeHandler provided
143 void WxGimmickView::CreateTreeView( TreeHandler* h)
145 std::string name(h->GetTree().GetAttribute("Name"));
146 GimmickMessage(2,"Creating the tree view for '"<<
147 name<<"'"<<std::endl);
148 // Create the WxTreeView
149 WxTreeView* view = new WxTreeView(h,mNotebook,-1);
151 // TO DO : TEST THAT A VIEW WITH SAME NAME IS NOT
152 // ALREADY IN THE MAP
153 GetTreeViewMap()[name] = view;
156 mNotebook->AddPage( view, crea::std2wx(name) );
159 //======================================================================
163 //=================================================
164 void WxGimmickView::CreateIconList()
166 // Size of the icons;
170 // should correspond to Icon_xxx enum
171 icons[Icon_Patient] = wxIcon(patient_xpm);
172 icons[Icon_Study] = wxIcon(study_xpm);
173 icons[Icon_Series] = wxIcon(series_xpm);
174 icons[Icon_Image] = wxIcon(image_xpm);
175 icons[Icon_Database] = wxIcon(database_xpm);
176 icons[Icon_Folder] = wxIcon(folder_xpm);
177 icons[Icon_DicomDir] = wxIcon(dicomdir_xpm);
178 icons[Icon_Root] = wxIcon(root_xpm);
180 unsigned int NbIcons = 8;
181 // Make an image list containing small icons
182 mIcon = new wxImageList(size,size,true);
184 // Make all icons the same size = size of the first one
185 int sizeOrig = icons[0].GetWidth();
186 for ( size_t i = 0; i < NbIcons; i++ )
188 if ( size == sizeOrig )
190 mIcon->Add(icons[i]);
194 mIcon->Add(wxBitmap(wxBitmap(icons[i]).ConvertToImage().Rescale(size, size)));
198 //=================================================
202 } // EO namespace creaImageIO