]> Creatis software - bbtk.git/blob - doc/bouml/bbtkk/140674.bodies
.
[bbtk.git] / doc / bouml / bbtkk / 140674.bodies
1 class wxTreeMultiCtrl
2 !!!172546.cpp!!!        DoFold(inout item : TreeMultiItemBase, in expand : bool, in recursive : bool) : void
3
4
5
6
7         // go through all node objects on this level, and expand or
8
9         // collapse them
10
11
12
13         if(item == 0)
14
15                 return;
16
17
18
19         // if this is a node, use it to go through all the subnodes (if needed)
20
21         // if not, then just exit.
22
23
24
25         TreeMultiItemNode *node = item->IsTreeMultiItemNode();
26
27         if(node)
28
29         {
30
31                 node->Fold(expand);
32
33
34
35                 // go recursive
36
37                 if(recursive)
38
39                 {
40
41                         TreeMultiItemNode *p;
42
43                         for(int i = 0; i < node->GetNodeCount(); i++)
44
45                         {
46
47                                 // get node, and if a real node, then call fold
48
49                                 p = node->GetNode(i)->IsTreeMultiItemNode();
50
51                                 if(p)
52
53                                         p->Fold(expand);
54
55
56
57                                 // go recursive for every node
58
59                                 DoFold(p, expand, recursive);
60
61                         }
62
63                 }
64
65         }
66
67 !!!172674.cpp!!!        RedrawFromNode(inout n : TreeMultiItemNode) : void
68
69
70         static int recalcMutex = 0;
71
72         bool visible = true;
73
74
75
76         if(recalcMutex > 0)
77
78                 return;
79
80
81
82         recalcMutex ++;
83
84
85
86         // when node is not visible or excluded
87
88         // then don't redraw.
89
90
91
92         if(n)
93
94                 visible = n->IsVisible();
95
96
97
98         if(visible)
99
100         {
101
102                 int h, h1,w, w1;
103
104                 GetVirtualSize(&w, &h);
105
106
107
108                 UpdateAllWindowVisibility();
109
110                 RecalculateNodePositions();
111
112                 RecalculateVirtualSize();
113
114
115
116                 // why is this needed? Because folding or collapsing can change
117
118                 // the state. When the virtual area gets smaller, we need to keep
119
120                 // the largest one and the other way atound. And since we do not
121
122                 // know here we are folding or collapsing, we remember the biggest
123
124                 GetVirtualSize(&w1, &h1);
125
126
127
128                 if(h1 > h)
129
130                         h = h1;
131
132
133
134                 // only refresh the part from x,y down
135
136                 if(n)
137
138                 {
139
140                         int x, y;
141
142                         CalcScrolledPosition(n->GetX(), n->GetY(), &x, &y);
143
144                         if(h - y > 0)
145
146                         {
147
148                                 wxRect rect(0, y, w, h - y);
149
150                                 RefreshRect(rect);
151
152                         }
153
154                         else
155
156                                 Refresh();
157
158                 }
159
160                 else
161
162                         Refresh();      // do a full refresh
163
164         }
165
166
167
168         recalcMutex --;
169
170 !!!172802.cpp!!!        RedrawFromParentNode(inout n : TreeMultiItemBase) : void
171
172
173         TreeMultiItemNode *p = 0;
174
175         if(n)
176
177                 p = n->GetParent();
178
179
180
181         RedrawFromNode(p);
182
183 !!!172930.cpp!!!        DrawCheckbox(inout b : TreeMultiItemBase, inout dc : wxDC, in convertScrolled : bool = false) : void
184
185
186         wxCHECK2(b, return);
187
188
189
190         wxBitmap *bmp;
191
192         int bmpOffsetX = b->GetX() - (_gutterWidth + _iconWidth);
193
194
195
196         switch(b->GetCheckboxState())
197
198         {
199
200         case 0:
201
202                 bmp = _uncheckBmp;
203
204                 break;
205
206         case 1:
207
208                 bmp = _checkBmp;
209
210                 break;
211
212         default:
213
214                 bmp = _tristateBmp;
215
216                 break;
217
218         }
219
220
221
222         int x, xx, y, yy;
223
224
225
226         if(b->IsTreeMultiItemWindow())
227
228         {
229
230                 xx = x = bmpOffsetX - ((TreeMultiItemWindow *)b)->GetFrontSpacing() + _checkWidth;
231
232                 yy = y = b->GetY() + _checkDeltaY;
233
234         }
235
236         else
237
238         {
239
240                 xx = x = bmpOffsetX;
241
242                 yy = y = b->GetY() + _checkDeltaY;
243
244         }
245
246
247
248         if(convertScrolled)
249
250                 CalcScrolledPosition(x, y, &xx, &yy);
251
252
253
254         dc.DrawBitmap(*bmp, xx, yy, true);
255
256 !!!173058.cpp!!!        RecalculateNodePositions() : void
257
258
259         int currentY = _spacingY;
260
261         // go recursive on every node, and store the information in the node
262
263
264
265         for(int i = 0; i < _root.GetNodeCount(); i++)
266
267         currentY += CalculateNodeDimensions(_root.GetNode(i), currentY, 0);
268
269 !!!173186.cpp!!!        CalculateNodeDimensions(inout b : TreeMultiItemBase, in currentY : int, in level : int) : int
270
271
272         int gutter = (_gutterWidth * 2) + _iconWidth;
273
274         int y = 0, topSpacing = 0;
275
276
277
278         // return same if no proper object
279
280         wxCHECK(b, 0);
281
282
283
284 #if(CHECKBOXVIEW)
285
286         if(b->GetCheckbox())
287
288                 gutter += _checkWidth;
289
290 #endif
291
292
293
294         // if we are not visible, skip recalculation and descending
295
296         if(b->IsVisible())
297
298         {
299
300                 b->SetY(currentY);
301
302
303
304                 // if level is 0, calculate with front gutter, else without
305
306                 y = currentY + b->GetHeight();
307
308                 if(b->IsTreeMultiItemNode())
309
310                 {
311
312                         TreeMultiItemNode *n = (TreeMultiItemNode *)b;
313
314
315
316                         if(level == 0)
317
318                                 b->SetX(gutter);
319
320                         else
321
322                                 b->SetX(gutter + (level * (_gutterWidth + _iconWidth)));
323
324
325
326                         // now do children of this node
327
328
329
330                         for(int i = 0; i < n->GetNodeCount(); i++)
331
332                                 y += CalculateNodeDimensions(n->GetNode(i), y + _spacingY, level+1);
333
334                 }
335
336                 else if(b->IsTreeMultiItemWindow())
337
338                 {
339
340                         TreeMultiItemWindow *w = (TreeMultiItemWindow *)b;
341
342
343
344                         if(level == 0)
345
346                                 b->SetX(gutter + w->GetFrontSpacing());
347
348                         else
349
350                                 b->SetX(_gutterWidth + (level * (_gutterWidth + _iconWidth)) + w->GetFrontSpacing());
351
352
353
354                         topSpacing = w->GetTopSpacing();
355
356
357
358                         // reposition the window
359
360
361
362                         wxWindow *wnd = w->GetWindow();
363
364                         if(wnd)
365
366                         {
367
368                                 int x = 0, y = 0;
369
370                                 CalcScrolledPosition(w->GetX(), w->GetY(), &x, &y);
371
372                                 wnd->SetSize(x, y, w->GetWidth(), w->GetHeight());
373
374                         }
375
376                 }
377
378
379
380                 if(y > 0)
381
382                         return (y - currentY) + _spacingY + topSpacing; // return delta
383
384                 else
385
386                         return 0;
387
388         }
389
390
391
392         return 0;       // not visible, thus we skip calculations
393
394 !!!173314.cpp!!!        DrawNode(inout b : TreeMultiItemBase, inout dc : wxDC) : void
395
396
397         // go through this item .. if it is a node, draw
398
399         // the caption, else reposition the window.
400
401
402
403         if(!b)
404
405                 return;
406
407
408
409         // forget it if this node is not visible
410
411         if(b->IsVisible())
412
413         {
414
415                 int bmpOffsetX = b->GetX() - (_gutterWidth + _iconWidth);
416
417
418
419 #if(CHECKBOXVIEW)
420
421                 // now draw the checkbox if there is any, in the proper state
422
423                 if(b->GetCheckbox())
424
425                 {
426
427                         DrawCheckbox(b, dc);
428
429
430
431                         // adjust the bmpOffset because we also have a checkbox
432
433                         bmpOffsetX -= _checkWidth;
434
435                 }
436
437 #endif
438
439
440
441                 if(b->IsTreeMultiItemNode())
442
443                 {
444
445                         // draw the node icon and the caption
446
447                         TreeMultiItemNode *n = (TreeMultiItemNode *)b;
448
449
450
451                  // set background of caption item
452
453                   if (n->IsSelected())
454
455                   {
456
457                     dc.SetBrush(*(this->m_HilightBrush));
458
459         dc.SetPen(wxPen(this->m_HilightBrush->GetColour(),1,wxSOLID));
460
461                   } /* if */
462
463                   else
464
465                   {
466
467                     dc.SetBrush(wxBrush(*wxWHITE,wxSOLID));
468
469         dc.SetPen(wxPen(*wxWHITE,1,wxSOLID));
470
471                   } /* if */
472
473                   dc.DrawRectangle(n->GetX(),n->GetY(),n->GetWidth(),n->GetHeight());
474
475                  // draw caption
476
477                         dc.DrawText(n->GetCaption(), n->GetX(), n->GetY());
478
479
480
481                         // draw the bitmap for the state
482
483                         if(n->IsExpanded())
484
485                                 dc.DrawBitmap(*_expandBmp, bmpOffsetX, n->GetY() + _iconDeltaY, true);
486
487                         else
488
489                                 dc.DrawBitmap(*_collBmp, bmpOffsetX, n->GetY() + _iconDeltaY, true);
490
491
492
493                         // now go through all the subnodes
494
495                         for(int i = 0; i < n->GetNodeCount(); i++)
496
497                                 DrawNode(n->GetNode(i), dc);
498
499
500
501                 }
502
503         }
504
505 !!!173442.cpp!!!        SetWindowBackgroundColour(inout wnd : wxWindow, in col : wxColour, in flags : int) : void
506
507
508         if(wnd)
509
510         {
511
512                 // if we cannot change a button, make sure all button
513
514                 // classes are not changed
515
516
517
518                 wxButton *btn = wxDynamicCast(wnd, wxButton);
519
520                 if(!btn || ((flags & wxTMC_BG_ADJUST_BTN) != 0))
521
522                         wnd->SetBackgroundColour(col);
523
524
525
526                 // get every window, and make the background equal to the given one
527
528                 wxWindowListNode *node = wnd->GetChildren().GetFirst();
529
530                 while (node)
531
532                 {
533
534                         SetWindowBackgroundColour(node->GetData(), col, flags);
535
536                         node = node->GetNext();
537
538                 }
539
540         }
541
542 !!!173570.cpp!!!        ShowTreeMultiWindow(inout window : TreeMultiItemWindow, in show : bool = true) : void
543
544
545         // show or hide window
546
547         if(window && window->GetWindow())
548
549                 window->GetWindow()->Show(show);
550
551 !!!173698.cpp!!!        UpdateAllWindowVisibility() : void
552
553
554         // all roots are visible, but what lies beneath ... who knows
555
556         for(int i = 0; i < _root.GetNodeCount(); i++)
557
558                 UpdateTreeMultiWindowVisibility(_root.GetNode(i), true);
559
560 !!!173826.cpp!!!        UpdateTreeMultiWindowVisibility(inout b : TreeMultiItemBase, in show : bool) : void
561
562
563         if(b)
564
565         {
566
567                 // this is done for performance issues. IsVisible can go all
568
569                 // the way up the tree to check. However if show is already
570
571                 // false, there is no need to check (some higher one is collapsed)
572
573                 bool showMe = show;
574
575
576
577                 if(showMe)
578
579                         showMe = b->IsVisible();
580
581
582
583                 if(b->IsTreeMultiItemWindow())
584
585                 {
586
587                         // if this level must be hidden, hide
588
589                         ShowTreeMultiWindow((TreeMultiItemWindow*)b, showMe);
590
591                 }
592
593                 else if(b->IsTreeMultiItemNode())
594
595                 {
596
597                         TreeMultiItemNode *node = (TreeMultiItemNode *)b;
598
599
600
601                         // if hidden, descend and hide all windows
602
603                         for(int i = 0; i < node->GetNodeCount(); i++)
604
605                                 UpdateTreeMultiWindowVisibility(node->GetNode(i), showMe);
606
607                 }
608
609         }
610
611 !!!173954.cpp!!!        RecalculateVirtualSize() : void
612
613
614         // go through all the nodes, and store the largest x and largest y
615
616
617
618         int x = 0, y = 0;
619
620         RecalculateVirtualSizeFromNode(&_root, x, y);
621
622
623
624         // now adjust virtual size
625
626         SetVirtualSize(x, y);
627
628         AdjustScrollbars(x, y);
629
630 !!!174082.cpp!!!        AdjustScrollbars(in x : int, in y : int) : void
631
632
633         // adjust scrollbars
634
635         // courtesy of treectrlg.cpp
636
637
638
639         y += WXTMC_PIXELS_PER_UNIT+2; // one more scrollbar unit + 2 pixels
640
641     x += WXTMC_PIXELS_PER_UNIT+2; // one more scrollbar unit + 2 pixels
642
643     int x_pos = GetScrollPos( wxHORIZONTAL );
644
645     int y_pos = GetScrollPos( wxVERTICAL );
646
647     SetScrollbars( WXTMC_PIXELS_PER_UNIT, WXTMC_PIXELS_PER_UNIT, x/WXTMC_PIXELS_PER_UNIT,
648
649                            y/WXTMC_PIXELS_PER_UNIT, x_pos, y_pos, true );
650
651 !!!174210.cpp!!!        RecalculateVirtualSizeFromNode(in node : TreeMultiItemNode, inout x : int, inout y : int) : void
652
653
654         if(node->IsExcluded())
655
656                 return;
657
658
659
660         // if calulate this node's dimensions
661
662         if(x < (node->GetWidth() + node->GetX()))
663
664                 x = node->GetWidth() + node->GetX();
665
666
667
668         y = node->GetY() + node->GetHeight();
669
670
671
672         // if this node is collapsed, no subnodes are visible, else
673
674         // go through all subnodes as well, node needs to be included as well
675
676         if(node->IsExpanded())
677
678         {
679
680                 TreeMultiItemBase *b;
681
682                 for(int i = 0; i < node->GetNodeCount(); i++)
683
684                 {
685
686                         b = node->GetNode(i);
687
688
689
690                         // calculate x and y
691
692                         if(x < (b->GetWidth() + b->GetX()))
693
694                                 x = b->GetWidth() + b->GetX();
695
696
697
698                         y = b->GetY() + b->GetHeight();
699
700
701
702                         if(b->IsTreeMultiItemNode())
703
704                                 RecalculateVirtualSizeFromNode((TreeMultiItemNode *)b, x, y);
705
706                 }
707
708         }
709
710 !!!174338.cpp!!!        FindNodeByPoint(inout b : TreeMultiItemBase, in pt : wxPoint, inout area : int) : TreeMultiItemBase
711
712
713         wxCHECK(b, 0);
714
715
716
717         // if this layer is not visible, return with nothing.
718
719         if(!b->IsVisible())
720
721                 return 0;
722
723
724
725         area = 0;
726
727
728
729         // now see if our y is matching the mouse
730
731         if(pt.y >= b->GetY() && pt.y < (b->GetY() + b->GetHeight()))
732
733         {
734
735 #if(CHECKBOXVIEW)
736
737                 // if we are checkboxed, calculate the checkbox position
738
739                 if(b->GetCheckbox())
740
741                 {
742
743                         int extraSpacing = 0, extraWidth = 0;
744
745
746
747                         // now for a windows item, this is minus the gutter. For a normal node it is X minus checkbox
748
749                         if(b->IsTreeMultiItemWindow())
750
751                         {
752
753                             extraWidth = _checkWidth;
754
755                                 extraSpacing = ((TreeMultiItemWindow *)b)->GetFrontSpacing();
756
757                         }
758
759                         else
760
761                                 extraSpacing = 4;
762
763
764
765                         if(pt.x > (b->GetX() - extraSpacing - _checkWidth) && pt.x < (b->GetX() - extraSpacing + extraWidth))
766
767                         {
768
769                                 area = wxTMC_HITTEST_CHECKBOX;
770
771                                 return b;
772
773                         }
774
775                 }
776
777 #endif
778
779
780
781                 // allrighty we have something, now where and what is it (look with x)
782
783                 if(pt.x < b->GetX())
784
785                         area = wxTMC_HITTEST_GUTTER;
786
787
788
789                 /** \todo Match only the real part of the caption, window (we assume x > GetX() which is the rest)
790
791                         HOWEVER the window probably doesn't propagate the click event back to the parent, so we might
792
793                         leave it like this so the use can click behind a window so it will be selected.
794
795                 */
796
797                 else
798
799                 {
800
801                         // inside area, return proper flag
802
803                         if(b->IsTreeMultiItemNode())
804
805                                 area = wxTMC_HITTEST_CAPTION;
806
807                         else
808
809                                 area = wxTMC_HITTEST_WINDOW;
810
811                 }
812
813
814
815                 return b;
816
817         }
818
819         else
820
821         {
822
823                 // not found, let's try our children if we have some
824
825                 TreeMultiItemNode *n = b->IsTreeMultiItemNode();
826
827                 if(n)
828
829                 {
830
831                         TreeMultiItemBase *bb = 0;
832
833                         for(int i = 0; i < n->GetNodeCount() && !bb; i++)
834
835                                 bb = FindNodeByPoint(n->GetNode(i), pt, area);
836
837
838
839                         // keep returning result to caller
840
841                         return bb;
842
843                 }
844
845         }
846
847
848
849         return 0;
850
851 !!!174466.cpp!!!        FindWindowNode(inout wnd : wxWindow, inout n : TreeMultiItemNode = 0) : wxTreeMultiItem
852
853
854         wxCHECK(wnd, wxTreeMultiItem(0));
855
856
857
858         // take root node if not assigned one
859
860
861
862         if(!n)
863
864                 n = (TreeMultiItemNode *)&_root;
865
866
867
868         // check on this level for the wxWindow pointer
869
870
871
872         TreeMultiItemWindow *w;
873
874         wxTreeMultiItem result(0);
875
876         for(int i = 0; i < n->GetNodeCount() && !result.IsOk(); i++)
877
878         {
879
880                 // if window node
881
882                 w = n->GetNode(i)->IsTreeMultiItemWindow();
883
884                 if(w && w->GetWindow() == wnd)
885
886                         return wxTreeMultiItem(n);
887
888
889
890                 // if node, go deeper
891
892                 if(n->GetNode(i)->IsTreeMultiItemNode())
893
894                         result = FindWindowNode(wnd, (TreeMultiItemNode*)n->GetNode(i));
895
896         }
897
898
899
900         return result;
901
902 !!!174594.cpp!!!        FindNextVisibleWindowItem(inout b : TreeMultiItemBase, in index : int = -1) : TreeMultiItemWindow
903
904
905         wxCHECK(b, 0);
906
907
908
909         // check on this level, go deeper with every node we got. When a node is not
910
911         // visible anymore, skip the node.
912
913
914
915         TreeMultiItemWindow *value = 0;
916
917         if(b->IsVisible())
918
919         {
920
921                 // if we are already searching on a node with an index
922
923
924
925                 TreeMultiItemBase *bn = 0;
926
927                 TreeMultiItemNode *n = b->IsTreeMultiItemNode();
928
929                 if(n)
930
931                 {
932
933                         for(int i = index + 1; i < n->GetNodeCount() && !value; i++)
934
935                         {
936
937                                 bn = n->GetNode(i);
938
939                                 value = bn->IsTreeMultiItemWindow();
940
941
942
943                                 // assume a node, root when not a a window
944
945                                 if(!value)
946
947                                         value = FindNextVisibleWindowItem(bn, -1);
948
949                         }
950
951
952
953                 }
954
955                 else
956
957                 {
958
959                         if(b->IsTreeMultiItemWindow())
960
961                         {
962
963                                 // get parent first, and locate child as ptr
964
965                                 TreeMultiItemNode *p = b->GetParent();
966
967                                 wxCHECK(p, 0);
968
969
970
971                                 // go scan the parent from the given index, if
972
973                                 // the index is valid else there is no child with that index
974
975
976
977                                 int idx = p->Index(b);
978
979                                 wxCHECK(idx >= 0, 0);
980
981
982
983                                 value = FindNextVisibleWindowItem(p, idx);
984
985                         }
986
987                 }
988
989         }
990
991
992
993         return value;
994
995
996
997 !!!174722.cpp!!!        AdjustIconsDeltaY() : void
998
999
1000         int x = 0, y = 0;
1001
1002
1003
1004         if(_captionFont.Ok())
1005
1006       GetTextExtent(wxT("jG"), &x, &y, 0, 0, &_captionFont);
1007
1008         _captionHeight = y;
1009
1010
1011
1012         if(_maxHeight < _captionHeight)
1013
1014                 _maxHeight = _captionHeight;
1015
1016
1017
1018         // determine the center pos for the [+]
1019
1020         _iconDeltaY = abs(_maxHeight - _iconHeight) / 2 + 1;
1021
1022         if(_iconDeltaY < 1)
1023
1024                 _iconDeltaY = 1;
1025
1026
1027
1028 #if(CHECKBOXVIEW)
1029
1030         // determine the center pos for the checkbox
1031
1032         _checkDeltaY = abs(_maxHeight - _checkHeight) / 2 + 1;
1033
1034         if(_checkDeltaY < 1)
1035
1036                 _checkDeltaY = 1;
1037
1038 #endif
1039
1040 !!!174850.cpp!!!        CalculateNodeSpanning(inout b : TreeMultiItemBase) : void
1041
1042
1043         // return same if no proper object
1044
1045         wxCHECK2(b, return);
1046
1047
1048
1049         if(b->IsTreeMultiItemNode())
1050
1051         {
1052
1053                 TreeMultiItemNode *n = (TreeMultiItemNode *)b;
1054
1055
1056
1057                 // now do children of this node
1058
1059
1060
1061                 for(int i = 0; i < n->GetNodeCount(); i++)
1062
1063                         CalculateNodeSpanning(n->GetNode(i));
1064
1065         }
1066
1067         else if(b->IsTreeMultiItemWindow())
1068
1069         {
1070
1071                 TreeMultiItemWindow *w = (TreeMultiItemWindow *)b;
1072
1073                 wxWindow *wnd = w->GetWindow();
1074
1075                 if(wnd)
1076
1077                 {
1078
1079                         // if the window is spanning, we adjust the width to the max width of the control
1080
1081                         if(w->GetHorizontalSpan())
1082
1083                         {
1084
1085                                 wxSize tmcsize = GetClientSize();
1086
1087                                 int maxwidth = tmcsize.GetWidth() - w->GetX() - 8; // extract 3 for border
1088
1089
1090
1091                                 wxSizer *sz = wnd->GetSizer();
1092
1093                                 if(sz)
1094
1095                                 {
1096
1097                                         if(maxwidth < sz->GetMinSize().GetWidth())
1098
1099                                                 maxwidth = sz->GetMinSize().GetWidth();
1100
1101                                 }
1102
1103
1104
1105                                 // prevent a size of 0
1106
1107                                 if(maxwidth < 1)
1108
1109                                         maxwidth = 1;
1110
1111
1112
1113                                 // set the size
1114
1115                                 w->SetWidth(maxwidth);
1116
1117                                 wnd->SetSize(w->GetWidth(), w->GetHeight());
1118
1119
1120
1121                                 // layout by sizer (not sure if this is needed)
1122
1123                                 if(wnd->GetSizer())
1124
1125                                         wnd->GetSizer()->Layout();
1126
1127                         }
1128
1129                 }
1130
1131         }
1132
1133 !!!174978.cpp!!!        SetRecursiveCheckState(inout n : TreeMultiItemNode, in check : bool) : void
1134
1135
1136         int state = 0;
1137
1138         if(check)
1139
1140                 state++;
1141
1142
1143
1144         // go check all kids on this level
1145
1146         for(int i = 0; i < n->GetNodeCount(); i++)
1147
1148         {
1149
1150                 // check all the nodes, and go deeper
1151
1152                 n->GetNode(i)->SetCheckboxState(state);
1153
1154                 if(n->GetNode(i)->IsTreeMultiItemNode())
1155
1156                         SetRecursiveCheckState((TreeMultiItemNode *)n->GetNode(i), check);
1157
1158         }
1159
1160 !!!175106.cpp!!!        ScanTristateCheckstates(inout b : TreeMultiItemBase) : void
1161
1162
1163         // check from the parent on, all node entries and see if they are
1164
1165         // checked or cleared or scattered
1166
1167         TreeMultiItemNode *p = b->GetParent();
1168
1169
1170
1171         if(p && p->GetCheckbox())
1172
1173         {
1174
1175                 bool foundcheck = false, foundclear = false;
1176
1177                 for(size_t i = 0; i < (size_t)p->GetNodeCount(); ++i)
1178
1179                 {
1180
1181                         // only evaluate when checkboxed
1182
1183                         if(p->GetNode(i)->IsTreeMultiItemWindow() && p->GetNode(i)->GetCheckbox())
1184
1185                         {
1186
1187                                 // record instance of a cleared checkbox
1188
1189                                 if(!p->GetNode(i)->GetCheckboxState())
1190
1191                                         foundclear = true;
1192
1193                                 // record instance of checked checkbox
1194
1195                                 if(p->GetNode(i)->GetCheckboxState() == 1)
1196
1197                                         foundcheck = true;
1198
1199                         }
1200
1201                 }
1202
1203
1204
1205                 // if we have both check and clear, go tristate
1206
1207                 // if all clear, clear parent and if all set, then set parent
1208
1209                 if(foundclear && !foundcheck)
1210
1211                         p->SetCheckboxState(0);
1212
1213                 else if(!foundclear && foundcheck)
1214
1215                         p->SetCheckboxState(1);
1216
1217                 else if(foundclear && foundcheck)
1218
1219                         p->SetCheckboxState(2);
1220
1221
1222
1223                 //wxClientDC dc;
1224
1225                 //DrawCheckbox(p, dc, false);
1226
1227                 RedrawFromNode(p);
1228
1229         }
1230
1231 !!!175234.cpp!!!        InsertNode(inout ParentPtr : TreeMultiItemNode, in Position : size_t, in Caption : wxString, in Name : wxString) : wxTreeMultiItem
1232
1233
1234         int extX, extY;
1235
1236
1237
1238   TreeMultiItemNode* NodePtr(new TreeMultiItemNode(ParentPtr,Caption,Name)); // generate new node pointer
1239
1240
1241
1242
1243
1244  // continue with initializing the new node:
1245
1246 #if(CHECKBOXVIEW)
1247
1248  // if checkbox view is desired, tag this item as a checkbox
1249
1250  // and set the state as 'false'
1251
1252         NodePtr->SetCheckbox(_checkboxView);
1253
1254         NodePtr->SetCheckboxState(0);
1255
1256 #endif
1257
1258  // calculate the height and width
1259
1260         this->GetTextExtent(Caption,&extX,&extY,0,0,&(this->_captionFont));
1261
1262         NodePtr->SetHeight(extY);
1263
1264         NodePtr->SetWidth(extX);
1265
1266  // finally, insert node:
1267
1268   if (Position < (size_t)ParentPtr->GetNodeCount())
1269
1270     ParentPtr->InsertNode(NodePtr,Position);
1271
1272   else
1273
1274     ParentPtr->AddNode(NodePtr);
1275
1276  // return the newly created node:
1277
1278   return wxTreeMultiItem(NodePtr);
1279
1280 !!!175362.cpp!!!        InsertWindow(inout ParentPtr : TreeMultiItemNode, in Position : size_t, inout WindowPtr : wxWindow, in Name : wxString, in Info : wxTreeMultiWindowInfo, in Flags : int) : wxTreeMultiItem
1281
1282
1283   int WindowFlags;
1284
1285
1286
1287         TreeMultiItemWindow* NewWindowPtr = new TreeMultiItemWindow(ParentPtr,Name); // generate new window pointer
1288
1289
1290
1291
1292
1293  // get flags from passed variable "Flags"; in case this variable does not contain any flags use the window's information flags:
1294
1295   if (Flags != 0)
1296
1297     WindowFlags = Flags;
1298
1299   else
1300
1301     WindowFlags = Info.GetFlags();
1302
1303
1304
1305  // continue with initializing the new window:
1306
1307 #if(CHECKBOXVIEW)
1308
1309         // if checkbox view is desired, tag this item as a checkbox
1310
1311         // and set the state as 'false'
1312
1313         NewWindowPtr->SetCheckbox(_checkboxView);
1314
1315 #endif
1316
1317  // if style wants us to change background, set it to our background
1318
1319         if (WindowFlags & wxTMC_BG_ADJUST_ALL)
1320
1321         {
1322
1323                 // go through all children of this window, and set the
1324
1325                 // background of it (recursively)
1326
1327                 this->SetWindowBackgroundColour(WindowPtr,this->GetBackgroundColour(),WindowFlags);
1328
1329         } /* if */
1330
1331
1332
1333  // set the spacing:
1334
1335         NewWindowPtr->SetTopSpacing(Info.GetTopSpacing());
1336
1337 #if(CHECKBOXVIEW)
1338
1339         // make sure that the checkboxes are at least indented enough
1340
1341         if (this->_checkboxView)
1342
1343                 NewWindowPtr->SetFrontSpacing(Info.GetFrontSpacing() + this->_checkWidth);
1344
1345         else
1346
1347 #endif
1348
1349                 NewWindowPtr->SetFrontSpacing(Info.GetFrontSpacing());
1350
1351  // assign finally the window:
1352
1353         NewWindowPtr->AssignWindow(WindowPtr);
1354
1355
1356
1357 #if(CHECKBOXVIEW)
1358
1359  // set the checkbox state after the window is assigned
1360
1361         NewWindowPtr->SetCheckboxState(Info.GetDefaultCheckState());
1362
1363 #endif
1364
1365
1366
1367  // if the window is not visible, set hide flag
1368
1369         this->ShowTreeMultiWindow(NewWindowPtr,NewWindowPtr->IsVisible());
1370
1371
1372
1373  // finally, insert the newly constructed window:
1374
1375   if (Position < (size_t)ParentPtr->GetNodeCount())
1376
1377     ParentPtr->InsertNode(NewWindowPtr,Position);
1378
1379   else
1380
1381     ParentPtr->AddNode(NewWindowPtr);
1382
1383  // return the newly created window:
1384
1385         return wxTreeMultiItem(NewWindowPtr);
1386
1387 !!!175490.cpp!!!        Init() : void
1388
1389
1390         _root.Clear();
1391
1392
1393
1394         _expandBmp = 0;
1395
1396         _collBmp = 0;
1397
1398
1399
1400 #if(CHECKBOXVIEW)
1401
1402         _checkBmp = 0;
1403
1404         _uncheckBmp = 0;
1405
1406         _tristateBmp = 0;
1407
1408
1409
1410         _checkHeight = 11;
1411
1412         _checkWidth = 11;
1413
1414
1415
1416         _checkboxView = false;
1417
1418 #endif
1419
1420
1421
1422         _gutterWidth = WXTMC_GUTTER_DEFAULT;
1423
1424         _iconWidth = 11;
1425
1426         _iconHeight = 11;
1427
1428         _maxHeight = 1;;
1429
1430         _iconDeltaY = 2;
1431
1432         _spacingY = WXTMC_YSPACING_DEFAULT;
1433
1434         _captionHeight = 13;
1435
1436
1437
1438         // create two bitmap nodes for drawing
1439
1440
1441
1442         _expandBmp = new wxBitmap(expand_xpm);
1443
1444         _collBmp = new wxBitmap(collapse_xpm);
1445
1446
1447
1448         // calculate average font height for bitmap centering
1449
1450
1451
1452         _iconWidth = _expandBmp->GetWidth();
1453
1454         _iconHeight = _expandBmp->GetHeight();
1455
1456
1457
1458 #if(CHECKBOXVIEW)
1459
1460         // create bitmaps for checkboxes
1461
1462         _checkBmp = new wxBitmap(checked_icon);
1463
1464         _uncheckBmp = new wxBitmap(unchecked_icon);
1465
1466         _tristateBmp = new wxBitmap(tristate_icon);
1467
1468
1469
1470         // adjust the height if the checkboxes are higher
1471
1472         // so that everything is alligned properly
1473
1474         _checkHeight = _checkBmp->GetHeight();
1475
1476         _checkWidth = _checkBmp->GetWidth();
1477
1478 #endif
1479
1480
1481
1482         // remember the highest of the two bitmaps so there is
1483
1484         // always enough room
1485
1486         _maxHeight = _iconHeight;
1487
1488
1489
1490 #if(CHECKBOXVIEW)
1491
1492         if(_maxHeight < _checkHeight)
1493
1494                 _maxHeight = _checkHeight;
1495
1496 #endif
1497
1498
1499
1500  // set standard highlighting brush
1501
1502   this->m_HilightBrush = new wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT),wxSOLID);
1503
1504
1505
1506         // set standard DC font
1507
1508     _captionFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
1509
1510
1511
1512         // adjust bitmap icon y position so they are centered
1513
1514         AdjustIconsDeltaY();
1515
1516
1517
1518         // set virtual size to this window size
1519
1520         if (_create_called) {
1521
1522                 wxSize wndsize = GetSize();
1523
1524                 SetVirtualSize(wndsize.GetWidth(), wndsize.GetWidth());
1525
1526         }
1527
1528 !!!175746.cpp!!!        OnMouseClick(inout event : wxMouseEvent) : void
1529
1530
1531         // react on double click and left mouse down
1532
1533         if(event.LeftDown() || event.LeftDClick())
1534
1535         {
1536
1537                 // get translation point
1538
1539                 wxPoint pt( event.GetPosition() );
1540
1541
1542
1543                 int x = 0, y = 0;
1544
1545                 CalcUnscrolledPosition( pt.x, pt.y, &x, &y );
1546
1547
1548
1549                 // go check if we clicked a treenode
1550
1551                 int flags;
1552
1553                 wxPoint p(x,y);
1554
1555                 wxTreeMultiItem id = HitTest(p, flags);
1556
1557
1558
1559 #if(CHECKBOXVIEW)
1560
1561                 if(flags == wxTMC_HITTEST_CHECKBOX)
1562
1563                 {
1564
1565                         // toggle the checkbox, and redraw
1566
1567                         if(id.IsOk())
1568
1569                         {
1570
1571                                 TreeMultiItemBase *b = id.GetItem();
1572
1573                                 b->SetCheckboxState((b->GetCheckboxState()+1) & 0x1);
1574
1575
1576
1577                                 TreeMultiItemWindow *w = b->IsTreeMultiItemWindow();
1578
1579                                 if(w)
1580
1581                                 {
1582
1583                                         // try to force a focus on the window. This could
1584
1585                                         // be extended by searching for the first edit control
1586
1587                                         // class but for now, just a focus is tried.
1588
1589                                         w->GetWindow()->Enable(b->GetCheckboxState() == 1);
1590
1591                                         w->GetWindow()->SetFocus();
1592
1593
1594
1595                                         // draw the checkbox in the state needed
1596
1597                                         wxClientDC dc(this);
1598
1599                                         DrawCheckbox(b, dc, true);
1600
1601
1602
1603                                         // TODO: determine if the upper parents should be
1604
1605                                         // tristated or not
1606
1607
1608
1609                                         ScanTristateCheckstates(b);
1610
1611
1612
1613                                 }
1614
1615                                 else if(b->IsTreeMultiItemNode())
1616
1617                                 {
1618
1619                                         // descend to all the children and set the state of the parent
1620
1621                                         SetRecursiveCheckState((TreeMultiItemNode *)b, b->GetCheckboxState() == 1);
1622
1623                                         RedrawFromNode((TreeMultiItemNode *)b);
1624
1625                                 }
1626
1627                         }
1628
1629                 }
1630
1631                 else
1632
1633 #endif // #if(CHECKBOXVIEW)
1634
1635                 {
1636
1637                         // react on left mouse button, to fold and on
1638
1639                         // right for caption doubleclick
1640
1641                         int area = -1;
1642
1643
1644
1645 // adjust behaviour for Linux (single click = always fold)
1646
1647 #ifndef LINUX
1648
1649                         if(event.LeftDClick())
1650
1651                                 area = wxTMC_HITTEST_CAPTION;
1652
1653                         else
1654
1655                                 area = wxTMC_HITTEST_GUTTER;
1656
1657 #else
1658
1659                         area = flags;
1660
1661 #endif
1662
1663
1664
1665 // Linux (single or double click -> always fold
1666
1667       if (id.IsOk())
1668
1669       {
1670
1671 #ifdef LINUX
1672
1673                                 // we have a valid item, if it is a node, then fold
1674
1675                                 TreeMultiItemNode *n = id.GetItem()->IsTreeMultiItemNode();
1676
1677                                 if(n)
1678
1679                                 {
1680
1681                                   this->SelectItem(id);
1682
1683                                         Fold(n, !n->IsExpanded());
1684
1685                                 } /* if */
1686
1687 #else
1688
1689         if (event.LeftDown())
1690
1691           if (flags == wxTMC_HITTEST_GUTTER)
1692
1693           {
1694
1695                                 TreeMultiItemNode *n = id.GetItem()->IsTreeMultiItemNode(); // for some reasons also windows may have set the flag
1696
1697
1698
1699             if (n != NULL)
1700
1701                                         Fold(n, !n->IsExpanded());
1702
1703           } /* if */
1704
1705           else if (flags == wxTMC_HITTEST_CAPTION)
1706
1707           {
1708
1709                                 TreeMultiItemNode *n = id.GetItem()->IsTreeMultiItemNode(); // for some reasons also windows may have set the flag
1710
1711
1712
1713                                 if (n != NULL)
1714
1715                                 {
1716
1717                                   this->SelectItem(id);
1718
1719                                 this->RedrawFromNode(n);
1720
1721                                 } /* if */
1722
1723           } /* if */
1724
1725 #endif
1726
1727       } /* if */
1728
1729       else
1730
1731         this->UnselectAll();
1732
1733                 }
1734
1735         }
1736
1737 !!!175874.cpp!!!        OnRightMouseClick(inout Event : wxMouseEvent) : void
1738
1739
1740   if (Event.RightDown())
1741
1742     if (Event.Dragging())
1743
1744       this->UnselectAll();
1745
1746     else
1747
1748     {
1749
1750      // variable definitions:
1751
1752         int Flags;
1753
1754         wxPoint Point;
1755
1756
1757
1758      // translate mouse coordinates:
1759
1760         CalcUnscrolledPosition(Event.GetPosition().x,Event.GetPosition().y,&(Point.x),&(Point.y));
1761
1762      // check if the mouse is above the caption of an item:
1763
1764       wxTreeMultiItem Item(this->HitTest(Point,Flags)); // variable definition and initialization
1765
1766
1767
1768       if (Item.IsOk() && (Flags == wxTMC_HITTEST_CAPTION))
1769
1770       {
1771
1772         this->SelectItem(Item);
1773
1774                                 this->RedrawFromNode(Item.GetItem()->IsTreeMultiItemNode());
1775
1776           Event.Skip(); // window will convert right mouse click to a context menu event or proceed with
1777
1778                         // a right mouse click event if the context menu event cannot be processed
1779
1780       } /* if */
1781
1782       else
1783
1784         this->UnselectAll();
1785
1786     } /* if */
1787
1788   else
1789
1790     this->UnselectAll();
1791
1792 !!!176002.cpp!!!        OnKey(inout event : wxKeyEvent) : void
1793
1794
1795         // check if we need to traverse to upper or lower
1796
1797         // control in the list
1798
1799         if(event.GetKeyCode() == WXK_TAB)
1800
1801         {
1802
1803                 wxTreeMultiItem item = GetFocus();
1804
1805                 if(item.IsOk())
1806
1807                 {
1808
1809                         // traverse down direction
1810
1811                         if(!event.ShiftDown())
1812
1813                                 item = FindNextVisibleWindowItem(item.GetItem());
1814
1815                         //else // traverse in up direction
1816
1817                         //      item = FindPreviousVisibleWindowItem(item);
1818
1819
1820
1821                         if(item.IsOk())
1822
1823                         {
1824
1825                                 TreeMultiItemWindow *w = item.GetItem()->IsTreeMultiItemWindow();
1826
1827                                 if(w)
1828
1829                                 {
1830
1831                                         wxWindow *wnd = w->GetWindow();
1832
1833                                         wnd->SetFocus();
1834
1835                                 }
1836
1837                         }
1838
1839                 }
1840
1841         }
1842
1843         else
1844
1845                 event.Skip();
1846
1847 !!!176258.cpp!!!        RecalculateSpanSizes() : void
1848
1849
1850         for(int i = 0; i < _root.GetNodeCount(); i++)
1851
1852         CalculateNodeSpanning(_root.GetNode(i));
1853
1854 !!!176642.cpp!!!        ~wxTreeMultiCtrl()
1855
1856
1857         // delete the bitmap resources
1858
1859         delete _expandBmp;
1860
1861         delete _collBmp;
1862
1863
1864
1865 #if(CHECKBOXVIEW)
1866
1867         delete _checkBmp;
1868
1869         delete _uncheckBmp;
1870
1871         delete _tristateBmp;
1872
1873 #endif
1874
1875 !!!176898.cpp!!!        AddRoot(in caption : wxString, in name : wxString = wxEmptyString) : wxTreeMultiItem
1876
1877
1878         wxTreeMultiItem result((TreeMultiItemBase *)&_root);
1879
1880         result = AppendNode(result, caption, name);
1881
1882
1883
1884         return result;
1885
1886 !!!177026.cpp!!!        AppendWindow(in ParentItem : wxTreeMultiItem, inout window : wxWindow = NULL, in name : wxString = wxEmptyString, in info : wxTreeMultiWindowInfo = wxTreeMultiWindowInfoDefault, in flags : int = 0) : wxTreeMultiItem
1887
1888
1889  // add window only if the parent item is valid and...
1890
1891         wxCHECK(ParentItem.IsOk(), wxTreeMultiItem(0));
1892
1893
1894
1895         TreeMultiItemNode* parent = ParentItem.GetItem()->IsTreeMultiItemNode(); // also roots are nodes
1896
1897
1898
1899  // ... is a node
1900
1901   wxCHECK(parent != NULL, wxTreeMultiItem(0));
1902
1903
1904
1905  // now, append node to the tree control:
1906
1907   wxTreeMultiItem NewWindowItem(this->InsertWindow(parent,wx_static_cast(size_t,parent->GetNodeCount()),window,name,info,flags));
1908
1909  // redraw the stucture:
1910
1911         this->RedrawFromNode(parent);
1912
1913  // return the new window
1914
1915         return NewWindowItem;
1916
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
1918
1919
1920  // add window only if the parent item is valid and...
1921
1922         wxCHECK(ParentItem.IsOk(), wxTreeMultiItem(0));
1923
1924
1925
1926         TreeMultiItemNode* parent = ParentItem.GetItem()->IsTreeMultiItemNode(); // also roots are nodes
1927
1928
1929
1930  // ... is a node
1931
1932   wxCHECK(parent != NULL, wxTreeMultiItem(0));
1933
1934
1935
1936  // now, append node to the tree control:
1937
1938   wxTreeMultiItem NewWindowItem(this->InsertWindow(parent,Position,window,name,info,flags));
1939
1940  // redraw the stucture:
1941
1942         this->RedrawFromNode(parent);
1943
1944  // return the new window
1945
1946         return NewWindowItem;
1947
1948 !!!177282.cpp!!!        PrependWindow(in ParentItem : wxTreeMultiItem, inout window : wxWindow = NULL, in name : wxString = wxEmptyString, in info : wxTreeMultiWindowInfo = wxTreeMultiWindowInfoDefault, in flags : int = 0) : wxTreeMultiItem
1949
1950
1951  // add window only if the parent item is valid and...
1952
1953         wxCHECK(ParentItem.IsOk(), wxTreeMultiItem(0));
1954
1955
1956
1957         TreeMultiItemNode* parent = ParentItem.GetItem()->IsTreeMultiItemNode(); // also roots are nodes
1958
1959
1960
1961  // ... is a node
1962
1963   wxCHECK(parent != NULL, wxTreeMultiItem(0));
1964
1965
1966
1967  // now, append node to the tree control:
1968
1969   wxTreeMultiItem NewWindowItem(this->InsertWindow(parent,0,window,name,info,flags));
1970
1971  // redraw the stucture:
1972
1973         this->RedrawFromNode(parent);
1974
1975  // return the new window
1976
1977         return NewWindowItem;
1978
1979 !!!177410.cpp!!!        AppendNode(in ParentItem : wxTreeMultiItem, in caption : wxString = wxEmptyString, in name : wxString = wxEmptyString) : wxTreeMultiItem
1980
1981
1982  // add window only if the parent item is valid and...
1983
1984         wxCHECK(ParentItem.IsOk(), wxTreeMultiItem(0));
1985
1986
1987
1988         TreeMultiItemNode* parent = ParentItem.GetItem()->IsTreeMultiItemNode(); // also roots are nodes
1989
1990
1991
1992  // ... is a node
1993
1994   wxCHECK(parent != NULL, wxTreeMultiItem(0));
1995
1996
1997
1998  // now, append node to the tree control:
1999
2000   wxTreeMultiItem NewNodeItem(this->InsertNode(parent,wx_static_cast(size_t,parent->GetNodeCount()),caption,name));
2001
2002  // redraw the structure:
2003
2004         this->RedrawFromNode(parent);
2005
2006  // return the new node:
2007
2008         return NewNodeItem;
2009
2010 !!!177538.cpp!!!        InsertNode(in ParentItem : wxTreeMultiItem, in Position : size_t, in caption : wxString, in name : wxString) : wxTreeMultiItem
2011
2012
2013  // add window only if the parent item is valid and...
2014
2015         wxCHECK(ParentItem.IsOk(), wxTreeMultiItem(0));
2016
2017
2018
2019         TreeMultiItemNode* parent = ParentItem.GetItem()->IsTreeMultiItemNode(); // also roots are nodes
2020
2021
2022
2023  // ... is a node
2024
2025   wxCHECK(parent != NULL, wxTreeMultiItem(0));
2026
2027
2028
2029  // now, append node to the tree control:
2030
2031   wxTreeMultiItem NewNodeItem(this->InsertNode(parent,Position,caption,name));
2032
2033  // redraw the structure:
2034
2035         this->RedrawFromNode(parent);
2036
2037  // return the new node:
2038
2039         return NewNodeItem;
2040
2041 !!!177666.cpp!!!        PrependNode(in ParentItem : wxTreeMultiItem, in caption : wxString = wxEmptyString, in name : wxString = wxEmptyString) : wxTreeMultiItem
2042
2043
2044  // add window only if the parent item is valid and...
2045
2046         wxCHECK(ParentItem.IsOk(), wxTreeMultiItem(0));
2047
2048
2049
2050         TreeMultiItemNode* parent = ParentItem.GetItem()->IsTreeMultiItemNode(); // also roots are nodes
2051
2052
2053
2054  // ... is a node
2055
2056   wxCHECK(parent != NULL, wxTreeMultiItem(0));
2057
2058
2059
2060  // now, append node to the tree control:
2061
2062   wxTreeMultiItem NewNodeItem(this->InsertNode(parent,0,caption,name));
2063
2064  // redraw the structure:
2065
2066         this->RedrawFromNode(parent);
2067
2068  // return the new node:
2069
2070         return NewNodeItem;
2071
2072 !!!177794.cpp!!!        Delete(inout item : wxTreeMultiItem) : bool
2073
2074
2075         bool redraw = true;
2076
2077         wxCHECK(item.IsOk(), false);
2078
2079
2080
2081         wxTreeMultiItem nullItem(0);
2082
2083
2084
2085
2086
2087  // if item has been selected, remove it from the selected list:
2088
2089   size_t ItemIndex(this->GetSelectedItemIndex(item));
2090
2091
2092
2093   if (ItemIndex != this->GetSelectedItemCount())
2094
2095     this->m_SelectedItems.RemoveAt(ItemIndex);
2096
2097
2098
2099         // get parent, to delete item from
2100
2101         TreeMultiItemNode *p = item.GetItem()->GetParent();
2102
2103
2104
2105         // first check if it was visible, if so from the parent off
2106
2107         // it needs redrawing
2108
2109         redraw = item.GetItem()->IsVisible();
2110
2111         if(p)
2112
2113                 p->DeleteNode(item.GetItem());
2114
2115         else
2116
2117                 _root.DeleteNode(item.GetItem());
2118
2119
2120
2121         item = nullItem;
2122
2123
2124
2125         // do redraw when node was visible
2126
2127         if(redraw)
2128
2129                 RedrawFromNode(p);
2130
2131
2132
2133         return true;
2134
2135 !!!178050.cpp!!!        DeleteChildren(in item : wxTreeMultiItem) : void
2136
2137
2138         if(item.IsNodeItem())
2139
2140         {
2141
2142                 TreeMultiItemNode *n = (TreeMultiItemNode *)item.GetItem();
2143
2144
2145
2146    // remove all children from the selected item list:
2147
2148           if (n->GetNodeCount() > 0)
2149
2150           {
2151
2152            // variable definitions and initializations:
2153
2154             int Cookie;
2155
2156             wxTreeMultiItem FirstItemIterator(this->GetFirstChild(item,Cookie)), LastItemIterator(this->GetLastChild(item));
2157
2158
2159
2160             for (;;)
2161
2162             {
2163
2164               size_t ItemIndex(this->GetSelectedItemIndex(item)); // variable definition and initialization
2165
2166
2167
2168               if (ItemIndex != this->GetSelectedItemCount())
2169
2170                 this->m_SelectedItems.RemoveAt(ItemIndex);
2171
2172               if (FirstItemIterator == LastItemIterator)
2173
2174                 break; // all children checked
2175
2176               else
2177
2178                 FirstItemIterator = this->GetNext(FirstItemIterator);
2179
2180             } /* for */
2181
2182           } /* if */
2183
2184          // delete children:
2185
2186                 n->Clear();
2187
2188         // redraw:
2189
2190                 RedrawFromNode(n);
2191
2192         }
2193
2194 !!!178178.cpp!!!        ExpandNodes(in recursive : bool = false) : void
2195
2196
2197         // go through all children and call DoFold recursively
2198
2199         for(int i = 0; i < _root.GetNodeCount(); i++)
2200
2201                 DoFold(_root.GetNode(i), true, recursive);
2202
2203         RedrawFromNode(0);
2204
2205 !!!178306.cpp!!!        CollapseNodes(in recursive : bool = false) : void
2206
2207
2208         // go through all children and call DoFold recursively
2209
2210         for(int i = 0; i < _root.GetNodeCount(); i++)
2211
2212                 DoFold(_root.GetNode(i), false, recursive);
2213
2214         RedrawFromNode(0);
2215
2216 !!!178434.cpp!!!        Expand(in item : wxTreeMultiItem, in recursive : bool) : void
2217
2218
2219         if(item.IsOk())
2220
2221         {
2222
2223         TreeMultiItemNode *n = item.GetItem()->IsTreeMultiItemNode();
2224
2225                 if(!n)
2226
2227                         n = item.GetItem()->GetParent();
2228
2229         DoFold(n, true, recursive);
2230
2231                 RedrawFromNode(item.GetItem()->IsTreeMultiItemNode());
2232
2233         }
2234
2235 !!!178562.cpp!!!        Collapse(in item : wxTreeMultiItem, in recursive : bool) : void
2236
2237
2238         if(item.IsOk())
2239
2240         {
2241
2242         TreeMultiItemNode *n = item.GetItem()->IsTreeMultiItemNode();
2243
2244                 if(!n)
2245
2246                         n = item.GetItem()->GetParent();
2247
2248                 DoFold(n, false, recursive);
2249
2250                 RedrawFromNode(item.GetItem()->IsTreeMultiItemNode());
2251
2252         }
2253
2254 !!!178690.cpp!!!        CollapseAndReset(in item : wxTreeMultiItem) : void
2255
2256
2257         if(item.IsNodeItem())
2258
2259         {
2260
2261                  TreeMultiItemNode *n = (TreeMultiItemNode *)item.GetItem();
2262
2263
2264
2265                  // delete all kids
2266
2267                  n->Clear();
2268
2269                  Collapse(item, false);
2270
2271         }
2272
2273 !!!179074.cpp!!!        GetFirstSelectedItem(in  : void) : wxTreeMultiItem
2274
2275
2276   if (this->GetSelectedItemCount() > 0)
2277
2278     return this->m_SelectedItems[0];
2279
2280   else
2281
2282     return wxTreeMultiItem();
2283
2284 !!!179202.cpp!!!        GetLastSelectedItem(in  : void) : wxTreeMultiItem
2285
2286
2287   if (this->GetSelectedItemCount() > 0)
2288
2289     return this->m_SelectedItems[this->GetSelectedItemCount()-1];
2290
2291   else
2292
2293     return wxTreeMultiItem();
2294
2295 !!!179330.cpp!!!        GetSelectedItem(in Index : size_t) : wxTreeMultiItem
2296
2297
2298   if (Index < this->GetSelectedItemCount())
2299
2300     return this->m_SelectedItems[Index];
2301
2302   else
2303
2304     return wxTreeMultiItem();
2305
2306 !!!179458.cpp!!!        GetSelectedItemIndex(in Item : wxTreeMultiItem) : size_t
2307
2308
2309  // attention: the function wxArray::Index() can NOT be used in a save manner as it only checks the address of an item
2310
2311  //            element but it is not guaranteed that Item may not be a copy of the originally inserted item
2312
2313   const size_t NoOfSelectedItems = this->GetSelectedItemCount();
2314
2315
2316
2317   size_t Index(0);
2318
2319
2320
2321
2322
2323   while ((Index < NoOfSelectedItems) && (this->m_SelectedItems[Index] != Item))
2324
2325     ++Index;
2326
2327   return Index;
2328
2329 !!!179586.cpp!!!        SelectItem(in Item : wxTreeMultiItem, in UnselectOthers : bool = true, in ExpandSelection : bool = false) : void
2330
2331
2332   TreeMultiItemNode* NodePtr(Item.GetItem()->IsTreeMultiItemNode());
2333
2334
2335
2336
2337
2338  // only nodes can be selected and they can only be selected if they are not already selected:
2339
2340   if ((NodePtr == NULL) || NodePtr->IsSelected())
2341
2342    return;
2343
2344
2345
2346  // inform that we are about to change:
2347
2348   wxTreeMultiEvent Event(wxEVT_COMMAND_TREE_MULTI_SEL_CHANGING,Item); // variable definition and initialization
2349
2350
2351
2352   if (this->m_SelectedItems.GetCount() > 0) // the last item in the array is always the latest inserted item
2353
2354     Event.SetOldItem(this->m_SelectedItems.Last());
2355
2356   Event.SetEventObject(this);
2357
2358   if (this->GetEventHandler()->ProcessEvent(Event) && !(Event.IsAllowed()))
2359
2360       return; // vetoed
2361
2362
2363
2364  // make sure that the to be selected item can be seen:
2365
2366   this->Include(Item);
2367
2368
2369
2370  // variable definition and initialization:
2371
2372   wxTreeMultiItem ExcludedParent(this->GetExcludedParent(Item));
2373
2374
2375
2376   while (ExcludedParent.IsOk())
2377
2378   {
2379
2380     this->Include(ExcludedParent);
2381
2382     ExcludedParent = this->GetExcludedParent(Item);
2383
2384   } /* while */
2385
2386
2387
2388  // unselect items if necessary:
2389
2390   if (UnselectOthers)
2391
2392     this->UnselectAll();
2393
2394  // expand selection if necessary:
2395
2396   if (ExpandSelection)
2397
2398   {
2399
2400    // variable definition:
2401
2402     wxTreeMultiItem FirstItemIterator, LastItemIterator;
2403
2404     wxTreeMultiItem LastSelectedItem;
2405
2406
2407
2408    // determine the last selected item or the first item in case nothing has been selected before:
2409
2410     if (this->m_SelectedItems.GetCount() > 0)
2411
2412       LastSelectedItem = this->m_SelectedItems.Last();
2413
2414     else
2415
2416       LastSelectedItem = this->GetFirstRoot();
2417
2418    // determine the item from which to start and the one with which to end the selection:
2419
2420     if (Item.GetItem()->GetY() > LastSelectedItem.GetItem()->GetY())
2421
2422     {
2423
2424       FirstItemIterator = LastSelectedItem;
2425
2426       LastItemIterator  = Item;
2427
2428     } /* if */
2429
2430     else
2431
2432     {
2433
2434       FirstItemIterator = Item;
2435
2436       LastItemIterator  = LastSelectedItem;
2437
2438     } /* if */
2439
2440    // select all items that are a node and are placed between the two limiting iterators (included the limits):
2441
2442     for (;;)
2443
2444     {
2445
2446       if (!(FirstItemIterator.IsSelected()) && FirstItemIterator.IsNodeItem())
2447
2448       {
2449
2450         FirstItemIterator.GetItem()->Select();
2451
2452         this->m_SelectedItems.Add(FirstItemIterator);
2453
2454         this->RefreshRect(wxRect(FirstItemIterator.GetItem()->GetX(),    FirstItemIterator.GetItem()->GetY(),
2455
2456                                  FirstItemIterator.GetItem()->GetWidth(),FirstItemIterator.GetItem()->GetHeight()));
2457
2458       } /* if */
2459
2460       if (FirstItemIterator == LastItemIterator)
2461
2462         break; // done
2463
2464      // continue iterating:
2465
2466       FirstItemIterator = this->GetNext(FirstItemIterator);
2467
2468     } /* for */
2469
2470   } /* if */
2471
2472   else // select passed item only
2473
2474   {
2475
2476     NodePtr->Select();
2477
2478     this->m_SelectedItems.Add(NodePtr);
2479
2480     this->RefreshRect(wxRect(NodePtr->GetX(),NodePtr->GetY(),NodePtr->GetWidth(),NodePtr->GetHeight()));
2481
2482   } /* if */
2483
2484
2485
2486  // inform that we have selected the item:
2487
2488   Event.SetEventType(wxEVT_COMMAND_TREE_MULTI_SEL_CHANGED);
2489
2490   this->GetEventHandler()->ProcessEvent(Event);
2491
2492 !!!179714.cpp!!!        UnselectAll(in  : void) : void
2493
2494
2495   const size_t NoOfSelectedItems = this->m_SelectedItems.GetCount();
2496
2497
2498
2499
2500
2501   for (size_t i=0; i<NoOfSelectedItems; ++i)
2502
2503   {
2504
2505     this->RefreshRect(wxRect(this->m_SelectedItems[i].GetItem()->GetX(),    this->m_SelectedItems[i].GetItem()->GetY(),
2506
2507                              this->m_SelectedItems[i].GetItem()->GetWidth(),this->m_SelectedItems[i].GetItem()->GetHeight()));
2508
2509     this->m_SelectedItems[i].GetItem()->Unselect();
2510
2511   } /* for */
2512
2513   this->m_SelectedItems.Clear();
2514
2515 !!!179842.cpp!!!        Unselect(in Item : wxTreeMultiItem) : void
2516
2517
2518   size_t ItemIndex(this->GetSelectedItemIndex(Item));
2519
2520
2521
2522
2523
2524   if (ItemIndex != this->GetSelectedItemCount())
2525
2526   {
2527
2528     Item.GetItem()->Unselect();
2529
2530     this->m_SelectedItems.RemoveAt(ItemIndex);
2531
2532     this->RefreshRect(wxRect(Item.GetItem()->GetX(),Item.GetItem()->GetY(),Item.GetItem()->GetWidth(),Item.GetItem()->GetHeight()));
2533
2534   } /* if */
2535
2536 !!!179970.cpp!!!        Exclude(in item : wxTreeMultiItem) : void
2537
2538
2539         wxCHECK2(item.IsOk(), return);
2540
2541
2542
2543         // exclude the item, and refresh
2544
2545         // if already excluded, skip
2546
2547
2548
2549         if(!item.GetItem()->IsExcluded())
2550
2551         {
2552
2553                 item.GetItem()->SetExcluded(true);
2554
2555                 RedrawFromParentNode(item.GetItem());
2556
2557         }
2558
2559 !!!180098.cpp!!!        Include(in item : wxTreeMultiItem) : void
2560
2561
2562         wxCHECK2(item.IsOk(), return);
2563
2564
2565
2566         // include the item, and refresh. If not
2567
2568         // excluded, do nothing
2569
2570
2571
2572         if(item.GetItem()->IsExcluded())
2573
2574         {
2575
2576                 item.GetItem()->SetExcluded(false);
2577
2578                 RedrawFromParentNode(item.GetItem());
2579
2580         }
2581
2582 !!!180226.cpp!!!        GetExcludedParent(in item : wxTreeMultiItem) : wxTreeMultiItem
2583
2584
2585         wxCHECK(item.IsOk(), wxTreeMultiItem(0));
2586
2587
2588
2589         // go find the parent (including this one) that
2590
2591         // can be the excluded one
2592
2593
2594
2595         TreeMultiItemNode *n = item.GetItem()->IsTreeMultiItemNode();
2596
2597         if(n && n->IsExcluded())
2598
2599                 return wxTreeMultiItem(n);
2600
2601
2602
2603         n = item.GetItem()->GetParent();
2604
2605         while(n)
2606
2607         {
2608
2609                 if(n->IsExcluded())
2610
2611                         return wxTreeMultiItem(n);
2612
2613                 else
2614
2615                         n = n->GetParent();
2616
2617         }
2618
2619
2620
2621         return wxTreeMultiItem(0);
2622
2623 !!!180354.cpp!!!        HitTest(in pt : wxPoint, inout flags : int) : wxTreeMultiItem
2624
2625
2626         // scan all nodes to see which one matches
2627
2628         TreeMultiItemBase *b = 0;
2629
2630         for(int i = 0; i < _root.GetNodeCount() && !b; i++)
2631
2632                 b = FindNodeByPoint(_root.GetNode(i), pt, flags);
2633
2634
2635
2636         if(!b)
2637
2638         {
2639
2640                 // none found, reset
2641
2642                 flags = 0;
2643
2644                 return wxTreeMultiItem(0);
2645
2646         }
2647
2648
2649
2650         // return an item
2651
2652         return wxTreeMultiItem(b);
2653
2654 !!!180482.cpp!!!        FindItem(in item : wxTreeMultiItem, in name : wxString, in ignoreCase : bool = false, in skipFirst : bool = false) : wxTreeMultiItem
2655
2656
2657         if(item.IsOk())
2658
2659         {
2660
2661                 TreeMultiItemBase *b = item.GetItem();
2662
2663
2664
2665                 // check this item first (or not)
2666
2667
2668
2669                 if(!skipFirst)
2670
2671                 {
2672
2673                         if(b->GetName().IsSameAs(name, !ignoreCase))
2674
2675                                 return wxTreeMultiItem(b);
2676
2677                 }
2678
2679
2680
2681                 if(b->IsTreeMultiItemNode())
2682
2683                 {
2684
2685                         // now check whether we are a node, then go check children
2686
2687
2688
2689                         TreeMultiItemNode *n = (TreeMultiItemNode *)b;
2690
2691                         wxTreeMultiItem result(0);
2692
2693                         for(int i = 0; i < n->GetNodeCount() && !result.IsOk(); i++)
2694
2695                                 result = FindItem(wxTreeMultiItem(n->GetNode(i)), name, ignoreCase, false);
2696
2697
2698
2699                         return result;
2700
2701                 }
2702
2703         }
2704
2705
2706
2707         return wxTreeMultiItem(0);
2708
2709 !!!180866.cpp!!!        GetFocus() : wxTreeMultiItem
2710
2711
2712         wxWindow *wnd = wxWindow::FindFocus();
2713
2714
2715
2716         // now find window that holds this item. if not
2717
2718         // visible it cannot have focus (should not have)
2719
2720
2721
2722         wxTreeMultiItem item = FindWindowNode(wnd);
2723
2724         if(item.IsOk() && item.GetItem()->IsVisible())
2725
2726                 return item;
2727
2728
2729
2730         return wxTreeMultiItem(0);
2731
2732 !!!180994.cpp!!!        GetBooleanValue(in wndId : int) : bool
2733
2734
2735         wxWindow *wnd = wxWindow::FindWindow(wndId);
2736
2737         wxCHECK(wnd, false);
2738
2739
2740
2741         // try a radio button
2742
2743         wxRadioButton *b = wxDynamicCast(wnd, wxRadioButton);
2744
2745         if(b)
2746
2747                 return b->GetValue();
2748
2749
2750
2751         // try a check box
2752
2753         wxCheckBox *c = wxDynamicCast(wnd, wxCheckBox);
2754
2755         if(c)
2756
2757                 return c->GetValue();
2758
2759
2760
2761         /** \todo For custom controls we should put something in wxMultiTreeItemData class
2762
2763             which can be overridden to retrieve the boolean value. It will also be passed
2764
2765             the pointer to the window, so the derived class can figure out how to get a boolean
2766
2767             value.
2768
2769         */
2770
2771
2772
2773         // generate assert or just return with false
2774
2775         wxCHECK(0, false);
2776
2777 !!!181122.cpp!!!        GetTextValue(in wndId : int) : wxString
2778
2779
2780         wxWindow *wnd = wxWindow::FindWindow(wndId);
2781
2782         wxCHECK(wnd, wxEmptyString);
2783
2784
2785
2786         // try a radio button
2787
2788         wxTextCtrl *t = wxDynamicCast(wnd, wxTextCtrl);
2789
2790         if(t)
2791
2792                 return t->GetValue();
2793
2794
2795
2796         // try a choice box
2797
2798         wxChoice *c1 = wxDynamicCast(wnd, wxChoice);
2799
2800         if(c1)
2801
2802                 return c1->GetStringSelection();
2803
2804
2805
2806         // try a combo box
2807
2808         wxComboBox *c2 = wxDynamicCast(wnd, wxComboBox);
2809
2810         if(c2)
2811
2812                 return c2->GetStringSelection();
2813
2814
2815
2816         // try a listbox
2817
2818         wxListBox *l = wxDynamicCast(wnd, wxListBox);
2819
2820         if(l)
2821
2822                 return l->GetStringSelection();
2823
2824
2825
2826         /** \todo For custom controls we should put something in wxMultiTreeItemData class
2827
2828             which can be overridden to retrieve the boolean value. It will also be passed
2829
2830             the pointer to the window, so the derived class can figure out how to get a boolean
2831
2832             value.
2833
2834         */
2835
2836
2837
2838         // generate assert or just return with string
2839
2840         wxCHECK(0, wxEmptyString);
2841
2842 !!!181250.cpp!!!        SetBooleanValue(in wndId : int, in value : bool = true) : void
2843
2844
2845         wxWindow *wnd = wxWindow::FindWindow(wndId);
2846
2847         wxCHECK2(wnd, return);
2848
2849
2850
2851         // try a radio button
2852
2853         wxRadioButton *b = wxDynamicCast(wnd, wxRadioButton);
2854
2855         if(b)
2856
2857         {
2858
2859                 b->SetValue(value);
2860
2861                 return;
2862
2863         }
2864
2865
2866
2867         // try a check box
2868
2869         wxCheckBox *c = wxDynamicCast(wnd, wxCheckBox);
2870
2871         if(c)
2872
2873         {
2874
2875                 c->SetValue(value);
2876
2877                 return;
2878
2879         }
2880
2881
2882
2883         /** \todo For custom controls we should put something in wxMultiTreeItemData class
2884
2885                     which can be overridden to retrieve the boolean value. It will also be passed
2886
2887                     the pointer to the window, so the derived class can figure out how to get a boolean
2888
2889                     value.
2890
2891         */
2892
2893
2894
2895         // generate assert
2896
2897         wxCHECK2(0, return);
2898
2899 !!!181378.cpp!!!        SetTextValue(in wndId : int, in value : wxString = wxEmptyString) : void
2900
2901
2902         wxWindow *wnd = wxWindow::FindWindow(wndId);
2903
2904         wxCHECK2(wnd, return);
2905
2906
2907
2908         // try a radio button
2909
2910         wxTextCtrl *t = wxDynamicCast(wnd, wxTextCtrl);
2911
2912         if(t)
2913
2914         {
2915
2916                 t->SetValue(value);
2917
2918                 return;
2919
2920         }
2921
2922
2923
2924         /** \todo For custom controls we should put something in wxMultiTreeItemData class
2925
2926                     which can be overridden to retrieve the boolean value. It will also be passed
2927
2928                     the pointer to the window, so the derived class can figure out how to get a boolean
2929
2930                     value.
2931
2932         */
2933
2934
2935
2936         // generate assert
2937
2938         wxCHECK2(0, return);
2939
2940 !!!181634.cpp!!!        SetSelectionValue(in wndId : int, in sel : int) : void
2941
2942
2943         wxWindow *wnd = wxWindow::FindWindow(wndId);
2944
2945         wxCHECK2(wnd, return);
2946
2947
2948
2949         // try a choice box
2950
2951         wxChoice *c1 = wxDynamicCast(wnd, wxChoice);
2952
2953         if(c1)
2954
2955         {
2956
2957                 c1->SetSelection(sel);
2958
2959                 return;
2960
2961         }
2962
2963
2964
2965         // try a combo box
2966
2967         wxComboBox *c2 = wxDynamicCast(wnd, wxComboBox);
2968
2969         if(c2)
2970
2971         {
2972
2973                 c2->SetSelection(sel);
2974
2975                 return;
2976
2977         }
2978
2979
2980
2981         // try a listbox
2982
2983         wxListBox *l = wxDynamicCast(wnd, wxListBox);
2984
2985         if(l)
2986
2987         {
2988
2989                 l->SetSelection(sel);
2990
2991                 return;
2992
2993         }
2994
2995
2996
2997         /** \todo For custom controls we should put something in wxMultiTreeItemData class
2998
2999             which can be overridden to retrieve the boolean value. It will also be passed
3000
3001             the pointer to the window, so the derived class can figure out how to get a boolean
3002
3003             value.
3004
3005         */
3006
3007
3008
3009         // generate assert or just return with string
3010
3011         wxCHECK2(0, return);
3012
3013 !!!181762.cpp!!!        GetSelectionValue(in wndId : int) : int
3014
3015
3016         wxWindow *wnd = wxWindow::FindWindow(wndId);
3017
3018         wxCHECK(wnd, -1);
3019
3020
3021
3022         // try a choice box
3023
3024         wxChoice *c1 = wxDynamicCast(wnd, wxChoice);
3025
3026         if(c1)
3027
3028                 return c1->GetSelection();
3029
3030
3031
3032         // try a combo box
3033
3034         wxComboBox *c2 = wxDynamicCast(wnd, wxComboBox);
3035
3036         if(c2)
3037
3038                 return c2->GetSelection();
3039
3040
3041
3042         // try a listbox
3043
3044         wxListBox *l = wxDynamicCast(wnd, wxListBox);
3045
3046         if(l)
3047
3048                 return l->GetSelection();
3049
3050
3051
3052         /** \todo For custom controls we should put something in wxMultiTreeItemData class
3053
3054             which can be overridden to retrieve the boolean value. It will also be passed
3055
3056             the pointer to the window, so the derived class can figure out how to get a boolean
3057
3058             value.
3059
3060         */
3061
3062
3063
3064         // generate assert or just return with string
3065
3066         wxCHECK(0, -1);
3067
3068 !!!181890.cpp!!!        GetSelectionValues(in wndId : int, inout sels : wxArrayInt) : void
3069
3070
3071         sels.Clear();
3072
3073
3074
3075         wxWindow *wnd = wxWindow::FindWindow(wndId);
3076
3077         wxCHECK2(wnd, return);
3078
3079
3080
3081         // try a listbox
3082
3083         wxListBox *l = wxDynamicCast(wnd, wxListBox);
3084
3085         if(l)
3086
3087         {
3088
3089                 l->GetSelections(sels);
3090
3091                 return;
3092
3093         }
3094
3095
3096
3097         /** \todo For custom controls we should put something in wxMultiTreeItemData class
3098
3099             which can be overridden to retrieve the boolean value. It will also be passed
3100
3101             the pointer to the window, so the derived class can figure out how to get a boolean
3102
3103             value.
3104
3105         */
3106
3107
3108
3109         // generate assert or just return with string
3110
3111         wxCHECK2(0, return);
3112
3113 !!!183042.cpp!!!        GetParent(in item : wxTreeMultiItem) : wxTreeMultiItem
3114
3115
3116  // check if valid or root item has been passed, both do not have parents:
3117
3118   if (!(item.IsOk()) || item.GetItem()->IsTreeMultiItemRoot())
3119
3120     return wxTreeMultiItem();
3121
3122   else
3123
3124     return wxTreeMultiItem(item.GetItem()->GetParent()); // GetParent() returns a valid pointer in case of a root item!!
3125
3126                                                          // therefore, the check if the passed item is a root item is necessary
3127
3128 !!!183170.cpp!!!        GetFirstChild(in item : wxTreeMultiItem, inout cookie : int) : wxTreeMultiItem
3129
3130
3131         if(item.IsNodeItem())
3132
3133         {
3134
3135                 TreeMultiItemNode *n = (TreeMultiItemNode *)item.GetItem();
3136
3137
3138
3139                 if(n->GetNodeCount() > 0)
3140
3141                 {
3142
3143                         cookie = 0;
3144
3145                         return wxTreeMultiItem(n->GetNode(0));
3146
3147                 }
3148
3149         }
3150
3151
3152
3153         // no children or no valid node
3154
3155         cookie = -1;
3156
3157         return wxTreeMultiItem(0);
3158
3159 !!!183298.cpp!!!        GetNextChild(in item : wxTreeMultiItem, inout cookie : int) : wxTreeMultiItem
3160
3161
3162         if(item.IsNodeItem())
3163
3164         {
3165
3166                 TreeMultiItemNode *n = (TreeMultiItemNode *)item.GetItem();
3167
3168
3169
3170                 if(cookie >= 0 && cookie < (n->GetNodeCount()-1))
3171
3172                 {
3173
3174                         // increment cookie, return node
3175
3176                         cookie ++;
3177
3178                         return wxTreeMultiItem(n->GetNode(cookie));
3179
3180                 }
3181
3182         }
3183
3184
3185
3186         // end of query, or no valid node
3187
3188         cookie = -1;
3189
3190         return wxTreeMultiItem(0);
3191
3192 !!!183426.cpp!!!        GetLastChild(in item : wxTreeMultiItem) : wxTreeMultiItem
3193
3194
3195         if(item.IsNodeItem())
3196
3197         {
3198
3199                 TreeMultiItemNode *n = (TreeMultiItemNode *)item.GetItem();
3200
3201
3202
3203                 if(n->GetNodeCount() > 0)
3204
3205                         return wxTreeMultiItem(n->GetNode(n->GetNodeCount()-1));
3206
3207         }
3208
3209
3210
3211         return wxTreeMultiItem(0);
3212
3213 !!!183554.cpp!!!        GetNextSibling(in item : wxTreeMultiItem) : wxTreeMultiItem
3214
3215
3216  // check if a valid item has been passed:
3217
3218   if (!(item.IsOk()))
3219
3220     return wxTreeMultiItem();
3221
3222
3223
3224   TreeMultiItemNode* ParentPtr(item.GetItem()->GetParent());
3225
3226
3227
3228
3229
3230   if (ParentPtr != NULL) // the parent pointer is only null if the passed item is the root
3231
3232   {
3233
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:
3235
3236     int NextItemIndex(ParentPtr->Index(item.GetItem())+1); // variable definition and initialization
3237
3238
3239
3240     if (NextItemIndex < ParentPtr->GetNodeCount())
3241
3242       return ParentPtr->GetNode(NextItemIndex);
3243
3244     else
3245
3246       return wxTreeMultiItem();
3247
3248   } /* if */
3249
3250   else
3251
3252     return wxTreeMultiItem();
3253
3254 !!!183682.cpp!!!        GetPrevSibling(in item : wxTreeMultiItem) : wxTreeMultiItem
3255
3256
3257  // check if a valid item has been passed:
3258
3259   if (!(item.IsOk()))
3260
3261     return wxTreeMultiItem();
3262
3263
3264
3265   TreeMultiItemNode* ParentPtr(item.GetItem()->GetParent());
3266
3267
3268
3269
3270
3271   if (ParentPtr != NULL)
3272
3273   {
3274
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:
3276
3277     int PrevItemIndex(ParentPtr->Index(item.GetItem())-1); // variable definition and initialization
3278
3279
3280
3281     if (PrevItemIndex >= 0)
3282
3283       return ParentPtr->GetNode(PrevItemIndex);
3284
3285     else
3286
3287       return wxTreeMultiItem();
3288
3289   } /* if */
3290
3291   else
3292
3293     return wxTreeMultiItem();
3294
3295 !!!183810.cpp!!!        GetNext(in item : wxTreeMultiItem) : wxTreeMultiItem
3296
3297
3298  // check if a valid item has been passed:
3299
3300   if (!(item.IsOk()))
3301
3302     return wxTreeMultiItem();
3303
3304
3305
3306   TreeMultiItemNode* NodePtr(item.GetItem()->IsTreeMultiItemNode()); // variable definition and initialization
3307
3308
3309
3310   if ((NodePtr != NULL) && (NodePtr->GetNodeCount() > 0))
3311
3312     return wxTreeMultiItem(NodePtr->First());
3313
3314   else
3315
3316   {
3317
3318    // variable definitions and initializations:
3319
3320     wxTreeMultiItem Parent(item);
3321
3322     wxTreeMultiItem Sibling;
3323
3324
3325
3326     do
3327
3328     {
3329
3330       Sibling = this->GetNextSibling(Parent); // try to find next sibling
3331
3332       Parent = this->GetParent(Parent);       // get next ancestor
3333
3334     } while (!(Sibling.IsOk()) && Parent.IsOk());
3335
3336    // in case the loop ended with Sibling.IsOk() "Sibling" contains a valid sibling otherwise an invalid
3337
3338     return Sibling;
3339
3340   } /* if */
3341
3342 !!!183938.cpp!!!        GetPrevious(in item : wxTreeMultiItem) : wxTreeMultiItem
3343
3344
3345  // check if a valid item has been passed:
3346
3347   if (!(item.IsOk()))
3348
3349     return wxTreeMultiItem();
3350
3351
3352
3353   TreeMultiItemNode* NodePtr(item.GetItem()->IsTreeMultiItemNode()); // variable definition and initialization
3354
3355
3356
3357   if ((NodePtr != NULL) && (NodePtr->GetNodeCount() > 0))
3358
3359     return wxTreeMultiItem(NodePtr->Last());
3360
3361   else
3362
3363   {
3364
3365    // variable definitions and initializations:
3366
3367     wxTreeMultiItem Parent(item);
3368
3369     wxTreeMultiItem Sibling;
3370
3371
3372
3373     do
3374
3375     {
3376
3377       Sibling = this->GetPrevSibling(Parent); // try to find next sibling
3378
3379       Parent = this->GetParent(Parent);       // get next ancestor
3380
3381     } while (!(Sibling.IsOk()) && Parent.IsOk());
3382
3383    // in case the loop ended with Sibling.IsOk() "Sibling" contains a valid sibling otherwise an invalid
3384
3385     return Sibling;
3386
3387   } /* if */
3388
3389 !!!184194.cpp!!!        SetCaptionFont(in font : wxFont) : void
3390
3391
3392         _captionFont = font;
3393
3394
3395
3396         // adjust the icons so that they are in the middle
3397
3398         AdjustIconsDeltaY();
3399
3400
3401
3402         RedrawFromNode(0);
3403
3404 !!!184322.cpp!!!        OnDraw(inout dc : wxDC) : void
3405
3406
3407         // go recursive and draw the whole visible tree.
3408
3409         dc.SetFont(_captionFont);
3410
3411         for(int i = 0; i < _root.GetNodeCount(); i++)
3412
3413                 DrawNode(_root.GetNode(i), dc);
3414