Tools__ViewTreeApplication.st
author Claus Gittinger <cg@exept.de>
Wed, 31 Jul 2013 13:13:51 +0200
changeset 3040 b62c4b71910c
parent 3037 876c28de42da
child 3049 292d06e8b7ae
permissions -rw-r--r--
class: Tools::ViewTreeInspectorApplication
changed:
#submenuInspector:
#submenuInterface:
cg@2748
     1
"
cg@2748
     2
 COPYRIGHT (c) 2007 by eXept Software AG
cg@2748
     3
              All Rights Reserved
cg@2748
     4
cg@2748
     5
 This software is furnished under a license and may be used
cg@2748
     6
 only in accordance with the terms of that license and with the
cg@2748
     7
 inclusion of the above copyright notice.   This software may not
cg@2748
     8
 be provided or otherwise made available to, or used by, any
cg@2748
     9
 other person.  No title to or ownership of the software is
cg@2748
    10
 hereby transferred.
cg@2748
    11
"
ca@2177
    12
"{ Package: 'stx:libtool2' }"
ca@2177
    13
ca@2177
    14
"{ NameSpace: Tools }"
ca@2177
    15
cg@2744
    16
ToolApplicationModel subclass:#ViewTreeInspectorApplication
ca@2177
    17
	instanceVariableNames:'model treeView hasSingleSelectionHolder clickedItem clickedPoint
cg@2770
    18
		motionAction process followFocusChannel showNamesHolder
cg@3037
    19
		inspectorView inspectorModeIndexHolder'
ca@2177
    20
	classVariableNames:''
ca@2177
    21
	poolDictionaries:''
cg@2744
    22
	category:'Interface-Smalltalk'
ca@2177
    23
!
ca@2177
    24
ca@2177
    25
Object subclass:#MenuDesc
ca@2177
    26
	instanceVariableNames:'title value action'
ca@2177
    27
	classVariableNames:''
ca@2177
    28
	poolDictionaries:''
cg@2744
    29
	privateIn:ViewTreeInspectorApplication
ca@2177
    30
!
ca@2177
    31
cg@2744
    32
HierarchicalItem subclass:#ViewTreeItem
cg@2744
    33
	instanceVariableNames:'widget isDrawnShown exists xOffsetAdditionalName'
cg@2744
    34
	classVariableNames:'HandleExtent'
cg@2744
    35
	poolDictionaries:''
cg@2744
    36
	privateIn:ViewTreeInspectorApplication
cg@2744
    37
!
cg@2744
    38
cg@2744
    39
ValueModel subclass:#ViewTreeModel
cg@2744
    40
	instanceVariableNames:'lockSema selectedSuperItems selection hiddenLevel listOfItems
cg@2744
    41
		inputEventAction mappedViewAction beforeSelectionChangedAction
cg@2744
    42
		icons timedUpdateTask selectOnClickHolder testModeChannel
cg@2978
    43
		hasTargetWidgetChannel catchEvents'
cg@2744
    44
	classVariableNames:''
cg@2744
    45
	poolDictionaries:''
cg@2744
    46
	privateIn:ViewTreeInspectorApplication
cg@2744
    47
!
cg@2744
    48
cg@2744
    49
HierarchicalList subclass:#ItemList
cg@2744
    50
	instanceVariableNames:'treeModel eventHook eventHookInitialized showWidgetNames'
cg@2744
    51
	classVariableNames:''
cg@2744
    52
	poolDictionaries:''
cg@2744
    53
	privateIn:ViewTreeInspectorApplication::ViewTreeModel
cg@2744
    54
!
cg@2744
    55
cg@2744
    56
!ViewTreeInspectorApplication class methodsFor:'documentation'!
ca@2177
    57
cg@2748
    58
copyright
cg@2748
    59
"
cg@2748
    60
 COPYRIGHT (c) 2007 by eXept Software AG
cg@2748
    61
              All Rights Reserved
cg@2748
    62
cg@2748
    63
 This software is furnished under a license and may be used
cg@2748
    64
 only in accordance with the terms of that license and with the
cg@2748
    65
 inclusion of the above copyright notice.   This software may not
cg@2748
    66
 be provided or otherwise made available to, or used by, any
cg@2748
    67
 other person.  No title to or ownership of the software is
cg@2748
    68
 hereby transferred.
cg@2748
    69
"
cg@2748
    70
!
cg@2748
    71
ca@2177
    72
documentation
ca@2177
    73
"
ca@2177
    74
     Small application showing a ViewTreeModel use.
ca@2177
    75
ca@2177
    76
     It displays a hierarchical list of a selected TopView and
ca@2177
    77
     all its contained subViews.
ca@2177
    78
     Useful to have a look at subcomponents - to see how views
ca@2177
    79
     are structured.
ca@2177
    80
ca@2177
    81
ca@2177
    82
    [Instance variables:]
ca@2177
    83
        model           <ViewTreeModel>      the used ViewTreeModel
ca@2177
    84
        clickedItem     <ViewTreeItem>       item under the clickedPoint (motion action)
ca@2177
    85
        clickedPoint    <Point>              point where the motion action started from.
ca@2177
    86
        motionAction    <Action>             (oneArg-) action called durring buttonMotion.
ca@2177
    87
ca@2177
    88
ca@2177
    89
    [author:]
ca@2177
    90
        Claus Atzkern
ca@2177
    91
ca@2177
    92
    [see also:]
ca@2177
    93
        ViewTreeModel
ca@2177
    94
        ViewTreeItem
ca@2177
    95
"
ca@2177
    96
! !
ca@2177
    97
cg@2744
    98
!ViewTreeInspectorApplication class methodsFor:'initialization'!
ca@2177
    99
ca@2177
   100
initialize
ca@2177
   101
    "add myself to the launcher menu
ca@2177
   102
    "
ca@2177
   103
    self installInLauncher.
ca@2177
   104
!
ca@2177
   105
ca@2177
   106
installInLauncher
cg@2744
   107
    "add myself to the launcher menu"
cg@2744
   108
ca@2177
   109
    |menuItem icon|
ca@2177
   110
ca@2177
   111
    NewLauncher isNil ifTrue:[^ self].
cg@2744
   112
    "/ cg - disabled. the icon is too ugly.
cg@2744
   113
    ^ self.
ca@2177
   114
ca@2177
   115
    icon := ToolbarIconLibrary inspectLocals20x20Icon magnifiedTo:28@28.
ca@2177
   116
ca@2177
   117
    menuItem := MenuItem new 
cg@2744
   118
                    label: 'View Tree Inspector';
cg@2744
   119
                    value: [ ViewTreeInspectorApplication open];
ca@2177
   120
                    isButton: true;
ca@2177
   121
                    icon: icon;
ca@2177
   122
                    nameKey: #viewInspect.
ca@2177
   123
ca@2177
   124
    menuItem startGroup:#right.
ca@2177
   125
    NewLauncher addMenuItem:menuItem in:'toolbar'
ca@2177
   126
                   position:#( #before #help)
ca@2177
   127
                      space:false.
ca@2177
   128
ca@2177
   129
"
ca@2177
   130
self installInLauncher
ca@2177
   131
self removeFromLauncher
ca@2177
   132
"
ca@2177
   133
!
ca@2177
   134
ca@2177
   135
postAutoload
ca@2177
   136
    "add myself to the launcher menu
ca@2177
   137
    "
ca@2177
   138
    self installInLauncher.
ca@2177
   139
"
ca@2177
   140
self installInLauncher
ca@2177
   141
self removeFromLauncher
ca@2177
   142
"
ca@2177
   143
!
ca@2177
   144
ca@2177
   145
removeFromLauncher
ca@2177
   146
    "remove myself from the launcher menu
ca@2177
   147
    "
ca@2177
   148
    NewLauncher isNil ifTrue:[^ self].
ca@2177
   149
    NewLauncher removeUserTool:#viewInspect
ca@2177
   150
ca@2177
   151
"
ca@2177
   152
self installInLauncher
ca@2177
   153
self removeFromLauncher
ca@2177
   154
"
ca@2177
   155
!
ca@2177
   156
ca@2177
   157
unload
ca@2177
   158
    "class is about to be unloaded - remove myself from the launcher menu
ca@2177
   159
    "
ca@2177
   160
    self removeFromLauncher.
ca@2177
   161
    super unload.
ca@2177
   162
! !
ca@2177
   163
cg@2744
   164
!ViewTreeInspectorApplication class methodsFor:'image specs'!
cg@2744
   165
cg@2759
   166
crossHairIcon
cg@2759
   167
    "This resource specification was automatically generated
cg@2759
   168
     by the ImageEditor of ST/X."
cg@2759
   169
cg@2759
   170
    "Do not manually edit this!! If it is corrupted,
cg@2759
   171
     the ImageEditor may not be able to read the specification."
cg@2759
   172
cg@2759
   173
    "
cg@2759
   174
     self crossHairIcon inspect
cg@2759
   175
     ImageEditor openOnClass:self andSelector:#crossHairIcon
cg@2759
   176
     Icon flushCachedIcons
cg@2759
   177
    "
cg@2759
   178
cg@2759
   179
    <resource: #image>
cg@2759
   180
cg@2759
   181
    ^Icon
cg@2759
   182
        constantNamed:'Tools::ViewTreeInspectorApplication class crossHairIcon'
cg@2759
   183
        ifAbsentPut:[(Depth1Image new) width: 24; height: 24; photometric:(#palette); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@F0@@XL@@>>@A8O@A>?@B,Z B(J @@@@B(J B,Z A>?@A8O@@>>@@XL@@F0@@@@@@@@@@@@@@@@@@@@@') ; colorMapFromArray:#[255 255 255 0 0 0]; mask:((Depth1Image new) width: 24; height: 24; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@G0@@_<@@?>@A??@C?? C?? G??0G<_0G<_0G<_0G??0C?? C?? A??@@?>@@_<@@G0@@@@@@@@@@@@@@@@@') ; yourself); yourself]
cg@2759
   184
!
cg@2759
   185
cg@2744
   186
pickWindowIcon
cg@2744
   187
    "This resource specification was automatically generated
cg@2744
   188
     by the ImageEditor of ST/X."
cg@2744
   189
cg@2744
   190
    "Do not manually edit this!! If it is corrupted,
cg@2744
   191
     the ImageEditor may not be able to read the specification."
cg@2744
   192
cg@2744
   193
    "
cg@2744
   194
     self pickWindowIcon inspect
cg@2744
   195
     ImageEditor openOnClass:self andSelector:#pickWindowIcon
cg@2744
   196
     Icon flushCachedIcons
cg@2744
   197
    "
cg@2744
   198
cg@2744
   199
    <resource: #image>
cg@2744
   200
cg@2744
   201
    ^Icon
cg@2744
   202
        constantNamed:'Tools::ViewTreeInspectorApplication class pickWindowIcon'
cg@2744
   203
        ifAbsentPut:[(Depth8Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#[8]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
cg@2744
   204
,;N3,;N3,;N3,;N3,;N3,;N3,;N3,3H<P38;M3P,H2@^GA(VEQHQCP0KA D<[&-%XU=WST%BN#D!!GQ$TD@(IBP\BQF)+Z6E_U4-FPCX+G1,WEA@JBP$HAT23
cg@2744
   205
,;N3,;N3,;N3,;N$():Z&IRR&1!!^,;N3,;N3,;N3,;N$)JJ^&)"T$),0W[N3,;N3,;N3,;N3,:R"'')*X%IJWK523,;N3,;N3,0@@@KN3)JJ^&)"T$"5Z,;N3
cg@2744
   206
,;N3@@B3-KL@@JJ^&)"T$)D*V[N3,;N3@KN3-KR4)JH@&)"T$)*MJE"3,;N3,0B3)JJ4&*R"@I*X%IJZ#RYV,;N3,0B3@JR"-JR"-I(@%IJV%H %U[N3,;L@
cg@2744
   207
-@B4-KR4-KR4@IRR%IJEIER3,;N3@KL@)JJ4():4&@BO#9RR!!RIS,;N3,;L@,:R"-JJ^& BT#8>O#8H"T+N3,;N3@KN$@@@@'')(@%H>O#(>AH%F3,;N3,;L@
cg@2744
   208
@JR4'' @@%IJO#8>O RIO,;N3,;N3):P@@@BX%IJO#8>O#7<"S*63,;N$():Z&IRR&IRR#8>O#8=>H"&-,;N$():Z&IRR&)"T$(>O#8>O @<)R$!!GQTD?OS$8
cg@2744
   209
MSL.I2H"H"H"H"HO,;N3,;N3,;N3,;N3,;N3,;N3,;N3,0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a') ; colorMapFromArray:#[0 0 0 0 50 164 0 50 171 0 137 0 0 206 0 1 50 177 2 56 178 3 64 241 3 67 246 3 73 255 4 74 255 5 63 191 7 66 194 10 71 196 10 79 255 12 59 167 12 82 255 14 77 199 18 83 201 19 88 255 21 91 255 23 89 204 27 95 206 28 97 255 29 72 179 30 100 255 32 101 209 36 106 255 36 107 211 39 109 255 41 113 214 45 115 255 45 119 216 48 118 255 50 87 176 50 125 219 51 88 176 51 88 177 52 89 178 52 90 178 53 90 178 53 127 212 54 91 179 54 123 255 54 131 221 55 92 180 55 95 181 56 93 180 56 94 181 57 127 255 57 149 229 58 99 184 58 137 224 61 104 187 63 132 255 63 143 226 64 108 190 66 113 193 66 135 255 67 149 229 68 157 232 69 117 196 71 155 231 72 122 199 72 141 255 75 126 202 75 144 255 75 160 234 77 163 236 78 131 206 80 149 255 81 136 209 84 140 212 84 153 255 87 145 215 88 157 255 91 168 235 93 161 255 94 154 222 96 157 223 96 165 255 97 159 225 98 160 225 98 162 226 99 163 227 100 165 228 101 166 229 101 170 255 102 167 230 103 169 231 104 170 232 104 173 255 105 172 233 105 174 234 106 175 235 109 178 255 112 180 255 117 186 255 119 187 255 122 154 245 125 160 253 125 193 255 126 161 253 126 194 255 127 162 254 130 165 254 132 200 255 132 201 255 133 60 36 135 170 255 139 207 255 140 175 255 144 179 255 149 184 255 153 188 255 157 192 255 162 196 255 166 200 255 170 204 255 174 208 255 174 218 230 177 212 255 181 215 255 185 219 255 188 222 255 191 225 255 212 211 224 218 217 230 219 219 230 220 220 231 222 221 232 223 223 233 225 224 234 225 225 234 226 226 237 227 226 235 227 227 236 227 227 238 228 228 237 229 229 239 231 230 238 231 231 238 231 231 240 232 232 241 233 232 239 233 233 240 234 234 242 235 234 241 236 236 243 237 236 242 237 237 244 238 237 243 238 238 244 239 238 243 239 239 245 240 239 244 241 240 245 241 241 246 241 241 247 242 242 246 242 242 247 243 243 247 243 243 248 244 244 248 244 244 249 245 244 247 246 246 249 246 246 250 247 246 249 247 247 250 248 248 251 249 249 250 249 249 251 250 250 251 250 250 252 251 251 252 251 251 253 253 253 254 254 254 255 255 255 255 0 0 0]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@C????????????????????????????????????????????????????????????????????????????????@@@C') ; yourself); yourself]
cg@2759
   210
!
cg@2759
   211
cg@2759
   212
pickWindowIcon2
cg@2759
   213
    "This resource specification was automatically generated
cg@2759
   214
     by the ImageEditor of ST/X."
cg@2759
   215
cg@2759
   216
    "Do not manually edit this!! If it is corrupted,
cg@2759
   217
     the ImageEditor may not be able to read the specification."
cg@2759
   218
cg@2759
   219
    "
cg@2759
   220
     self pickWindowIcon2 inspect
cg@2759
   221
     ImageEditor openOnClass:self andSelector:#pickWindowIcon2
cg@2759
   222
     Icon flushCachedIcons
cg@2759
   223
    "
cg@2759
   224
cg@2759
   225
    <resource: #image>
cg@2759
   226
cg@2759
   227
    ^Icon
cg@2759
   228
        constantNamed:'Tools::ViewTreeInspectorApplication class pickWindowIcon2'
cg@2759
   229
        ifAbsentPut:[(Depth8Image new) width: 22; height: 23; photometric:(#palette); bitsPerSample:(#[8]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
cg@2759
   230
@CH<O#,7MB0#HA8\F!!XUD!!DMC@,F@P@<[&U!!W5]MRTH:LRD]FQPPB $IA0H@QF)+XU=WR4Y@M",_F1\TD@(IBP E@D23,;N3,;N3,;N3,;N"'')*X%IJ[F@A^
cg@2759
   231
,;N3,;N3,0@@@@@@():Z&IRR&3@@W+N3,;N3@@B3,0B3)@@@&)"T$),0@E63,;N3@KN3@@@@@@B"'' BX%IJWK0A\,;N3@KN3,;N3@JR"'')*X@IRR&24@V+N3
cg@2759
   232
@KN3,;L@@@@@@I:Z&IP@$),*@E&3,0B3,;N3,:P@():Z&IRT@IJ[J@AX,0B3@KL@,;L@@@B^& BT@IP@&2X@U+L@,0B3@KL@)JJ^@I @%@BT@I,%@EV3@@@@
cg@2759
   233
@@@@@JR"'' @@@@@@@@B[I@AT,0B3@KL@)@B$()8@&@BZ@IP@&2H@T;L@,0B3@JR$@@@@%I @& BT@I,"@EJ3,0B3,:R$)I8@&IRX%I*X@IJ[H AQ,;L@,:R$
cg@2759
   234
)@@@@@@@&IRO#0BO RH@S;N3,0B$)JR"'' BX%I"T#0BO#7<"@D:-,;N$@JR$@@@@@@BR#0BO#8=>H AN+[N$)JH@@I"T@I"T@@BO#8>O_"H@JZ63)JJ^&) @
cg@2759
   235
@@@@@IJO#8>O#8@O@B&3,;N3,;N3,;N3,;N"'')*X%IJ[C0@)R$]EPS<=NS 5L28''H"H"H"H"H <b') ; colorMapFromArray:#[0 0 0 0 50 164 0 50 171 0 137 0 0 206 0 1 50 177 2 56 178 3 64 241 3 67 246 3 73 255 4 74 255 5 63 191 7 66 194 10 71 196 10 79 255 12 59 167 12 82 255 14 77 199 18 83 201 19 88 255 21 91 255 23 89 204 27 95 206 28 97 255 29 72 179 30 100 255 32 101 209 36 106 255 36 107 211 39 109 255 41 113 214 45 115 255 45 119 216 48 118 255 50 87 176 50 125 219 51 88 176 51 88 177 52 89 178 52 90 178 53 90 178 53 127 212 54 91 179 54 123 255 54 131 221 55 92 180 55 95 181 56 93 180 56 94 181 57 127 255 57 149 229 58 99 184 58 137 224 61 104 187 63 132 255 63 143 226 64 108 190 66 113 193 66 135 255 67 149 229 68 157 232 69 117 196 71 155 231 72 122 199 72 141 255 75 126 202 75 144 255 75 160 234 77 163 236 78 131 206 80 149 255 81 136 209 84 140 212 84 153 255 87 145 215 88 157 255 91 168 235 93 161 255 94 154 222 96 157 223 96 165 255 97 159 225 98 160 225 98 162 226 99 163 227 100 165 228 101 166 229 101 170 255 102 167 230 103 169 231 104 170 232 104 173 255 105 172 233 105 174 234 106 175 235 109 178 255 112 180 255 117 186 255 119 187 255 122 154 245 125 160 253 125 193 255 126 161 253 126 194 255 127 162 254 130 165 254 132 200 255 132 201 255 133 60 36 135 170 255 139 207 255 140 175 255 144 179 255 149 184 255 153 188 255 157 192 255 162 196 255 166 200 255 170 204 255 174 208 255 174 218 230 177 212 255 181 215 255 185 219 255 188 222 255 191 225 255 212 211 224 218 217 230 219 219 230 220 220 231 222 221 232 223 223 233 225 224 234 225 225 234 226 226 237 227 226 235 227 227 236 227 227 238 228 228 237 229 229 239 231 230 238 231 231 238 231 231 240 232 232 241 233 232 239 233 233 240 234 234 242 235 234 241 236 236 243 237 236 242 237 237 244 238 237 243 238 238 244 239 238 243 239 239 245 240 239 244 241 240 245 241 241 246 241 241 247 242 242 246 242 242 247 243 243 247 243 243 248 244 244 248 244 244 249 245 244 247 246 246 249 246 246 250 247 246 249 247 247 250 248 248 251 249 249 250 249 249 251 250 250 251 250 250 252 251 251 252 251 251 253 253 253 254 254 254 255 255 255 255]; mask:((Depth1Image new) width: 22; height: 23; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<') ; yourself); yourself]
cg@3000
   236
!
cg@3000
   237
cg@3000
   238
releaseViewIcon
cg@3000
   239
    "This resource specification was automatically generated
cg@3000
   240
     by the ImageEditor of ST/X."
cg@3000
   241
cg@3000
   242
    "Do not manually edit this!! If it is corrupted,
cg@3000
   243
     the ImageEditor may not be able to read the specification."
cg@3000
   244
cg@3000
   245
    "
cg@3000
   246
     self releaseViewIcon inspect
cg@3000
   247
     ImageEditor openOnClass:self andSelector:#releaseViewIcon
cg@3000
   248
     Icon flushCachedIcons
cg@3000
   249
    "
cg@3000
   250
cg@3000
   251
    <resource: #image>
cg@3000
   252
cg@3000
   253
    ^Icon
cg@3000
   254
        constantNamed:'Tools::ViewTreeInspectorApplication releaseViewIcon'
cg@3000
   255
        ifAbsentPut:[(Depth8Image new) width: 24; height: 24; photometric:(#palette); bitsPerSample:(#[8]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
cg@3000
   256
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
cg@3000
   257
@@@@@@@@@@@@@@A8^G!!7O3ACP5*P@@A8^G @@@@@@@@@@@A8^@@@OE0/!!P0S#0@@^G @@@@@@@@@@@B (@@''D#48"1.CX5H@(J@@@@@@@@@@@@B (@@@@@@"
cg@3000
   258
''%!!/P7,@(J@@@@@@@@@@@@@%I@@@@BH%IRTQV5P@IRT@@@@@@@@@@@ANSP@@@@ANS$8:T80@S$8@@@@@@@@@@@AN&UYWK(EYQ@\FUPQHXT8@@@@@@@@@@@AN
cg@3000
   259
HC2!!TVY:Y#-%I*IKMD8@@@@@@@@@@@A$\@83XBEG%).GGX _!!&P@@@@@@@@@@@AO[P5+ &(WPYN@["!!E\$<@@@@@@@@@@@B_F''FQPAXX_!!&TGH4HB9<@@@@@
cg@3000
   260
@@@@@@B_%3HCJ7=BKPU,Q)01B9<@@@@@@@@@@@@PBP8T_F!!''JPI)_Y"D&!!@@@@@@@@@@@@@$B)I9TGXO''WQIWQ93W0@@@@@@@@@@@@@$"U=JR$)JR$)JR$)_
cg@3000
   261
"P@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
cg@3000
   262
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@') ; colorMapFromArray:#[132 141 152 147 150 154 250 223 1 246 214 0 205 172 133 238 195 0 213 180 146 217 186 150 188 136 0 206 151 0 183 125 9 208 208 202 196 204 214 255 255 210 255 255 219 210 178 65 242 242 235 106 112 117 96 107 126 250 255 255 255 241 0 154 154 151 255 227 0 67 35 0 52 17 0 253 211 0 208 159 0 167 178 193 222 168 0 248 231 45 208 174 26 199 152 26 225 184 36 255 249 75 220 220 215 77 88 108 241 241 235 245 245 239 255 250 109 242 249 255 255 255 142 255 237 1 142 148 162 242 212 1 143 154 176 174 133 0 222 189 144 169 179 192 177 184 193 184 129 0 255 255 194 253 241 60 210 210 205 214 214 209 77 83 92 230 230 225 98 106 114 243 243 238 117 117 114 255 252 115 255 255 255 115 123 147 130 140 156 152 156 159 241 210 0 53 18 0 151 116 0 162 170 184 218 187 150 193 143 4 220 165 0 206 188 46 181 130 21 204 173 44 206 206 201 208 167 44 72 84 108 240 240 234 244 244 238 243 243 237 212 182 79 255 255 126 131 135 141 119 133 159 132 141 163 195 162 126 219 188 133 218 185 135 180 180 176 221 190 150 175 181 191 176 183 196 181 189 201 202 170 38 209 209 204 207 207 202 251 241 74 229 229 224 238 238 233 226 234 245 244 244 237 255 251 113 255 255 124 255 241 2 255 234 3 249 219 0 255 249 29 252 243 30 227 181 0 212 165 5 222 170 0 173 179 194 216 171 19 255 255 198 208 208 203 156 90 7 206 175 50 91 91 95 211 180 71 242 242 237 246 246 241 212 182 80 255 255 123 129 137 152 255 239 8 251 223 0 59 25 0 251 215 0 228 183 0 222 191 149 249 238 43 177 186 197 187 129 0 186 194 206 209 209 203 249 238 67 255 255 211 226 226 221 235 235 229 100 103 111 76 93 127 255 255 112 88 104 139 130 135 148 149 155 158 247 218 0 224 194 126 255 217 0 228 184 0 13 30 68 161 138 32 204 152 0 255 255 53 206 155 18 207 207 201 255 250 72 255 255 82 209 176 59 232 232 227 243 243 236 245 245 240 255 255 115 255 255 251]; mask:((Depth1Image new) width: 24; height: 24; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@G8@@O<@@O>@@@^@@@N@@@N@@?? @?? @?? @?? @?? @?? @?? @?? @_?@@@@@@@@@@@@@@@@@@@@@') ; yourself); yourself]
cg@2744
   263
! !
cg@2744
   264
cg@2744
   265
!ViewTreeInspectorApplication class methodsFor:'interface specs'!
ca@2177
   266
ca@2177
   267
windowSpec
ca@2177
   268
    "This resource specification was automatically generated
ca@2177
   269
     by the UIPainter of ST/X."
ca@2177
   270
ca@2177
   271
    "Do not manually edit this!! If it is corrupted,
ca@2177
   272
     the UIPainter may not be able to read the specification."
ca@2177
   273
ca@2177
   274
    "
cg@2757
   275
     UIPainter new openOnClass:Tools::ViewTreeInspectorApplication andSelector:#windowSpec
cg@2757
   276
     Tools::ViewTreeInspectorApplication new openInterface:#windowSpec
cg@2757
   277
     Tools::ViewTreeInspectorApplication open
ca@2177
   278
    "
ca@2177
   279
ca@2177
   280
    <resource: #canvas>
ca@2177
   281
ca@2177
   282
    ^ 
cg@3037
   283
    #(FullSpec
cg@3037
   284
       name: windowSpec
cg@3037
   285
       window: 
cg@3037
   286
      (WindowSpec
cg@3037
   287
         label: 'View Tree Inspector'
cg@3037
   288
         name: 'View Tree Inspector'
cg@3037
   289
         min: (Point 10 10)
cg@3037
   290
         max: (Point 1024 9999)
cg@3037
   291
         bounds: (Rectangle 0 0 381 654)
cg@3037
   292
         menu: menu
cg@3037
   293
       )
cg@3037
   294
       component: 
cg@3037
   295
      (SpecCollection
cg@3037
   296
         collection: (
cg@3037
   297
          (MenuPanelSpec
cg@3037
   298
             name: 'toolbarMenu'
cg@3037
   299
             layout: (LayoutFrame 0 0.0 0 0 0 1.0 40 0)
cg@3037
   300
             menu: toolbarMenu
cg@3037
   301
             textDefault: true
cg@3037
   302
           )
cg@3037
   303
          (VariableVerticalPanelSpec
cg@3037
   304
             name: 'VariableVerticalPanel1'
cg@3037
   305
             layout: (LayoutFrame 0 0.0 40 0.0 0 1.0 0 1.0)
cg@3037
   306
             component: 
cg@3037
   307
            (SpecCollection
cg@3037
   308
               collection: (
cg@3037
   309
                (HierarchicalListViewSpec
cg@3037
   310
                   name: 'List'
cg@3037
   311
                   level: 1
cg@3037
   312
                   model: model
cg@3037
   313
                   menu: middleButtonMenu
cg@3037
   314
                   hasHorizontalScrollBar: true
cg@3037
   315
                   hasVerticalScrollBar: true
cg@3037
   316
                   miniScrollerHorizontal: true
cg@3037
   317
                   miniScrollerVertical: false
cg@3037
   318
                   listModel: listOfItems
cg@3037
   319
                   multipleSelectOk: true
cg@3037
   320
                   useIndex: false
cg@3037
   321
                   highlightMode: label
cg@3037
   322
                   showLeftIndicators: false
cg@3037
   323
                   indicatorSelector: indicatorClicked:
cg@3037
   324
                   useDefaultIcons: false
cg@3037
   325
                   postBuildCallback: postBuildTree:
cg@2770
   326
                 )
cg@3037
   327
                (ViewSpec
cg@3037
   328
                   name: 'Box2'
cg@3037
   329
                   component: 
cg@3037
   330
                  (SpecCollection
cg@3037
   331
                     collection: (
cg@3037
   332
                      (ViewSpec
cg@3037
   333
                         name: 'Inspector'
cg@3037
   334
                         layout: (LayoutFrame 0 0 26 0 0 1 0 1)
cg@3037
   335
                         postBuildCallback: postBuildInspectorView:
cg@3037
   336
                         viewClassName: 'InspectorView'
cg@3037
   337
                       )
cg@3037
   338
                      (TabViewSpec
cg@3037
   339
                         name: 'TabHeader1'
cg@3037
   340
                         layout: (LayoutFrame 0 0.0 0 0 0 1.0 25 0)
cg@3037
   341
                         model: inspectorModeIndexHolder
cg@3037
   342
                         menu: inspectorModes
cg@3037
   343
                         useIndex: true
cg@3037
   344
                         translateLabel: true
cg@3037
   345
                       )
cg@3037
   346
                      )
cg@3037
   347
                    
cg@3037
   348
                   )
cg@3037
   349
                 )
cg@3037
   350
                )
cg@3037
   351
              
cg@3037
   352
             )
cg@3037
   353
             handles: (Any 0.5 1.0)
ca@2177
   354
           )
cg@3037
   355
          )
cg@3037
   356
        
cg@3037
   357
       )
cg@3037
   358
     )
ca@2177
   359
! !
ca@2177
   360
cg@2744
   361
!ViewTreeInspectorApplication class methodsFor:'menu specs'!
ca@2177
   362
ca@2177
   363
menu
ca@2177
   364
    "This resource specification was automatically generated
ca@2177
   365
     by the MenuEditor of ST/X."
ca@2177
   366
ca@2177
   367
    "Do not manually edit this!! If it is corrupted,
ca@2177
   368
     the MenuEditor may not be able to read the specification."
ca@2177
   369
cg@2978
   370
ca@2177
   371
    "
cg@2978
   372
     MenuEditor new openOnClass:Tools::ViewTreeInspectorApplication andSelector:#menu
cg@2978
   373
     (Menu new fromLiteralArrayEncoding:(Tools::ViewTreeInspectorApplication menu)) startUp
ca@2177
   374
    "
ca@2177
   375
ca@2177
   376
    <resource: #menu>
ca@2177
   377
ca@2177
   378
    ^ 
ca@2177
   379
     #(Menu
ca@2177
   380
        (
ca@2177
   381
         (MenuItem
ca@2177
   382
            label: 'File'
ca@2177
   383
            submenu: 
ca@2177
   384
           (Menu
ca@2177
   385
              (
ca@2177
   386
               (MenuItem
ca@2177
   387
                  label: 'Pick a View'
cg@2762
   388
                  itemValue: doPickView
ca@2177
   389
                )
ca@2177
   390
               (MenuItem
ca@2455
   391
                  enabled: hasTargetWidgetChannel
ca@2177
   392
                  label: 'Release Picked View'
ca@2177
   393
                  itemValue: doUnpick
ca@2177
   394
                )
ca@2177
   395
               (MenuItem
ca@2177
   396
                  label: '-'
ca@2177
   397
                )
ca@2177
   398
               (MenuItem
cg@2744
   399
                  label: 'Settings'
cg@2744
   400
                  submenu: 
cg@2744
   401
                 (Menu
cg@2744
   402
                    (
cg@2744
   403
                     (MenuItem
cg@2744
   404
                        label: 'Test Mode'
cg@2744
   405
                        hideMenuOnActivated: false
cg@2744
   406
                        indication: testModeChannel
cg@2744
   407
                      )
cg@2744
   408
                     (MenuItem
cg@2744
   409
                        enabled: testModeChannel
cg@2744
   410
                        label: 'Follow Focus'
cg@2744
   411
                        hideMenuOnActivated: false
cg@2744
   412
                        indication: followFocusChannel
cg@2744
   413
                      )
cg@2744
   414
                     (MenuItem
cg@2744
   415
                        label: '-'
cg@2744
   416
                      )
cg@2744
   417
                     (MenuItem
cg@2744
   418
                        label: 'Select on Click'
cg@2744
   419
                        hideMenuOnActivated: false
cg@2744
   420
                        indication: selectOnClickHolder
cg@2744
   421
                      )
cg@2744
   422
                     (MenuItem
cg@2744
   423
                        label: '-'
cg@2744
   424
                      )
cg@2744
   425
                     (MenuItem
cg@2744
   426
                        label: 'Show Name of Widgets'
cg@2744
   427
                        hideMenuOnActivated: false
cg@2744
   428
                        indication: showNamesHolder
cg@2744
   429
                      )
cg@2744
   430
                     )
cg@2744
   431
                    nil
cg@2744
   432
                    nil
cg@2744
   433
                  )
cg@2744
   434
                )
cg@2744
   435
               (MenuItem
cg@2744
   436
                  label: '-'
cg@2744
   437
                )
cg@2744
   438
               (MenuItem
ca@2177
   439
                  label: 'Exit'
ca@2177
   440
                  itemValue: closeRequest
ca@2177
   441
                )
ca@2177
   442
               )
ca@2177
   443
              nil
ca@2177
   444
              nil
ca@2177
   445
            )
ca@2177
   446
          )
ca@2177
   447
         (MenuItem
cg@2744
   448
            enabled: hasSingleSelectionHolder
cg@2744
   449
            label: 'Selection'
cg@2744
   450
            submenuChannel: middleButtonMenu
cg@2744
   451
          )
cg@2744
   452
         (MenuItem
cg@3034
   453
            label: 'Widget'
cg@3034
   454
            submenu: 
cg@3034
   455
           (Menu
cg@3034
   456
              (
cg@3034
   457
               (MenuItem
cg@3034
   458
                  enabled: hasSingleSelectionHolder
cg@3034
   459
                  label: 'Browse'
cg@3034
   460
                  itemValue: doBrowse:
cg@3034
   461
                  argument: view
cg@3034
   462
                )
cg@3034
   463
               (MenuItem
cg@3034
   464
                  enabled: hasSingleSelectionHolder
cg@3034
   465
                  label: 'Inspect'
cg@3034
   466
                  itemValue: doInspect:
cg@3034
   467
                  argument: view
cg@3034
   468
                )
cg@3034
   469
               (MenuItem
cg@3034
   470
                  label: '-'
cg@3034
   471
                )
cg@3034
   472
               (MenuItem
cg@3034
   473
                  enabled: hasTargetWidgetChannel
cg@3034
   474
                  label: 'All Components'
cg@3034
   475
                  startGroup: right
cg@3034
   476
                  submenuChannel: submenuComponents:
cg@3034
   477
                )
cg@3034
   478
               )
cg@3034
   479
              nil
cg@3034
   480
              nil
cg@3034
   481
            )
cg@3034
   482
          )
cg@3034
   483
         (MenuItem
cg@2744
   484
            label: 'Application'
ca@2454
   485
            submenu: 
ca@2454
   486
           (Menu
ca@2454
   487
              (
ca@2454
   488
               (MenuItem
cg@2978
   489
                  label: 'Redraw'
cg@2978
   490
                  itemValue: doRedraw
cg@2978
   491
                )
cg@2978
   492
               (MenuItem
cg@2978
   493
                  label: '-'
cg@2978
   494
                )
cg@2978
   495
               (MenuItem
cg@2744
   496
                  enabled: hasSingleSelectionHolder
cg@2744
   497
                  label: 'Browse'
cg@2744
   498
                  itemValue: doBrowse:
cg@2744
   499
                  argument: application
ca@2454
   500
                )
ca@2454
   501
               (MenuItem
cg@2744
   502
                  enabled: hasSingleSelectionHolder
cg@2744
   503
                  label: 'Inspect'
cg@2744
   504
                  itemValue: doInspect:
cg@2744
   505
                  argument: application
ca@2454
   506
                )
ca@2454
   507
               (MenuItem
ca@2454
   508
                  label: '-'
ca@2454
   509
                )
ca@2454
   510
               (MenuItem
cg@2744
   511
                  enabled: hasTargetWidgetChannel
cg@2744
   512
                  label: 'All Applications'
cg@2744
   513
                  submenuChannel: submenuApplications:
cg@2744
   514
                )
cg@2744
   515
               )
cg@2744
   516
              nil
cg@2744
   517
              nil
cg@2744
   518
            )
cg@2744
   519
          )
cg@2744
   520
         (MenuItem
cg@3034
   521
            label: 'Process'
cg@2744
   522
            submenu: 
cg@2744
   523
           (Menu
cg@2744
   524
              (
cg@2744
   525
               (MenuItem
cg@2744
   526
                  enabled: hasSingleSelectionHolder
cg@2744
   527
                  label: 'Inspect'
cg@2744
   528
                  itemValue: doInspect:
cg@3034
   529
                  argument: process
ca@2454
   530
                )
ca@2454
   531
               (MenuItem
ca@2454
   532
                  label: '-'
ca@2454
   533
                )
ca@2454
   534
               (MenuItem
cg@3034
   535
                  label: 'Open Process Monitor'
cg@3034
   536
                  itemValue: doOpenProcessMonitor
ca@2454
   537
                )
ca@2454
   538
               )
ca@2454
   539
              nil
ca@2454
   540
              nil
ca@2454
   541
            )
ca@2454
   542
          )
ca@2454
   543
         (MenuItem
cg@2744
   544
            label: 'Help'
cg@2744
   545
            startGroup: conditionalRight
cg@2744
   546
            submenu: 
cg@2744
   547
           (Menu
cg@2744
   548
              (
cg@2744
   549
               (MenuItem
cg@2744
   550
                  label: 'Documentation'
cg@2744
   551
                  itemValue: openDocumentation
cg@2744
   552
                )
cg@2744
   553
               (MenuItem
cg@2744
   554
                  label: '-'
cg@2744
   555
                )
cg@2744
   556
               (MenuItem
cg@2744
   557
                  label: 'About this Application...'
cg@2744
   558
                  itemValue: openAboutThisApplication
cg@2744
   559
                )
cg@2744
   560
               )
cg@2744
   561
              nil
cg@2744
   562
              nil
cg@2744
   563
            )
ca@2177
   564
          )
ca@2177
   565
         )
ca@2177
   566
        nil
ca@2177
   567
        nil
ca@2177
   568
      )
ca@2177
   569
!
ca@2177
   570
ca@2177
   571
middleButtonMenu
ca@2177
   572
    "This resource specification was automatically generated
ca@2177
   573
     by the MenuEditor of ST/X."
ca@2177
   574
ca@2177
   575
    "Do not manually edit this!! If it is corrupted,
ca@2177
   576
     the MenuEditor may not be able to read the specification."
ca@2177
   577
ca@2177
   578
    "
ca@2177
   579
     MenuEditor new openOnClass:ViewTreeApplication andSelector:#middleButtonMenu
ca@2177
   580
     (Menu new fromLiteralArrayEncoding:(ViewTreeApplication middleButtonMenu)) startUp
ca@2177
   581
    "
ca@2177
   582
ca@2177
   583
    <resource: #menu>
ca@2177
   584
ca@2177
   585
    ^ 
ca@2177
   586
     #(Menu
ca@2177
   587
        (
ca@2177
   588
         (MenuItem
ca@2177
   589
            label: 'Geometry'
ca@2177
   590
            translateLabel: true
ca@2177
   591
            submenuChannel: submenuGeometry:
ca@2177
   592
            keepLinkedMenu: true
ca@2177
   593
          )
ca@2177
   594
         (MenuItem
ca@2177
   595
            label: 'Interface'
ca@2177
   596
            translateLabel: true
ca@2177
   597
            submenuChannel: submenuInterface:
ca@2177
   598
            keepLinkedMenu: true
ca@2177
   599
          )
ca@2177
   600
         (MenuItem
ca@2177
   601
            label: 'Visibility'
ca@2177
   602
            translateLabel: true
ca@2177
   603
            submenuChannel: submenuVisibility:
ca@2177
   604
            keepLinkedMenu: true
ca@2177
   605
          )
ca@2177
   606
         (MenuItem
ca@2177
   607
            label: '-'
ca@2177
   608
          )
ca@2177
   609
         (MenuItem
ca@2177
   610
            label: 'Browse View Class'
ca@2177
   611
            itemValue: doBrowse:
ca@2177
   612
            translateLabel: true
ca@2177
   613
            argument: view
ca@2177
   614
          )
ca@2177
   615
         (MenuItem
ca@2177
   616
            label: 'Browse Model Class'
ca@2177
   617
            itemValue: doBrowse:
ca@2177
   618
            translateLabel: true
ca@2177
   619
            isVisible: hasModel
ca@2177
   620
            argument: model
ca@2177
   621
          )
ca@2177
   622
         (MenuItem
ca@2177
   623
            label: 'Browse Application Class'
ca@2177
   624
            itemValue: doBrowse:
ca@2177
   625
            translateLabel: true
ca@2177
   626
            isVisible: hasApplication
ca@2177
   627
            argument: application
ca@2177
   628
          )
ca@2177
   629
         (MenuItem
ca@2177
   630
            label: 'Browse Controller Class'
ca@2177
   631
            itemValue: doBrowse:
ca@2177
   632
            translateLabel: true
ca@2177
   633
            isVisible: hasController
ca@2177
   634
            argument: controller
ca@2177
   635
          )
ca@2177
   636
         (MenuItem
ca@2177
   637
            label: '-'
ca@2177
   638
          )
ca@2177
   639
         (MenuItem
ca@2177
   640
            label: 'Inspect View'
ca@2177
   641
            itemValue: doInspect:
ca@2177
   642
            translateLabel: true
ca@2177
   643
            argument: view
ca@2177
   644
          )
ca@2177
   645
         (MenuItem
ca@2177
   646
            label: 'Inspect Window Group'
ca@2177
   647
            itemValue: doInspect:
ca@2177
   648
            translateLabel: true
ca@2177
   649
            argument: group
ca@2177
   650
          )
ca@2177
   651
         (MenuItem
ca@2177
   652
            label: 'Inspect Model'
ca@2177
   653
            itemValue: doInspect:
ca@2177
   654
            translateLabel: true
ca@2177
   655
            isVisible: hasModel
ca@2177
   656
            argument: model
ca@2177
   657
          )
ca@2177
   658
         (MenuItem
ca@2177
   659
            label: 'Inspect Application'
ca@2177
   660
            itemValue: doInspect:
ca@2177
   661
            translateLabel: true
ca@2177
   662
            isVisible: hasApplication
ca@2177
   663
            argument: application
ca@2177
   664
          )
ca@2177
   665
         (MenuItem
ca@2177
   666
            label: 'Inspect Controller'
ca@2177
   667
            itemValue: doInspect:
ca@2177
   668
            translateLabel: true
ca@2177
   669
            isVisible: hasController
ca@2177
   670
            argument: controller
ca@2177
   671
          )
ca@2177
   672
         (MenuItem
ca@2177
   673
            label: '-'
ca@2177
   674
          )
ca@2177
   675
         (MenuItem
ca@2177
   676
            label: 'Flash'
ca@2177
   677
            itemValue: doFlash
ca@2177
   678
            translateLabel: true
ca@2177
   679
          )
ca@2177
   680
         (MenuItem
ca@2177
   681
            label: '-'
ca@2177
   682
          )
ca@2177
   683
         (MenuItem
ca@2177
   684
            label: 'Destroy'
ca@2177
   685
            itemValue: doDestroy
ca@2177
   686
            translateLabel: true
ca@2177
   687
          )
ca@2177
   688
         (MenuItem
ca@2177
   689
            label: '-'
ca@2177
   690
          )
ca@2177
   691
         (MenuItem
ca@2177
   692
            label: 'Instance Variables'
ca@2177
   693
            translateLabel: true
ca@2177
   694
            submenuChannel: submenuInspector:
ca@2177
   695
            keepLinkedMenu: true
ca@2177
   696
          )
ca@2177
   697
         (MenuItem
ca@2177
   698
            label: '='
ca@2177
   699
          )
ca@2177
   700
         (MenuItem
ca@2177
   701
            label: ''
ca@2177
   702
          )
ca@2177
   703
         (MenuItem
ca@2177
   704
            enabled: selectedComponentHasChildren
ca@2177
   705
            label: 'Applications'
ca@2177
   706
            nameKey: single
ca@2177
   707
            translateLabel: true
ca@2177
   708
            submenuChannel: submenuApplications:
ca@2177
   709
            keepLinkedMenu: true
ca@2177
   710
          )
ca@2177
   711
         (MenuItem
ca@2177
   712
            enabled: selectedComponentHasChildren
ca@2177
   713
            label: 'Components'
ca@2177
   714
            nameKey: single
ca@2177
   715
            translateLabel: true
ca@2177
   716
            submenuChannel: submenuComponents:
ca@2177
   717
            keepLinkedMenu: true
ca@2177
   718
          )
ca@2177
   719
         )
ca@2177
   720
        nil
ca@2177
   721
        nil
ca@2177
   722
      )
ca@2177
   723
!
ca@2177
   724
ca@2177
   725
toolbarMenu
ca@2177
   726
    "This resource specification was automatically generated
ca@2177
   727
     by the MenuEditor of ST/X."
ca@2177
   728
ca@2177
   729
    "Do not manually edit this!! If it is corrupted,
ca@2177
   730
     the MenuEditor may not be able to read the specification."
ca@2177
   731
cg@2978
   732
ca@2177
   733
    "
cg@2757
   734
     MenuEditor new openOnClass:Tools::ViewTreeInspectorApplication andSelector:#toolbarMenu
cg@2757
   735
     (Menu new fromLiteralArrayEncoding:(Tools::ViewTreeInspectorApplication toolbarMenu)) startUp
ca@2177
   736
    "
ca@2177
   737
ca@2177
   738
    <resource: #menu>
ca@2177
   739
ca@2177
   740
    ^ 
ca@2177
   741
     #(Menu
ca@2177
   742
        (
ca@2177
   743
         (MenuItem
cg@2978
   744
            enabled: hasTargetWidgetChannel
cg@2978
   745
            label: 'Redraw'
cg@2978
   746
            itemValue: doRedraw
cg@2978
   747
            isButton: true
cg@2978
   748
            labelImage: (ResourceRetriever ToolbarIconLibrary reloadIcon)
cg@2978
   749
          )
cg@2978
   750
         (MenuItem
cg@2978
   751
            label: '-'
cg@2978
   752
          )
cg@2978
   753
         (MenuItem
cg@2978
   754
            label: 'Pick a View and Catch Events'
cg@2762
   755
            itemValue: doPickView
cg@2744
   756
            translateLabel: false
cg@2744
   757
            isButton: true
cg@2744
   758
            hideMenuOnActivated: false
cg@2759
   759
            labelImage: (ResourceRetriever #'Tools::ViewTreeInspectorApplication' pickWindowIcon2)
cg@2744
   760
          )
cg@2744
   761
         (MenuItem
cg@2757
   762
            enabled: hasTargetWidgetChannel
cg@2978
   763
            label: 'Release Picked View and Uncatch Events'
cg@2978
   764
            itemValue: doUncatchEvents
cg@2757
   765
            isButton: true
cg@3000
   766
            labelImage: (ResourceRetriever #'Tools::ViewTreeInspectorApplication' releaseViewIcon)
cg@2757
   767
          )
cg@2757
   768
         (MenuItem
cg@2757
   769
            label: '-'
cg@2757
   770
          )
cg@2757
   771
         (MenuItem
ca@2454
   772
            enabled: hasSingleSelectionHolder
cg@2744
   773
            label: 'Browse Application'
ca@2454
   774
            itemValue: doBrowse:
ca@2454
   775
            translateLabel: false
cg@2744
   776
            isButton: true
cg@2744
   777
            hideMenuOnActivated: false
ca@2454
   778
            labelImage: (ResourceRetriever ToolbarIconLibrary systemBrowser24x24Icon2)
ca@2454
   779
            argument: application
ca@2177
   780
          )
ca@2177
   781
         (MenuItem
ca@2454
   782
            enabled: hasSingleSelectionHolder
cg@2744
   783
            label: 'Inspect Application'
ca@2454
   784
            itemValue: doInspect:
ca@2454
   785
            translateLabel: false
cg@2744
   786
            isButton: true
cg@2744
   787
            hideMenuOnActivated: false
cg@2744
   788
            labelImage: (ResourceRetriever ToolbarIconLibrary inspect22x24Icon)
ca@2454
   789
            argument: application
ca@2177
   790
          )
ca@2177
   791
         )
ca@2177
   792
        nil
ca@2177
   793
        nil
ca@2177
   794
      )
ca@2177
   795
! !
ca@2177
   796
cg@2747
   797
!ViewTreeInspectorApplication class methodsFor:'startup'!
cg@2747
   798
cg@2747
   799
openInPickMode
cg@2747
   800
    |app|
cg@2747
   801
cg@2747
   802
    app := self new.
cg@2747
   803
    app open.
cg@2762
   804
    app doPickView.
cg@3014
   805
!
cg@3014
   806
cg@3014
   807
openOn:aView
cg@3014
   808
    "show a particular window's topView hierarchy,
cg@3014
   809
     select the given view"
cg@3014
   810
cg@3014
   811
    |app|
cg@3014
   812
cg@3014
   813
    app := self new.
cg@3014
   814
    app open.
cg@3014
   815
    app showWindow:aView.
cg@2747
   816
! !
cg@2747
   817
cg@2744
   818
!ViewTreeInspectorApplication methodsFor:'actions'!
ca@2177
   819
ca@2177
   820
indicatorClicked:anIndex
ca@2177
   821
    |item sensor|
ca@2177
   822
ca@2177
   823
    item := model listOfItems at:anIndex ifAbsent:nil.
ca@2177
   824
ca@2177
   825
    item notNil ifTrue:[
ca@2177
   826
        (     (sensor := self window sensor) notNil
ca@2177
   827
         and:[(sensor ctrlDown or:[sensor shiftDown])]
ca@2177
   828
        ) ifTrue:[
ca@2177
   829
            item recursiveToggleExpand
ca@2177
   830
        ] ifFalse:[
ca@2177
   831
            item toggleExpand
ca@2177
   832
        ]
ca@2177
   833
    ].
ca@2177
   834
! !
ca@2177
   835
cg@2744
   836
!ViewTreeInspectorApplication methodsFor:'aspects'!
ca@2177
   837
ca@2177
   838
followFocusChannel
ca@2455
   839
    "boolean holder, which indicates whether selection changed dependend on the focus view"
ca@2455
   840
ca@2177
   841
    ^ followFocusChannel
ca@2177
   842
!
ca@2177
   843
ca@2177
   844
hasSingleSelectionHolder
ca@2455
   845
    "boolean holder, true if one item is selected"
ca@2455
   846
ca@2177
   847
    ^ hasSingleSelectionHolder
ca@2177
   848
!
ca@2177
   849
ca@2455
   850
hasTargetWidgetChannel
ca@2455
   851
    "answer the channel which is set to true if a target widget exists"
ca@2455
   852
ca@2455
   853
    ^ model hasTargetWidgetChannel
ca@2455
   854
!
ca@2455
   855
cg@3037
   856
inspectorMode
cg@3037
   857
    "what is shwn in the inspector:
cg@3037
   858
     1->widget
cg@3037
   859
     2->application"
cg@3037
   860
cg@3037
   861
    ^ (inspectorModeIndexHolder value == 1) 
cg@3037
   862
        ifTrue:[#widget]
cg@3037
   863
        ifFalse:[#application]
cg@3037
   864
cg@3037
   865
    "Created: / 30-07-2013 / 07:44:59 / cg"
cg@3037
   866
!
cg@3037
   867
cg@3037
   868
inspectorModeIndexHolder
cg@3037
   869
    "what is shwn in the inspector:
cg@3037
   870
     1->widget
cg@3037
   871
     2->application"
cg@3037
   872
cg@3037
   873
    ^ inspectorModeIndexHolder
cg@3037
   874
cg@3037
   875
    "Created: / 30-07-2013 / 07:44:07 / cg"
cg@3037
   876
!
cg@3037
   877
cg@3037
   878
inspectorModes
cg@3037
   879
    ^ #('Widget' 'Application')
cg@3037
   880
cg@3037
   881
    "Created: / 30-07-2013 / 09:42:16 / cg"
cg@3037
   882
!
cg@3037
   883
ca@2177
   884
listOfItems
ca@2455
   885
    "returns the hierarchical list of items"
ca@2455
   886
ca@2177
   887
    ^ model listOfItems
ca@2177
   888
!
ca@2177
   889
ca@2177
   890
model
ca@2455
   891
    "returns my selection model, a ViewTreeModel"
ca@2455
   892
ca@2177
   893
    ^ model
ca@2177
   894
!
ca@2177
   895
ca@2177
   896
selectOnClickHolder
ca@2455
   897
    "boolean holder, which indicates whether the selection will change on click"
ca@2455
   898
ca@2177
   899
    ^ model selectOnClickHolder
ca@2177
   900
!
ca@2177
   901
ca@2451
   902
showNamesHolder
ca@2451
   903
    "boolean holder, which indicates whether application names or widget names
ca@2455
   904
     as additional text are shown for the items"
ca@2455
   905
ca@2451
   906
    ^ showNamesHolder
ca@2451
   907
!
ca@2451
   908
ca@2177
   909
testModeChannel
ca@2455
   910
    "answer a boolean channel which describes the behaviour how to process
ca@2455
   911
     events on the target view.
ca@2455
   912
ca@2455
   913
     false: all input events are eaten and the selection is shown on the target view.
ca@2455
   914
     true:  no  input events are eaten and no  selection is shown on the target view."
ca@2455
   915
ca@2455
   916
    ^ model testModeChannel
ca@2177
   917
! !
ca@2177
   918
cg@2744
   919
!ViewTreeInspectorApplication methodsFor:'change & update'!
ca@2177
   920
cg@3037
   921
inspectorModeIndexHolderChanged
cg@3037
   922
    self updateInspector
cg@3037
   923
cg@3037
   924
    "Created: / 30-07-2013 / 09:21:51 / cg"
cg@3037
   925
!
cg@3037
   926
ca@2177
   927
selectionChanged
ca@2177
   928
    |info view item|
ca@2177
   929
ca@2177
   930
    item := model selectedItem.
ca@2177
   931
ca@2177
   932
    item notNil ifTrue:[ |state|
ca@2177
   933
        view := item widget.
ca@2177
   934
ca@2177
   935
        view id isNil ifTrue:[
ca@2177
   936
            state := 'no ID'.
ca@2177
   937
        ] ifFalse:[
ca@2177
   938
            view shown ifTrue:[
ca@2177
   939
                state := 'visible'.
ca@2177
   940
            ] ifFalse:[
ca@2177
   941
                state := 'invisible'
ca@2177
   942
            ].
ca@2177
   943
        ].
ca@2177
   944
        info := '%1 [%2] - %3' bindWith:(view class name)
ca@2177
   945
                                   with:(view name ? '') with:state allBold.
ca@2177
   946
ca@2177
   947
    ] ifFalse:[
ca@2177
   948
        info := ''
ca@2177
   949
    ].
ca@2177
   950
    hasSingleSelectionHolder value:(view notNil).
cg@3037
   951
    self updateInspector
cg@3037
   952
cg@3037
   953
    "Modified: / 30-07-2013 / 09:21:27 / cg"
ca@2177
   954
!
ca@2177
   955
ca@2177
   956
update:something with:someArgument from:aModel
ca@2454
   957
    |oldSelection|
ca@2454
   958
ca@2451
   959
    aModel == showNamesHolder ifTrue:[
ca@2455
   960
        oldSelection := model selectedItem.
ca@2454
   961
        model selectedItem:nil.
ca@2451
   962
        self listOfItems showWidgetNames:(aModel value).
ca@2454
   963
        model selectedItem:oldSelection.
ca@2451
   964
        ^ self
ca@2451
   965
    ].
ca@2458
   966
ca@2458
   967
    aModel == model ifTrue:[
ca@2458
   968
        self selectionChanged.
ca@2458
   969
        ^ self
ca@2458
   970
    ].
ca@2458
   971
ca@2177
   972
    super update:something with:someArgument from:aModel.
cg@3037
   973
!
cg@3037
   974
cg@3037
   975
updateInspector
cg@3037
   976
    |view obj|
cg@3037
   977
cg@3037
   978
    view := self selectedView.
cg@3037
   979
    (view isNil or:[self inspectorMode == #widget]) ifTrue:[
cg@3037
   980
        obj := view.
cg@3037
   981
    ] ifFalse:[
cg@3037
   982
        obj := view application.
cg@3037
   983
    ].
cg@3037
   984
    inspectorView inspect:obj.
cg@3037
   985
    inspectorView headLineLabel:(obj class nameWithoutPrefix)
cg@3037
   986
cg@3037
   987
    "Created: / 30-07-2013 / 09:21:16 / cg"
ca@2177
   988
! !
ca@2177
   989
cg@2744
   990
!ViewTreeInspectorApplication methodsFor:'event processing'!
ca@2177
   991
ca@2177
   992
processButtonMotionEvent:ev
ca@2455
   993
    |click rootView|
ca@2177
   994
ca@2455
   995
    motionAction isNil ifTrue:[^ self].
ca@2455
   996
ca@2455
   997
    (rootView := model rootView) isNil ifTrue:[
ca@2455
   998
        clickedItem := motionAction := nil.
ca@2455
   999
        ^ self
ca@2455
  1000
    ].
ca@2455
  1001
ca@2455
  1002
    click := rootView device
ca@2455
  1003
            translatePoint:((ev x)@ (ev y))
ca@2455
  1004
            fromView:(ev view)
ca@2455
  1005
            toView:rootView.
ca@2455
  1006
ca@2455
  1007
    click = clickedPoint ifFalse:[
ca@2455
  1008
        (clickedItem isNil or:[(click dist:clickedPoint) > 5.0]) ifTrue:[
ca@2455
  1009
            motionAction value:click
ca@2177
  1010
        ]
ca@2177
  1011
    ].
ca@2177
  1012
!
ca@2177
  1013
ca@2177
  1014
processButtonPressEvent:ev
ca@2455
  1015
    |rootView sensor lastRectangle|
ca@2455
  1016
ca@2455
  1017
    rootView    := model rootView.
ca@2177
  1018
    sensor      := model rootView sensor.
ca@2177
  1019
    clickedItem := model listOfItems detectItemRespondsToView:(ev view).
ca@2177
  1020
ca@2177
  1021
    (sensor ctrlDown or:[sensor shiftDown]) ifTrue:[
ca@2177
  1022
        clickedItem notNil ifTrue:[
ca@2177
  1023
            self selectOnClickHolder value ifTrue:[
ca@2177
  1024
                model toggleSelectItem:clickedItem
ca@2177
  1025
            ].
ca@2177
  1026
        ].
ca@2177
  1027
        clickedItem := motionAction := nil.
ca@2455
  1028
        ^ self
ca@2455
  1029
    ].
ca@2177
  1030
ca@2455
  1031
    clickedPoint := rootView device translatePoint:((ev x)@ (ev y))  fromView:(ev view) toView:rootView.
ca@2455
  1032
    lastRectangle := nil.
ca@2177
  1033
ca@2455
  1034
    motionAction :=[:p|
ca@2455
  1035
        rootView    := model rootView device rootView.
ca@2455
  1036
        rootView    := model rootView.
ca@2455
  1037
        clickedItem := nil.
ca@2177
  1038
ca@2455
  1039
        rootView xoring:[
ca@2455
  1040
            lastRectangle notNil ifTrue:[ rootView displayRectangle:lastRectangle ]
ca@2455
  1041
                                ifFalse:[ rootView clippedByChildren:false ].
ca@2455
  1042
ca@2455
  1043
            p isNil ifTrue:[
ca@2455
  1044
                rootView clippedByChildren:true.
ca@2455
  1045
                motionAction := nil.
ca@2455
  1046
            ] ifFalse:[
ca@2455
  1047
                lastRectangle := Rectangle origin:(clickedPoint min:p) corner:(clickedPoint max:p).
ca@2455
  1048
                rootView displayRectangle:lastRectangle.
ca@2177
  1049
            ].
ca@2455
  1050
            rootView flush.
ca@2455
  1051
        ].
ca@2455
  1052
        lastRectangle
ca@2455
  1053
    ].
ca@2177
  1054
!
ca@2177
  1055
ca@2177
  1056
processButtonReleaseEvent:anEvent
ca@2177
  1057
    |rootView rectangle newItems widget origin|
ca@2177
  1058
ca@2455
  1059
    (rootView := model rootView) isNil ifTrue:[
ca@2455
  1060
        clickedItem := motionAction := nil.
ca@2455
  1061
        ^ self
ca@2455
  1062
    ].
ca@2177
  1063
    motionAction isNil ifTrue:[ ^ self ].
ca@2177
  1064
    clickedItem notNil ifTrue:[ ^ model selectItem:clickedItem ].
ca@2177
  1065
ca@2455
  1066
    rectangle := motionAction value:nil.
ca@2455
  1067
    rectangle isNil ifTrue:[^ self].
ca@2177
  1068
ca@2455
  1069
    newItems := OrderedCollection new.
ca@2177
  1070
ca@2455
  1071
    model rootItem recursiveDo:[:anItem|
ca@2455
  1072
        widget := anItem widget.
ca@2455
  1073
        origin := widget originRelativeTo:rootView.
ca@2455
  1074
ca@2455
  1075
        (rectangle containsRect:(Rectangle origin:origin extent:(widget extent))) ifTrue:[
ca@2455
  1076
            newItems add:anItem.
ca@2455
  1077
        ]
ca@2177
  1078
    ].
ca@2455
  1079
    model value:newItems.
ca@2177
  1080
!
ca@2177
  1081
ca@2177
  1082
processEvent:anEvent
ca@2177
  1083
    |button menu|
ca@2177
  1084
cg@2758
  1085
    anEvent isKeyPressEvent ifTrue:[ self processKeyPressEvent:anEvent. ^ self  ].
ca@2177
  1086
    anEvent isButtonEvent  ifFalse:[ ^ self ].
ca@2177
  1087
ca@2177
  1088
    button := anEvent button.
ca@2177
  1089
ca@2177
  1090
    (button == 2 or:[button == #menu]) ifTrue:[
ca@2177
  1091
        motionAction isNil ifTrue:[
ca@2177
  1092
            anEvent isButtonPressEvent ifTrue:[
ca@2177
  1093
                self selectOnClickHolder value ifTrue:[
ca@2177
  1094
                    menu := self middleButtonMenu value.
ca@2177
  1095
                    menu notNil ifTrue:[
cg@2758
  1096
                        menu := MenuPanel 
cg@2758
  1097
                                    menu:(Menu new fromLiteralArrayEncoding:menu)
cg@2758
  1098
                                    receiver:self.
ca@2177
  1099
                        menu startUp.
ca@2177
  1100
                    ]
ca@2177
  1101
                ].
ca@2177
  1102
            ].
ca@2177
  1103
            clickedItem := nil.
ca@2177
  1104
        ].
ca@2177
  1105
        ^ self
ca@2177
  1106
    ].
ca@2177
  1107
cg@2758
  1108
    anEvent isButtonPressEvent  ifTrue:[ self processButtonPressEvent:anEvent. ^ self ].
cg@2758
  1109
    anEvent isButtonMotionEvent ifTrue:[ self processButtonMotionEvent:anEvent. ^ self ].
ca@2177
  1110
ca@2177
  1111
    anEvent isButtonReleaseEvent ifTrue:[
ca@2177
  1112
        self selectOnClickHolder value ifTrue:[
ca@2177
  1113
            self processButtonReleaseEvent:anEvent
ca@2177
  1114
        ].
ca@2177
  1115
    ].
ca@2177
  1116
    clickedItem := motionAction := nil.
ca@2177
  1117
ca@2177
  1118
    anEvent type == #'buttonMultiPress:x:y:' ifTrue:[
ca@2177
  1119
        self selectOnClickHolder value ifTrue:[
ca@2177
  1120
            self doInspect:#view.
ca@2177
  1121
        ].
ca@2177
  1122
    ].
ca@2177
  1123
!
ca@2177
  1124
ca@2177
  1125
processKeyPressEvent:anEvent
ca@2177
  1126
    |item prnt idx key max next|
ca@2177
  1127
ca@2177
  1128
    key := anEvent key.
ca@2177
  1129
    key isSymbol ifFalse:[^ self].
ca@2177
  1130
ca@2177
  1131
    key == #Delete    ifTrue:[ ^ self doDestroy ].
ca@2177
  1132
    key == #InspectIt ifTrue:[ ^ self doInspect:#view ].
ca@2177
  1133
ca@2177
  1134
    (   key == #CursorUp
ca@2177
  1135
    or:[key == #CursorDown
ca@2177
  1136
    or:[key == #CursorLeft
ca@2177
  1137
    or:[key == #CursorRight]]]
ca@2177
  1138
    ) ifFalse:[
ca@2177
  1139
        ^ self
ca@2177
  1140
    ].
ca@2177
  1141
    item := model selectedItem.
ca@2177
  1142
ca@2177
  1143
    item isNil ifTrue:[
ca@2177
  1144
        ^ model selectedItem:(model first ? model rootItem)
ca@2177
  1145
    ].
ca@2177
  1146
ca@2177
  1147
    prnt := item parent.
ca@2177
  1148
    prnt isNil ifTrue:[
ca@2177
  1149
        "/ is the root item
ca@2177
  1150
        (key == #CursorUp or:[key == #CursorLeft]) ifTrue:[item := model listOfItems last]
ca@2177
  1151
                                                  ifFalse:[item := item at:1 ifAbsent:item].
ca@2177
  1152
cg@2758
  1153
        ^ model selectedItem:item
ca@2177
  1154
    ].
ca@2177
  1155
    key == #CursorLeft ifTrue:[ ^ model selectedItem:prnt ].
ca@2177
  1156
ca@2177
  1157
    key == #CursorRight ifTrue:[
ca@2177
  1158
        next := item at:1 ifAbsent:nil.
ca@2177
  1159
        next notNil ifTrue:[ model selectedItem:next ].
cg@2758
  1160
        ^ self
ca@2177
  1161
    ].
ca@2177
  1162
ca@2177
  1163
    max := prnt size.
ca@2177
  1164
ca@2177
  1165
    key == #CursorUp ifTrue:[
ca@2177
  1166
        idx := prnt identityIndexOf:item.
ca@2177
  1167
        idx == 1 ifTrue:[idx := max + 1].
ca@2177
  1168
        model selectedItem:(prnt at:idx - 1).
cg@2758
  1169
        ^ self.
ca@2177
  1170
    ].
ca@2177
  1171
ca@2177
  1172
    key == #CursorDown ifTrue:[
ca@2177
  1173
        idx := prnt identityIndexOf:item.
ca@2177
  1174
        idx == max ifTrue:[idx := 0].
ca@2177
  1175
        model selectedItem:(prnt at:idx + 1).
cg@2758
  1176
        ^ self.
ca@2177
  1177
    ].
ca@2177
  1178
!
ca@2177
  1179
ca@2177
  1180
processMappedView:aView
ca@2177
  1181
    |parent anchor|
ca@2177
  1182
ca@2177
  1183
    parent := self listOfItems detectItemRespondsToView:aView.
ca@2177
  1184
    parent isNil ifTrue:[ ^ self ].
ca@2177
  1185
ca@2177
  1186
    NotFoundSignal handle:[:ex|
ca@2177
  1187
        "contained subvies used by spec are not yet created;
ca@2177
  1188
         thus we have to wait until last used subview is build
ca@2177
  1189
        "
ca@2177
  1190
        anchor := nil.
ca@2177
  1191
    ] do:[
ca@2177
  1192
        anchor := parent class buildViewsFrom:(parent widget).
ca@2177
  1193
    ].
ca@2177
  1194
    anchor notNil ifTrue:[
ca@2177
  1195
        parent updateFromChildren:anchor children.
ca@2177
  1196
    ].
ca@2177
  1197
! !
ca@2177
  1198
cg@2744
  1199
!ViewTreeInspectorApplication methodsFor:'initialization & release'!
ca@2177
  1200
ca@2177
  1201
closeDownViews
ca@2455
  1202
    "release the grapped application"
ca@2455
  1203
ca@2177
  1204
    process := nil.
ca@2177
  1205
    super closeDownViews.
ca@2177
  1206
    self doUnpick.
ca@2177
  1207
!
ca@2177
  1208
ca@2177
  1209
initialize
ca@2455
  1210
    "setup my model and channels"
ca@2455
  1211
ca@2177
  1212
    super initialize.
ca@2177
  1213
ca@2177
  1214
    hasSingleSelectionHolder := false asValue.
ca@2177
  1215
    followFocusChannel       := false asValue.
cg@3037
  1216
    inspectorModeIndexHolder := 1 asValue.
cg@3037
  1217
    inspectorModeIndexHolder onChangeSend:#inspectorModeIndexHolderChanged to:self.
ca@2177
  1218
ca@2177
  1219
    model := ViewTreeModel new.
ca@2177
  1220
    model inputEventAction:[:ev| self processEvent:ev ].
ca@2177
  1221
    model mappedViewAction:[:vw| self processMappedView:vw ].
ca@2177
  1222
    model application:self.
ca@2458
  1223
    model addDependent:self.
ca@2458
  1224
ca@2177
  1225
ca@2451
  1226
    showNamesHolder := false asValue.
ca@2451
  1227
    showNamesHolder addDependent:self.
cg@3037
  1228
cg@3037
  1229
    "Modified: / 30-07-2013 / 09:20:08 / cg"
ca@2177
  1230
!
ca@2177
  1231
cg@2770
  1232
postBuildInspectorView:anInspector
cg@2770
  1233
    inspectorView := anInspector.
cg@2770
  1234
!
cg@2770
  1235
ca@2177
  1236
postBuildTree:aTree
ca@2177
  1237
    treeView := aTree scrolledView.
ca@2177
  1238
    treeView hasConstantHeight:true.
ca@2177
  1239
! !
ca@2177
  1240
cg@2744
  1241
!ViewTreeInspectorApplication methodsFor:'menu queries'!
ca@2177
  1242
ca@2177
  1243
hasApplication
ca@2455
  1244
    "returns true if the current selected view has an application"
ca@2455
  1245
ca@2177
  1246
    |view|
ca@2177
  1247
ca@2177
  1248
    view := self selectedView.
ca@2177
  1249
  ^ (view notNil and:[view application notNil])
ca@2177
  1250
!
ca@2177
  1251
ca@2177
  1252
hasController
ca@2177
  1253
    "returns true if the current selected item's view has a controller
ca@2455
  1254
     other than nil or the view itself"
ca@2455
  1255
ca@2177
  1256
    |view controller|
ca@2177
  1257
ca@2177
  1258
    view := self selectedView.
ca@2177
  1259
ca@2177
  1260
    view notNil ifTrue:[
ca@2177
  1261
        controller := view controller.
ca@2177
  1262
      ^ (controller notNil and:[controller ~~ view])
ca@2177
  1263
    ].
ca@2177
  1264
    ^ false
ca@2177
  1265
!
ca@2177
  1266
ca@2177
  1267
hasModel
ca@2455
  1268
    "returns true if the current selected view has a model"
ca@2455
  1269
ca@2177
  1270
    |view|
ca@2177
  1271
ca@2177
  1272
    view := self selectedView.
ca@2177
  1273
  ^ (view notNil and:[view model notNil])
ca@2177
  1274
! !
ca@2177
  1275
cg@2744
  1276
!ViewTreeInspectorApplication methodsFor:'menu specs'!
ca@2177
  1277
ca@2177
  1278
middleButtonMenu
ca@2455
  1279
    "returns the middleButton menu for the single selected item or nil"
ca@2455
  1280
cg@2758
  1281
    ^ [ 
cg@2758
  1282
        model selectedItem notNil 
cg@2758
  1283
            ifTrue:[self class middleButtonMenu]
cg@2758
  1284
            ifFalse:[nil]
ca@2177
  1285
      ]
ca@2177
  1286
!
ca@2177
  1287
ca@2177
  1288
submenuApplications:aMenu
ca@2177
  1289
    |applications menu item list addBlock|
ca@2177
  1290
ca@2177
  1291
    item := aMenu selection nameKey == #single ifTrue:[model selectedItem]
ca@2177
  1292
                                              ifFalse:[model rootItem].
ca@2177
  1293
    item isNil ifTrue:[^ nil].
ca@2177
  1294
ca@2177
  1295
    applications := IdentityDictionary new.
ca@2177
  1296
ca@2177
  1297
    addBlock := [:el| |cls ctr|
ca@2177
  1298
        cls := self resolveApplicationClassFor:el.
ca@2177
  1299
ca@2177
  1300
        cls notNil ifTrue:[
ca@2177
  1301
            ctr := applications at:cls ifAbsent:0.
ca@2177
  1302
            applications at:cls put:(ctr + 1).
ca@2177
  1303
        ].
ca@2177
  1304
    ].
ca@2177
  1305
    item recursiveDo:addBlock.
ca@2177
  1306
    addBlock value:item.
ca@2177
  1307
ca@2177
  1308
    applications isEmpty ifTrue:[^ nil ].
ca@2177
  1309
    list := SortedCollection sortBlock:[:a :b| a title < b title ].
ca@2177
  1310
ca@2177
  1311
    applications keysAndValuesDo:[:cls :ctr|
ca@2177
  1312
       list add:(MenuDesc title:(cls name)
ca@2177
  1313
                          value:(ctr printString)
ca@2177
  1314
                         action:[self doSelectNextOfApplicationClass:cls startingIn:item]
ca@2177
  1315
                 ).
ca@2177
  1316
    ].
ca@2177
  1317
ca@2177
  1318
    menu := MenuDesc buildFromList:list onGC:aMenu.
ca@2177
  1319
    menu do:[:el|
ca@2177
  1320
        el hideMenuOnActivated:false
ca@2177
  1321
    ].
ca@2177
  1322
    ^ menu
ca@2177
  1323
!
ca@2177
  1324
ca@2177
  1325
submenuComponents:aMenu
ca@2177
  1326
    |widgets list total menu item|
ca@2177
  1327
ca@2177
  1328
    item := aMenu selection nameKey == #single ifTrue:[model selectedItem]
ca@2177
  1329
                                              ifFalse:[model rootItem].
ca@2177
  1330
    item isNil ifTrue:[^ nil].
ca@2177
  1331
ca@2177
  1332
    widgets := IdentityDictionary new.
ca@2177
  1333
    total   := 0.
ca@2177
  1334
ca@2177
  1335
    item recursiveDo:[:el| |cls ctr|
ca@2177
  1336
        cls := el widget.
ca@2177
  1337
ca@2177
  1338
        cls notNil ifTrue:[
ca@2177
  1339
            cls := cls class.
ca@2177
  1340
            ctr := widgets at:cls ifAbsent:0.
ca@2177
  1341
            widgets at:cls put:(ctr + 1).
ca@2177
  1342
            total := total + 1.
ca@2177
  1343
        ].
ca@2177
  1344
    ].
ca@2177
  1345
    total == 0 ifTrue:[^ nil].
ca@2177
  1346
    list := SortedCollection sortBlock:[:a :b| a title < b title ].
ca@2177
  1347
ca@2177
  1348
    widgets keysAndValuesDo:[:cls :ctr|
ca@2177
  1349
        list add:(MenuDesc title:(cls name)
ca@2177
  1350
                           value:(ctr printString)
ca@2177
  1351
                          action:[self doSelectNextOfClass:cls startingIn:item]
ca@2177
  1352
                 ).
ca@2177
  1353
    ].
ca@2177
  1354
    list := list asOrderedCollection.
ca@2177
  1355
    list add:(MenuDesc separator).
ca@2177
  1356
    list add:(MenuDesc title:'Total' value:(total printString)).
ca@2177
  1357
    menu := MenuDesc buildFromList:list onGC:aMenu.
ca@2177
  1358
    menu do:[:el|
ca@2177
  1359
        el hideMenuOnActivated:false
ca@2177
  1360
    ].
ca@2177
  1361
    ^ menu
ca@2177
  1362
!
ca@2177
  1363
ca@2177
  1364
submenuGeometry:aMenu
ca@2455
  1365
    "builds and returns the geometry submenu"
ca@2455
  1366
ca@2177
  1367
    |view point inst list x y|
ca@2177
  1368
ca@2177
  1369
    view := self selectedView.
ca@2177
  1370
    view isNil ifTrue:[^ nil].
ca@2177
  1371
ca@2177
  1372
    list := OrderedCollection new.
ca@2177
  1373
ca@2177
  1374
    "/ origin
ca@2177
  1375
    point := view relativeOrigin.
ca@2177
  1376
    point isNil ifTrue:[ point := view origin ].
ca@2177
  1377
ca@2177
  1378
    x := view left.
ca@2177
  1379
    y := view top.
ca@2177
  1380
ca@2177
  1381
    (x == point x and:[y == point y]) ifTrue:[ inst := point ]
ca@2177
  1382
                                     ifFalse:[ inst := '%1 --> (%2@%3)' bindWith:point with:x with:y ].
ca@2177
  1383
ca@2177
  1384
    list add:(MenuDesc title:'origin' value:inst).
ca@2177
  1385
ca@2177
  1386
    "/ corner
ca@2177
  1387
    point := view relativeCorner.
ca@2177
  1388
    point isNil ifTrue:[ point := view corner ].
ca@2177
  1389
ca@2177
  1390
    x := view right.
ca@2177
  1391
    y := view bottom.
ca@2177
  1392
ca@2177
  1393
    (x == point x and:[y == point y]) ifTrue:[ inst := point ]
ca@2177
  1394
                                     ifFalse:[ inst := '%1 --> (%2@%3)' bindWith:point with:x with:y ].
ca@2177
  1395
ca@2177
  1396
    list add:(MenuDesc title:'corner' value:inst).
ca@2177
  1397
ca@2177
  1398
    "/ extent
ca@2177
  1399
    (point := view relativeExtent) isNil ifTrue:[point := view extent].
ca@2177
  1400
    list add:(MenuDesc title:'extent' value:point).
ca@2177
  1401
ca@2177
  1402
    "/ preferred extent
ca@2177
  1403
    list add:(MenuDesc title:'pref. extent' value:(view preferredExtent)).
ca@2177
  1404
    list add:(MenuDesc separator).
ca@2177
  1405
ca@2177
  1406
    "/ view insets
ca@2177
  1407
    inst := 'l:%1  r:%2  t:%3  b:%4' bindWith:(view leftInset)
ca@2177
  1408
                                         with:(view rightInset)
ca@2177
  1409
                                         with:(view topInset)
ca@2177
  1410
                                         with:(view bottomInset).
ca@2177
  1411
ca@2177
  1412
    list add:(MenuDesc title:'insets'      value:inst).
ca@2177
  1413
    list add:(MenuDesc title:'borderWidth' value:(view borderWidth)).
ca@2177
  1414
    list add:(MenuDesc title:'level'       value:(view level)).
ca@2177
  1415
    list add:(MenuDesc separator).
ca@2177
  1416
ca@2177
  1417
    (inst := view layout) notNil ifTrue:[ inst := inst displayString ].
ca@2177
  1418
    list add:(MenuDesc title:'layout' value:inst).
ca@2177
  1419
ca@2177
  1420
    (inst := view transformation) notNil ifTrue:[ inst := inst displayString ].
ca@2177
  1421
    list add:(MenuDesc title:'transformation' value:inst).
ca@2177
  1422
ca@2177
  1423
  ^ MenuDesc buildFromList:list onGC:aMenu
ca@2177
  1424
!
ca@2177
  1425
ca@2177
  1426
submenuInspector:aMenu
ca@2455
  1427
    "builds and returns the inspector submenu"
ca@2455
  1428
cg@3040
  1429
    |view list n names label value indices|
ca@2177
  1430
ca@2177
  1431
    view := self selectedView.
ca@2177
  1432
    view isNil ifTrue:[^ nil].
ca@2177
  1433
ca@2177
  1434
    n := view class instSize.
ca@2177
  1435
    n > 0 ifFalse:[^ nil ].
ca@2177
  1436
ca@2177
  1437
    list  := OrderedCollection new:n.
ca@2177
  1438
    names := view class allInstVarNames.
cg@3040
  1439
    indices := (1 to:names size) asArray.
cg@3040
  1440
    names sortWith:indices.
ca@2177
  1441
ca@2177
  1442
    1 to:n do:[:i| |action|
ca@2177
  1443
        label := (names at:i) printString.
cg@3040
  1444
        value := view instVarAt:(indices at:i).
ca@2177
  1445
        value isNil ifTrue:[
ca@2177
  1446
            value  := '------'.
ca@2177
  1447
            action := nil.
ca@2177
  1448
        ] ifFalse:[
ca@2177
  1449
            value  := value displayString contractAtEndTo:40.
ca@2177
  1450
            action := [(view instVarAt:i) inspect].
ca@2177
  1451
        ].
ca@2177
  1452
        list add:(MenuDesc title:label value:value action:action).
ca@2177
  1453
    ].
ca@2177
  1454
ca@2177
  1455
    ^ MenuDesc buildFromList:list onGC:aMenu
cg@3040
  1456
cg@3040
  1457
    "Modified: / 31-07-2013 / 13:12:52 / cg"
ca@2177
  1458
!
ca@2177
  1459
ca@2177
  1460
submenuInterface:aMenu
ca@2455
  1461
    "builds and returns the interface submenu"
ca@2455
  1462
ca@2177
  1463
    |view label inst value list|
ca@2177
  1464
ca@2177
  1465
    view := self selectedView.
ca@2177
  1466
    view isNil ifTrue:[^ nil].
ca@2177
  1467
ca@2177
  1468
    list := OrderedCollection new.
ca@2177
  1469
ca@2177
  1470
    inst  := view controller.
ca@2177
  1471
    value := nil.
ca@2177
  1472
ca@2177
  1473
    inst isNil ifTrue:[
ca@2177
  1474
        label := nil
ca@2177
  1475
    ] ifFalse:[
cg@2758
  1476
        inst == view ifTrue:[ 
cg@2758
  1477
            label := '== view itself' 
cg@2758
  1478
        ] ifFalse:[ 
cg@2758
  1479
            label := inst displayString.
cg@2758
  1480
            value := [view controller inspect].
cg@2758
  1481
        ].
ca@2177
  1482
    ].
ca@2177
  1483
    list add:(MenuDesc title:'controller' value:label action:value).
ca@2177
  1484
ca@2177
  1485
    inst := view delegate.
ca@2177
  1486
    inst notNil ifTrue:[
ca@2177
  1487
        list add:(MenuDesc title:'delegate' value:(inst displayString) action:[ view delegate inspect ]).
ca@2177
  1488
    ].
ca@2177
  1489
ca@2177
  1490
    inst := view application.
ca@2177
  1491
cg@2758
  1492
    inst notNil ifTrue:[ 
cg@2758
  1493
        |topAppl|
cg@2758
  1494
ca@2177
  1495
        list add:(MenuDesc title:'application' value:inst action:[ view application inspect ]).
ca@2177
  1496
ca@2177
  1497
        topAppl := inst topApplication.
ca@2177
  1498
ca@2177
  1499
        (topAppl notNil and:[topAppl ~~ inst]) ifTrue:[
ca@2177
  1500
            list add:(MenuDesc title:'topApplication' value:topAppl action:[ inst topApplication inspect ]).
ca@2177
  1501
        ].
ca@2177
  1502
    ].
ca@2177
  1503
    list add:(MenuDesc separator).
ca@2177
  1504
cg@2888
  1505
    (view respondsTo:#'model') ifTrue:[
cg@2779
  1506
        inst := view model.
ca@2177
  1507
cg@2888
  1508
        inst isNil 
cg@2888
  1509
            ifTrue:[ label := value := nil ]
cg@2888
  1510
            ifFalse:[ label := inst displayString.
cg@2888
  1511
                      label := label,(self aspectLabelFor:inst inApplicationOf:view).  
cg@2888
  1512
                      value := [ view model inspect ].
cg@2888
  1513
                    ].
ca@2177
  1514
ca@2177
  1515
        list add:(MenuDesc title:'model' value:label action:value).
ca@2177
  1516
ca@2177
  1517
        (inst notNil and:[view respondsTo:#modelInterface]) ifTrue:[
ca@2177
  1518
            view modelInterface keysAndValuesDo:[:key : val|
ca@2177
  1519
                val isNil ifTrue:[ label := nil ]
ca@2177
  1520
                         ifFalse:[ label := val displayString ].
ca@2177
  1521
ca@2177
  1522
                list add:(MenuDesc title:('      - ', key) value:label ).
ca@2177
  1523
            ]
ca@2177
  1524
        ].
ca@2177
  1525
    ].
ca@2177
  1526
ca@2177
  1527
    (view respondsTo:#enableChannel) ifTrue:[
ca@2177
  1528
        inst := view enableChannel.
ca@2177
  1529
ca@2177
  1530
        inst isNil ifTrue:[ label := value := nil ]
ca@2177
  1531
                  ifFalse:[ label := inst displayString.
cg@2888
  1532
                            label := label,(self aspectLabelFor:inst inApplicationOf:view).  
ca@2177
  1533
                            value := [ view enableChannel inspect ].
ca@2177
  1534
                          ].
ca@2177
  1535
ca@2177
  1536
        list add:(MenuDesc title:'enableChannel' value:label action:value).
ca@2177
  1537
    ].
ca@2177
  1538
cg@2888
  1539
    #( #action #pressAction #releaseAction ) do:[:actionSelector |
cg@2779
  1540
        (view respondsTo:actionSelector) ifTrue:[
cg@2779
  1541
            inst := view perform:actionSelector.
cg@2779
  1542
cg@2779
  1543
            inst isNil 
cg@2779
  1544
                ifTrue:[ label := value := nil ]
cg@2779
  1545
                ifFalse:[ label := inst displayString.
cg@2779
  1546
                            value := [ (view perform:actionSelector) inspect ].
cg@2779
  1547
                        ].
cg@2779
  1548
cg@3040
  1549
            list add:(MenuDesc title:actionSelector"'action'" value:label action:value).
cg@2779
  1550
        ].
cg@2779
  1551
    ].
cg@2779
  1552
ca@2177
  1553
    list last isSeparator ifFalse:[ list add:(MenuDesc separator) ].
ca@2177
  1554
ca@2177
  1555
    (view respondsTo:#listHolder) ifTrue:[
ca@2177
  1556
        inst := view listHolder.
ca@2177
  1557
ca@2177
  1558
        inst isNil ifTrue:[ label := value := nil ]
ca@2177
  1559
                  ifFalse:[ label := inst class printString.
cg@2888
  1560
                            label := label,(self aspectLabelFor:inst inApplicationOf:view).  
ca@2177
  1561
                            value := [ view listHolder inspect ].
ca@2177
  1562
                          ].
ca@2177
  1563
        list add:(MenuDesc title:'listHolder' value:label action:value).
ca@2177
  1564
    ].
ca@2177
  1565
ca@2177
  1566
    (view respondsTo:#list) ifTrue:[
ca@2177
  1567
        inst := view list.
ca@2177
  1568
ca@2177
  1569
        inst isNil ifTrue:[ label := value := nil ]
ca@2177
  1570
                  ifFalse:[ label := '%1 [%2]' bindWith:(inst class printString) with:(inst size).
cg@2888
  1571
                            label := label,(self aspectLabelFor:inst inApplicationOf:view).  
ca@2177
  1572
                            value := [ view list inspect ].
ca@2177
  1573
                          ].
ca@2177
  1574
ca@2177
  1575
        list add:(MenuDesc title:'list' value:label action:value).
ca@2177
  1576
    ].
ca@2177
  1577
ca@2177
  1578
    list last isSeparator ifTrue:[ list removeLast ].
cg@2888
  1579
    ^ MenuDesc buildFromList:list onGC:aMenu
cg@2888
  1580
cg@3040
  1581
    "Modified: / 31-07-2013 / 13:09:55 / cg"
ca@2177
  1582
!
ca@2177
  1583
ca@2177
  1584
submenuVisibility:aMenu
ca@2455
  1585
    "builds and returns the geometry submenu"
ca@2455
  1586
ca@2177
  1587
    |view list value|
ca@2177
  1588
ca@2177
  1589
    view := self selectedView.
ca@2177
  1590
    view isNil ifTrue:[^ nil].
ca@2177
  1591
ca@2177
  1592
    list := OrderedCollection new.
ca@2177
  1593
ca@2177
  1594
    list add:(MenuDesc title:'device'     value:(view device printString)).
ca@2177
  1595
    list add:(MenuDesc title:'drawableId' value:(view id)).
ca@2177
  1596
    list add:(MenuDesc title:'gcId'       value:(view gcId)).
ca@2177
  1597
ca@2177
  1598
    list add:(MenuDesc separator).
ca@2177
  1599
ca@2177
  1600
    list add:(MenuDesc title:'shown'    value:(view shown)).
ca@2177
  1601
    list add:(MenuDesc title:'realized' value:(view realized)).
ca@2177
  1602
ca@2177
  1603
    list add:(MenuDesc separator).
ca@2177
  1604
ca@2177
  1605
    list add:(MenuDesc title:'hiddenOnRealize' value:(view isHiddenOnRealize)).
ca@2177
  1606
ca@2177
  1607
    (value := view visibilityChannel) isNil ifTrue:[
ca@2177
  1608
        list add:(MenuDesc title:'visibilityChannel' value:'------').
ca@2177
  1609
    ] ifFalse:[
ca@2177
  1610
        list add:(MenuDesc title:'visibilityChannel'
ca@2177
  1611
                           value:(value displayString)
ca@2177
  1612
                          action:[view visibilityChannel inspect]).
ca@2177
  1613
    ].
ca@2177
  1614
cg@2758
  1615
    ^ MenuDesc buildFromList:list onGC:aMenu
ca@2177
  1616
! !
ca@2177
  1617
cg@2744
  1618
!ViewTreeInspectorApplication methodsFor:'private'!
ca@2177
  1619
cg@2888
  1620
aspectLabelFor:aModel inApplicationOf:aView
cg@2888
  1621
    |app|
cg@2888
  1622
cg@2888
  1623
    aModel isNil ifTrue:[^ ''].
cg@2888
  1624
    aView isNil ifTrue:[^ ''].
cg@2888
  1625
    (app := aView application) isNil ifTrue:[^ ''].
cg@2888
  1626
    app builder bindings keysAndValuesDo:[:aspect :value |
cg@2888
  1627
        value == aModel ifTrue:[^ ' [aspect: ',aspect,']'].
cg@2888
  1628
    ].
cg@2888
  1629
    app class allInstVarNames do:[:nm | 
cg@2888
  1630
        (app instVarNamed:nm) == aModel ifTrue:[^ ' [instvar: ',nm,']']
cg@2888
  1631
    ].
cg@2888
  1632
cg@2888
  1633
    ^ ''
cg@2888
  1634
cg@2888
  1635
    "Created: / 27-04-2012 / 14:22:09 / cg"
cg@2888
  1636
!
cg@2888
  1637
ca@2177
  1638
selectFocusView
cg@2762
  1639
    |rootView focusView|
ca@2177
  1640
ca@2177
  1641
    rootView := model rootView.
ca@2177
  1642
ca@2177
  1643
    (rootView notNil and:[rootView shown]) ifTrue:[
ca@2177
  1644
        focusView := rootView windowGroup focusView.
ca@2177
  1645
    ].
ca@2177
  1646
    focusView isNil ifTrue:[^ self ].
ca@2177
  1647
cg@2762
  1648
    self selectView:focusView
cg@2762
  1649
!
cg@2762
  1650
cg@2762
  1651
selectView:aView
cg@2762
  1652
    |currentItem viewItem|
cg@2762
  1653
cg@2762
  1654
    currentItem := model selectedItem.
cg@2762
  1655
cg@2762
  1656
    (currentItem notNil and:[currentItem widget == aView]) ifTrue:[
ca@2177
  1657
        ^ self
ca@2177
  1658
    ].
cg@2762
  1659
    viewItem := model listOfItems recursiveDetect:[:el| el widget == aView ].
cg@2762
  1660
cg@2762
  1661
    viewItem notNil ifTrue:[
cg@2762
  1662
        model selectItem:viewItem.
ca@2177
  1663
    ].        
ca@2177
  1664
!
ca@2177
  1665
ca@2177
  1666
setRootItem:aRootItemOrNil
ca@2177
  1667
    |theProcess|
ca@2177
  1668
ca@2177
  1669
    aRootItemOrNil isNil ifTrue:[
ca@2177
  1670
        process := nil.
ca@2177
  1671
    ] ifFalse:[
ca@2177
  1672
        "/ expand tree to level 3
ca@2177
  1673
        aRootItemOrNil do:[:aRootChild|
ca@2177
  1674
            aRootChild do:[:aSubChild| aSubChild expand ].
ca@2177
  1675
            aRootChild expand.
ca@2177
  1676
        ].
ca@2177
  1677
        aRootItemOrNil expand.
ca@2177
  1678
ca@2177
  1679
        process isNil ifTrue:[
ca@2177
  1680
            theProcess := process :=
cg@3034
  1681
                Process 
cg@3034
  1682
                    for:[   
cg@3034
  1683
                        |update testModeChannel|
cg@3034
  1684
cg@3034
  1685
                        update := false.
cg@3034
  1686
                        testModeChannel := model testModeChannel.
cg@3034
  1687
cg@3034
  1688
                        [process == theProcess] whileTrue:[
cg@3034
  1689
                            Delay waitForSeconds:0.5.
cg@3034
  1690
cg@3034
  1691
                            (treeView notNil and:[process == theProcess and:[treeView shown]]) ifTrue:[
cg@3034
  1692
                                (testModeChannel value == true and:[followFocusChannel value == true]) ifTrue:[
cg@3034
  1693
                                    self selectFocusView.
ca@2177
  1694
                                ].
cg@3034
  1695
                                update ifTrue:[
cg@3034
  1696
                                    self updateShownStatus.
cg@3034
  1697
                                ].
cg@3034
  1698
                                update := update not.
cg@3034
  1699
                            ].
cg@3034
  1700
                        ].
cg@3034
  1701
                    ] 
cg@3034
  1702
                    priority:(Processor userSchedulingPriority).
cg@3034
  1703
            theProcess name:'ViewTreeInspector - Focus Follower'.
ca@2177
  1704
            theProcess resume.
ca@2177
  1705
        ].
ca@2177
  1706
    ].
ca@2177
  1707
    model rootItem:aRootItemOrNil.
cg@3034
  1708
cg@3034
  1709
    "Modified: / 25-07-2013 / 12:03:44 / cg"
ca@2177
  1710
!
ca@2177
  1711
ca@2177
  1712
updateShownStatus
ca@2177
  1713
    |rootItem min max visState listIdx visY0 visY1 height damage|
ca@2177
  1714
ca@2177
  1715
    rootItem := model rootItem.
ca@2177
  1716
    (rootItem notNil and:[rootItem widget shown]) ifFalse:[^ self].
ca@2177
  1717
ca@2177
  1718
    max := 0.
ca@2177
  1719
    min := 9999999.
ca@2177
  1720
ca@2177
  1721
    rootItem recursiveEachVisibleItemDo:[:anItem|
ca@2177
  1722
        visState := (anItem widget shown).
ca@2177
  1723
ca@2177
  1724
        visState ~~ anItem isDrawnShown ifTrue:[
ca@2177
  1725
            anItem isDrawnShown:visState.
ca@2177
  1726
            listIdx := treeView identityIndexOf:anItem.
ca@2177
  1727
ca@2177
  1728
            listIdx > 0 ifTrue:[    
ca@2177
  1729
                max := max max:listIdx.
ca@2177
  1730
                min := min min:listIdx.
ca@2177
  1731
            ].
ca@2177
  1732
        ].
ca@2177
  1733
    ].
ca@2177
  1734
    max < min ifTrue:[^ self].
ca@2177
  1735
    max := max + 1.
ca@2177
  1736
ca@2177
  1737
    visY0  := (treeView yVisibleOfLine:min) max:0.
ca@2177
  1738
    visY1  := (treeView yVisibleOfLine:max) min:(treeView height).
ca@2177
  1739
    height := visY1 - visY0.
ca@2177
  1740
    
ca@2177
  1741
    height > 2 ifTrue:[
ca@2177
  1742
        treeView shown ifTrue:[
ca@2177
  1743
            damage := Rectangle left:0 top:visY0 width:(treeView width) height:height.
ca@2177
  1744
            treeView invalidateDeviceRectangle:damage repairNow:false.
ca@2177
  1745
        ].
ca@2177
  1746
    ].
ca@2177
  1747
! !
ca@2177
  1748
cg@2744
  1749
!ViewTreeInspectorApplication methodsFor:'selection'!
ca@2177
  1750
ca@2177
  1751
selectedView
ca@2455
  1752
    "answer the selected view or nil"
ca@2455
  1753
ca@2177
  1754
    |item|
ca@2177
  1755
ca@2177
  1756
    item := model selectedItem.
ca@2177
  1757
    item notNil ifTrue:[ ^ item widget ].
ca@2177
  1758
  ^ nil
ca@2177
  1759
! !
ca@2177
  1760
cg@2744
  1761
!ViewTreeInspectorApplication methodsFor:'testing'!
ca@2177
  1762
ca@2177
  1763
resolveApplicationClassFor:aTreeItem
ca@2177
  1764
    aTreeItem isApplicationClass ifTrue:[
ca@2177
  1765
       ^ aTreeItem applicationClass
ca@2177
  1766
    ].
ca@2177
  1767
    ^ nil
ca@2177
  1768
!
ca@2177
  1769
ca@2177
  1770
selectedComponentHasChildren
ca@2177
  1771
    |item|
ca@2177
  1772
ca@2177
  1773
    item := model selectedItem.
ca@2177
  1774
    ^ (item notNil and:[item hasChildren])
ca@2177
  1775
! !
ca@2177
  1776
cg@2744
  1777
!ViewTreeInspectorApplication methodsFor:'user operations'!
ca@2177
  1778
ca@2177
  1779
doBrowse:what
ca@2177
  1780
    "open browser on:
ca@2177
  1781
        #view           browse class
ca@2177
  1782
        #model          browse model class
ca@2177
  1783
        #application    browse application class
ca@2177
  1784
        #controller     browse controller class
ca@2177
  1785
    "
ca@2177
  1786
    |view inst|
ca@2177
  1787
ca@2177
  1788
    view := self selectedView.
ca@2177
  1789
    view isNil ifTrue:[^ self].
ca@2177
  1790
ca@2177
  1791
             what == #view        ifTrue:[ inst := view ]
ca@2177
  1792
    ifFalse:[what == #model       ifTrue:[ inst := view model ]
ca@2177
  1793
    ifFalse:[what == #application ifTrue:[ inst := view application ]
ca@2177
  1794
    ifFalse:[what == #controller  ifTrue:[ inst := view controller ]
ca@2177
  1795
    ifFalse:[
ca@2177
  1796
        ^ self
ca@2177
  1797
    ]]]].
ca@2177
  1798
ca@2177
  1799
    inst notNil ifTrue:[
ca@2177
  1800
        inst class browserClass openInClass:(inst class) selector:nil
ca@2177
  1801
    ].
ca@2177
  1802
!
ca@2177
  1803
ca@2177
  1804
doDestroy
ca@2455
  1805
    "destroy the current selected view"
ca@2455
  1806
ca@2177
  1807
    |item parent|
ca@2177
  1808
ca@2177
  1809
    item := model selectedItem.
ca@2177
  1810
    item isNil ifTrue:[ ^ self].
ca@2177
  1811
ca@2177
  1812
    parent := item parent.
ca@2177
  1813
ca@2177
  1814
    parent isNil ifTrue:[
ca@2177
  1815
        "/ the root
ca@2177
  1816
        model withSelectionHiddenDo:[item deleteAll].
ca@2177
  1817
      ^ self
ca@2177
  1818
    ].
ca@2177
  1819
ca@2177
  1820
    model withSelectionHiddenDo:[
ca@2177
  1821
        |idx nsel|
ca@2177
  1822
ca@2177
  1823
        idx := parent identityIndexOf:item.
ca@2177
  1824
ca@2177
  1825
        idx == parent size ifTrue:[
ca@2177
  1826
            nsel := parent at:(idx - 1) ifAbsent:parent
ca@2177
  1827
        ] ifFalse:[
ca@2177
  1828
            nsel := parent at:(idx + 1)
ca@2177
  1829
        ].
ca@2177
  1830
        model setValue:nil.
ca@2177
  1831
        item delete.
ca@2177
  1832
ca@2177
  1833
        parent isLayoutContainer ifTrue:[
ca@2177
  1834
            parent widget sizeChanged:nil
ca@2177
  1835
        ].
ca@2177
  1836
        model value:nsel.
ca@2177
  1837
    ].
ca@2177
  1838
!
ca@2177
  1839
ca@2177
  1840
doFlash
ca@2455
  1841
    "flash the selected view"
ca@2455
  1842
ca@2177
  1843
    |view|
ca@2177
  1844
ca@2177
  1845
    view := self selectedView.
ca@2177
  1846
    view isNil ifTrue:[ ^ self].
ca@2177
  1847
ca@2177
  1848
    view shown ifTrue:[
ca@2177
  1849
        model withSelectionHiddenDo:[
ca@2177
  1850
            view perform:#flash ifNotUnderstood:nil.
ca@2177
  1851
        ].
ca@2177
  1852
    ].
ca@2177
  1853
!
ca@2177
  1854
ca@2177
  1855
doInspect:what
ca@2177
  1856
    "open inspector on:
ca@2177
  1857
        #view           inspect class
ca@2177
  1858
        #group          inspect windowGroup
ca@2177
  1859
        #model          inspect model
ca@2177
  1860
        #application    inspect application
ca@2177
  1861
        #controller     inspect controller
cg@3034
  1862
        #process        inspect application's process
ca@2177
  1863
    "
ca@2177
  1864
    |inst|
ca@2177
  1865
ca@2177
  1866
    inst := self selectedView.
ca@2177
  1867
    inst isNil ifTrue:[^ self].
ca@2177
  1868
ca@2177
  1869
             what == #group       ifTrue:[ inst := inst windowGroup ]
ca@2177
  1870
    ifFalse:[what == #model       ifTrue:[ inst := inst model ]
ca@2177
  1871
    ifFalse:[what == #application ifTrue:[ inst := inst application ]
cg@3034
  1872
    ifFalse:[what == #controller  ifTrue:[ inst := inst controller  ]
cg@3034
  1873
    ifFalse:[what == #process     ifTrue:[ inst := inst windowGroup process  ]]]]].
ca@2177
  1874
ca@2177
  1875
    inst notNil ifTrue:[ inst inspect ].
ca@2177
  1876
!
ca@2177
  1877
cg@3034
  1878
doOpenProcessMonitor
cg@3034
  1879
    (ProcessMonitorV2 ? ProcessMonitor) open
cg@3034
  1880
cg@3034
  1881
    "Created: / 25-07-2013 / 12:34:23 / cg"
cg@3034
  1882
!
cg@3034
  1883
cg@2762
  1884
doPickView
ca@2455
  1885
    "pick a window's topView"
ca@2455
  1886
cg@2762
  1887
    |screen clickedView topWindow cursor|
ca@2177
  1888
ca@2177
  1889
    self doUnpick.
ca@2177
  1890
cg@2759
  1891
    cursor := Cursor fromImage:(self class crossHairIcon).
cg@2759
  1892
cg@2759
  1893
    screen := Screen current.
cg@2762
  1894
    clickedView := screen viewFromPoint:(screen pointFromUserShowing:cursor).
cg@2762
  1895
    clickedView isNil ifTrue:[^ self].
cg@2762
  1896
cg@2762
  1897
    topWindow := clickedView topView.
cg@2762
  1898
cg@2762
  1899
    (    topWindow == Screen current rootView
cg@2762
  1900
     or:[topWindow == self window topView]
ca@2177
  1901
    ) ifTrue:[
ca@2177
  1902
        ^ self
ca@2177
  1903
    ].
cg@2978
  1904
cg@3014
  1905
    self showWindow:clickedView
ca@2177
  1906
!
ca@2177
  1907
cg@2978
  1908
doRedraw
cg@2978
  1909
    "redraw the app"
cg@2978
  1910
cg@2978
  1911
    model rootView withAllSubViewsDo:[:v | v redraw; invalidate].
cg@2978
  1912
!
cg@2978
  1913
ca@2177
  1914
doSelectNextOfApplicationClass:aClass startingIn:anItem
ca@2177
  1915
    |startItem firstFound searchNext|
ca@2177
  1916
ca@2177
  1917
    startItem  := model last.
ca@2177
  1918
    searchNext := startItem notNil.        
ca@2177
  1919
    firstFound := nil.
ca@2177
  1920
ca@2177
  1921
    anItem recursiveDo:[:el|
ca@2177
  1922
        el == startItem ifTrue:[
ca@2177
  1923
            searchNext := false
ca@2177
  1924
        ] ifFalse:[
ca@2177
  1925
            (self resolveApplicationClassFor:el) == aClass ifTrue:[
ca@2177
  1926
                searchNext ifFalse:[^ model selectItem:el].
ca@2177
  1927
ca@2177
  1928
                firstFound isNil ifTrue:[
ca@2177
  1929
                    firstFound := el
ca@2177
  1930
                ]
ca@2177
  1931
            ]
ca@2177
  1932
        ]
ca@2177
  1933
    ].
ca@2177
  1934
    firstFound notNil ifTrue:[
ca@2177
  1935
        self window beep.
ca@2177
  1936
        model selectItem:firstFound
ca@2177
  1937
    ].
ca@2177
  1938
!
ca@2177
  1939
ca@2177
  1940
doSelectNextOfClass:aClass startingIn:anItem
ca@2177
  1941
    |startItem firstFound searchNext|
ca@2177
  1942
ca@2177
  1943
    startItem  := model last.
ca@2177
  1944
    searchNext := startItem notNil.        
ca@2177
  1945
    firstFound := nil.
ca@2177
  1946
ca@2177
  1947
    anItem recursiveDo:[:el|
ca@2177
  1948
        el == startItem ifTrue:[
ca@2177
  1949
            searchNext := false
ca@2177
  1950
        ] ifFalse:[
ca@2177
  1951
            el widget class == aClass ifTrue:[
ca@2177
  1952
                searchNext ifFalse:[^ model selectItem:el].
ca@2177
  1953
ca@2177
  1954
                firstFound isNil ifTrue:[
ca@2177
  1955
                    firstFound := el
ca@2177
  1956
                ]
ca@2177
  1957
            ]
ca@2177
  1958
        ]
ca@2177
  1959
    ].
ca@2177
  1960
    firstFound notNil ifTrue:[
ca@2177
  1961
        self window beep.
ca@2177
  1962
        model selectItem:firstFound
ca@2177
  1963
    ].
ca@2177
  1964
!
ca@2177
  1965
cg@2978
  1966
doUncatchEvents
cg@2978
  1967
    model catchEvents:false.
cg@2978
  1968
    self doRedraw
cg@2978
  1969
!
cg@2978
  1970
ca@2177
  1971
doUnpick
ca@2455
  1972
    "release current picked window and contained subwindows"
ca@2455
  1973
ca@2177
  1974
    self setRootItem:nil.
cg@2744
  1975
!
cg@2744
  1976
cg@2744
  1977
openDocumentation
cg@2744
  1978
    HTMLDocumentView openFullOnDocumentationFile:'tools/misc/TOP.html#VIEWTREEINSPECTOR'
cg@3014
  1979
!
cg@3014
  1980
cg@3014
  1981
showWindow:aView
cg@3014
  1982
    "show a particular window's topView hierarchy,
cg@3014
  1983
     select the given view"
cg@3014
  1984
cg@3014
  1985
    | topWindow |
cg@3014
  1986
cg@3014
  1987
    topWindow := aView topView.
cg@3014
  1988
cg@3014
  1989
    model catchEvents:true.
cg@3014
  1990
    self setRootItem:(ViewTreeItem buildViewsFrom:topWindow).
cg@3014
  1991
    self selectView:aView.
ca@2177
  1992
! !
ca@2177
  1993
cg@2744
  1994
!ViewTreeInspectorApplication::MenuDesc class methodsFor:'building'!
ca@2177
  1995
ca@2177
  1996
buildFromList:aList onGC:aMenu
ca@2177
  1997
    |tabSpec menu w menuPanel|
ca@2177
  1998
ca@2177
  1999
    w := 0.
ca@2177
  2000
    aList do:[:el| w := w max:(el widthOn:aMenu) ].
ca@2177
  2001
ca@2177
  2002
    tabSpec := TabulatorSpecification new.
ca@2177
  2003
    tabSpec unit:#pixel.
ca@2177
  2004
    tabSpec positions:#(0     1.5 ).
ca@2177
  2005
    tabSpec align:#(#left #left).
ca@2177
  2006
ca@2177
  2007
    w := w + 15.
ca@2177
  2008
    tabSpec positions:(Array with:0 with:w).
ca@2177
  2009
ca@2177
  2010
    menu := Menu new.
ca@2177
  2011
ca@2177
  2012
    aList do:[:el|
ca@2177
  2013
        menu addItem:(el asMenuItemWithTabulatorSpecification:tabSpec).
ca@2177
  2014
    ].
ca@2177
  2015
    menuPanel := MenuPanel menu:menu.
ca@2177
  2016
    ^ menuPanel
ca@2177
  2017
! !
ca@2177
  2018
cg@2744
  2019
!ViewTreeInspectorApplication::MenuDesc class methodsFor:'instance creation'!
ca@2177
  2020
ca@2177
  2021
separator
ca@2177
  2022
    ^ self new
ca@2177
  2023
!
ca@2177
  2024
ca@2177
  2025
title:aTitle value:aValue
ca@2177
  2026
    ^ self title:aTitle value:aValue action:nil
ca@2177
  2027
!
ca@2177
  2028
ca@2177
  2029
title:aTitle value:aValue action:anAction
ca@2177
  2030
    ^ self new title:aTitle value:aValue action:anAction
ca@2177
  2031
! !
ca@2177
  2032
cg@2744
  2033
!ViewTreeInspectorApplication::MenuDesc methodsFor:'accessing'!
ca@2177
  2034
ca@2177
  2035
title
ca@2177
  2036
    ^ title
ca@2177
  2037
! !
ca@2177
  2038
cg@2744
  2039
!ViewTreeInspectorApplication::MenuDesc methodsFor:'building'!
ca@2177
  2040
ca@2177
  2041
asMenuItemWithTabulatorSpecification:aTabSpec
ca@2177
  2042
    |array|
ca@2177
  2043
ca@2177
  2044
    title isNil ifTrue:[ ^ MenuItem label:value ].     "/ separator
ca@2177
  2045
ca@2177
  2046
    array := Array with:(title, ':') with:'------'.
ca@2177
  2047
ca@2177
  2048
    value notNil ifTrue:[
ca@2177
  2049
        array at:2 put:(value printString, ' ')
ca@2177
  2050
    ].
ca@2177
  2051
cg@2758
  2052
   ^ MenuItem 
cg@2758
  2053
        label:(MultiColListEntry fromStrings:array tabulatorSpecification:aTabSpec)
cg@2758
  2054
        value:action
ca@2177
  2055
! !
ca@2177
  2056
cg@2744
  2057
!ViewTreeInspectorApplication::MenuDesc methodsFor:'instance creation'!
ca@2177
  2058
ca@2177
  2059
title:aTitle value:aValue action:anAction
ca@2177
  2060
    "test for separator
ca@2177
  2061
    "
ca@2177
  2062
    title  := aTitle withoutSeparators.
ca@2177
  2063
    action := anAction.
ca@2177
  2064
ca@2177
  2065
    aValue notNil ifTrue:[
ca@2177
  2066
        value := aValue printString.
ca@2177
  2067
ca@2177
  2068
        value size > 70 ifTrue:[
ca@2177
  2069
            value := value copyFrom:1 to:70.
ca@2177
  2070
            value := value, '...'
ca@2177
  2071
        ]
ca@2177
  2072
    ].
ca@2177
  2073
! !
ca@2177
  2074
cg@2744
  2075
!ViewTreeInspectorApplication::MenuDesc methodsFor:'queries'!
ca@2177
  2076
ca@2177
  2077
isSeparator
ca@2177
  2078
    ^ title isNil
ca@2177
  2079
!
ca@2177
  2080
ca@2177
  2081
widthOn:aGC
ca@2177
  2082
    title isNil ifTrue:[^ 5].  "/ separator
cg@2758
  2083
    ^ title widthOn:aGC
ca@2177
  2084
! !
ca@2177
  2085
cg@2744
  2086
!ViewTreeInspectorApplication::ViewTreeItem class methodsFor:'building'!
cg@2744
  2087
cg@2744
  2088
buildViewsFrom:aView
cg@2744
  2089
    "build the items starting from a source view;
cg@2744
  2090
     returns the anhor.
cg@2744
  2091
    "
cg@2744
  2092
    |item subViews subItems|
cg@2744
  2093
cg@2744
  2094
    aView isNil ifTrue:[^ nil].
cg@2744
  2095
cg@2744
  2096
    item     := self forView:aView.
cg@2744
  2097
    subViews := aView subViews.
cg@2744
  2098
cg@2744
  2099
    subViews notEmptyOrNil ifTrue:[
cg@2744
  2100
        subItems := OrderedCollection new.
cg@2744
  2101
        subViews do:[:aSubView|
cg@2744
  2102
            subItems add:(self buildViewsFrom:aSubView).
cg@2744
  2103
        ].
cg@2744
  2104
        item children:subItems.
cg@2744
  2105
    ].
cg@2744
  2106
    ^ item
cg@2744
  2107
! !
cg@2744
  2108
cg@2744
  2109
!ViewTreeInspectorApplication::ViewTreeItem class methodsFor:'documentation'!
cg@2744
  2110
cg@2744
  2111
documentation
cg@2744
  2112
"
cg@2744
  2113
    ViewTreeItems represants a pickable object within a ViewTreeModel.
cg@2744
  2114
    The class is used to build up the hierarchical tree.
cg@2744
  2115
cg@2744
  2116
    [Instance variables:]
cg@2744
  2117
        widget        <View>            the widget represented by the item
cg@2744
  2118
        spec          <UISpecification> the UISpecification or nil
cg@2744
  2119
cg@2744
  2120
    [Class variables:]
cg@2744
  2121
        HandleExtent  <Point>           keeps the extent of a handle
cg@2744
  2122
cg@2744
  2123
cg@2744
  2124
    [author:]
cg@2744
  2125
        Claus Atzkern
cg@2744
  2126
cg@2744
  2127
    [see also:]
cg@2744
  2128
        HierarchicalItem
cg@2744
  2129
        ViewTreeModel
cg@2744
  2130
"
cg@2744
  2131
!
ca@2177
  2132
ca@2177
  2133
version
ca@2177
  2134
    ^ '$Header$'
ca@2177
  2135
! !
ca@2177
  2136
cg@2744
  2137
!ViewTreeInspectorApplication::ViewTreeItem class methodsFor:'initialization'!
cg@2744
  2138
cg@2744
  2139
initialize
cg@2744
  2140
    "set the extent of the Handle
cg@2744
  2141
    "
cg@2744
  2142
    HandleExtent := 6@6.
cg@2744
  2143
! !
cg@2744
  2144
cg@2744
  2145
!ViewTreeInspectorApplication::ViewTreeItem class methodsFor:'instance creation'!
cg@2744
  2146
cg@2744
  2147
forView:aView
cg@2744
  2148
    |item|
cg@2744
  2149
cg@2744
  2150
    item := self basicNew initialize.
cg@2744
  2151
    item forView:aView.
cg@2744
  2152
  ^ item
cg@2744
  2153
!
cg@2744
  2154
cg@2744
  2155
new
cg@2744
  2156
    self error:'not allowed'.
cg@2744
  2157
  ^ nil
cg@2744
  2158
!
cg@2744
  2159
cg@2744
  2160
on:aView withSpec:aSpec
cg@2744
  2161
    |item|
cg@2744
  2162
cg@2744
  2163
    item := self basicNew initialize.
cg@2744
  2164
    item on:aView withSpec:aSpec.
cg@2744
  2165
  ^ item
cg@2744
  2166
! !
cg@2744
  2167
cg@2744
  2168
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'accessing'!
cg@2744
  2169
cg@2744
  2170
applicationClass
cg@2744
  2171
    |appl|
cg@2744
  2172
cg@2744
  2173
    widget notNil ifTrue:[
cg@2744
  2174
        appl := widget application.
cg@2744
  2175
        appl notNil ifTrue:[^ appl class ].
cg@2744
  2176
    ].
cg@2744
  2177
    ^ nil
cg@2744
  2178
!
cg@2744
  2179
cg@2744
  2180
isDrawnShown
cg@2744
  2181
    "returns true if the last display operations was done during the widget was shown
cg@2744
  2182
    "
cg@2744
  2183
    ^ isDrawnShown
cg@2744
  2184
!
cg@2744
  2185
cg@2744
  2186
isDrawnShown:aBoolean
cg@2744
  2187
    isDrawnShown := aBoolean.
cg@2744
  2188
!
cg@2744
  2189
cg@2744
  2190
rootView
cg@2744
  2191
    "returns the widget assigned to the root or nil
cg@2744
  2192
    "
cg@2744
  2193
    ^ parent rootView
cg@2744
  2194
!
cg@2744
  2195
cg@2744
  2196
specClass
cg@2744
  2197
    "returns the spec-class assigned to the item
cg@2744
  2198
    "
cg@2744
  2199
    ^ widget specClass
cg@2744
  2200
!
cg@2744
  2201
cg@2744
  2202
treeModel
cg@2744
  2203
    "returns the assigned treeModel, an instance of ViewTreeModel
cg@2744
  2204
    "
cg@2744
  2205
    ^ parent treeModel
cg@2744
  2206
!
cg@2744
  2207
cg@2744
  2208
widget
cg@2744
  2209
    "returns the widget assigned to the item
cg@2744
  2210
    "
cg@2744
  2211
    ^ widget
cg@2744
  2212
! !
cg@2744
  2213
cg@2744
  2214
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'accessing layout'!
cg@2744
  2215
cg@2744
  2216
boundsRelativeToRoot
cg@2744
  2217
    "returns the bounds relative to the root widget
cg@2744
  2218
    "
cg@2744
  2219
    ^ self originRelativeToRoot extent:(widget extent)
cg@2744
  2220
!
cg@2744
  2221
cg@2744
  2222
cornerRelativeToRoot
cg@2744
  2223
    "returns the corner relative to the root widget
cg@2744
  2224
    "
cg@2744
  2225
    ^ self originRelativeToRoot + (widget extent)
cg@2744
  2226
!
cg@2744
  2227
cg@2744
  2228
extent
cg@2744
  2229
    "returns the extent of the widget
cg@2744
  2230
    "
cg@2744
  2231
    ^ widget extent
cg@2744
  2232
!
cg@2744
  2233
cg@2744
  2234
layoutType
cg@2744
  2235
    "returns the type of layout assigned to the wiget; nil if the
cg@2744
  2236
     superView cannot resize its sub widgets
cg@2744
  2237
    "
cg@2744
  2238
    |layout specClass superView|
cg@2744
  2239
cg@2744
  2240
    (superView := widget superView) isNil ifTrue:[
cg@2744
  2241
        ^ #Extent
cg@2744
  2242
    ].
cg@2744
  2243
        
cg@2744
  2244
    specClass := superView specClass.
cg@2744
  2245
cg@2744
  2246
    (specClass notNil and:[specClass isLayoutContainer]) ifTrue:[
cg@2744
  2247
        ^ specClass canResizeSubComponents ifTrue:[#Extent] ifFalse:[nil]
cg@2744
  2248
    ].
cg@2744
  2249
cg@2744
  2250
    (layout := widget geometryLayout) isNil ifTrue:[
cg@2744
  2251
        ^ #Extent
cg@2744
  2252
    ].
cg@2744
  2253
cg@2744
  2254
    layout isLayout ifTrue:[
cg@2744
  2255
        layout isLayoutFrame        ifTrue:[ ^ #LayoutFrame ].
cg@2744
  2256
        layout isAlignmentOrigin    ifTrue:[ ^ #AlignmentOrigin ].
cg@2744
  2257
        layout isLayoutOrigin       ifTrue:[ ^ #LayoutOrigin ].
cg@2744
  2258
    ] ifFalse:[
cg@2744
  2259
        layout isRectangle          ifTrue:[ ^ #Rectangle ].
cg@2744
  2260
        layout isPoint              ifTrue:[ ^ #Point ].
cg@2744
  2261
cg@2744
  2262
    ].
cg@2744
  2263
    Transcript showCR:'UNSUPPORTRD LAYOUT: ', layout printString.
cg@2744
  2264
  ^ nil
cg@2744
  2265
!
cg@2744
  2266
cg@2744
  2267
originRelativeToRoot
cg@2744
  2268
    "returns the origin relative to the root widget
cg@2744
  2269
    "
cg@2744
  2270
    ^ widget originRelativeTo:(self rootView)
cg@2744
  2271
! !
cg@2744
  2272
cg@2744
  2273
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'accessing optimize'!
cg@2744
  2274
cg@2744
  2275
children
cg@2744
  2276
    "redefined: optimize
cg@2744
  2277
    "
cg@2744
  2278
    ^ children
cg@2744
  2279
!
cg@2744
  2280
cg@2744
  2281
hasChildren
cg@2744
  2282
    |subViews list item|
cg@2744
  2283
cg@2744
  2284
    children size ~~ 0 ifTrue:[
cg@2744
  2285
        ^ true
cg@2744
  2286
    ].
cg@2744
  2287
    isExpanded := false.
cg@2744
  2288
    subViews   := widget subViews.
cg@2744
  2289
cg@2744
  2290
    subViews size == 0 ifTrue:[^ false].
cg@2744
  2291
cg@2744
  2292
    list := OrderedCollection new.
cg@2744
  2293
cg@2744
  2294
    subViews do:[:aSubView|
cg@2744
  2295
        item := self class buildViewsFrom:aSubView.
cg@2744
  2296
        item parent:self.
cg@2744
  2297
        list add:item.
cg@2744
  2298
    ].
cg@2744
  2299
    children := list.
cg@2744
  2300
    ^ true
cg@2744
  2301
!
cg@2744
  2302
cg@2744
  2303
size
cg@2744
  2304
    "redefined: returns list of children
cg@2744
  2305
    "
cg@2744
  2306
    ^ children size
cg@2744
  2307
! !
cg@2744
  2308
cg@2744
  2309
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'displaying'!
cg@2744
  2310
cg@2744
  2311
additionalLabelForItem:anItem
cg@3017
  2312
    "answer an additional label for an Item"
cg@2744
  2313
cg@2744
  2314
    parent notNil ifTrue:[
cg@2744
  2315
        ^ parent additionalLabelForItem:anItem
cg@2744
  2316
    ].
cg@2744
  2317
    ^ nil
cg@2744
  2318
!
cg@2744
  2319
cg@2744
  2320
displayIcon:anIcon atX:x y:y on:aGC
cg@2744
  2321
    |x0 y0 y1 w|
cg@2744
  2322
cg@2744
  2323
    super displayIcon:anIcon atX:x y:y on:aGC.
cg@2744
  2324
cg@2744
  2325
    self exists ifFalse:[
cg@2744
  2326
        aGC paint:(Color red).
cg@2744
  2327
cg@2744
  2328
        y0 := y + 1.
cg@2744
  2329
        y1 := y + anIcon height - 2.
cg@2744
  2330
cg@2744
  2331
        x0 := x - 1.
cg@2744
  2332
        w  := anIcon width.
cg@2744
  2333
cg@2744
  2334
        2 timesRepeat:[
cg@2744
  2335
            aGC displayLineFromX:x0 y:y0 toX:(x0 + w) y:y1.
cg@2744
  2336
            aGC displayLineFromX:x0 y:y1 toX:(x0 + w) y:y0.
cg@2744
  2337
            x0 := x0 + 1.
cg@2744
  2338
        ].
cg@2744
  2339
    ].
cg@2744
  2340
!
cg@2744
  2341
cg@2744
  2342
displayOn:aGC x:x y:y h:h
cg@2744
  2343
    |labelHeight additionalName label isValidAndShown|
cg@2744
  2344
cg@2744
  2345
    label := self label.
cg@2744
  2346
    label isEmptyOrNil ifTrue:[^ self].
cg@2744
  2347
cg@2744
  2348
    widget id isNil ifTrue:[
cg@2744
  2349
        isDrawnShown := false.
cg@2744
  2350
cg@2744
  2351
        self exists ifFalse:[
cg@2744
  2352
            xOffsetAdditionalName := nil.
cg@2744
  2353
        ].
cg@2744
  2354
        isValidAndShown := false.
cg@2744
  2355
    ] ifFalse:[
cg@2744
  2356
        isValidAndShown := widget shown.
cg@2744
  2357
    ].
cg@2744
  2358
    isValidAndShown ifFalse:[
cg@2762
  2359
        label := Text string:label emphasis:#italic.
cg@2762
  2360
        label colorizeAllWith:Color grey.
cg@2744
  2361
    ].
cg@2744
  2362
cg@2744
  2363
    labelHeight := self heightOn:aGC.
cg@2744
  2364
    self displayLabel:label h:labelHeight on:aGC x:x y:y h:h.
cg@2744
  2365
cg@2744
  2366
    xOffsetAdditionalName notNil ifTrue:[
cg@2744
  2367
        additionalName := self additionalLabelForItem:self.
cg@2744
  2368
cg@2744
  2369
        additionalName notNil ifTrue:[
cg@2744
  2370
            self displayLabel:additionalName
cg@2744
  2371
                            h:labelHeight on:aGC
cg@2744
  2372
                            x:(x + xOffsetAdditionalName)
cg@2744
  2373
                            y:y
cg@2744
  2374
                            h:h.
cg@2744
  2375
        ] ifFalse:[
cg@2744
  2376
            xOffsetAdditionalName := nil.
cg@2744
  2377
        ].
cg@2744
  2378
    ].
cg@2744
  2379
!
cg@2744
  2380
cg@2744
  2381
recursiveAdditionalNameBehaviourChanged
cg@2744
  2382
    width := xOffsetAdditionalName := nil.
cg@2744
  2383
cg@2744
  2384
    children notNil ifTrue:[
cg@2744
  2385
        children do:[:each| each recursiveAdditionalNameBehaviourChanged ]
cg@2744
  2386
    ].
cg@2744
  2387
!
cg@2744
  2388
cg@2744
  2389
widthOn:aGC
cg@2744
  2390
    "return the width of the receiver, if it is to be displayed on aGC
cg@2744
  2391
    "
cg@2744
  2392
    |additionalName|
cg@2744
  2393
cg@2744
  2394
    width isNil ifTrue:[
cg@2744
  2395
        width := self widthOf:(self label) on:aGC.
cg@2744
  2396
        width := width + 2.
cg@2744
  2397
cg@2744
  2398
        additionalName := self additionalLabelForItem:self.
cg@2744
  2399
cg@2744
  2400
        additionalName notNil ifTrue:[
cg@2744
  2401
            xOffsetAdditionalName := width + 10.
cg@2744
  2402
            width := xOffsetAdditionalName + (self widthOf:additionalName on:aGC).
cg@2744
  2403
            width := width + 2.
cg@2744
  2404
        ] ifFalse:[
cg@2744
  2405
            xOffsetAdditionalName := nil.
cg@2744
  2406
        ].
cg@2744
  2407
    ].
cg@2744
  2408
    ^ width
cg@2744
  2409
! !
cg@2744
  2410
cg@2744
  2411
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'enumerating'!
cg@2744
  2412
cg@2744
  2413
handlesDo:aTwoArgAction
cg@2744
  2414
    "evaluate the two arg block on each handle; the arguments to the block is
cg@2744
  2415
     the rectangle relative to the rootView and the handle type which is
cg@2744
  2416
     set to nil if not resizeable.
cg@2744
  2417
cg@2744
  2418
     TYPES:     type    position( X - Y )
cg@2744
  2419
                -------------------------        
cg@2744
  2420
                #LT     Left   - Top
cg@2744
  2421
                #LC     Left   - Center
cg@2744
  2422
                #LB     Left   - Bottom
cg@2744
  2423
                #CT     Center - Top
cg@2744
  2424
                #CB     Center - Bottom
cg@2744
  2425
                #RT     Right  - Top
cg@2744
  2426
                #RC     Right  - Center
cg@2744
  2427
                #RB     Right  - Bottom
cg@2744
  2428
cg@2744
  2429
                nil     ** handle not pickable **
cg@2744
  2430
    "
cg@2744
  2431
    |type relOrg relCrn maxExt rootView w h
cg@2744
  2432
     xL    "{ Class:SmallInteger }"
cg@2744
  2433
     xC    "{ Class:SmallInteger }"
cg@2744
  2434
     xR    "{ Class:SmallInteger }"
cg@2744
  2435
     yT    "{ Class:SmallInteger }"
cg@2744
  2436
     yC    "{ Class:SmallInteger }"
cg@2744
  2437
     yB    "{ Class:SmallInteger }"
cg@2744
  2438
    |
cg@2744
  2439
    rootView := self rootView.
cg@2744
  2440
    relOrg   := widget originRelativeTo:rootView.
cg@2744
  2441
    relOrg isNil ifTrue:[ ^ self ].    "/ widget destroyed
cg@2744
  2442
cg@2744
  2443
    relOrg   := relOrg - (HandleExtent // 2).
cg@2744
  2444
    relCrn   := relOrg + widget extent.
cg@2744
  2445
    maxExt   := rootView extent - HandleExtent.
cg@2744
  2446
cg@2744
  2447
    xL := relOrg x max:0.
cg@2744
  2448
    xR := relCrn x min:(maxExt x).
cg@2744
  2449
    xC := xR + xL // 2.
cg@2744
  2450
cg@2744
  2451
    yT := relOrg y max:0.
cg@2744
  2452
    yB := relCrn y min:(maxExt y).
cg@2744
  2453
    yC := yB + yT // 2.
cg@2744
  2454
cg@2744
  2455
    type := self layoutType.
cg@2744
  2456
    w   := HandleExtent x.
cg@2744
  2457
    h   := HandleExtent y.
cg@2744
  2458
cg@2744
  2459
    (type == #LayoutFrame or:[type == #Rectangle]) ifTrue:[
cg@2744
  2460
        aTwoArgAction value:(Rectangle left:xL top:yT width:w height:h) value:#LT.
cg@2744
  2461
        aTwoArgAction value:(Rectangle left:xL top:yC width:w height:h) value:#LC.
cg@2744
  2462
        aTwoArgAction value:(Rectangle left:xL top:yB width:w height:h) value:#LB.
cg@2744
  2463
        aTwoArgAction value:(Rectangle left:xC top:yT width:w height:h) value:#CT.
cg@2744
  2464
        aTwoArgAction value:(Rectangle left:xC top:yB width:w height:h) value:#CB.
cg@2744
  2465
        aTwoArgAction value:(Rectangle left:xR top:yT width:w height:h) value:#RT.
cg@2744
  2466
        aTwoArgAction value:(Rectangle left:xR top:yC width:w height:h) value:#RC.
cg@2744
  2467
        aTwoArgAction value:(Rectangle left:xR top:yB width:w height:h) value:#RB.
cg@2744
  2468
      ^ self
cg@2744
  2469
    ].
cg@2744
  2470
cg@2744
  2471
    aTwoArgAction value:(Rectangle left:xL top:yT width:w height:h) value:nil.
cg@2744
  2472
    aTwoArgAction value:(Rectangle left:xL top:yB width:w height:h) value:nil.
cg@2744
  2473
    aTwoArgAction value:(Rectangle left:xR top:yT width:w height:h) value:nil.
cg@2744
  2474
cg@2744
  2475
    type == #Extent ifTrue:[
cg@2744
  2476
        aTwoArgAction value:(Rectangle left:xC top:yB width:w height:h) value:#CB.
cg@2744
  2477
        aTwoArgAction value:(Rectangle left:xR top:yC width:w height:h) value:#RC.
cg@2744
  2478
        aTwoArgAction value:(Rectangle left:xR top:yB width:w height:h) value:#RB.
cg@2744
  2479
      ^ self
cg@2744
  2480
    ].
cg@2744
  2481
    aTwoArgAction value:(Rectangle left:xR top:yB width:w height:h) value:nil.
cg@2744
  2482
!
cg@2744
  2483
cg@2744
  2484
recursiveEachVisibleItemDo:anOneArgBlock
cg@2744
  2485
    "recursive evaluate the block on each child which is visible
cg@2744
  2486
    "
cg@2744
  2487
    (isExpanded and:[children size > 0]) ifTrue:[
cg@2744
  2488
        children do:[:aChild|
cg@2744
  2489
            anOneArgBlock value:aChild.
cg@2744
  2490
            aChild recursiveEachVisibleItemDo:anOneArgBlock.
cg@2744
  2491
        ]
cg@2744
  2492
    ].
cg@2744
  2493
!
cg@2744
  2494
cg@2744
  2495
subViewsDo:aOneArgBlock
cg@2744
  2496
    "evaluate aBlock for all subviews other than InputView's   
cg@2744
  2497
    "
cg@2744
  2498
    |subViews|
cg@2744
  2499
cg@2744
  2500
    subViews := widget subViews.
cg@2744
  2501
cg@2744
  2502
    subViews notNil ifTrue:[
cg@2744
  2503
        subViews do:aOneArgBlock
cg@2744
  2504
    ].
cg@2744
  2505
! !
cg@2744
  2506
cg@2744
  2507
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'initialization'!
cg@2744
  2508
cg@2744
  2509
forView:aView
cg@2744
  2510
    widget := aView.
cg@2744
  2511
!
cg@2744
  2512
cg@2744
  2513
initialize
cg@2744
  2514
    "setup default attributes
cg@2744
  2515
    "
cg@2744
  2516
    super initialize.
cg@2744
  2517
    isDrawnShown := false.
cg@2744
  2518
    isExpanded   := false.
cg@2744
  2519
    children     := OrderedCollection new.
cg@2744
  2520
! !
cg@2744
  2521
cg@2744
  2522
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'operations delete'!
cg@2744
  2523
cg@2744
  2524
delete
cg@2744
  2525
    "delete self and all contained items; the assigned views are destroyed
cg@2744
  2526
     in case of rootView, only the children are deleted
cg@2744
  2527
    "
cg@2744
  2528
    parent isHierarchicalItem ifTrue:[
cg@2744
  2529
        self criticalDo:[
cg@2744
  2530
            parent remove:self.
cg@2744
  2531
            widget destroy.
cg@2744
  2532
        ]
cg@2744
  2533
    ] ifFalse:[
cg@2744
  2534
        self deleteAll
cg@2744
  2535
    ].
cg@2744
  2536
!
cg@2744
  2537
cg@2744
  2538
deleteAll
cg@2744
  2539
    "delete all contained items; the assigned views are destroyed
cg@2744
  2540
    "
cg@2744
  2541
    children size == 0 ifTrue:[^ self].
cg@2744
  2542
cg@2744
  2543
    self criticalDo:[
cg@2744
  2544
        self nonCriticalDo:[:el| el widget destroy ].
cg@2744
  2545
        self removeAll
cg@2744
  2546
    ].
cg@2744
  2547
! !
cg@2744
  2548
cg@2744
  2549
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'operations layout'!
cg@2744
  2550
cg@2744
  2551
asLayoutFrame
cg@2744
  2552
    "convert the layout of the widget to a LayoutFrame;
cg@2744
  2553
    "
cg@2744
  2554
    |extent layout newLyt lftFrc lftOff topFrc topOff|
cg@2744
  2555
cg@2744
  2556
    layout := widget geometryLayout.
cg@2744
  2557
cg@2744
  2558
    layout isNil ifTrue:[
cg@2744
  2559
        ^ widget bounds asLayout
cg@2744
  2560
    ].
cg@2744
  2561
cg@2744
  2562
    layout isLayout ifFalse:[
cg@2744
  2563
        layout isRectangle ifTrue:[
cg@2744
  2564
            ^ LayoutFrame leftOffset:(layout left) rightOffset:(layout right)
cg@2744
  2565
                           topOffset:(layout top) bottomOffset:(layout bottom)
cg@2744
  2566
        ].
cg@2744
  2567
        layout isPoint ifTrue:[
cg@2744
  2568
            extent := widget extent.
cg@2744
  2569
          ^ LayoutFrame leftOffset:(layout x)  rightOffset:(layout x + extent x)
cg@2744
  2570
                         topOffset:(layout y) bottomOffset:(layout y + extent y)
cg@2744
  2571
        ].
cg@2744
  2572
cg@2744
  2573
        Transcript showCR:'UNSUPPORTRD LAYOUT: ', layout printString.
cg@2744
  2574
      ^ nil
cg@2744
  2575
    ].
cg@2744
  2576
cg@2744
  2577
    layout isLayoutFrame ifTrue:[ ^ layout copy ].    
cg@2744
  2578
cg@2744
  2579
    lftFrc := layout leftFraction.
cg@2744
  2580
    lftOff := layout leftOffset.
cg@2744
  2581
    topFrc := layout topFraction.
cg@2744
  2582
    topOff := layout topOffset.
cg@2744
  2583
    extent := widget extent.
cg@2744
  2584
cg@2744
  2585
    newLyt := LayoutFrame leftFraction:lftFrc offset:lftOff
cg@2744
  2586
                         rightFraction:lftFrc offset:(lftOff + extent x)
cg@2744
  2587
                           topFraction:topFrc offset:topOff
cg@2744
  2588
                        bottomFraction:topFrc offset:(topOff + extent y).
cg@2744
  2589
cg@2744
  2590
    (      layout isAlignmentOrigin
cg@2744
  2591
     and:[(layout leftAlignmentFraction ~= 0 or:[layout topAlignmentFraction ~= 0])]
cg@2744
  2592
    ) ifTrue:[
cg@2744
  2593
        |svRc prBd dlta|
cg@2744
  2594
cg@2744
  2595
        svRc := widget superView viewRectangle.
cg@2744
  2596
        prBd := widget preferredBounds.
cg@2744
  2597
cg@2744
  2598
        dlta := (  ((layout rectangleRelativeTo:svRc preferred:prBd) corner)
cg@2744
  2599
                 - ((newLyt rectangleRelativeTo:svRc preferred:prBd) corner)
cg@2744
  2600
                ) rounded.
cg@2744
  2601
cg@2744
  2602
        newLyt   leftOffset:(lftOff + dlta x).
cg@2744
  2603
        newLyt  rightOffset:(lftOff + extent x + dlta x).
cg@2744
  2604
        newLyt    topOffset:(topOff + dlta y).
cg@2744
  2605
        newLyt bottomOffset:(topOff + extent y + dlta y).
cg@2744
  2606
    ].
cg@2744
  2607
    ^ newLyt
cg@2744
  2608
!
cg@2744
  2609
cg@2744
  2610
moveLeft:l top:t
cg@2744
  2611
    "move the widget n pixele left and right
cg@2744
  2612
    "
cg@2744
  2613
    |layout|
cg@2744
  2614
cg@2744
  2615
    self isMoveable ifFalse:[ ^ self ].
cg@2744
  2616
cg@2744
  2617
    (layout := widget geometryLayout) isNil ifTrue:[
cg@2744
  2618
        "Extent"
cg@2744
  2619
        widget origin:(widget origin + (l@t)).
cg@2744
  2620
      ^ self
cg@2744
  2621
    ].
cg@2744
  2622
cg@2744
  2623
    layout := layout copy.
cg@2744
  2624
cg@2744
  2625
    layout isLayout ifTrue:[
cg@2744
  2626
        layout leftOffset:(layout leftOffset + l)
cg@2744
  2627
                topOffset:(layout topOffset  + t).
cg@2744
  2628
cg@2744
  2629
        layout isLayoutFrame ifTrue:[
cg@2744
  2630
            layout  rightOffset:(layout rightOffset  + l).
cg@2744
  2631
            layout bottomOffset:(layout bottomOffset + t).
cg@2744
  2632
        ]
cg@2744
  2633
cg@2744
  2634
    ] ifFalse:[
cg@2744
  2635
        layout isRectangle ifTrue:[
cg@2744
  2636
            layout setLeft:(layout left + l).
cg@2744
  2637
            layout  setTop:(layout top  + t).
cg@2744
  2638
        ] ifFalse:[
cg@2744
  2639
            layout isPoint ifFalse:[^ self].
cg@2744
  2640
            layout x:(layout x + l) y:(layout y + t).
cg@2744
  2641
        ]
cg@2744
  2642
    ].
cg@2744
  2643
    widget geometryLayout:layout.
cg@2744
  2644
!
cg@2744
  2645
cg@2744
  2646
resizeLeft:l top:t right:r bottom:b
cg@2744
  2647
    "resize the widget measured in pixels
cg@2744
  2648
    "
cg@2744
  2649
    |layout|
cg@2744
  2650
cg@2744
  2651
    self isResizeable ifFalse:[
cg@2744
  2652
        ^ self
cg@2744
  2653
    ].
cg@2744
  2654
cg@2744
  2655
    (layout := widget geometryLayout) isNil ifTrue:[
cg@2744
  2656
        "Extent"
cg@2744
  2657
        (r == l and:[b == t]) ifFalse:[
cg@2744
  2658
            widget extent:(widget computeExtent + ((r-l) @ (b-t))).
cg@2744
  2659
        ].
cg@2744
  2660
        ^ self
cg@2744
  2661
    ].
cg@2744
  2662
cg@2744
  2663
    layout isLayout ifTrue:[
cg@2744
  2664
        layout := layout copy.
cg@2744
  2665
cg@2744
  2666
        layout leftOffset:(layout leftOffset + l)
cg@2744
  2667
                topOffset:(layout topOffset  + t).
cg@2744
  2668
cg@2744
  2669
        layout isLayoutFrame ifTrue:[
cg@2744
  2670
            layout bottomOffset:(layout bottomOffset + b).
cg@2744
  2671
            layout  rightOffset:(layout rightOffset  + r).
cg@2744
  2672
        ]
cg@2744
  2673
    ] ifFalse:[
cg@2744
  2674
        layout isRectangle ifFalse:[^ self].
cg@2744
  2675
        layout := layout copy.
cg@2744
  2676
cg@2744
  2677
        layout left:(layout left   + l)
cg@2744
  2678
              right:(layout right  + r)
cg@2744
  2679
                top:(layout top    + t)
cg@2744
  2680
             bottom:(layout bottom + b).
cg@2744
  2681
    ].
cg@2744
  2682
    widget geometryLayout:layout.
cg@2744
  2683
! !
cg@2744
  2684
cg@2744
  2685
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'operations update'!
cg@2744
  2686
cg@2744
  2687
updateChildren
cg@2744
  2688
    |list|
cg@2744
  2689
cg@2744
  2690
    self do:[:el|
cg@2744
  2691
        el exists ifTrue:[
cg@2744
  2692
            el updateChildren.
cg@2744
  2693
        ] ifFalse:[
cg@2744
  2694
            list isNil ifTrue:[list := OrderedCollection new].
cg@2744
  2695
            list add:el.
cg@2744
  2696
        ]
cg@2744
  2697
    ].
cg@2744
  2698
    list notNil ifTrue:[
cg@2744
  2699
        list do:[:el| self remove:el ].
cg@2744
  2700
    ].
cg@2744
  2701
!
cg@2744
  2702
cg@2744
  2703
updateFromChildren:mergedList
cg@2744
  2704
    "update my children against the list of items derived from
cg@2744
  2705
     the merged list.
cg@2744
  2706
    "
cg@2744
  2707
cg@2744
  2708
    mergedList size == 0 ifTrue:[ ^ self removeAll ].
cg@2744
  2709
    children   size == 0 ifTrue:[ ^ self addAll:mergedList ].
cg@2744
  2710
cg@2744
  2711
    self criticalDo:[
cg@2744
  2712
        self nonCriticalDo:[:el| |wdg|
cg@2744
  2713
            wdg := el widget.
cg@2744
  2714
            mergedList detect:[:e2| e2 widget == wdg ] ifNone:[ self remove:el ].
cg@2744
  2715
        ].
cg@2744
  2716
cg@2744
  2717
        mergedList keysAndValuesDo:[:i :el| |wdg e2|
cg@2744
  2718
            wdg := el widget.
cg@2744
  2719
cg@2744
  2720
            e2  := self at:i ifAbsent:nil.
cg@2744
  2721
cg@2744
  2722
            (e2 isNil or:[e2 widget ~~ wdg]) ifTrue:[
cg@2744
  2723
                self add:el beforeIndex:i
cg@2744
  2724
            ]
cg@2744
  2725
        ]
cg@2744
  2726
    ].
cg@2744
  2727
! !
cg@2744
  2728
cg@2744
  2729
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'printing & storing'!
cg@2744
  2730
cg@2744
  2731
icon
cg@2744
  2732
    "get the icon used for presentation
cg@2744
  2733
    "
cg@2744
  2734
    |specClass model|
cg@2744
  2735
cg@2744
  2736
    specClass := self specClass.
cg@2744
  2737
    specClass isNil ifTrue:[^ nil].
cg@2744
  2738
cg@2744
  2739
    model := self treeModel.
cg@2744
  2740
cg@2744
  2741
    model notNil ifTrue:[
cg@2744
  2742
        ^ model iconAt:specClass ifNonePut:[specClass icon]
cg@2744
  2743
    ].
cg@2744
  2744
    ^ specClass icon
cg@2744
  2745
!
cg@2744
  2746
cg@2744
  2747
label
cg@2744
  2748
    "get the label used for presentation
cg@2744
  2749
    "
cg@2744
  2750
    ^ self string
cg@2744
  2751
!
cg@2744
  2752
cg@2744
  2753
printOn:aStream
cg@2744
  2754
    "append a a printed representation of the item to aStream
cg@2744
  2755
    "
cg@2744
  2756
    aStream nextPutAll:(self string)
cg@2744
  2757
!
cg@2744
  2758
cg@2744
  2759
string
cg@2744
  2760
    "get the string
cg@2744
  2761
    "
cg@2744
  2762
    ^ widget class name.
cg@2744
  2763
! !
cg@2744
  2764
cg@2744
  2765
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'queries'!
cg@2744
  2766
cg@2744
  2767
canChangeLayout
cg@2744
  2768
    "returns true if the layout of the widget can be changed and the
cg@2744
  2769
     layout is not organized by its superView
cg@2744
  2770
    "
cg@2744
  2771
    ^ self isResizeable
cg@2744
  2772
!
cg@2744
  2773
cg@2744
  2774
canResizeSubComponents
cg@2744
  2775
    "returns true if the widget can resize its sub components
cg@2744
  2776
    "
cg@2744
  2777
    |specClass|