43
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1995 by Claus Gittinger
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
49
|
13 |
SelectionInListView subclass:#UIPainterTreeView
|
|
14 |
instanceVariableNames:'builderView'
|
43
|
15 |
classVariableNames:''
|
|
16 |
poolDictionaries:''
|
|
17 |
category:'Interface-UIPainter'
|
|
18 |
!
|
|
19 |
|
|
20 |
!UIPainterTreeView class methodsFor:'documentation'!
|
|
21 |
|
|
22 |
copyright
|
|
23 |
"
|
|
24 |
COPYRIGHT (c) 1995 by Claus Gittinger
|
|
25 |
All Rights Reserved
|
|
26 |
|
|
27 |
This software is furnished under a license and may be used
|
|
28 |
only in accordance with the terms of that license and with the
|
|
29 |
inclusion of the above copyright notice. This software may not
|
|
30 |
be provided or otherwise made available to, or used by, any
|
|
31 |
other person. No title to or ownership of the software is
|
|
32 |
hereby transferred.
|
|
33 |
"
|
|
34 |
!
|
|
35 |
|
|
36 |
documentation
|
|
37 |
"
|
|
38 |
not yet finished, not yet published, not yet released.
|
|
39 |
"
|
|
40 |
! !
|
|
41 |
|
49
|
42 |
!UIPainterTreeView class methodsFor:'constants'!
|
43
|
43 |
|
49
|
44 |
indent
|
|
45 |
"indent for contained element
|
|
46 |
"
|
|
47 |
^ 2
|
|
48 |
|
43
|
49 |
|
49
|
50 |
! !
|
|
51 |
|
|
52 |
!UIPainterTreeView class methodsFor:'defaults'!
|
43
|
53 |
|
49
|
54 |
defaultMenuMessage
|
|
55 |
"This message is the default yo be sent to the menuHolder to get a menu
|
|
56 |
"
|
|
57 |
^ #editMenu
|
43
|
58 |
|
|
59 |
|
|
60 |
! !
|
|
61 |
|
49
|
62 |
!UIPainterTreeView methodsFor:'accessing'!
|
43
|
63 |
|
|
64 |
builderView:aBuilderView
|
|
65 |
builderView := aBuilderView.
|
49
|
66 |
self updateTree.
|
43
|
67 |
|
|
68 |
!
|
|
69 |
|
49
|
70 |
indexOf:aString
|
|
71 |
"returns the index of the string entry into my list
|
|
72 |
"
|
|
73 |
^ list findFirst:[:aName| aName withoutSeparators = aString ]
|
|
74 |
|
|
75 |
|
|
76 |
! !
|
|
77 |
|
|
78 |
!UIPainterTreeView methodsFor:'event handling'!
|
43
|
79 |
|
49
|
80 |
selectionChanged
|
|
81 |
"selection has changed
|
|
82 |
"
|
|
83 |
|sel|
|
43
|
84 |
|
49
|
85 |
selection notNil ifTrue:[
|
|
86 |
selection size == 1 ifTrue:[
|
|
87 |
sel := (list at:(selection first)) withoutSeparators
|
|
88 |
] ifFalse:[
|
|
89 |
sel := OrderedCollection new.
|
|
90 |
selection do:[:aNumber|
|
|
91 |
aNumber ~~ 1 ifTrue:[
|
|
92 |
sel add:((list at:aNumber) withoutSeparators)
|
|
93 |
]
|
|
94 |
]
|
43
|
95 |
]
|
49
|
96 |
].
|
54
|
97 |
builderView selectNames:sel
|
43
|
98 |
|
|
99 |
!
|
|
100 |
|
|
101 |
update:something
|
|
102 |
|
49
|
103 |
(something == #tree or:[something == #widgetName]) ifTrue:[
|
43
|
104 |
self updateTree
|
|
105 |
] ifFalse:[
|
|
106 |
something == #selection ifFalse:[
|
|
107 |
^ self
|
49
|
108 |
].
|
|
109 |
self setSelection:nil.
|
43
|
110 |
].
|
|
111 |
|
49
|
112 |
"update selection
|
|
113 |
"
|
|
114 |
builderView selectionDo:[:aView||idx|
|
|
115 |
idx := self indexOf:(builderView variableNameOf:aView).
|
43
|
116 |
|
49
|
117 |
idx ~~ 0 ifTrue:[
|
|
118 |
self addToSelection:idx
|
|
119 |
]
|
54
|
120 |
].
|
|
121 |
selection isNil ifTrue:[
|
|
122 |
self setSelection:1
|
43
|
123 |
]
|
|
124 |
! !
|
|
125 |
|
|
126 |
!UIPainterTreeView methodsFor:'initialization'!
|
|
127 |
|
|
128 |
initialize
|
|
129 |
super initialize.
|
|
130 |
|
49
|
131 |
list := OrderedCollection new.
|
43
|
132 |
|
49
|
133 |
self multipleSelectOk:true.
|
|
134 |
self action:[:aSelection| self selectionChanged ].
|
43
|
135 |
|
49
|
136 |
|
43
|
137 |
! !
|
|
138 |
|
49
|
139 |
!UIPainterTreeView methodsFor:'menu & actions'!
|
43
|
140 |
|
49
|
141 |
editMenu
|
|
142 |
|menu ispMenu|
|
43
|
143 |
|
54
|
144 |
menu := PopUpMenu labels:( resources array:#('inspect') )
|
49
|
145 |
selectors:#( #inspect )
|
|
146 |
receiver:self.
|
43
|
147 |
|
54
|
148 |
ispMenu := PopUpMenu labels:( resources array:#('view' 'property') )
|
49
|
149 |
selectors:#( #inspectView #inspectProps )
|
|
150 |
receiver:self.
|
43
|
151 |
|
49
|
152 |
menu subMenuAt:#inspect put:ispMenu.
|
|
153 |
^ menu
|
43
|
154 |
|
|
155 |
|
|
156 |
!
|
|
157 |
|
|
158 |
inspectProps
|
|
159 |
builderView inspectAttributes
|
|
160 |
!
|
|
161 |
|
|
162 |
inspectView
|
|
163 |
builderView inspectSelection
|
49
|
164 |
! !
|
|
165 |
|
|
166 |
!UIPainterTreeView methodsFor:'update'!
|
43
|
167 |
|
49
|
168 |
updateSubTree:aView indent:anIndent
|
|
169 |
|name indent|
|
43
|
170 |
|
49
|
171 |
name := builderView variableNameOf:aView.
|
43
|
172 |
|
49
|
173 |
anIndent ~~ 0 ifTrue:[
|
|
174 |
name := (String new:anIndent), name
|
|
175 |
].
|
|
176 |
list add:name.
|
|
177 |
|
|
178 |
indent := anIndent + self class indent.
|
|
179 |
|
|
180 |
builderView subviewsOf:aView do:[:subview|
|
|
181 |
self updateSubTree:subview indent:indent
|
43
|
182 |
]
|
|
183 |
|
|
184 |
|
49
|
185 |
!
|
43
|
186 |
|
49
|
187 |
updateTree
|
43
|
188 |
|
49
|
189 |
selection := nil.
|
|
190 |
list := OrderedCollection new.
|
|
191 |
self updateSubTree:builderView indent:0.
|
|
192 |
super list:list.
|
43
|
193 |
|
|
194 |
! !
|
|
195 |
|
|
196 |
!UIPainterTreeView class methodsFor:'documentation'!
|
|
197 |
|
|
198 |
version
|
|
199 |
^ '$Header$'
|
|
200 |
! !
|