level.wxCtrl = ctrl;
level.wxSplitter->Initialize(ctrl);
+ // Create the first column : number of children
+
+ std::string title = "#";
+ if (i<handler->GetTree().GetNumberOfLevels()-1)
+ {
+ title += handler->GetTree().GetLevelDescriptor(i+1).GetName();
+ if (title[title.size()-1]!='s')
+ title += "s";
+ }
+ ctrl->InsertColumn(0,crea::std2wx(title),col_style);
+
+
// Create the columns : one for each attribute of the level
- int col = 0;
+ int col = 1;
tree::LevelDescriptor::AttributeDescriptorListType::const_iterator a;
for (a = handler->GetTree().GetAttributeDescriptorList(i).begin();
a != handler->GetTree().GetAttributeDescriptorList(i).end();
++a)
{
- if(col==0)
- {
- wxListItem it;
- it.SetTextColour(*wxRED);
- it.SetText(_T("#C"));
-
- ctrl->InsertColumn(col,it);
- col++;
- }
-
+
GimmickDebugMessage(5,"Creating column "<<col<<" : "
<<a->GetName()
<<std::endl);
mLastSelected=0;
mDirection=true;
mSelectionMade=false;
+ mProcess=true;
CreateColorPalette();
UpdateLevel(1);
<<"'"<<level
<<std::endl);
int _id=1;
- int colorId=0;
-
-
+
//Adds items (other than the first) and sets their attributes
GetTreeHandler()->LoadChildren(*i,1);
int n= GetTreeHandler()->GetNumberOfChildren(*j);
oss << n;
std::string s(oss.str());
- item.SetText( crea::std2wx(s));
-
- //Setting the color according to the parent
- if(l==0)
- {
- item.SetBackgroundColour
- (wxColourDatabase().Find
- (crea::std2wx(mColorPalette[colorId])));
- mColorMap.insert
- (NodeColorPair
- (*j,wxColourDatabase().Find
- (crea::std2wx(mColorPalette[colorId]))));
- if(colorId<64)
- {
- colorId++;
- }
- else
- {
- colorId=0;
- }
- }
- else if(l!=mLevelList.size()-1)
- {
- item.SetBackgroundColour(mColorMap[*i]);
- mColorMap.insert(NodeColorPair(*j,mColorMap[*i]));
- }
- else
- {
- item.SetBackgroundColour(mColorMap[*i]);
- }
-
+ item.SetText( crea::std2wx(s));
item.SetColumn(0);
GetCtrl(l)->SetItem(item);
{
mSelected=GetSelected(level+2);
}
- else
+ else if(mProcess)
{
mLastLevelSelected=GetSelected(level+2);
}
+ else
+ {
+ event.Veto();
+ }
if (level<mLevelList.size()-1)
{
GetGimmickView()->ClearSelection();
}
if (level==mLevelList.size()-2) SelectLowerLevel();
- if (level==mLevelList.size()-1) ValidateSelectedImages ();
+ if (level==(mLevelList.size()-1)&&mProcess)
+ {
+ ValidateSelectedImages ();
+ }
}
else
{
}
+
}
//================================================================
{
long item = -1;
int level=mLevelList.size()-1;
+
for ( ;; )
{
item = GetCtrl(level)->GetNextItem(item,
wxLIST_NEXT_ALL);
if ( item == -1 )
break;
+
+ if(item==(GetCtrl(level)->GetItemCount()-1))
+ {
+ mProcess=true;
+ }
+ else
+ {
+ mProcess=false;
+ }
+
if(item!=0)
{
GetCtrl(level)->SetItemState(item,wxLIST_STATE_SELECTED, wxLIST_MASK_STATE
| wxLIST_MASK_TEXT |wxLIST_MASK_IMAGE | wxLIST_MASK_DATA | wxLIST_MASK_WIDTH | wxLIST_MASK_FORMAT);
}
+
}
}
}
+ //================================================================
+ void WxTreeView::SetColor(int l)
+ {
+ /*
+ int colorId=0;
+ //Setting the color according to the parent
+ if(l==0)
+ {
+ item.SetBackgroundColour
+ (wxColourDatabase().Find
+ (crea::std2wx(mColorPalette[colorId])));
+ mColorMap.insert
+ (NodeColorPair
+ (*j,wxColourDatabase().Find
+ (crea::std2wx(mColorPalette[colorId]))));
+ if(colorId<64)
+ {
+ colorId++;
+ }
+ else
+ {
+ colorId=0;
+ }
+ }
+ else if(l!=mLevelList.size()-1)
+ {
+ item.SetBackgroundColour(mColorMap[*i]);
+ mColorMap.insert(NodeColorPair(*j,mColorMap[*i]));
+ }
+ else
+ {
+ item.SetBackgroundColour(mColorMap[*i]);
+ }*/
+ }
//================================================================
void WxTreeView::CreateColorPalette()
{