2 !!!172546.cpp!!! DoFold(inout item : TreeMultiItemBase, in expand : bool, in recursive : bool) : void
7 // go through all node objects on this level, and expand or
19 // if this is a node, use it to go through all the subnodes (if needed)
21 // if not, then just exit.
25 TreeMultiItemNode *node = item->IsTreeMultiItemNode();
43 for(int i = 0; i < node->GetNodeCount(); i++)
47 // get node, and if a real node, then call fold
49 p = node->GetNode(i)->IsTreeMultiItemNode();
57 // go recursive for every node
59 DoFold(p, expand, recursive);
67 !!!172674.cpp!!! RedrawFromNode(inout n : TreeMultiItemNode) : void
70 static int recalcMutex = 0;
86 // when node is not visible or excluded
94 visible = n->IsVisible();
104 GetVirtualSize(&w, &h);
108 UpdateAllWindowVisibility();
110 RecalculateNodePositions();
112 RecalculateVirtualSize();
116 // why is this needed? Because folding or collapsing can change
118 // the state. When the virtual area gets smaller, we need to keep
120 // the largest one and the other way atound. And since we do not
122 // know here we are folding or collapsing, we remember the biggest
124 GetVirtualSize(&w1, &h1);
134 // only refresh the part from x,y down
142 CalcScrolledPosition(n->GetX(), n->GetY(), &x, &y);
148 wxRect rect(0, y, w, h - y);
162 Refresh(); // do a full refresh
170 !!!172802.cpp!!! RedrawFromParentNode(inout n : TreeMultiItemBase) : void
173 TreeMultiItemNode *p = 0;
183 !!!172930.cpp!!! DrawCheckbox(inout b : TreeMultiItemBase, inout dc : wxDC, in convertScrolled : bool = false) : void
192 int bmpOffsetX = b->GetX() - (_gutterWidth + _iconWidth);
196 switch(b->GetCheckboxState())
226 if(b->IsTreeMultiItemWindow())
230 xx = x = bmpOffsetX - ((TreeMultiItemWindow *)b)->GetFrontSpacing() + _checkWidth;
232 yy = y = b->GetY() + _checkDeltaY;
242 yy = y = b->GetY() + _checkDeltaY;
250 CalcScrolledPosition(x, y, &xx, &yy);
254 dc.DrawBitmap(*bmp, xx, yy, true);
256 !!!173058.cpp!!! RecalculateNodePositions() : void
259 int currentY = _spacingY;
261 // go recursive on every node, and store the information in the node
265 for(int i = 0; i < _root.GetNodeCount(); i++)
267 currentY += CalculateNodeDimensions(_root.GetNode(i), currentY, 0);
269 !!!173186.cpp!!! CalculateNodeDimensions(inout b : TreeMultiItemBase, in currentY : int, in level : int) : int
272 int gutter = (_gutterWidth * 2) + _iconWidth;
274 int y = 0, topSpacing = 0;
278 // return same if no proper object
288 gutter += _checkWidth;
294 // if we are not visible, skip recalculation and descending
304 // if level is 0, calculate with front gutter, else without
306 y = currentY + b->GetHeight();
308 if(b->IsTreeMultiItemNode())
312 TreeMultiItemNode *n = (TreeMultiItemNode *)b;
322 b->SetX(gutter + (level * (_gutterWidth + _iconWidth)));
326 // now do children of this node
330 for(int i = 0; i < n->GetNodeCount(); i++)
332 y += CalculateNodeDimensions(n->GetNode(i), y + _spacingY, level+1);
336 else if(b->IsTreeMultiItemWindow())
340 TreeMultiItemWindow *w = (TreeMultiItemWindow *)b;
346 b->SetX(gutter + w->GetFrontSpacing());
350 b->SetX(_gutterWidth + (level * (_gutterWidth + _iconWidth)) + w->GetFrontSpacing());
354 topSpacing = w->GetTopSpacing();
358 // reposition the window
362 wxWindow *wnd = w->GetWindow();
370 CalcScrolledPosition(w->GetX(), w->GetY(), &x, &y);
372 wnd->SetSize(x, y, w->GetWidth(), w->GetHeight());
382 return (y - currentY) + _spacingY + topSpacing; // return delta
392 return 0; // not visible, thus we skip calculations
394 !!!173314.cpp!!! DrawNode(inout b : TreeMultiItemBase, inout dc : wxDC) : void
397 // go through this item .. if it is a node, draw
399 // the caption, else reposition the window.
409 // forget it if this node is not visible
415 int bmpOffsetX = b->GetX() - (_gutterWidth + _iconWidth);
421 // now draw the checkbox if there is any, in the proper state
431 // adjust the bmpOffset because we also have a checkbox
433 bmpOffsetX -= _checkWidth;
441 if(b->IsTreeMultiItemNode())
445 // draw the node icon and the caption
447 TreeMultiItemNode *n = (TreeMultiItemNode *)b;
451 // set background of caption item
457 dc.SetBrush(*(this->m_HilightBrush));
459 dc.SetPen(wxPen(this->m_HilightBrush->GetColour(),1,wxSOLID));
467 dc.SetBrush(wxBrush(*wxWHITE,wxSOLID));
469 dc.SetPen(wxPen(*wxWHITE,1,wxSOLID));
473 dc.DrawRectangle(n->GetX(),n->GetY(),n->GetWidth(),n->GetHeight());
477 dc.DrawText(n->GetCaption(), n->GetX(), n->GetY());
481 // draw the bitmap for the state
485 dc.DrawBitmap(*_expandBmp, bmpOffsetX, n->GetY() + _iconDeltaY, true);
489 dc.DrawBitmap(*_collBmp, bmpOffsetX, n->GetY() + _iconDeltaY, true);
493 // now go through all the subnodes
495 for(int i = 0; i < n->GetNodeCount(); i++)
497 DrawNode(n->GetNode(i), dc);
505 !!!173442.cpp!!! SetWindowBackgroundColour(inout wnd : wxWindow, in col : wxColour, in flags : int) : void
512 // if we cannot change a button, make sure all button
514 // classes are not changed
518 wxButton *btn = wxDynamicCast(wnd, wxButton);
520 if(!btn || ((flags & wxTMC_BG_ADJUST_BTN) != 0))
522 wnd->SetBackgroundColour(col);
526 // get every window, and make the background equal to the given one
528 wxWindowListNode *node = wnd->GetChildren().GetFirst();
534 SetWindowBackgroundColour(node->GetData(), col, flags);
536 node = node->GetNext();
542 !!!173570.cpp!!! ShowTreeMultiWindow(inout window : TreeMultiItemWindow, in show : bool = true) : void
545 // show or hide window
547 if(window && window->GetWindow())
549 window->GetWindow()->Show(show);
551 !!!173698.cpp!!! UpdateAllWindowVisibility() : void
554 // all roots are visible, but what lies beneath ... who knows
556 for(int i = 0; i < _root.GetNodeCount(); i++)
558 UpdateTreeMultiWindowVisibility(_root.GetNode(i), true);
560 !!!173826.cpp!!! UpdateTreeMultiWindowVisibility(inout b : TreeMultiItemBase, in show : bool) : void
567 // this is done for performance issues. IsVisible can go all
569 // the way up the tree to check. However if show is already
571 // false, there is no need to check (some higher one is collapsed)
579 showMe = b->IsVisible();
583 if(b->IsTreeMultiItemWindow())
587 // if this level must be hidden, hide
589 ShowTreeMultiWindow((TreeMultiItemWindow*)b, showMe);
593 else if(b->IsTreeMultiItemNode())
597 TreeMultiItemNode *node = (TreeMultiItemNode *)b;
601 // if hidden, descend and hide all windows
603 for(int i = 0; i < node->GetNodeCount(); i++)
605 UpdateTreeMultiWindowVisibility(node->GetNode(i), showMe);
611 !!!173954.cpp!!! RecalculateVirtualSize() : void
614 // go through all the nodes, and store the largest x and largest y
620 RecalculateVirtualSizeFromNode(&_root, x, y);
624 // now adjust virtual size
626 SetVirtualSize(x, y);
628 AdjustScrollbars(x, y);
630 !!!174082.cpp!!! AdjustScrollbars(in x : int, in y : int) : void
635 // courtesy of treectrlg.cpp
639 y += WXTMC_PIXELS_PER_UNIT+2; // one more scrollbar unit + 2 pixels
641 x += WXTMC_PIXELS_PER_UNIT+2; // one more scrollbar unit + 2 pixels
643 int x_pos = GetScrollPos( wxHORIZONTAL );
645 int y_pos = GetScrollPos( wxVERTICAL );
647 SetScrollbars( WXTMC_PIXELS_PER_UNIT, WXTMC_PIXELS_PER_UNIT, x/WXTMC_PIXELS_PER_UNIT,
649 y/WXTMC_PIXELS_PER_UNIT, x_pos, y_pos, true );
651 !!!174210.cpp!!! RecalculateVirtualSizeFromNode(in node : TreeMultiItemNode, inout x : int, inout y : int) : void
654 if(node->IsExcluded())
660 // if calulate this node's dimensions
662 if(x < (node->GetWidth() + node->GetX()))
664 x = node->GetWidth() + node->GetX();
668 y = node->GetY() + node->GetHeight();
672 // if this node is collapsed, no subnodes are visible, else
674 // go through all subnodes as well, node needs to be included as well
676 if(node->IsExpanded())
680 TreeMultiItemBase *b;
682 for(int i = 0; i < node->GetNodeCount(); i++)
686 b = node->GetNode(i);
692 if(x < (b->GetWidth() + b->GetX()))
694 x = b->GetWidth() + b->GetX();
698 y = b->GetY() + b->GetHeight();
702 if(b->IsTreeMultiItemNode())
704 RecalculateVirtualSizeFromNode((TreeMultiItemNode *)b, x, y);
710 !!!174338.cpp!!! FindNodeByPoint(inout b : TreeMultiItemBase, in pt : wxPoint, inout area : int) : TreeMultiItemBase
717 // if this layer is not visible, return with nothing.
729 // now see if our y is matching the mouse
731 if(pt.y >= b->GetY() && pt.y < (b->GetY() + b->GetHeight()))
737 // if we are checkboxed, calculate the checkbox position
743 int extraSpacing = 0, extraWidth = 0;
747 // now for a windows item, this is minus the gutter. For a normal node it is X minus checkbox
749 if(b->IsTreeMultiItemWindow())
753 extraWidth = _checkWidth;
755 extraSpacing = ((TreeMultiItemWindow *)b)->GetFrontSpacing();
765 if(pt.x > (b->GetX() - extraSpacing - _checkWidth) && pt.x < (b->GetX() - extraSpacing + extraWidth))
769 area = wxTMC_HITTEST_CHECKBOX;
781 // allrighty we have something, now where and what is it (look with x)
785 area = wxTMC_HITTEST_GUTTER;
789 /** \todo Match only the real part of the caption, window (we assume x > GetX() which is the rest)
791 HOWEVER the window probably doesn't propagate the click event back to the parent, so we might
793 leave it like this so the use can click behind a window so it will be selected.
801 // inside area, return proper flag
803 if(b->IsTreeMultiItemNode())
805 area = wxTMC_HITTEST_CAPTION;
809 area = wxTMC_HITTEST_WINDOW;
823 // not found, let's try our children if we have some
825 TreeMultiItemNode *n = b->IsTreeMultiItemNode();
831 TreeMultiItemBase *bb = 0;
833 for(int i = 0; i < n->GetNodeCount() && !bb; i++)
835 bb = FindNodeByPoint(n->GetNode(i), pt, area);
839 // keep returning result to caller
851 !!!174466.cpp!!! FindWindowNode(inout wnd : wxWindow, inout n : TreeMultiItemNode = 0) : wxTreeMultiItem
854 wxCHECK(wnd, wxTreeMultiItem(0));
858 // take root node if not assigned one
864 n = (TreeMultiItemNode *)&_root;
868 // check on this level for the wxWindow pointer
872 TreeMultiItemWindow *w;
874 wxTreeMultiItem result(0);
876 for(int i = 0; i < n->GetNodeCount() && !result.IsOk(); i++)
882 w = n->GetNode(i)->IsTreeMultiItemWindow();
884 if(w && w->GetWindow() == wnd)
886 return wxTreeMultiItem(n);
890 // if node, go deeper
892 if(n->GetNode(i)->IsTreeMultiItemNode())
894 result = FindWindowNode(wnd, (TreeMultiItemNode*)n->GetNode(i));
902 !!!174594.cpp!!! FindNextVisibleWindowItem(inout b : TreeMultiItemBase, in index : int = -1) : TreeMultiItemWindow
909 // check on this level, go deeper with every node we got. When a node is not
911 // visible anymore, skip the node.
915 TreeMultiItemWindow *value = 0;
921 // if we are already searching on a node with an index
925 TreeMultiItemBase *bn = 0;
927 TreeMultiItemNode *n = b->IsTreeMultiItemNode();
933 for(int i = index + 1; i < n->GetNodeCount() && !value; i++)
939 value = bn->IsTreeMultiItemWindow();
943 // assume a node, root when not a a window
947 value = FindNextVisibleWindowItem(bn, -1);
959 if(b->IsTreeMultiItemWindow())
963 // get parent first, and locate child as ptr
965 TreeMultiItemNode *p = b->GetParent();
971 // go scan the parent from the given index, if
973 // the index is valid else there is no child with that index
977 int idx = p->Index(b);
979 wxCHECK(idx >= 0, 0);
983 value = FindNextVisibleWindowItem(p, idx);
997 !!!174722.cpp!!! AdjustIconsDeltaY() : void
1004 if(_captionFont.Ok())
1006 GetTextExtent(wxT("jG"), &x, &y, 0, 0, &_captionFont);
1012 if(_maxHeight < _captionHeight)
1014 _maxHeight = _captionHeight;
1018 // determine the center pos for the [+]
1020 _iconDeltaY = abs(_maxHeight - _iconHeight) / 2 + 1;
1030 // determine the center pos for the checkbox
1032 _checkDeltaY = abs(_maxHeight - _checkHeight) / 2 + 1;
1034 if(_checkDeltaY < 1)
1040 !!!174850.cpp!!! CalculateNodeSpanning(inout b : TreeMultiItemBase) : void
1043 // return same if no proper object
1045 wxCHECK2(b, return);
1049 if(b->IsTreeMultiItemNode())
1053 TreeMultiItemNode *n = (TreeMultiItemNode *)b;
1057 // now do children of this node
1061 for(int i = 0; i < n->GetNodeCount(); i++)
1063 CalculateNodeSpanning(n->GetNode(i));
1067 else if(b->IsTreeMultiItemWindow())
1071 TreeMultiItemWindow *w = (TreeMultiItemWindow *)b;
1073 wxWindow *wnd = w->GetWindow();
1079 // if the window is spanning, we adjust the width to the max width of the control
1081 if(w->GetHorizontalSpan())
1085 wxSize tmcsize = GetClientSize();
1087 int maxwidth = tmcsize.GetWidth() - w->GetX() - 8; // extract 3 for border
1091 wxSizer *sz = wnd->GetSizer();
1097 if(maxwidth < sz->GetMinSize().GetWidth())
1099 maxwidth = sz->GetMinSize().GetWidth();
1105 // prevent a size of 0
1115 w->SetWidth(maxwidth);
1117 wnd->SetSize(w->GetWidth(), w->GetHeight());
1121 // layout by sizer (not sure if this is needed)
1125 wnd->GetSizer()->Layout();
1133 !!!174978.cpp!!! SetRecursiveCheckState(inout n : TreeMultiItemNode, in check : bool) : void
1144 // go check all kids on this level
1146 for(int i = 0; i < n->GetNodeCount(); i++)
1150 // check all the nodes, and go deeper
1152 n->GetNode(i)->SetCheckboxState(state);
1154 if(n->GetNode(i)->IsTreeMultiItemNode())
1156 SetRecursiveCheckState((TreeMultiItemNode *)n->GetNode(i), check);
1160 !!!175106.cpp!!! ScanTristateCheckstates(inout b : TreeMultiItemBase) : void
1163 // check from the parent on, all node entries and see if they are
1165 // checked or cleared or scattered
1167 TreeMultiItemNode *p = b->GetParent();
1171 if(p && p->GetCheckbox())
1175 bool foundcheck = false, foundclear = false;
1177 for(size_t i = 0; i < (size_t)p->GetNodeCount(); ++i)
1181 // only evaluate when checkboxed
1183 if(p->GetNode(i)->IsTreeMultiItemWindow() && p->GetNode(i)->GetCheckbox())
1187 // record instance of a cleared checkbox
1189 if(!p->GetNode(i)->GetCheckboxState())
1193 // record instance of checked checkbox
1195 if(p->GetNode(i)->GetCheckboxState() == 1)
1205 // if we have both check and clear, go tristate
1207 // if all clear, clear parent and if all set, then set parent
1209 if(foundclear && !foundcheck)
1211 p->SetCheckboxState(0);
1213 else if(!foundclear && foundcheck)
1215 p->SetCheckboxState(1);
1217 else if(foundclear && foundcheck)
1219 p->SetCheckboxState(2);
1225 //DrawCheckbox(p, dc, false);
1231 !!!175234.cpp!!! InsertNode(inout ParentPtr : TreeMultiItemNode, in Position : size_t, in Caption : wxString, in Name : wxString) : wxTreeMultiItem
1238 TreeMultiItemNode* NodePtr(new TreeMultiItemNode(ParentPtr,Caption,Name)); // generate new node pointer
1244 // continue with initializing the new node:
1248 // if checkbox view is desired, tag this item as a checkbox
1250 // and set the state as 'false'
1252 NodePtr->SetCheckbox(_checkboxView);
1254 NodePtr->SetCheckboxState(0);
1258 // calculate the height and width
1260 this->GetTextExtent(Caption,&extX,&extY,0,0,&(this->_captionFont));
1262 NodePtr->SetHeight(extY);
1264 NodePtr->SetWidth(extX);
1266 // finally, insert node:
1268 if (Position < (size_t)ParentPtr->GetNodeCount())
1270 ParentPtr->InsertNode(NodePtr,Position);
1274 ParentPtr->AddNode(NodePtr);
1276 // return the newly created node:
1278 return wxTreeMultiItem(NodePtr);
1280 !!!175362.cpp!!! InsertWindow(inout ParentPtr : TreeMultiItemNode, in Position : size_t, inout WindowPtr : wxWindow, in Name : wxString, in Info : wxTreeMultiWindowInfo, in Flags : int) : wxTreeMultiItem
1287 TreeMultiItemWindow* NewWindowPtr = new TreeMultiItemWindow(ParentPtr,Name); // generate new window pointer
1293 // get flags from passed variable "Flags"; in case this variable does not contain any flags use the window's information flags:
1297 WindowFlags = Flags;
1301 WindowFlags = Info.GetFlags();
1305 // continue with initializing the new window:
1309 // if checkbox view is desired, tag this item as a checkbox
1311 // and set the state as 'false'
1313 NewWindowPtr->SetCheckbox(_checkboxView);
1317 // if style wants us to change background, set it to our background
1319 if (WindowFlags & wxTMC_BG_ADJUST_ALL)
1323 // go through all children of this window, and set the
1325 // background of it (recursively)
1327 this->SetWindowBackgroundColour(WindowPtr,this->GetBackgroundColour(),WindowFlags);
1335 NewWindowPtr->SetTopSpacing(Info.GetTopSpacing());
1339 // make sure that the checkboxes are at least indented enough
1341 if (this->_checkboxView)
1343 NewWindowPtr->SetFrontSpacing(Info.GetFrontSpacing() + this->_checkWidth);
1349 NewWindowPtr->SetFrontSpacing(Info.GetFrontSpacing());
1351 // assign finally the window:
1353 NewWindowPtr->AssignWindow(WindowPtr);
1359 // set the checkbox state after the window is assigned
1361 NewWindowPtr->SetCheckboxState(Info.GetDefaultCheckState());
1367 // if the window is not visible, set hide flag
1369 this->ShowTreeMultiWindow(NewWindowPtr,NewWindowPtr->IsVisible());
1373 // finally, insert the newly constructed window:
1375 if (Position < (size_t)ParentPtr->GetNodeCount())
1377 ParentPtr->InsertNode(NewWindowPtr,Position);
1381 ParentPtr->AddNode(NewWindowPtr);
1383 // return the newly created window:
1385 return wxTreeMultiItem(NewWindowPtr);
1387 !!!175490.cpp!!! Init() : void
1416 _checkboxView = false;
1422 _gutterWidth = WXTMC_GUTTER_DEFAULT;
1432 _spacingY = WXTMC_YSPACING_DEFAULT;
1434 _captionHeight = 13;
1438 // create two bitmap nodes for drawing
1442 _expandBmp = new wxBitmap(expand_xpm);
1444 _collBmp = new wxBitmap(collapse_xpm);
1448 // calculate average font height for bitmap centering
1452 _iconWidth = _expandBmp->GetWidth();
1454 _iconHeight = _expandBmp->GetHeight();
1460 // create bitmaps for checkboxes
1462 _checkBmp = new wxBitmap(checked_icon);
1464 _uncheckBmp = new wxBitmap(unchecked_icon);
1466 _tristateBmp = new wxBitmap(tristate_icon);
1470 // adjust the height if the checkboxes are higher
1472 // so that everything is alligned properly
1474 _checkHeight = _checkBmp->GetHeight();
1476 _checkWidth = _checkBmp->GetWidth();
1482 // remember the highest of the two bitmaps so there is
1484 // always enough room
1486 _maxHeight = _iconHeight;
1492 if(_maxHeight < _checkHeight)
1494 _maxHeight = _checkHeight;
1500 // set standard highlighting brush
1502 this->m_HilightBrush = new wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT),wxSOLID);
1506 // set standard DC font
1508 _captionFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
1512 // adjust bitmap icon y position so they are centered
1514 AdjustIconsDeltaY();
1518 // set virtual size to this window size
1520 if (_create_called) {
1522 wxSize wndsize = GetSize();
1524 SetVirtualSize(wndsize.GetWidth(), wndsize.GetWidth());
1528 !!!175746.cpp!!! OnMouseClick(inout event : wxMouseEvent) : void
1531 // react on double click and left mouse down
1533 if(event.LeftDown() || event.LeftDClick())
1537 // get translation point
1539 wxPoint pt( event.GetPosition() );
1545 CalcUnscrolledPosition( pt.x, pt.y, &x, &y );
1549 // go check if we clicked a treenode
1555 wxTreeMultiItem id = HitTest(p, flags);
1561 if(flags == wxTMC_HITTEST_CHECKBOX)
1565 // toggle the checkbox, and redraw
1571 TreeMultiItemBase *b = id.GetItem();
1573 b->SetCheckboxState((b->GetCheckboxState()+1) & 0x1);
1577 TreeMultiItemWindow *w = b->IsTreeMultiItemWindow();
1583 // try to force a focus on the window. This could
1585 // be extended by searching for the first edit control
1587 // class but for now, just a focus is tried.
1589 w->GetWindow()->Enable(b->GetCheckboxState() == 1);
1591 w->GetWindow()->SetFocus();
1595 // draw the checkbox in the state needed
1597 wxClientDC dc(this);
1599 DrawCheckbox(b, dc, true);
1603 // TODO: determine if the upper parents should be
1609 ScanTristateCheckstates(b);
1615 else if(b->IsTreeMultiItemNode())
1619 // descend to all the children and set the state of the parent
1621 SetRecursiveCheckState((TreeMultiItemNode *)b, b->GetCheckboxState() == 1);
1623 RedrawFromNode((TreeMultiItemNode *)b);
1633 #endif // #if(CHECKBOXVIEW)
1637 // react on left mouse button, to fold and on
1639 // right for caption doubleclick
1645 // adjust behaviour for Linux (single click = always fold)
1649 if(event.LeftDClick())
1651 area = wxTMC_HITTEST_CAPTION;
1655 area = wxTMC_HITTEST_GUTTER;
1665 // Linux (single or double click -> always fold
1673 // we have a valid item, if it is a node, then fold
1675 TreeMultiItemNode *n = id.GetItem()->IsTreeMultiItemNode();
1681 this->SelectItem(id);
1683 Fold(n, !n->IsExpanded());
1689 if (event.LeftDown())
1691 if (flags == wxTMC_HITTEST_GUTTER)
1695 TreeMultiItemNode *n = id.GetItem()->IsTreeMultiItemNode(); // for some reasons also windows may have set the flag
1701 Fold(n, !n->IsExpanded());
1705 else if (flags == wxTMC_HITTEST_CAPTION)
1709 TreeMultiItemNode *n = id.GetItem()->IsTreeMultiItemNode(); // for some reasons also windows may have set the flag
1717 this->SelectItem(id);
1719 this->RedrawFromNode(n);
1731 this->UnselectAll();
1737 !!!175874.cpp!!! OnRightMouseClick(inout Event : wxMouseEvent) : void
1740 if (Event.RightDown())
1742 if (Event.Dragging())
1744 this->UnselectAll();
1750 // variable definitions:
1758 // translate mouse coordinates:
1760 CalcUnscrolledPosition(Event.GetPosition().x,Event.GetPosition().y,&(Point.x),&(Point.y));
1762 // check if the mouse is above the caption of an item:
1764 wxTreeMultiItem Item(this->HitTest(Point,Flags)); // variable definition and initialization
1768 if (Item.IsOk() && (Flags == wxTMC_HITTEST_CAPTION))
1772 this->SelectItem(Item);
1774 this->RedrawFromNode(Item.GetItem()->IsTreeMultiItemNode());
1776 Event.Skip(); // window will convert right mouse click to a context menu event or proceed with
1778 // a right mouse click event if the context menu event cannot be processed
1784 this->UnselectAll();
1790 this->UnselectAll();
1792 !!!176002.cpp!!! OnKey(inout event : wxKeyEvent) : void
1795 // check if we need to traverse to upper or lower
1797 // control in the list
1799 if(event.GetKeyCode() == WXK_TAB)
1803 wxTreeMultiItem item = GetFocus();
1809 // traverse down direction
1811 if(!event.ShiftDown())
1813 item = FindNextVisibleWindowItem(item.GetItem());
1815 //else // traverse in up direction
1817 // item = FindPreviousVisibleWindowItem(item);
1825 TreeMultiItemWindow *w = item.GetItem()->IsTreeMultiItemWindow();
1831 wxWindow *wnd = w->GetWindow();
1847 !!!176258.cpp!!! RecalculateSpanSizes() : void
1850 for(int i = 0; i < _root.GetNodeCount(); i++)
1852 CalculateNodeSpanning(_root.GetNode(i));
1854 !!!176642.cpp!!! ~wxTreeMultiCtrl()
1857 // delete the bitmap resources
1871 delete _tristateBmp;
1875 !!!176898.cpp!!! AddRoot(in caption : wxString, in name : wxString = wxEmptyString) : wxTreeMultiItem
1878 wxTreeMultiItem result((TreeMultiItemBase *)&_root);
1880 result = AppendNode(result, caption, name);
1886 !!!177026.cpp!!! AppendWindow(in ParentItem : wxTreeMultiItem, inout window : wxWindow = NULL, in name : wxString = wxEmptyString, in info : wxTreeMultiWindowInfo = wxTreeMultiWindowInfoDefault, in flags : int = 0) : wxTreeMultiItem
1889 // add window only if the parent item is valid and...
1891 wxCHECK(ParentItem.IsOk(), wxTreeMultiItem(0));
1895 TreeMultiItemNode* parent = ParentItem.GetItem()->IsTreeMultiItemNode(); // also roots are nodes
1901 wxCHECK(parent != NULL, wxTreeMultiItem(0));
1905 // now, append node to the tree control:
1907 wxTreeMultiItem NewWindowItem(this->InsertWindow(parent,wx_static_cast(size_t,parent->GetNodeCount()),window,name,info,flags));
1909 // redraw the stucture:
1911 this->RedrawFromNode(parent);
1913 // return the new window
1915 return NewWindowItem;
1917 !!!177154.cpp!!! InsertWindow(in ParentItem : wxTreeMultiItem, in Position : size_t, inout window : wxWindow = NULL, in name : wxString = wxEmptyString, in info : wxTreeMultiWindowInfo = wxTreeMultiWindowInfoDefault, in flags : int = 0) : wxTreeMultiItem
1920 // add window only if the parent item is valid and...
1922 wxCHECK(ParentItem.IsOk(), wxTreeMultiItem(0));
1926 TreeMultiItemNode* parent = ParentItem.GetItem()->IsTreeMultiItemNode(); // also roots are nodes
1932 wxCHECK(parent != NULL, wxTreeMultiItem(0));
1936 // now, append node to the tree control:
1938 wxTreeMultiItem NewWindowItem(this->InsertWindow(parent,Position,window,name,info,flags));
1940 // redraw the stucture:
1942 this->RedrawFromNode(parent);
1944 // return the new window
1946 return NewWindowItem;
1948 !!!177282.cpp!!! PrependWindow(in ParentItem : wxTreeMultiItem, inout window : wxWindow = NULL, in name : wxString = wxEmptyString, in info : wxTreeMultiWindowInfo = wxTreeMultiWindowInfoDefault, in flags : int = 0) : wxTreeMultiItem
1951 // add window only if the parent item is valid and...
1953 wxCHECK(ParentItem.IsOk(), wxTreeMultiItem(0));
1957 TreeMultiItemNode* parent = ParentItem.GetItem()->IsTreeMultiItemNode(); // also roots are nodes
1963 wxCHECK(parent != NULL, wxTreeMultiItem(0));
1967 // now, append node to the tree control:
1969 wxTreeMultiItem NewWindowItem(this->InsertWindow(parent,0,window,name,info,flags));
1971 // redraw the stucture:
1973 this->RedrawFromNode(parent);
1975 // return the new window
1977 return NewWindowItem;
1979 !!!177410.cpp!!! AppendNode(in ParentItem : wxTreeMultiItem, in caption : wxString = wxEmptyString, in name : wxString = wxEmptyString) : wxTreeMultiItem
1982 // add window only if the parent item is valid and...
1984 wxCHECK(ParentItem.IsOk(), wxTreeMultiItem(0));
1988 TreeMultiItemNode* parent = ParentItem.GetItem()->IsTreeMultiItemNode(); // also roots are nodes
1994 wxCHECK(parent != NULL, wxTreeMultiItem(0));
1998 // now, append node to the tree control:
2000 wxTreeMultiItem NewNodeItem(this->InsertNode(parent,wx_static_cast(size_t,parent->GetNodeCount()),caption,name));
2002 // redraw the structure:
2004 this->RedrawFromNode(parent);
2006 // return the new node:
2010 !!!177538.cpp!!! InsertNode(in ParentItem : wxTreeMultiItem, in Position : size_t, in caption : wxString, in name : wxString) : wxTreeMultiItem
2013 // add window only if the parent item is valid and...
2015 wxCHECK(ParentItem.IsOk(), wxTreeMultiItem(0));
2019 TreeMultiItemNode* parent = ParentItem.GetItem()->IsTreeMultiItemNode(); // also roots are nodes
2025 wxCHECK(parent != NULL, wxTreeMultiItem(0));
2029 // now, append node to the tree control:
2031 wxTreeMultiItem NewNodeItem(this->InsertNode(parent,Position,caption,name));
2033 // redraw the structure:
2035 this->RedrawFromNode(parent);
2037 // return the new node:
2041 !!!177666.cpp!!! PrependNode(in ParentItem : wxTreeMultiItem, in caption : wxString = wxEmptyString, in name : wxString = wxEmptyString) : wxTreeMultiItem
2044 // add window only if the parent item is valid and...
2046 wxCHECK(ParentItem.IsOk(), wxTreeMultiItem(0));
2050 TreeMultiItemNode* parent = ParentItem.GetItem()->IsTreeMultiItemNode(); // also roots are nodes
2056 wxCHECK(parent != NULL, wxTreeMultiItem(0));
2060 // now, append node to the tree control:
2062 wxTreeMultiItem NewNodeItem(this->InsertNode(parent,0,caption,name));
2064 // redraw the structure:
2066 this->RedrawFromNode(parent);
2068 // return the new node:
2072 !!!177794.cpp!!! Delete(inout item : wxTreeMultiItem) : bool
2077 wxCHECK(item.IsOk(), false);
2081 wxTreeMultiItem nullItem(0);
2087 // if item has been selected, remove it from the selected list:
2089 size_t ItemIndex(this->GetSelectedItemIndex(item));
2093 if (ItemIndex != this->GetSelectedItemCount())
2095 this->m_SelectedItems.RemoveAt(ItemIndex);
2099 // get parent, to delete item from
2101 TreeMultiItemNode *p = item.GetItem()->GetParent();
2105 // first check if it was visible, if so from the parent off
2107 // it needs redrawing
2109 redraw = item.GetItem()->IsVisible();
2113 p->DeleteNode(item.GetItem());
2117 _root.DeleteNode(item.GetItem());
2125 // do redraw when node was visible
2135 !!!178050.cpp!!! DeleteChildren(in item : wxTreeMultiItem) : void
2138 if(item.IsNodeItem())
2142 TreeMultiItemNode *n = (TreeMultiItemNode *)item.GetItem();
2146 // remove all children from the selected item list:
2148 if (n->GetNodeCount() > 0)
2152 // variable definitions and initializations:
2156 wxTreeMultiItem FirstItemIterator(this->GetFirstChild(item,Cookie)), LastItemIterator(this->GetLastChild(item));
2164 size_t ItemIndex(this->GetSelectedItemIndex(item)); // variable definition and initialization
2168 if (ItemIndex != this->GetSelectedItemCount())
2170 this->m_SelectedItems.RemoveAt(ItemIndex);
2172 if (FirstItemIterator == LastItemIterator)
2174 break; // all children checked
2178 FirstItemIterator = this->GetNext(FirstItemIterator);
2194 !!!178178.cpp!!! ExpandNodes(in recursive : bool = false) : void
2197 // go through all children and call DoFold recursively
2199 for(int i = 0; i < _root.GetNodeCount(); i++)
2201 DoFold(_root.GetNode(i), true, recursive);
2205 !!!178306.cpp!!! CollapseNodes(in recursive : bool = false) : void
2208 // go through all children and call DoFold recursively
2210 for(int i = 0; i < _root.GetNodeCount(); i++)
2212 DoFold(_root.GetNode(i), false, recursive);
2216 !!!178434.cpp!!! Expand(in item : wxTreeMultiItem, in recursive : bool) : void
2223 TreeMultiItemNode *n = item.GetItem()->IsTreeMultiItemNode();
2227 n = item.GetItem()->GetParent();
2229 DoFold(n, true, recursive);
2231 RedrawFromNode(item.GetItem()->IsTreeMultiItemNode());
2235 !!!178562.cpp!!! Collapse(in item : wxTreeMultiItem, in recursive : bool) : void
2242 TreeMultiItemNode *n = item.GetItem()->IsTreeMultiItemNode();
2246 n = item.GetItem()->GetParent();
2248 DoFold(n, false, recursive);
2250 RedrawFromNode(item.GetItem()->IsTreeMultiItemNode());
2254 !!!178690.cpp!!! CollapseAndReset(in item : wxTreeMultiItem) : void
2257 if(item.IsNodeItem())
2261 TreeMultiItemNode *n = (TreeMultiItemNode *)item.GetItem();
2269 Collapse(item, false);
2273 !!!179074.cpp!!! GetFirstSelectedItem(in : void) : wxTreeMultiItem
2276 if (this->GetSelectedItemCount() > 0)
2278 return this->m_SelectedItems[0];
2282 return wxTreeMultiItem();
2284 !!!179202.cpp!!! GetLastSelectedItem(in : void) : wxTreeMultiItem
2287 if (this->GetSelectedItemCount() > 0)
2289 return this->m_SelectedItems[this->GetSelectedItemCount()-1];
2293 return wxTreeMultiItem();
2295 !!!179330.cpp!!! GetSelectedItem(in Index : size_t) : wxTreeMultiItem
2298 if (Index < this->GetSelectedItemCount())
2300 return this->m_SelectedItems[Index];
2304 return wxTreeMultiItem();
2306 !!!179458.cpp!!! GetSelectedItemIndex(in Item : wxTreeMultiItem) : size_t
2309 // attention: the function wxArray::Index() can NOT be used in a save manner as it only checks the address of an item
2311 // element but it is not guaranteed that Item may not be a copy of the originally inserted item
2313 const size_t NoOfSelectedItems = this->GetSelectedItemCount();
2323 while ((Index < NoOfSelectedItems) && (this->m_SelectedItems[Index] != Item))
2329 !!!179586.cpp!!! SelectItem(in Item : wxTreeMultiItem, in UnselectOthers : bool = true, in ExpandSelection : bool = false) : void
2332 TreeMultiItemNode* NodePtr(Item.GetItem()->IsTreeMultiItemNode());
2338 // only nodes can be selected and they can only be selected if they are not already selected:
2340 if ((NodePtr == NULL) || NodePtr->IsSelected())
2346 // inform that we are about to change:
2348 wxTreeMultiEvent Event(wxEVT_COMMAND_TREE_MULTI_SEL_CHANGING,Item); // variable definition and initialization
2352 if (this->m_SelectedItems.GetCount() > 0) // the last item in the array is always the latest inserted item
2354 Event.SetOldItem(this->m_SelectedItems.Last());
2356 Event.SetEventObject(this);
2358 if (this->GetEventHandler()->ProcessEvent(Event) && !(Event.IsAllowed()))
2364 // make sure that the to be selected item can be seen:
2366 this->Include(Item);
2370 // variable definition and initialization:
2372 wxTreeMultiItem ExcludedParent(this->GetExcludedParent(Item));
2376 while (ExcludedParent.IsOk())
2380 this->Include(ExcludedParent);
2382 ExcludedParent = this->GetExcludedParent(Item);
2388 // unselect items if necessary:
2392 this->UnselectAll();
2394 // expand selection if necessary:
2396 if (ExpandSelection)
2400 // variable definition:
2402 wxTreeMultiItem FirstItemIterator, LastItemIterator;
2404 wxTreeMultiItem LastSelectedItem;
2408 // determine the last selected item or the first item in case nothing has been selected before:
2410 if (this->m_SelectedItems.GetCount() > 0)
2412 LastSelectedItem = this->m_SelectedItems.Last();
2416 LastSelectedItem = this->GetFirstRoot();
2418 // determine the item from which to start and the one with which to end the selection:
2420 if (Item.GetItem()->GetY() > LastSelectedItem.GetItem()->GetY())
2424 FirstItemIterator = LastSelectedItem;
2426 LastItemIterator = Item;
2434 FirstItemIterator = Item;
2436 LastItemIterator = LastSelectedItem;
2440 // select all items that are a node and are placed between the two limiting iterators (included the limits):
2446 if (!(FirstItemIterator.IsSelected()) && FirstItemIterator.IsNodeItem())
2450 FirstItemIterator.GetItem()->Select();
2452 this->m_SelectedItems.Add(FirstItemIterator);
2454 this->RefreshRect(wxRect(FirstItemIterator.GetItem()->GetX(), FirstItemIterator.GetItem()->GetY(),
2456 FirstItemIterator.GetItem()->GetWidth(),FirstItemIterator.GetItem()->GetHeight()));
2460 if (FirstItemIterator == LastItemIterator)
2464 // continue iterating:
2466 FirstItemIterator = this->GetNext(FirstItemIterator);
2472 else // select passed item only
2478 this->m_SelectedItems.Add(NodePtr);
2480 this->RefreshRect(wxRect(NodePtr->GetX(),NodePtr->GetY(),NodePtr->GetWidth(),NodePtr->GetHeight()));
2486 // inform that we have selected the item:
2488 Event.SetEventType(wxEVT_COMMAND_TREE_MULTI_SEL_CHANGED);
2490 this->GetEventHandler()->ProcessEvent(Event);
2492 !!!179714.cpp!!! UnselectAll(in : void) : void
2495 const size_t NoOfSelectedItems = this->m_SelectedItems.GetCount();
2501 for (size_t i=0; i<NoOfSelectedItems; ++i)
2505 this->RefreshRect(wxRect(this->m_SelectedItems[i].GetItem()->GetX(), this->m_SelectedItems[i].GetItem()->GetY(),
2507 this->m_SelectedItems[i].GetItem()->GetWidth(),this->m_SelectedItems[i].GetItem()->GetHeight()));
2509 this->m_SelectedItems[i].GetItem()->Unselect();
2513 this->m_SelectedItems.Clear();
2515 !!!179842.cpp!!! Unselect(in Item : wxTreeMultiItem) : void
2518 size_t ItemIndex(this->GetSelectedItemIndex(Item));
2524 if (ItemIndex != this->GetSelectedItemCount())
2528 Item.GetItem()->Unselect();
2530 this->m_SelectedItems.RemoveAt(ItemIndex);
2532 this->RefreshRect(wxRect(Item.GetItem()->GetX(),Item.GetItem()->GetY(),Item.GetItem()->GetWidth(),Item.GetItem()->GetHeight()));
2536 !!!179970.cpp!!! Exclude(in item : wxTreeMultiItem) : void
2539 wxCHECK2(item.IsOk(), return);
2543 // exclude the item, and refresh
2545 // if already excluded, skip
2549 if(!item.GetItem()->IsExcluded())
2553 item.GetItem()->SetExcluded(true);
2555 RedrawFromParentNode(item.GetItem());
2559 !!!180098.cpp!!! Include(in item : wxTreeMultiItem) : void
2562 wxCHECK2(item.IsOk(), return);
2566 // include the item, and refresh. If not
2568 // excluded, do nothing
2572 if(item.GetItem()->IsExcluded())
2576 item.GetItem()->SetExcluded(false);
2578 RedrawFromParentNode(item.GetItem());
2582 !!!180226.cpp!!! GetExcludedParent(in item : wxTreeMultiItem) : wxTreeMultiItem
2585 wxCHECK(item.IsOk(), wxTreeMultiItem(0));
2589 // go find the parent (including this one) that
2591 // can be the excluded one
2595 TreeMultiItemNode *n = item.GetItem()->IsTreeMultiItemNode();
2597 if(n && n->IsExcluded())
2599 return wxTreeMultiItem(n);
2603 n = item.GetItem()->GetParent();
2611 return wxTreeMultiItem(n);
2621 return wxTreeMultiItem(0);
2623 !!!180354.cpp!!! HitTest(in pt : wxPoint, inout flags : int) : wxTreeMultiItem
2626 // scan all nodes to see which one matches
2628 TreeMultiItemBase *b = 0;
2630 for(int i = 0; i < _root.GetNodeCount() && !b; i++)
2632 b = FindNodeByPoint(_root.GetNode(i), pt, flags);
2640 // none found, reset
2644 return wxTreeMultiItem(0);
2652 return wxTreeMultiItem(b);
2654 !!!180482.cpp!!! FindItem(in item : wxTreeMultiItem, in name : wxString, in ignoreCase : bool = false, in skipFirst : bool = false) : wxTreeMultiItem
2661 TreeMultiItemBase *b = item.GetItem();
2665 // check this item first (or not)
2673 if(b->GetName().IsSameAs(name, !ignoreCase))
2675 return wxTreeMultiItem(b);
2681 if(b->IsTreeMultiItemNode())
2685 // now check whether we are a node, then go check children
2689 TreeMultiItemNode *n = (TreeMultiItemNode *)b;
2691 wxTreeMultiItem result(0);
2693 for(int i = 0; i < n->GetNodeCount() && !result.IsOk(); i++)
2695 result = FindItem(wxTreeMultiItem(n->GetNode(i)), name, ignoreCase, false);
2707 return wxTreeMultiItem(0);
2709 !!!180866.cpp!!! GetFocus() : wxTreeMultiItem
2712 wxWindow *wnd = wxWindow::FindFocus();
2716 // now find window that holds this item. if not
2718 // visible it cannot have focus (should not have)
2722 wxTreeMultiItem item = FindWindowNode(wnd);
2724 if(item.IsOk() && item.GetItem()->IsVisible())
2730 return wxTreeMultiItem(0);
2732 !!!180994.cpp!!! GetBooleanValue(in wndId : int) : bool
2735 wxWindow *wnd = wxWindow::FindWindow(wndId);
2737 wxCHECK(wnd, false);
2741 // try a radio button
2743 wxRadioButton *b = wxDynamicCast(wnd, wxRadioButton);
2747 return b->GetValue();
2753 wxCheckBox *c = wxDynamicCast(wnd, wxCheckBox);
2757 return c->GetValue();
2761 /** \todo For custom controls we should put something in wxMultiTreeItemData class
2763 which can be overridden to retrieve the boolean value. It will also be passed
2765 the pointer to the window, so the derived class can figure out how to get a boolean
2773 // generate assert or just return with false
2777 !!!181122.cpp!!! GetTextValue(in wndId : int) : wxString
2780 wxWindow *wnd = wxWindow::FindWindow(wndId);
2782 wxCHECK(wnd, wxEmptyString);
2786 // try a radio button
2788 wxTextCtrl *t = wxDynamicCast(wnd, wxTextCtrl);
2792 return t->GetValue();
2798 wxChoice *c1 = wxDynamicCast(wnd, wxChoice);
2802 return c1->GetStringSelection();
2808 wxComboBox *c2 = wxDynamicCast(wnd, wxComboBox);
2812 return c2->GetStringSelection();
2818 wxListBox *l = wxDynamicCast(wnd, wxListBox);
2822 return l->GetStringSelection();
2826 /** \todo For custom controls we should put something in wxMultiTreeItemData class
2828 which can be overridden to retrieve the boolean value. It will also be passed
2830 the pointer to the window, so the derived class can figure out how to get a boolean
2838 // generate assert or just return with string
2840 wxCHECK(0, wxEmptyString);
2842 !!!181250.cpp!!! SetBooleanValue(in wndId : int, in value : bool = true) : void
2845 wxWindow *wnd = wxWindow::FindWindow(wndId);
2847 wxCHECK2(wnd, return);
2851 // try a radio button
2853 wxRadioButton *b = wxDynamicCast(wnd, wxRadioButton);
2869 wxCheckBox *c = wxDynamicCast(wnd, wxCheckBox);
2883 /** \todo For custom controls we should put something in wxMultiTreeItemData class
2885 which can be overridden to retrieve the boolean value. It will also be passed
2887 the pointer to the window, so the derived class can figure out how to get a boolean
2897 wxCHECK2(0, return);
2899 !!!181378.cpp!!! SetTextValue(in wndId : int, in value : wxString = wxEmptyString) : void
2902 wxWindow *wnd = wxWindow::FindWindow(wndId);
2904 wxCHECK2(wnd, return);
2908 // try a radio button
2910 wxTextCtrl *t = wxDynamicCast(wnd, wxTextCtrl);
2924 /** \todo For custom controls we should put something in wxMultiTreeItemData class
2926 which can be overridden to retrieve the boolean value. It will also be passed
2928 the pointer to the window, so the derived class can figure out how to get a boolean
2938 wxCHECK2(0, return);
2940 !!!181634.cpp!!! SetSelectionValue(in wndId : int, in sel : int) : void
2943 wxWindow *wnd = wxWindow::FindWindow(wndId);
2945 wxCHECK2(wnd, return);
2951 wxChoice *c1 = wxDynamicCast(wnd, wxChoice);
2957 c1->SetSelection(sel);
2967 wxComboBox *c2 = wxDynamicCast(wnd, wxComboBox);
2973 c2->SetSelection(sel);
2983 wxListBox *l = wxDynamicCast(wnd, wxListBox);
2989 l->SetSelection(sel);
2997 /** \todo For custom controls we should put something in wxMultiTreeItemData class
2999 which can be overridden to retrieve the boolean value. It will also be passed
3001 the pointer to the window, so the derived class can figure out how to get a boolean
3009 // generate assert or just return with string
3011 wxCHECK2(0, return);
3013 !!!181762.cpp!!! GetSelectionValue(in wndId : int) : int
3016 wxWindow *wnd = wxWindow::FindWindow(wndId);
3024 wxChoice *c1 = wxDynamicCast(wnd, wxChoice);
3028 return c1->GetSelection();
3034 wxComboBox *c2 = wxDynamicCast(wnd, wxComboBox);
3038 return c2->GetSelection();
3044 wxListBox *l = wxDynamicCast(wnd, wxListBox);
3048 return l->GetSelection();
3052 /** \todo For custom controls we should put something in wxMultiTreeItemData class
3054 which can be overridden to retrieve the boolean value. It will also be passed
3056 the pointer to the window, so the derived class can figure out how to get a boolean
3064 // generate assert or just return with string
3068 !!!181890.cpp!!! GetSelectionValues(in wndId : int, inout sels : wxArrayInt) : void
3075 wxWindow *wnd = wxWindow::FindWindow(wndId);
3077 wxCHECK2(wnd, return);
3083 wxListBox *l = wxDynamicCast(wnd, wxListBox);
3089 l->GetSelections(sels);
3097 /** \todo For custom controls we should put something in wxMultiTreeItemData class
3099 which can be overridden to retrieve the boolean value. It will also be passed
3101 the pointer to the window, so the derived class can figure out how to get a boolean
3109 // generate assert or just return with string
3111 wxCHECK2(0, return);
3113 !!!183042.cpp!!! GetParent(in item : wxTreeMultiItem) : wxTreeMultiItem
3116 // check if valid or root item has been passed, both do not have parents:
3118 if (!(item.IsOk()) || item.GetItem()->IsTreeMultiItemRoot())
3120 return wxTreeMultiItem();
3124 return wxTreeMultiItem(item.GetItem()->GetParent()); // GetParent() returns a valid pointer in case of a root item!!
3126 // therefore, the check if the passed item is a root item is necessary
3128 !!!183170.cpp!!! GetFirstChild(in item : wxTreeMultiItem, inout cookie : int) : wxTreeMultiItem
3131 if(item.IsNodeItem())
3135 TreeMultiItemNode *n = (TreeMultiItemNode *)item.GetItem();
3139 if(n->GetNodeCount() > 0)
3145 return wxTreeMultiItem(n->GetNode(0));
3153 // no children or no valid node
3157 return wxTreeMultiItem(0);
3159 !!!183298.cpp!!! GetNextChild(in item : wxTreeMultiItem, inout cookie : int) : wxTreeMultiItem
3162 if(item.IsNodeItem())
3166 TreeMultiItemNode *n = (TreeMultiItemNode *)item.GetItem();
3170 if(cookie >= 0 && cookie < (n->GetNodeCount()-1))
3174 // increment cookie, return node
3178 return wxTreeMultiItem(n->GetNode(cookie));
3186 // end of query, or no valid node
3190 return wxTreeMultiItem(0);
3192 !!!183426.cpp!!! GetLastChild(in item : wxTreeMultiItem) : wxTreeMultiItem
3195 if(item.IsNodeItem())
3199 TreeMultiItemNode *n = (TreeMultiItemNode *)item.GetItem();
3203 if(n->GetNodeCount() > 0)
3205 return wxTreeMultiItem(n->GetNode(n->GetNodeCount()-1));
3211 return wxTreeMultiItem(0);
3213 !!!183554.cpp!!! GetNextSibling(in item : wxTreeMultiItem) : wxTreeMultiItem
3216 // check if a valid item has been passed:
3220 return wxTreeMultiItem();
3224 TreeMultiItemNode* ParentPtr(item.GetItem()->GetParent());
3230 if (ParentPtr != NULL) // the parent pointer is only null if the passed item is the root
3234 // find the current item in the parent's list; the next sibling has an index that is one higher than the one of the current item:
3236 int NextItemIndex(ParentPtr->Index(item.GetItem())+1); // variable definition and initialization
3240 if (NextItemIndex < ParentPtr->GetNodeCount())
3242 return ParentPtr->GetNode(NextItemIndex);
3246 return wxTreeMultiItem();
3252 return wxTreeMultiItem();
3254 !!!183682.cpp!!! GetPrevSibling(in item : wxTreeMultiItem) : wxTreeMultiItem
3257 // check if a valid item has been passed:
3261 return wxTreeMultiItem();
3265 TreeMultiItemNode* ParentPtr(item.GetItem()->GetParent());
3271 if (ParentPtr != NULL)
3275 // find the current item in the parent's list; the next sibling has an index that is one higher than the one of the current item:
3277 int PrevItemIndex(ParentPtr->Index(item.GetItem())-1); // variable definition and initialization
3281 if (PrevItemIndex >= 0)
3283 return ParentPtr->GetNode(PrevItemIndex);
3287 return wxTreeMultiItem();
3293 return wxTreeMultiItem();
3295 !!!183810.cpp!!! GetNext(in item : wxTreeMultiItem) : wxTreeMultiItem
3298 // check if a valid item has been passed:
3302 return wxTreeMultiItem();
3306 TreeMultiItemNode* NodePtr(item.GetItem()->IsTreeMultiItemNode()); // variable definition and initialization
3310 if ((NodePtr != NULL) && (NodePtr->GetNodeCount() > 0))
3312 return wxTreeMultiItem(NodePtr->First());
3318 // variable definitions and initializations:
3320 wxTreeMultiItem Parent(item);
3322 wxTreeMultiItem Sibling;
3330 Sibling = this->GetNextSibling(Parent); // try to find next sibling
3332 Parent = this->GetParent(Parent); // get next ancestor
3334 } while (!(Sibling.IsOk()) && Parent.IsOk());
3336 // in case the loop ended with Sibling.IsOk() "Sibling" contains a valid sibling otherwise an invalid
3342 !!!183938.cpp!!! GetPrevious(in item : wxTreeMultiItem) : wxTreeMultiItem
3345 // check if a valid item has been passed:
3349 return wxTreeMultiItem();
3353 TreeMultiItemNode* NodePtr(item.GetItem()->IsTreeMultiItemNode()); // variable definition and initialization
3357 if ((NodePtr != NULL) && (NodePtr->GetNodeCount() > 0))
3359 return wxTreeMultiItem(NodePtr->Last());
3365 // variable definitions and initializations:
3367 wxTreeMultiItem Parent(item);
3369 wxTreeMultiItem Sibling;
3377 Sibling = this->GetPrevSibling(Parent); // try to find next sibling
3379 Parent = this->GetParent(Parent); // get next ancestor
3381 } while (!(Sibling.IsOk()) && Parent.IsOk());
3383 // in case the loop ended with Sibling.IsOk() "Sibling" contains a valid sibling otherwise an invalid
3389 !!!184194.cpp!!! SetCaptionFont(in font : wxFont) : void
3392 _captionFont = font;
3396 // adjust the icons so that they are in the middle
3398 AdjustIconsDeltaY();
3404 !!!184322.cpp!!! OnDraw(inout dc : wxDC) : void
3407 // go recursive and draw the whole visible tree.
3409 dc.SetFont(_captionFont);
3411 for(int i = 0; i < _root.GetNodeCount(); i++)
3413 DrawNode(_root.GetNode(i), dc);