From 79be5edd158476cd0f21d3146223594234ef06fc Mon Sep 17 00:00:00 2001 From: guigues Date: Tue, 17 Feb 2009 10:37:29 +0000 Subject: [PATCH] *** empty log message *** --- src2/creaImageIOGimmickView.cpp | 16 +++ src2/creaImageIOGimmickView.h | 7 ++ src2/creaImageIOWxGimmickView.cpp | 174 +++++++++++++++++++++++++++++- src2/creaImageIOWxGimmickView.h | 26 ++++- src2/creaImageIOWxTreeView.cpp | 51 +++++++++ src2/creaImageIOWxTreeView.h | 6 +- 6 files changed, 272 insertions(+), 8 deletions(-) diff --git a/src2/creaImageIOGimmickView.cpp b/src2/creaImageIOGimmickView.cpp index d7f04de..c391d4a 100644 --- a/src2/creaImageIOGimmickView.cpp +++ b/src2/creaImageIOGimmickView.cpp @@ -5,6 +5,7 @@ namespace creaImageIO { // CTor GimmickView::GimmickView(Gimmick* gimmick) + : mGimmick(gimmick) { GimmickDebugMessage(1,"GimmickView::GimmickView" <GetTreeHandlerMap().begin(); + i!= mGimmick->GetTreeHandlerMap().end(); + ++i) + { + this->CreateTreeView(i->second); + } + } + } // EO namespace creaImageIO diff --git a/src2/creaImageIOGimmickView.h b/src2/creaImageIOGimmickView.h index a9298b9..1bef90c 100644 --- a/src2/creaImageIOGimmickView.h +++ b/src2/creaImageIOGimmickView.h @@ -3,6 +3,7 @@ #include #include +#include //#include #include @@ -51,6 +52,12 @@ namespace creaImageIO virtual void GetSelectedImages(std::vector& s) {} virtual void GetSelectedFiles(std::vector& s) {} + /// Create the tree views + void CreateTreeViews(); + + /// Create the tree view for TreeHandler provided + virtual void CreateTreeView( TreeHandler* h) { GimmickError("INTERNAL ERROR : CreateTreeView not implemented"); } + private: /// Controller which manages the interaction with the model Gimmick* mGimmick; diff --git a/src2/creaImageIOWxGimmickView.cpp b/src2/creaImageIOWxGimmickView.cpp index b5ee40f..c30f96c 100644 --- a/src2/creaImageIOWxGimmickView.cpp +++ b/src2/creaImageIOWxGimmickView.cpp @@ -1,8 +1,59 @@ #include +#include #include +// Icons +#include "../src/icons/database.xpm" +#include "../src/icons/folder.xpm" +#include "../src/icons/dicomdir.xpm" +#include "../src/icons/patient.xpm" +#include "../src/icons/study.xpm" +#include "../src/icons/series.xpm" +#include "../src/icons/image.xpm" +#include "../src/icons/root.xpm" + +#include + namespace creaImageIO { + //====================================================================== + // The ids of the different tools + enum + { + TOOL_ADDFILE_ID = 1 + }; + //====================================================================== + + //================================================================ + // + const int icon_number = 8; + // Icon ids + typedef enum + { + Icon_Root, + Icon_Database, + Icon_Folder, + Icon_DicomDir, + Icon_Patient, + Icon_Study, + Icon_Series, + Icon_Image + } + icon_id; + //================================================================ + + //================================================================ + /* + const icon_id Icon[5] = { Icon_Database, + Icon_Patient, + Icon_Study, + Icon_Series, + Icon_Image }; + */ + //================================================================ + + + //====================================================================== // CTor WxGimmickView::WxGimmickView(Gimmick* gimmick, wxWindow *parent, @@ -15,23 +66,138 @@ namespace creaImageIO { GimmickDebugMessage(1,"WxGimmickView::WxGimmickView" <Add( mToolBar ,0, wxGROW ,0); + + // Split part below toolbar into notebook for views and panel + // for preview, messages... + mSplitter = new wxSplitterWindow( this , -1); + + // Notebook - mNotebook = new wxNotebook(this, + mNotebook = new wxNotebook(mSplitter, -1,wxDefaultPosition, wxDefaultSize, 0); - + + // Create the views + CreateTreeViews(); + + // Bottom panel + mBottomPanel = new wxPanel(mSplitter,-1); + + // Splitting + int hsize = size.GetHeight(); + int bottom_minsize = 200; + + mSplitter->SetMinimumPaneSize( viewsminsize ); + mSplitter->SplitHorizontally( mNotebook, mBottomPanel, + hsize - bottom_minsize); + + sizer->Add( mSplitter,1,wxGROW ,0); + + + SetSizer( sizer ); + SetAutoLayout(true); + Layout(); + } + //====================================================================== + //====================================================================== /// Destructor WxGimmickView::~WxGimmickView() { GimmickDebugMessage(1,"WxGimmickView::~WxGimmickView" <AddTool( TOOL_ADDFILE_ID, + _T("Add file"), + mIcon->GetBitmap(Icon_Database), + _T("Add file") + ); + //const wxBitmap& bitmap1, const wxString& shortHelpString = "", wxItemKind kind = wxITEM_NORMAL) + + mToolBar->Realize(); + } + //====================================================================== + + + //====================================================================== + /// Create the tree view for TreeHandler provided + void WxGimmickView::CreateTreeView( TreeHandler* h) + { + std::string name(h->GetTree().GetAttribute("Name")); + GimmickMessage(2,"Creating the tree view for '"<< + name<<"'"<AddPage( view, crea::std2wx(name) ); + + } + //====================================================================== + + + + //================================================= + void WxGimmickView::CreateIconList() + { + // Size of the icons; + int size = 32; + + wxIcon icons[20]; + // should correspond to Icon_xxx enum + icons[Icon_Patient] = wxIcon(patient_xpm); + icons[Icon_Study] = wxIcon(study_xpm); + icons[Icon_Series] = wxIcon(series_xpm); + icons[Icon_Image] = wxIcon(image_xpm); + icons[Icon_Database] = wxIcon(database_xpm); + icons[Icon_Folder] = wxIcon(folder_xpm); + icons[Icon_DicomDir] = wxIcon(dicomdir_xpm); + icons[Icon_Root] = wxIcon(root_xpm); + + unsigned int NbIcons = 8; + // Make an image list containing small icons + mIcon = new wxImageList(size,size,true); + + // Make all icons the same size = size of the first one + int sizeOrig = icons[0].GetWidth(); + for ( size_t i = 0; i < NbIcons; i++ ) + { + if ( size == sizeOrig ) + { + mIcon->Add(icons[i]); + } + else + { + mIcon->Add(wxBitmap(wxBitmap(icons[i]).ConvertToImage().Rescale(size, size))); + } + } + } + //================================================= + + } // EO namespace creaImageIO diff --git a/src2/creaImageIOWxGimmickView.h b/src2/creaImageIOWxGimmickView.h index 08710e6..b6e4121 100644 --- a/src2/creaImageIOWxGimmickView.h +++ b/src2/creaImageIOWxGimmickView.h @@ -6,6 +6,10 @@ #include #include +#include +#include +#include +#include namespace creaImageIO { @@ -31,12 +35,28 @@ namespace creaImageIO /// Virtual destructor virtual ~WxGimmickView(); + protected: + /// Creates the tool bar + void CreateToolBar(); - + /// Create the tree view for TreeHandler provided + /// (overloaded from GimmickView) + void CreateTreeView( TreeHandler* ); private: - - }; + /// The ToolBar and the tools + wxToolBar* mToolBar; + wxToolBarToolBase* mToolAddFile; + + wxSplitterWindow* mSplitter; + wxPanel* mBottomPanel; + wxNotebook* mNotebook; + + /// The list of icons + wxImageList * mIcon; + void CreateIconList(); + + }; // EO class WxGimmickView //===================================================================== diff --git a/src2/creaImageIOWxTreeView.cpp b/src2/creaImageIOWxTreeView.cpp index fb6bcf3..f615a69 100644 --- a/src2/creaImageIOWxTreeView.cpp +++ b/src2/creaImageIOWxTreeView.cpp @@ -1,5 +1,6 @@ #include #include +#include namespace creaImageIO { @@ -12,6 +13,56 @@ namespace creaImageIO { GimmickDebugMessage(1,"WxTreeView::WxTreeView" < 0 (not for Root level) + for (int i = 1; + i < handler->GetTree().GetNumberOfLevels(); + ++i) + { + GimmickDebugMessage(5,"Creating ListCtrl for level "<GetTree().GetAttributeDescriptorList(i).begin(); + a != handler->GetTree().GetAttributeDescriptorList(i).end(); + ++a) + { + GimmickDebugMessage(5,"Creating column "<GetName() + <InsertColumn(col, + crea::std2wx(a->GetName()), + col_style); + col++; + } + mListCtrl.push_back(ctrl); + sizer->Add( ctrl ,1, wxGROW ,0); + } + + SetSizer( sizer ); + SetAutoLayout(true); + Layout(); + } /// Destructor diff --git a/src2/creaImageIOWxTreeView.h b/src2/creaImageIOWxTreeView.h index 678c626..65e783d 100644 --- a/src2/creaImageIOWxTreeView.h +++ b/src2/creaImageIOWxTreeView.h @@ -6,6 +6,8 @@ #include #include +#include + namespace creaImageIO { /** @@ -29,7 +31,9 @@ namespace creaImageIO private: - + /// The vector of wxListCtrl : one for each level of the tree + std::vector mListCtrl; + }; // EO class WxTreeView //===================================================================== -- 2.46.1