From: guigues Date: Wed, 1 Oct 2008 14:23:56 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: v0.2.0~14 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=29cfc2f238ce7c522d3c878e032982d3a52d1044;p=creaImageIO.git *** empty log message *** --- diff --git a/appli/TestWxGimmickDialog/main.cxx b/appli/TestWxGimmickDialog/main.cxx index 63b001c..b0ad1da 100644 --- a/appli/TestWxGimmickDialog/main.cxx +++ b/appli/TestWxGimmickDialog/main.cxx @@ -2,6 +2,8 @@ #include #include +#include + class myApp : public wxApp { public: @@ -11,20 +13,7 @@ public: IMPLEMENT_APP(myApp); -#if defined(_WIN32) - -// How to have a Console and wxWidgets -// http://www.wxwidgets.org/wiki/index.php/MSVC_Setup_Guide -// In Visual C++ 6 (7 should be similar), to create an application that is both a console application -// (cout's to the console are visible) and has a wxWidgets GUI, -// you need to use the linker option "/subsystem:console" and the following code: -int main(int argc, char* argv[]) -{ - return WinMain(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), SW_SHOWNORMAL); -} - -#endif // defined(_WIN32) - +CREA_WXMAIN_WITH_CONSOLE bool myApp::OnInit( ) { @@ -35,14 +24,16 @@ bool myApp::OnInit( ) #endif wxInitAllImageHandlers(); + int image_type = GIMMICK_3D_IMAGE_SELECTION; int threads = 1; creaImageIO::WxGimmickDialog w(0, - -1, - _T("WxGimmickDialog test"), - wxDefaultPosition, - wxSize(1200,800), - threads); + -1, + _T("WxGimmickDialog test"), + wxDefaultPosition, + wxSize(1200,800), + image_type, + threads); w.ShowModal(); if (w.GetReturnCode() == wxID_OK) @@ -50,13 +41,19 @@ bool myApp::OnInit( ) std::cout << "$$$$ main : user clicked 'OK' $$$$"< s; - w.GetSelectedImages(s); + w.GetSelectedFiles(s); std::vector::iterator i; for (i=s.begin();i!=s.end();++i) { std::cout << *i << std::endl; } std::cout << "$$$$ "< images; + w.GetSelectedImages(images); + crea::VtkBasicSlicer(images.front()); + images.front()->Delete(); + } else if (w.GetReturnCode() == wxID_CANCEL) { diff --git a/src/creaImageIODicomNode.cpp b/src/creaImageIODicomNode.cpp index 011c434..1ddbd6f 100644 --- a/src/creaImageIODicomNode.cpp +++ b/src/creaImageIODicomNode.cpp @@ -165,6 +165,27 @@ namespace creaImageIO } //============================================================= + //============================================================= + int DicomNode::ImageGetRows() const + { + return atoi(UnsafeGetFieldValue("A0028_0010").c_str()); + } + //============================================================= + + //============================================================= + int DicomNode::ImageGetColumns() const + { + return atoi(UnsafeGetFieldValue("A0028_0011").c_str()); + } + //============================================================= + + //============================================================= + int DicomNode::ImageGetFrames() const + { + return atoi(UnsafeGetFieldValue("A0028_0008").c_str()); + } + //============================================================= + //============================================================= void DicomNode::Print() const { diff --git a/src/creaImageIODicomNode.h b/src/creaImageIODicomNode.h index ae45ed9..42949c6 100644 --- a/src/creaImageIODicomNode.h +++ b/src/creaImageIODicomNode.h @@ -97,6 +97,12 @@ namespace creaImageIO void SortChildren(const LexicographicalDicomNodeComparator&); + + int ImageGetRows() const; + int ImageGetColumns() const; + int ImageGetFrames() const; + const std::string& ImageGetFullFileName() const { return UnsafeGetFieldValue("FullFileName"); } + protected: DicomDatabase* mDicomDatabase; diff --git a/src/creaImageIOWxGimmick.cpp b/src/creaImageIOWxGimmick.cpp index 7bfed5b..2bcc3ab 100644 --- a/src/creaImageIOWxGimmick.cpp +++ b/src/creaImageIOWxGimmick.cpp @@ -255,14 +255,26 @@ namespace creaImageIO //================================================================ //================================================================ WxGimmick::WxGimmick(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - int threads) + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + int image_type, + int threads) : wxPanel(parent,id,pos,size), + mSelectionType(image_type), mSaveConfigurationOnClose(true), mReader(threads) { + // Initialize image size corresponding to current selection + switch (mSelectionType) + { + case GIMMICK_2D_IMAGE_SELECTION : mSelectionMaxImageDimension = 2; break; + case GIMMICK_3D_IMAGE_SELECTION : mSelectionMaxImageDimension = 3; break; + case GIMMICK_4D_IMAGE_SELECTION : mSelectionMaxImageDimension = 4; break; + default : mSelectionMaxImageDimension = 0; + } + + // Start the threads ... mReader.Start(); @@ -1023,6 +1035,54 @@ namespace creaImageIO } //================================================================ + //================================================================ + void WxGimmick::LoadChildren(wxTreeItemId& id) + { + TreeItemData *item = (TreeItemData *)mTreeListCtrl->GetItemData(id); + if (item) + { + if ( ( item->IsDicomNode() || item->IsDatabase() ) && + ( ! item->GetDicomNode()->ChildrenLoaded() ) ) + { + + // If children not already loaded : do it + if ( + item->GetDicomNode()->GetDicomDatabase()->DBLoadChildren + (item->GetDicomNode(),item->GetDicomNode()->GetType()+1) + > 0 ) + { + // Some new children loaded + // Sort them + if (mSettings.HasActiveComparator + (item->GetDicomNode()->GetType()+1)) + { + /* std::cout << "Sorting using '" + << mSettings.GetActiveComparator + (item->GetDicomNode()->GetType()+1).GetName() + << "' ... "; + */ + item->GetDicomNode()->SortChildren + ( mSettings.GetActiveComparator + (item->GetDicomNode()->GetType()+1) + ); + // std::cout << "ok"<GetDicomNode()->GetChildrenList().begin(); + i!=item->GetDicomNode()->GetChildrenList().end(); + i++) + { + UpdateDicomNodeView(*i,id); + } + } + // EO If children not already loaded + } + } + } + //================================================================ + + //================================================================ void WxGimmick::OnItemExpanded(wxTreeEvent& event) { @@ -1033,7 +1093,10 @@ namespace creaImageIO wxBusyCursor busy; wxTreeItemId itemId = event.GetItem(); - + LoadChildren(itemId); + + return; + // expand if collapsed and collapse if expanded ... TreeItemData *item = (TreeItemData *)mTreeListCtrl->GetItemData(itemId); @@ -1725,25 +1788,111 @@ namespace creaImageIO } //================================================= + + + + + + + + //================================================================ + bool WxGimmick::IsImageSelectable(DicomNode* node) + { + int rows = node->ImageGetRows(); + int cols = node->ImageGetColumns(); + int frms = node->ImageGetFrames(); + + // std::cout << "R/C/F = " << rows << "/"<< cols <<"/"<0) dim=3; + else if (cols>0) dim=2; + else if (rows>0) dim=1; + + if (dim == 0) + { + std::cout << "Unknown image dimension : cannot select !" + << std::endl; + return false; + } + else if (dim>mSelectionMaxImageDimension) + { + std::cout << "Selecting "<GetSelectionSize() == 0 ) + { + mCurrentSelectionImageSize[0] = cols; + mCurrentSelectionImageSize[1] = rows; + mCurrentSelectionImageSize[2] = frms; + return true; + } + else + { + if ( dim == mSelectionMaxImageDimension ) + { + std::cout << "Cannot add this image to selection : would result in a "<ImageGetFullFileName() << std::endl; + return true; + } + //================================================================ + //================================================================ void WxGimmick::OnSelChanging(wxTreeEvent& event) { + event.Veto(); wxTreeItemId id = event.GetItem(); if (!id.IsOk()) { - std::cout << "ERROR : ID NOT OK"<GetItemData(id); - event.Veto(); + TreeItemData *data = (TreeItemData *)mTreeListCtrl->GetItemData(id); if (data->IsDicomNode()) { - if ((data->GetDicomNode()>0)&& - ( data->GetDicomNode()->GetType()==DicomNode::Image)) + if (data->GetDicomNode()>0) { - event.Allow(); + // An image was selected + if (data->GetDicomNode()->GetType()==DicomNode::Image) + { + if (IsImageSelectable(data->GetDicomNode())) event.Allow(); + } + // A series was selected + else if (data->GetDicomNode()->GetType()==DicomNode::Series) + { + // If images not loaded do it + LoadChildren(id); + // can be selected if all its images can + wxTreeItemId child; + wxTreeItemIdValue cookie; + for (child = mTreeListCtrl->GetFirstChild(id,cookie); + child.IsOk(); + child = mTreeListCtrl->GetNextChild(id,cookie)) + { + TreeItemData *cdata = + (TreeItemData *)mTreeListCtrl->GetItemData(child); + if ((cdata->IsDicomNode())&& + (cdata->GetDicomNode()>0)&& + (cdata->GetDicomNode()->GetType()==DicomNode::Image)&& + (!IsImageSelectable(cdata->GetDicomNode()))) + return; + } + event.Allow(); + } } } } @@ -1817,9 +1966,9 @@ namespace creaImageIO // << nsib->GetFieldValue("FullFileName") // << "' prio="<GetFieldValue("FullFileName"), + nsib->ImageGetFullFileName(), prio); - mImageFileNameToNode[nsib->GetFieldValue("FullFileName")] = + mImageFileNameToNode[nsib->ImageGetFullFileName()] = nsib; prio--; } @@ -1836,9 +1985,9 @@ namespace creaImageIO // << nsib->GetFieldValue("FullFileName") // << "' prio="<GetFieldValue("FullFileName"), + nsib->ImageGetFullFileName(), prio); - mImageFileNameToNode[nsib->GetFieldValue("FullFileName")] = + mImageFileNameToNode[nsib->ImageGetFullFileName()] = nsib; prio--; } @@ -1999,9 +2148,17 @@ namespace creaImageIO //================================================================ + //================================================================ + // LG : For the moment any selection is valid but in the future + // incomplete selections can be invalid... + bool WxGimmick::IsSelectionValid() + { + return (mTreeListCtrl->GetSelectionSize()>0); + } + //================================================================ //================================================================ - void WxGimmick::GetSelectedImages(std::vector& f) + void WxGimmick::GetSelectedFiles(std::vector& f) { wxArrayTreeItemIds id; // TO DO : TEST THAT STYLE IS MULTIPLE @@ -2015,7 +2172,7 @@ namespace creaImageIO { if (data->GetDicomNode()->GetType()==DicomNode::Image) { - f.push_back ( data->GetDicomNode()->GetFieldValue("FullFileName") ); + f.push_back ( data->GetDicomNode()->ImageGetFullFileName() ); } else if (data->GetDicomNode()->GetType()==DicomNode::Series) { @@ -2024,7 +2181,7 @@ namespace creaImageIO j!=data->GetDicomNode()->GetChildrenList().end(); j++) { - f.push_back((*j)->GetFieldValue("FullFileName")); + f.push_back((*j)->ImageGetFullFileName()); } } } @@ -2032,6 +2189,99 @@ namespace creaImageIO } //================================================================ + //================================================================ + void WxGimmick::GetSelectedImages(std::vector& f) + { + wxArrayTreeItemIds id; + // TO DO : TEST THAT STYLE IS MULTIPLE + unsigned int nb = mTreeListCtrl->GetSelections(id); + f.clear(); + + // Collect the brute vector of Image nodes + std::vector im; + for (unsigned int i=0; iGetItemData(id[i]); + if ((data) && (data->IsDicomNode())) + { + if (data->GetDicomNode()->GetType()==DicomNode::Image) + { + im.push_back ( data->GetDicomNode() ); + + } + else if (data->GetDicomNode()->GetType()==DicomNode::Series) + { + DicomNode::ChildrenListType::iterator j; + for (j =data->GetDicomNode()->GetChildrenList().begin(); + j!=data->GetDicomNode()->GetChildrenList().end(); + j++) + { + im.push_back ( *j ); + } + } + } + } + // Create the output data + if (im.size()==1) + { + // Only one image : give it + vtkImageData* out = vtkImageData::New(); + out->ShallowCopy(mReader.GetImage(im.front()->ImageGetFullFileName())); + f.push_back( out ); + } + else if (im.size()>1) + { + vtkImageData* first = mReader.GetImage( im.front()->ImageGetFullFileName() ); + if (first->GetDataDimension()==2) + { + // n2D to 3D + vtkImageData* out = vtkImageData::New(); + out->CopyStructure(first); + int ext[6]; + first->GetExtent(ext); + ext[5] = im.size(); + out->SetExtent(ext); + + out->AllocateScalars(); + out->Print(std::cout); + + int dim[3]; + first->GetDimensions(dim); + unsigned long imsize = + ( (unsigned long)first->GetScalarPointer(0,1,0) + - (unsigned long)first->GetScalarPointer(0,0,0)) + *dim[1]; + std::cout << "imsize="<::iterator it; + for (it=im.begin(); it!=im.end(); ++it) + { + vtkImageData* cur = mReader.GetImage( (*it)->ImageGetFullFileName() ); + + void* src = cur->GetScalarPointer(0,0,0); + void* dst = out->GetScalarPointer(0,0,slice); + memcpy(dst,src,imsize); + slice++; + } + f.push_back(out); + } + else + { + // n3D + std::vector::iterator it; + for (it=im.begin(); it!=im.end(); ++it) + { + vtkImageData* out = vtkImageData::New(); + out->ShallowCopy(mReader.GetImage((*it)->ImageGetFullFileName())); + f.push_back(out); + } + } + } + } + //================================================================ + //================================================================ void WxGimmick::GetSelectedDicomNodes(std::vector& f) @@ -2052,7 +2302,7 @@ namespace creaImageIO if (data->GetDicomNode()->GetType()==DicomNode::Image) { - f.push_back ( data->GetDicomNode() ); //->GetFieldValue("FullFileName") ); + f.push_back ( data->GetDicomNode() ); //->ImageGetFullFileName() ); } else if (data->GetDicomNode()->GetType()==DicomNode::Series) { @@ -2061,8 +2311,7 @@ namespace creaImageIO j!=data->GetDicomNode()->GetChildrenList().end(); j++) { - f.push_back((*j)); //->GetFieldValue("FullFileName")); - } + f.push_back((*j)); //->ImageGetFullFileName() ); } } } */ @@ -2596,17 +2845,14 @@ namespace creaImageIO //================================================================ //================================================================ WxGimmickFrame::WxGimmickFrame( wxWindow *parent, - wxString title, - wxSize size) + wxString title, + wxSize size) : wxFrame((wxFrame *)parent, -1, title, wxDefaultPosition, size) { wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); - long style = wxTR_DEFAULT_STYLE | -#ifndef NO_VARIABLE_HEIGHT - wxTR_HAS_VARIABLE_ROW_HEIGHT | -#endif - wxTR_EDIT_LABELS | wxSUNKEN_BORDER; - mWxGimmick = new WxGimmick(this,-1,wxDefaultPosition,wxDefaultSize,style); + mWxGimmick = new WxGimmick(this,-1, + wxDefaultPosition, + wxDefaultSize); sizer->Add(mWxGimmick,1,wxGROW); SetSizer(sizer); SetAutoLayout(true); diff --git a/src/creaImageIOWxGimmick.h b/src/creaImageIOWxGimmick.h index 062d8de..13cdaf8 100644 --- a/src/creaImageIOWxGimmick.h +++ b/src/creaImageIOWxGimmick.h @@ -35,48 +35,58 @@ namespace creaImageIO class WxGimmickDicomNodeData; //==================================================================== +#define GIMMICK_NO_IMAGE_SELECTION 0 +#define GIMMICK_2D_IMAGE_SELECTION 2 +#define GIMMICK_3D_IMAGE_SELECTION 3 +#define GIMMICK_4D_IMAGE_SELECTION 4 + //==================================================================== class CREAIMAGEIO_EXPORT WxGimmick : public wxPanel, - public MultiThreadImageReaderUser + public MultiThreadImageReaderUser { public: + WxGimmick(wxWindow *parent, const wxWindowID id, - const wxPoint& pos, const wxSize& size, - int number_of_threads = 0); + const wxPoint& pos, const wxSize& size, + int image_type = GIMMICK_3D_IMAGE_SELECTION, + int number_of_threads = 0); virtual ~WxGimmick(); + int GetSelectionSize() { return mTreeListCtrl->GetSelectionSize(); } + bool IsSelectionValid(); + void GetSelectedFiles(std::vector&); + void GetSelectedImages(std::vector&); + void GetSelectedDicomNodes(std::vector&); + void GetSelectedItems(std::vector&); + DicomNode* GetDicomNodeOfItem(const wxTreeItemId& i); + + static const int UserMenuFirstId; + + typedef WxGimmickSettings Settings; + const Settings& GetSettings() const { return mSettings; } + Settings& GetSettings() { return mSettings; } + + typedef WxGimmickEvent EventType; + typedef std::vector DicomDatabaseListType; - DicomDatabaseListType& GetDicomDatabaseList() { return mDicomDatabaseList; } - const DicomDatabaseListType& GetDicomDatabaseList() const { return mDicomDatabaseList; } + DicomDatabaseListType& GetDicomDatabaseList() + { return mDicomDatabaseList; } + const DicomDatabaseListType& GetDicomDatabaseList() const + { return mDicomDatabaseList; } wxTreeListCtrl* GetTreeListCtrl() { return mTreeListCtrl; } const wxTreeListCtrl* GetTreeListCtrl() const { return mTreeListCtrl; } void SetConfigurationFile(const std::string& filename) - { - mConfigurationFile = filename; - } + { mConfigurationFile = filename;} void LoadConfiguration(); void SaveConfiguration(); void SetSaveConfigurationOnClose(bool v) { mSaveConfigurationOnClose = v; } - void GetSelectedImages(std::vector&); - void GetSelectedDicomNodes(std::vector&); - void GetSelectedItems(std::vector&); - DicomNode* GetDicomNodeOfItem(const wxTreeItemId& i); - - - static const int UserMenuFirstId; - - typedef WxGimmickSettings Settings; - const Settings& GetSettings() const { return mSettings; } - Settings& GetSettings() { return mSettings; } - - typedef WxGimmickEvent EventType; protected: void RebuildView(); @@ -92,6 +102,7 @@ namespace creaImageIO void InsertDicomDatabase(wxTreeItemId& id, DicomDatabase* r); void DeleteDicomDatabase(wxTreeItemId& id, DicomDatabase* r); + void LoadChildren( wxTreeItemId& id ); friend class WxGimmickEvent; private: @@ -99,6 +110,10 @@ namespace creaImageIO WxGimmick() { } WxGimmick(const WxGimmick& ) { } + int mSelectionType; + int mSelectionMaxImageDimension; + int mCurrentSelectionImageSize[4]; + DicomDatabaseListType mDicomDatabaseList; wxTreeListCtrl* mTreeListCtrl; @@ -197,6 +212,7 @@ namespace creaImageIO void OnItemCollapsing(wxTreeEvent& event); void OnSelChanged(wxTreeEvent& event); void OnSelChanging(wxTreeEvent& event); + bool IsImageSelectable(DicomNode* node); void OnTreeKeyDown(wxTreeEvent& event); void OnItemActivated(wxTreeEvent& event); void OnItemRightClick(wxTreeEvent& event); diff --git a/src/creaImageIOWxGimmickDialog.cpp b/src/creaImageIOWxGimmickDialog.cpp index 0a736d3..87c44a4 100644 --- a/src/creaImageIOWxGimmickDialog.cpp +++ b/src/creaImageIOWxGimmickDialog.cpp @@ -12,30 +12,32 @@ namespace creaImageIO //================================================================ WxGimmickDialog::WxGimmickDialog(wxWindow *parent, - wxWindowID id, - wxString title, - const wxPoint& pos, - const wxSize& size, - int threads) + wxWindowID id, + wxString title, + const wxPoint& pos, + const wxSize& size, + int image_type, + int threads) : wxDialog( parent, - id, - title, - pos, - size, - wxRESIZE_BORDER | - wxSYSTEM_MENU | - wxCLOSE_BOX | - wxMAXIMIZE_BOX | - wxMINIMIZE_BOX | - wxCAPTION - ) + id, + title, + pos, + size, + wxRESIZE_BORDER | + wxSYSTEM_MENU | + wxCLOSE_BOX | + wxMAXIMIZE_BOX | + wxMINIMIZE_BOX | + wxCAPTION + ) { wxBoxSizer *topsizer = new wxBoxSizer(wxVERTICAL); - + mView = new ViewType(this, TVID, wxDefaultPosition, size, + image_type, threads); topsizer->Add( mView,1,wxGROW,0); @@ -65,25 +67,8 @@ namespace creaImageIO void WxGimmickDialog::OnSelChanged(EventType& event) { // std::cout << "++++++++++ WxGimmickDialog::OnSelChanged ++++++++++" - // < nodes; - mView->GetSelectedDicomNodes(nodes); - - bool ok = false; - std::vector::iterator i; - for (i=nodes.begin();i!=nodes.end();++i) - { - if ((*i)->GetType() == DicomNode::Image) - { - ok = true; - break; - } - // std::cout << "'" << (*i)->GetFieldValue("FullFileName") - // << "'" << std::endl; - } - // std::cout << "++++++++++++++++++++" << std::endl; - - if (ok) + + if (mView->IsSelectionValid()) { mOkButton->Enable(true); } diff --git a/src/creaImageIOWxGimmickDialog.h b/src/creaImageIOWxGimmickDialog.h index caa7edd..aafdc5d 100644 --- a/src/creaImageIOWxGimmickDialog.h +++ b/src/creaImageIOWxGimmickDialog.h @@ -14,22 +14,23 @@ namespace creaImageIO public: WxGimmickDialog(); WxGimmickDialog(wxWindow *parent, - const wxWindowID id, - wxString title, - const wxPoint& pos, - const wxSize& size, - int threads = 0); + const wxWindowID id, + wxString title, + const wxPoint& pos, + const wxSize& size, + int image_type = GIMMICK_3D_IMAGE_SELECTION, + int threads = 0); typedef WxGimmick ViewType; typedef WxGimmick::EventType EventType; ~WxGimmickDialog(); - vtkImageData* GetImage(); - - void GetSelectedImages(std::vector& s) - { return mView->GetSelectedImages(s); } - + void GetSelectedImages(std::vector& s) + { mView->GetSelectedImages(s); } + void GetSelectedFiles(std::vector& s) + { mView->GetSelectedFiles(s); } + void OnSelChanged(EventType& event); void OnContextualMenu(EventType& event); void OnMenuTest(wxCommandEvent& event); diff --git a/src/treelistctrl.cpp b/src/treelistctrl.cpp index 205a5ca..2df0ab9 100644 --- a/src/treelistctrl.cpp +++ b/src/treelistctrl.cpp @@ -4,7 +4,7 @@ // Author: Robert Roebling // Maintainer: Otto Wyss // Created: 01/02/97 -// RCS-ID: $Id: treelistctrl.cpp,v 1.2 2008/09/30 08:41:54 guigues Exp $ +// RCS-ID: $Id: treelistctrl.cpp,v 1.3 2008/10/01 14:23:59 guigues Exp $ // Copyright: (c) 2004 Robert Roebling, Julian Smart, Alberto Griggio, // Vadim Zeitlin, Otto Wyss // Licence: wxWindows @@ -405,6 +405,9 @@ public: // get all the items currently selected, return count of items size_t GetSelections(wxArrayTreeItemIds&) const; + // returns the number of currently selected items + size_t GetSelectionSize() const; + // get the parent of this item (may return NULL if root) wxTreeItemId GetItemParent(const wxTreeItemId& item) const; @@ -2685,6 +2688,13 @@ void wxTreeListMainWindow::FillArray (wxTreeListItem *item, } } + +// returns the number of currently selected items + size_t wxTreeListMainWindow::GetSelectionSize() const + { + return m_selected.GetCount(); + } + size_t wxTreeListMainWindow::GetSelections (wxArrayTreeItemIds &array) const { /* LG : NOT OK AS IS NOT IN TREE ORDER @@ -4451,6 +4461,10 @@ wxTreeItemId wxTreeListCtrl::GetRootItem() const //{ return m_main_win->GetSelection(); } wxTreeItemId wxTreeListCtrl::GetCurrent() const { return m_main_win->GetCurrent(); } + + // returns the number of currently selected items + size_t wxTreeListCtrl::GetSelectionSize() const + { return m_main_win->GetSelectionSize(); } size_t wxTreeListCtrl::GetSelections(wxArrayTreeItemIds& arr) const { return m_main_win->GetSelections(arr); } diff --git a/src/treelistctrl.h b/src/treelistctrl.h index a5c31b8..5c23dfc 100644 --- a/src/treelistctrl.h +++ b/src/treelistctrl.h @@ -4,7 +4,7 @@ // Author: Robert Roebling // Maintainer: Otto Wyss // Created: 01/02/97 -// RCS-ID: $Id: treelistctrl.h,v 1.2 2008/09/30 08:41:54 guigues Exp $ +// RCS-ID: $Id: treelistctrl.h,v 1.3 2008/10/01 14:23:59 guigues Exp $ // Copyright: (c) 2004 Robert Roebling, Julian Smart, Alberto Griggio, // Vadim Zeitlin, Otto Wyss // Licence: wxWindows @@ -371,6 +371,9 @@ public: // wxTreeItemId GetSelection() const; wxTreeItemId GetCurrent() const; + // returns the number of currently selected items + size_t GetSelectionSize() const; + // get the items currently selected, return the number of such item size_t GetSelections (wxArrayTreeItemIds&) const;