3 # This file implements the TixTree widget.
5 # Copyright (c) 1996, Expert Interface Technologies
7 # See the file "license.terms" for information on usage and redistribution
8 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
12 tixWidgetClass tixTree {
16 autosetmode close getmode open setmode
19 -browsecmd -command -opencmd -closecmd
22 {-browsecmd browseCmd BrowseCmd ""}
23 {-command command Command ""}
24 {-closecmd closeCmd CloseCmd ""}
25 {-opencmd openCmd OpenCmd ""}
29 {*Scrollbar.background #d9d9d9}
30 {*Scrollbar.relief sunken}
31 {*Scrollbar.takeFocus 0}
32 {*Scrollbar.troughColor #c3c3c3}
35 {*hlist.background #c3c3c3}
38 {*hlist.highlightBackground #d9d9d9}
41 {*hlist.itemType imagetext}
44 {*hlist.relief sunken}
46 {*hlist.wideSelection 0}
51 proc tixTree:InitWidgetRec {w} {
54 tixChainMethod $w InitWidgetRec
57 proc tixTree:ConstructWidget {w} {
60 tixChainMethod $w ConstructWidget
63 proc tixTree:SetBindings {w} {
66 tixChainMethod $w SetBindings
69 #----------------------------------------------------------------------
73 #----------------------------------------------------------------------
74 proc tixTree:autosetmode {w} {
75 tixTree:SetModes $w ""
78 proc tixTree:close {w ent} {
81 set type [tixVTree:GetType $w $ent]
82 if {$type == "close"} {
83 tixCallMethod $w Activate $ent $type
87 proc tixTree:open {w ent} {
90 set type [tixVTree:GetType $w $ent]
91 if {$type == "open"} {
92 tixCallMethod $w Activate $ent $type
96 proc tixTree:getmode {w ent} {
97 tixVTree:GetType $w $ent
100 proc tixTree:setmode {w ent mode} {
101 tixVTree:SetMode $w $ent $mode
103 #----------------------------------------------------------------------
107 #----------------------------------------------------------------------
108 proc tixTree:SetModes {w ent} {
114 set children [$data(w:hlist) info children]
116 set children [$data(w:hlist) info children $ent]
119 if {$children != ""} {
122 foreach c $children {
123 if [$data(w:hlist) info hidden $c] {
126 tixTree:SetModes $w $c
131 tixVTree:SetMode $w $ent $mode
134 #----------------------------------------------------------------------
138 #----------------------------------------------------------------------
139 proc tixTree:OpenCmd {w ent} {
142 if {$data(-opencmd) != ""} {
143 tixTree:CallSwitchCmd $w $data(-opencmd) $ent
145 tixChainMethod $w OpenCmd $ent
150 proc tixTree:CloseCmd {w ent} {
153 if {$data(-closecmd) != ""} {
154 tixTree:CallSwitchCmd $w $data(-closecmd) $ent
156 tixChainMethod $w CloseCmd $ent
160 # Call the opencmd or closecmd, depending on the mode ($cmd argument)
162 proc tixTree:CallSwitchCmd {w cmd ent} {
168 tixEvalCmdBinding $w $cmd bind $ent
171 proc tixTree:Command {w B} {
175 tixChainMethod $w Command $B
177 set ent [tixEvent flag V]
178 if {$data(-command) != ""} {
179 tixEvalCmdBinding $w $data(-command) bind $ent
183 proc tixTree:BrowseCmd {w B} {
186 set ent [tixEvent flag V]
187 if {$data(-browsecmd) != ""} {
188 tixEvalCmdBinding $w $data(-browsecmd) "" $ent