i < handler->GetTree().GetNumberOfLevels();
++i)
{
- GimmickDebugMessage(5,"Creating ListCtrl for level "<<i
+
+ GimmickDebugMessage(5,"Creating view for level "<<i
<<std::endl);
LevelType level;
- wxListCtrl* ctrl = new wxListCtrl(this,
+
+ // If the first level : parent = this
+ wxWindow* sparent = this;
+ // else parent = last splitter
+ if (i>1) sparent = mLevelList[i-2].wxSplitter;
+
+ level.wxSplitter = new wxSplitterWindow( sparent , -1);
+ // level.wxSplitter->SetMinimumPaneSize(100);
+
+ wxListCtrl* ctrl = new wxListCtrl(level.wxSplitter,
i,
wxDefaultPosition,
wxDefaultSize,
ctrl_style);
level.wxCtrl = ctrl;
+ level.wxSplitter->Initialize(ctrl);
// Create the columns : one for each attribute of the level
int col = 0;
}
mLevelList.push_back(level);
- sizer->Add( ctrl ,1, wxGROW ,0);
}
+
+ /// Initialize the first level splitter
+
+ sizer->Add( mLevelList[0].wxSplitter ,1, wxGROW ,0);
+
UpdateLevel(1);
SetSizer( sizer );
//=====================================================================
+
//=====================================================================
-
///
void WxTreeView::UpdateLevel( int level )
{
- GimmickDebugMessage(1,
+ GimmickDebugMessage(1,
GetTreeHandler()->GetTree().GetLabel()
<<" view : updating level "<<level
<<std::endl);
+
+ wxBusyCursor busy;
+ RecursiveUpdateLevel(level);
+ int i;
+ for (i=0; i<level-1; i++)
+ {
+ if (!GetSplitter(i)->IsSplit())
+ GetSplitter(i)->SplitVertically( GetCtrl(i), GetSplitter(i+1),
+ 100 );
+ }
+ if (GetSplitter(i)->IsSplit()) GetSplitter(i)->Unsplit();
+
+ }
+ //=====================================================================
+
+ ///
+ void WxTreeView::RecursiveUpdateLevel( int level )
+ {
+ GimmickDebugMessage(2,
+ GetTreeHandler()->GetTree().GetLabel()
+ <<" view : updating level (recursive)"<<level
+ <<std::endl);
+
- wxBusyCursor busy;
std::vector<tree::Node*> sel=GetSelected(level);
int l = level - 1;
#include <creaWx.h>
#include <wx/listctrl.h>
+#include <wx/splitter.h>
//#include <vector>
namespace creaImageIO
{
// The
wxListCtrl* wxCtrl;
+ wxSplitterWindow* wxSplitter;
std::vector<std::string> key;
};
/// The vector of levels : one for each level of the tree
/// return the wxListCtrl of one level
wxListCtrl* GetCtrl(int l) { return mLevelList[l].wxCtrl; }
+ /// return the wxSplitter of one level
+ wxSplitterWindow* GetSplitter(int l) { return mLevelList[l].wxSplitter; }
- std::vector<tree::Node*>GetSelected(int level);
+ std::vector<tree::Node*> GetSelected(int level);
-
+
+
+ // Updates the view of a level given the selected items of upper level
+ // Recursive method
+ virtual void RecursiveUpdateLevel( int );
+
DECLARE_EVENT_TABLE()
};