Tools__ViewTreeApplication.st
author Claus Gittinger <cg@exept.de>
Tue, 30 Jul 2013 09:45:42 +0200
changeset 3037 876c28de42da
parent 3034 862cd32dc02f
child 3040 b62c4b71910c
permissions -rw-r--r--
class: Tools::ViewTreeInspectorApplication
class definition
added:5 methods
changed:
#initialize
#selectionChanged
#windowSpec
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
ca@2177
  1429
    |view list n names label value|
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.
ca@2177
  1439
ca@2177
  1440
    1 to:n do:[:i| |action|
ca@2177
  1441
        label := (names at:i) printString.
ca@2177
  1442
        value := view instVarAt:i.
ca@2177
  1443
        value isNil ifTrue:[
ca@2177
  1444
            value  := '------'.
ca@2177
  1445
            action := nil.
ca@2177
  1446
        ] ifFalse:[
ca@2177
  1447
            value  := value displayString contractAtEndTo:40.
ca@2177
  1448
            action := [(view instVarAt:i) inspect].
ca@2177
  1449
        ].
ca@2177
  1450
        list add:(MenuDesc title:label value:value action:action).
ca@2177
  1451
    ].
ca@2177
  1452
ca@2177
  1453
    ^ MenuDesc buildFromList:list onGC:aMenu
ca@2177
  1454
!
ca@2177
  1455
ca@2177
  1456
submenuInterface:aMenu
ca@2455
  1457
    "builds and returns the interface submenu"
ca@2455
  1458
ca@2177
  1459
    |view label inst value list|
ca@2177
  1460
ca@2177
  1461
    view := self selectedView.
ca@2177
  1462
    view isNil ifTrue:[^ nil].
ca@2177
  1463
ca@2177
  1464
    list := OrderedCollection new.
ca@2177
  1465
ca@2177
  1466
    inst  := view controller.
ca@2177
  1467
    value := nil.
ca@2177
  1468
ca@2177
  1469
    inst isNil ifTrue:[
ca@2177
  1470
        label := nil
ca@2177
  1471
    ] ifFalse:[
cg@2758
  1472
        inst == view ifTrue:[ 
cg@2758
  1473
            label := '== view itself' 
cg@2758
  1474
        ] ifFalse:[ 
cg@2758
  1475
            label := inst displayString.
cg@2758
  1476
            value := [view controller inspect].
cg@2758
  1477
        ].
ca@2177
  1478
    ].
ca@2177
  1479
    list add:(MenuDesc title:'controller' value:label action:value).
ca@2177
  1480
ca@2177
  1481
    inst := view delegate.
ca@2177
  1482
    inst notNil ifTrue:[
ca@2177
  1483
        list add:(MenuDesc title:'delegate' value:(inst displayString) action:[ view delegate inspect ]).
ca@2177
  1484
    ].
ca@2177
  1485
ca@2177
  1486
    inst := view application.
ca@2177
  1487
cg@2758
  1488
    inst notNil ifTrue:[ 
cg@2758
  1489
        |topAppl|
cg@2758
  1490
ca@2177
  1491
        list add:(MenuDesc title:'application' value:inst action:[ view application inspect ]).
ca@2177
  1492
ca@2177
  1493
        topAppl := inst topApplication.
ca@2177
  1494
ca@2177
  1495
        (topAppl notNil and:[topAppl ~~ inst]) ifTrue:[
ca@2177
  1496
            list add:(MenuDesc title:'topApplication' value:topAppl action:[ inst topApplication inspect ]).
ca@2177
  1497
        ].
ca@2177
  1498
    ].
ca@2177
  1499
    list add:(MenuDesc separator).
ca@2177
  1500
cg@2888
  1501
    (view respondsTo:#'model') ifTrue:[
cg@2779
  1502
        inst := view model.
ca@2177
  1503
cg@2888
  1504
        inst isNil 
cg@2888
  1505
            ifTrue:[ label := value := nil ]
cg@2888
  1506
            ifFalse:[ label := inst displayString.
cg@2888
  1507
                      label := label,(self aspectLabelFor:inst inApplicationOf:view).  
cg@2888
  1508
                      value := [ view model inspect ].
cg@2888
  1509
                    ].
ca@2177
  1510
ca@2177
  1511
        list add:(MenuDesc title:'model' value:label action:value).
ca@2177
  1512
ca@2177
  1513
        (inst notNil and:[view respondsTo:#modelInterface]) ifTrue:[
ca@2177
  1514
            view modelInterface keysAndValuesDo:[:key : val|
ca@2177
  1515
                val isNil ifTrue:[ label := nil ]
ca@2177
  1516
                         ifFalse:[ label := val displayString ].
ca@2177
  1517
ca@2177
  1518
                list add:(MenuDesc title:('      - ', key) value:label ).
ca@2177
  1519
            ]
ca@2177
  1520
        ].
ca@2177
  1521
    ].
ca@2177
  1522
ca@2177
  1523
    (view respondsTo:#enableChannel) ifTrue:[
ca@2177
  1524
        inst := view enableChannel.
ca@2177
  1525
ca@2177
  1526
        inst isNil ifTrue:[ label := value := nil ]
ca@2177
  1527
                  ifFalse:[ label := inst displayString.
cg@2888
  1528
                            label := label,(self aspectLabelFor:inst inApplicationOf:view).  
ca@2177
  1529
                            value := [ view enableChannel inspect ].
ca@2177
  1530
                          ].
ca@2177
  1531
ca@2177
  1532
        list add:(MenuDesc title:'enableChannel' value:label action:value).
ca@2177
  1533
    ].
ca@2177
  1534
cg@2888
  1535
    #( #action #pressAction #releaseAction ) do:[:actionSelector |
cg@2779
  1536
        (view respondsTo:actionSelector) ifTrue:[
cg@2779
  1537
            inst := view perform:actionSelector.
cg@2779
  1538
cg@2779
  1539
            inst isNil 
cg@2779
  1540
                ifTrue:[ label := value := nil ]
cg@2779
  1541
                ifFalse:[ label := inst displayString.
cg@2779
  1542
                            value := [ (view perform:actionSelector) inspect ].
cg@2779
  1543
                        ].
cg@2779
  1544
cg@2779
  1545
            list add:(MenuDesc title:'action' value:label action:value).
cg@2779
  1546
        ].
cg@2779
  1547
    ].
cg@2779
  1548
ca@2177
  1549
    list last isSeparator ifFalse:[ list add:(MenuDesc separator) ].
ca@2177
  1550
ca@2177
  1551
    (view respondsTo:#listHolder) ifTrue:[
ca@2177
  1552
        inst := view listHolder.
ca@2177
  1553
ca@2177
  1554
        inst isNil ifTrue:[ label := value := nil ]
ca@2177
  1555
                  ifFalse:[ label := inst class printString.
cg@2888
  1556
                            label := label,(self aspectLabelFor:inst inApplicationOf:view).  
ca@2177
  1557
                            value := [ view listHolder inspect ].
ca@2177
  1558
                          ].
ca@2177
  1559
        list add:(MenuDesc title:'listHolder' value:label action:value).
ca@2177
  1560
    ].
ca@2177
  1561
ca@2177
  1562
    (view respondsTo:#list) ifTrue:[
ca@2177
  1563
        inst := view list.
ca@2177
  1564
ca@2177
  1565
        inst isNil ifTrue:[ label := value := nil ]
ca@2177
  1566
                  ifFalse:[ label := '%1 [%2]' bindWith:(inst class printString) with:(inst size).
cg@2888
  1567
                            label := label,(self aspectLabelFor:inst inApplicationOf:view).  
ca@2177
  1568
                            value := [ view list inspect ].
ca@2177
  1569
                          ].
ca@2177
  1570
ca@2177
  1571
        list add:(MenuDesc title:'list' value:label action:value).
ca@2177
  1572
    ].
ca@2177
  1573
ca@2177
  1574
    list last isSeparator ifTrue:[ list removeLast ].
cg@2888
  1575
    ^ MenuDesc buildFromList:list onGC:aMenu
cg@2888
  1576
cg@2888
  1577
    "Modified: / 27-04-2012 / 14:22:34 / cg"
ca@2177
  1578
!
ca@2177
  1579
ca@2177
  1580
submenuVisibility:aMenu
ca@2455
  1581
    "builds and returns the geometry submenu"
ca@2455
  1582
ca@2177
  1583
    |view list value|
ca@2177
  1584
ca@2177
  1585
    view := self selectedView.
ca@2177
  1586
    view isNil ifTrue:[^ nil].
ca@2177
  1587
ca@2177
  1588
    list := OrderedCollection new.
ca@2177
  1589
ca@2177
  1590
    list add:(MenuDesc title:'device'     value:(view device printString)).
ca@2177
  1591
    list add:(MenuDesc title:'drawableId' value:(view id)).
ca@2177
  1592
    list add:(MenuDesc title:'gcId'       value:(view gcId)).
ca@2177
  1593
ca@2177
  1594
    list add:(MenuDesc separator).
ca@2177
  1595
ca@2177
  1596
    list add:(MenuDesc title:'shown'    value:(view shown)).
ca@2177
  1597
    list add:(MenuDesc title:'realized' value:(view realized)).
ca@2177
  1598
ca@2177
  1599
    list add:(MenuDesc separator).
ca@2177
  1600
ca@2177
  1601
    list add:(MenuDesc title:'hiddenOnRealize' value:(view isHiddenOnRealize)).
ca@2177
  1602
ca@2177
  1603
    (value := view visibilityChannel) isNil ifTrue:[
ca@2177
  1604
        list add:(MenuDesc title:'visibilityChannel' value:'------').
ca@2177
  1605
    ] ifFalse:[
ca@2177
  1606
        list add:(MenuDesc title:'visibilityChannel'
ca@2177
  1607
                           value:(value displayString)
ca@2177
  1608
                          action:[view visibilityChannel inspect]).
ca@2177
  1609
    ].
ca@2177
  1610
cg@2758
  1611
    ^ MenuDesc buildFromList:list onGC:aMenu
ca@2177
  1612
! !
ca@2177
  1613
cg@2744
  1614
!ViewTreeInspectorApplication methodsFor:'private'!
ca@2177
  1615
cg@2888
  1616
aspectLabelFor:aModel inApplicationOf:aView
cg@2888
  1617
    |app|
cg@2888
  1618
cg@2888
  1619
    aModel isNil ifTrue:[^ ''].
cg@2888
  1620
    aView isNil ifTrue:[^ ''].
cg@2888
  1621
    (app := aView application) isNil ifTrue:[^ ''].
cg@2888
  1622
    app builder bindings keysAndValuesDo:[:aspect :value |
cg@2888
  1623
        value == aModel ifTrue:[^ ' [aspect: ',aspect,']'].
cg@2888
  1624
    ].
cg@2888
  1625
    app class allInstVarNames do:[:nm | 
cg@2888
  1626
        (app instVarNamed:nm) == aModel ifTrue:[^ ' [instvar: ',nm,']']
cg@2888
  1627
    ].
cg@2888
  1628
cg@2888
  1629
    ^ ''
cg@2888
  1630
cg@2888
  1631
    "Created: / 27-04-2012 / 14:22:09 / cg"
cg@2888
  1632
!
cg@2888
  1633
ca@2177
  1634
selectFocusView
cg@2762
  1635
    |rootView focusView|
ca@2177
  1636
ca@2177
  1637
    rootView := model rootView.
ca@2177
  1638
ca@2177
  1639
    (rootView notNil and:[rootView shown]) ifTrue:[
ca@2177
  1640
        focusView := rootView windowGroup focusView.
ca@2177
  1641
    ].
ca@2177
  1642
    focusView isNil ifTrue:[^ self ].
ca@2177
  1643
cg@2762
  1644
    self selectView:focusView
cg@2762
  1645
!
cg@2762
  1646
cg@2762
  1647
selectView:aView
cg@2762
  1648
    |currentItem viewItem|
cg@2762
  1649
cg@2762
  1650
    currentItem := model selectedItem.
cg@2762
  1651
cg@2762
  1652
    (currentItem notNil and:[currentItem widget == aView]) ifTrue:[
ca@2177
  1653
        ^ self
ca@2177
  1654
    ].
cg@2762
  1655
    viewItem := model listOfItems recursiveDetect:[:el| el widget == aView ].
cg@2762
  1656
cg@2762
  1657
    viewItem notNil ifTrue:[
cg@2762
  1658
        model selectItem:viewItem.
ca@2177
  1659
    ].        
ca@2177
  1660
!
ca@2177
  1661
ca@2177
  1662
setRootItem:aRootItemOrNil
ca@2177
  1663
    |theProcess|
ca@2177
  1664
ca@2177
  1665
    aRootItemOrNil isNil ifTrue:[
ca@2177
  1666
        process := nil.
ca@2177
  1667
    ] ifFalse:[
ca@2177
  1668
        "/ expand tree to level 3
ca@2177
  1669
        aRootItemOrNil do:[:aRootChild|
ca@2177
  1670
            aRootChild do:[:aSubChild| aSubChild expand ].
ca@2177
  1671
            aRootChild expand.
ca@2177
  1672
        ].
ca@2177
  1673
        aRootItemOrNil expand.
ca@2177
  1674
ca@2177
  1675
        process isNil ifTrue:[
ca@2177
  1676
            theProcess := process :=
cg@3034
  1677
                Process 
cg@3034
  1678
                    for:[   
cg@3034
  1679
                        |update testModeChannel|
cg@3034
  1680
cg@3034
  1681
                        update := false.
cg@3034
  1682
                        testModeChannel := model testModeChannel.
cg@3034
  1683
cg@3034
  1684
                        [process == theProcess] whileTrue:[
cg@3034
  1685
                            Delay waitForSeconds:0.5.
cg@3034
  1686
cg@3034
  1687
                            (treeView notNil and:[process == theProcess and:[treeView shown]]) ifTrue:[
cg@3034
  1688
                                (testModeChannel value == true and:[followFocusChannel value == true]) ifTrue:[
cg@3034
  1689
                                    self selectFocusView.
ca@2177
  1690
                                ].
cg@3034
  1691
                                update ifTrue:[
cg@3034
  1692
                                    self updateShownStatus.
cg@3034
  1693
                                ].
cg@3034
  1694
                                update := update not.
cg@3034
  1695
                            ].
cg@3034
  1696
                        ].
cg@3034
  1697
                    ] 
cg@3034
  1698
                    priority:(Processor userSchedulingPriority).
cg@3034
  1699
            theProcess name:'ViewTreeInspector - Focus Follower'.
ca@2177
  1700
            theProcess resume.
ca@2177
  1701
        ].
ca@2177
  1702
    ].
ca@2177
  1703
    model rootItem:aRootItemOrNil.
cg@3034
  1704
cg@3034
  1705
    "Modified: / 25-07-2013 / 12:03:44 / cg"
ca@2177
  1706
!
ca@2177
  1707
ca@2177
  1708
updateShownStatus
ca@2177
  1709
    |rootItem min max visState listIdx visY0 visY1 height damage|
ca@2177
  1710
ca@2177
  1711
    rootItem := model rootItem.
ca@2177
  1712
    (rootItem notNil and:[rootItem widget shown]) ifFalse:[^ self].
ca@2177
  1713
ca@2177
  1714
    max := 0.
ca@2177
  1715
    min := 9999999.
ca@2177
  1716
ca@2177
  1717
    rootItem recursiveEachVisibleItemDo:[:anItem|
ca@2177
  1718
        visState := (anItem widget shown).
ca@2177
  1719
ca@2177
  1720
        visState ~~ anItem isDrawnShown ifTrue:[
ca@2177
  1721
            anItem isDrawnShown:visState.
ca@2177
  1722
            listIdx := treeView identityIndexOf:anItem.
ca@2177
  1723
ca@2177
  1724
            listIdx > 0 ifTrue:[    
ca@2177
  1725
                max := max max:listIdx.
ca@2177
  1726
                min := min min:listIdx.
ca@2177
  1727
            ].
ca@2177
  1728
        ].
ca@2177
  1729
    ].
ca@2177
  1730
    max < min ifTrue:[^ self].
ca@2177
  1731
    max := max + 1.
ca@2177
  1732
ca@2177
  1733
    visY0  := (treeView yVisibleOfLine:min) max:0.
ca@2177
  1734
    visY1  := (treeView yVisibleOfLine:max) min:(treeView height).
ca@2177
  1735
    height := visY1 - visY0.
ca@2177
  1736
    
ca@2177
  1737
    height > 2 ifTrue:[
ca@2177
  1738
        treeView shown ifTrue:[
ca@2177
  1739
            damage := Rectangle left:0 top:visY0 width:(treeView width) height:height.
ca@2177
  1740
            treeView invalidateDeviceRectangle:damage repairNow:false.
ca@2177
  1741
        ].
ca@2177
  1742
    ].
ca@2177
  1743
! !
ca@2177
  1744
cg@2744
  1745
!ViewTreeInspectorApplication methodsFor:'selection'!
ca@2177
  1746
ca@2177
  1747
selectedView
ca@2455
  1748
    "answer the selected view or nil"
ca@2455
  1749
ca@2177
  1750
    |item|
ca@2177
  1751
ca@2177
  1752
    item := model selectedItem.
ca@2177
  1753
    item notNil ifTrue:[ ^ item widget ].
ca@2177
  1754
  ^ nil
ca@2177
  1755
! !
ca@2177
  1756
cg@2744
  1757
!ViewTreeInspectorApplication methodsFor:'testing'!
ca@2177
  1758
ca@2177
  1759
resolveApplicationClassFor:aTreeItem
ca@2177
  1760
    aTreeItem isApplicationClass ifTrue:[
ca@2177
  1761
       ^ aTreeItem applicationClass
ca@2177
  1762
    ].
ca@2177
  1763
    ^ nil
ca@2177
  1764
!
ca@2177
  1765
ca@2177
  1766
selectedComponentHasChildren
ca@2177
  1767
    |item|
ca@2177
  1768
ca@2177
  1769
    item := model selectedItem.
ca@2177
  1770
    ^ (item notNil and:[item hasChildren])
ca@2177
  1771
! !
ca@2177
  1772
cg@2744
  1773
!ViewTreeInspectorApplication methodsFor:'user operations'!
ca@2177
  1774
ca@2177
  1775
doBrowse:what
ca@2177
  1776
    "open browser on:
ca@2177
  1777
        #view           browse class
ca@2177
  1778
        #model          browse model class
ca@2177
  1779
        #application    browse application class
ca@2177
  1780
        #controller     browse controller class
ca@2177
  1781
    "
ca@2177
  1782
    |view inst|
ca@2177
  1783
ca@2177
  1784
    view := self selectedView.
ca@2177
  1785
    view isNil ifTrue:[^ self].
ca@2177
  1786
ca@2177
  1787
             what == #view        ifTrue:[ inst := view ]
ca@2177
  1788
    ifFalse:[what == #model       ifTrue:[ inst := view model ]
ca@2177
  1789
    ifFalse:[what == #application ifTrue:[ inst := view application ]
ca@2177
  1790
    ifFalse:[what == #controller  ifTrue:[ inst := view controller ]
ca@2177
  1791
    ifFalse:[
ca@2177
  1792
        ^ self
ca@2177
  1793
    ]]]].
ca@2177
  1794
ca@2177
  1795
    inst notNil ifTrue:[
ca@2177
  1796
        inst class browserClass openInClass:(inst class) selector:nil
ca@2177
  1797
    ].
ca@2177
  1798
!
ca@2177
  1799
ca@2177
  1800
doDestroy
ca@2455
  1801
    "destroy the current selected view"
ca@2455
  1802
ca@2177
  1803
    |item parent|
ca@2177
  1804
ca@2177
  1805
    item := model selectedItem.
ca@2177
  1806
    item isNil ifTrue:[ ^ self].
ca@2177
  1807
ca@2177
  1808
    parent := item parent.
ca@2177
  1809
ca@2177
  1810
    parent isNil ifTrue:[
ca@2177
  1811
        "/ the root
ca@2177
  1812
        model withSelectionHiddenDo:[item deleteAll].
ca@2177
  1813
      ^ self
ca@2177
  1814
    ].
ca@2177
  1815
ca@2177
  1816
    model withSelectionHiddenDo:[
ca@2177
  1817
        |idx nsel|
ca@2177
  1818
ca@2177
  1819
        idx := parent identityIndexOf:item.
ca@2177
  1820
ca@2177
  1821
        idx == parent size ifTrue:[
ca@2177
  1822
            nsel := parent at:(idx - 1) ifAbsent:parent
ca@2177
  1823
        ] ifFalse:[
ca@2177
  1824
            nsel := parent at:(idx + 1)
ca@2177
  1825
        ].
ca@2177
  1826
        model setValue:nil.
ca@2177
  1827
        item delete.
ca@2177
  1828
ca@2177
  1829
        parent isLayoutContainer ifTrue:[
ca@2177
  1830
            parent widget sizeChanged:nil
ca@2177
  1831
        ].
ca@2177
  1832
        model value:nsel.
ca@2177
  1833
    ].
ca@2177
  1834
!
ca@2177
  1835
ca@2177
  1836
doFlash
ca@2455
  1837
    "flash the selected view"
ca@2455
  1838
ca@2177
  1839
    |view|
ca@2177
  1840
ca@2177
  1841
    view := self selectedView.
ca@2177
  1842
    view isNil ifTrue:[ ^ self].
ca@2177
  1843
ca@2177
  1844
    view shown ifTrue:[
ca@2177
  1845
        model withSelectionHiddenDo:[
ca@2177
  1846
            view perform:#flash ifNotUnderstood:nil.
ca@2177
  1847
        ].
ca@2177
  1848
    ].
ca@2177
  1849
!
ca@2177
  1850
ca@2177
  1851
doInspect:what
ca@2177
  1852
    "open inspector on:
ca@2177
  1853
        #view           inspect class
ca@2177
  1854
        #group          inspect windowGroup
ca@2177
  1855
        #model          inspect model
ca@2177
  1856
        #application    inspect application
ca@2177
  1857
        #controller     inspect controller
cg@3034
  1858
        #process        inspect application's process
ca@2177
  1859
    "
ca@2177
  1860
    |inst|
ca@2177
  1861
ca@2177
  1862
    inst := self selectedView.
ca@2177
  1863
    inst isNil ifTrue:[^ self].
ca@2177
  1864
ca@2177
  1865
             what == #group       ifTrue:[ inst := inst windowGroup ]
ca@2177
  1866
    ifFalse:[what == #model       ifTrue:[ inst := inst model ]
ca@2177
  1867
    ifFalse:[what == #application ifTrue:[ inst := inst application ]
cg@3034
  1868
    ifFalse:[what == #controller  ifTrue:[ inst := inst controller  ]
cg@3034
  1869
    ifFalse:[what == #process     ifTrue:[ inst := inst windowGroup process  ]]]]].
ca@2177
  1870
ca@2177
  1871
    inst notNil ifTrue:[ inst inspect ].
ca@2177
  1872
!
ca@2177
  1873
cg@3034
  1874
doOpenProcessMonitor
cg@3034
  1875
    (ProcessMonitorV2 ? ProcessMonitor) open
cg@3034
  1876
cg@3034
  1877
    "Created: / 25-07-2013 / 12:34:23 / cg"
cg@3034
  1878
!
cg@3034
  1879
cg@2762
  1880
doPickView
ca@2455
  1881
    "pick a window's topView"
ca@2455
  1882
cg@2762
  1883
    |screen clickedView topWindow cursor|
ca@2177
  1884
ca@2177
  1885
    self doUnpick.
ca@2177
  1886
cg@2759
  1887
    cursor := Cursor fromImage:(self class crossHairIcon).
cg@2759
  1888
cg@2759
  1889
    screen := Screen current.
cg@2762
  1890
    clickedView := screen viewFromPoint:(screen pointFromUserShowing:cursor).
cg@2762
  1891
    clickedView isNil ifTrue:[^ self].
cg@2762
  1892
cg@2762
  1893
    topWindow := clickedView topView.
cg@2762
  1894
cg@2762
  1895
    (    topWindow == Screen current rootView
cg@2762
  1896
     or:[topWindow == self window topView]
ca@2177
  1897
    ) ifTrue:[
ca@2177
  1898
        ^ self
ca@2177
  1899
    ].
cg@2978
  1900
cg@3014
  1901
    self showWindow:clickedView
ca@2177
  1902
!
ca@2177
  1903
cg@2978
  1904
doRedraw
cg@2978
  1905
    "redraw the app"
cg@2978
  1906
cg@2978
  1907
    model rootView withAllSubViewsDo:[:v | v redraw; invalidate].
cg@2978
  1908
!
cg@2978
  1909
ca@2177
  1910
doSelectNextOfApplicationClass:aClass startingIn:anItem
ca@2177
  1911
    |startItem firstFound searchNext|
ca@2177
  1912
ca@2177
  1913
    startItem  := model last.
ca@2177
  1914
    searchNext := startItem notNil.        
ca@2177
  1915
    firstFound := nil.
ca@2177
  1916
ca@2177
  1917
    anItem recursiveDo:[:el|
ca@2177
  1918
        el == startItem ifTrue:[
ca@2177
  1919
            searchNext := false
ca@2177
  1920
        ] ifFalse:[
ca@2177
  1921
            (self resolveApplicationClassFor:el) == aClass ifTrue:[
ca@2177
  1922
                searchNext ifFalse:[^ model selectItem:el].
ca@2177
  1923
ca@2177
  1924
                firstFound isNil ifTrue:[
ca@2177
  1925
                    firstFound := el
ca@2177
  1926
                ]
ca@2177
  1927
            ]
ca@2177
  1928
        ]
ca@2177
  1929
    ].
ca@2177
  1930
    firstFound notNil ifTrue:[
ca@2177
  1931
        self window beep.
ca@2177
  1932
        model selectItem:firstFound
ca@2177
  1933
    ].
ca@2177
  1934
!
ca@2177
  1935
ca@2177
  1936
doSelectNextOfClass:aClass startingIn:anItem
ca@2177
  1937
    |startItem firstFound searchNext|
ca@2177
  1938
ca@2177
  1939
    startItem  := model last.
ca@2177
  1940
    searchNext := startItem notNil.        
ca@2177
  1941
    firstFound := nil.
ca@2177
  1942
ca@2177
  1943
    anItem recursiveDo:[:el|
ca@2177
  1944
        el == startItem ifTrue:[
ca@2177
  1945
            searchNext := false
ca@2177
  1946
        ] ifFalse:[
ca@2177
  1947
            el widget class == aClass ifTrue:[
ca@2177
  1948
                searchNext ifFalse:[^ model selectItem:el].
ca@2177
  1949
ca@2177
  1950
                firstFound isNil ifTrue:[
ca@2177
  1951
                    firstFound := el
ca@2177
  1952
                ]
ca@2177
  1953
            ]
ca@2177
  1954
        ]
ca@2177
  1955
    ].
ca@2177
  1956
    firstFound notNil ifTrue:[
ca@2177
  1957
        self window beep.
ca@2177
  1958
        model selectItem:firstFound
ca@2177
  1959
    ].
ca@2177
  1960
!
ca@2177
  1961
cg@2978
  1962
doUncatchEvents
cg@2978
  1963
    model catchEvents:false.
cg@2978
  1964
    self doRedraw
cg@2978
  1965
!
cg@2978
  1966
ca@2177
  1967
doUnpick
ca@2455
  1968
    "release current picked window and contained subwindows"
ca@2455
  1969
ca@2177
  1970
    self setRootItem:nil.
cg@2744
  1971
!
cg@2744
  1972
cg@2744
  1973
openDocumentation
cg@2744
  1974
    HTMLDocumentView openFullOnDocumentationFile:'tools/misc/TOP.html#VIEWTREEINSPECTOR'
cg@3014
  1975
!
cg@3014
  1976
cg@3014
  1977
showWindow:aView
cg@3014
  1978
    "show a particular window's topView hierarchy,
cg@3014
  1979
     select the given view"
cg@3014
  1980
cg@3014
  1981
    | topWindow |
cg@3014
  1982
cg@3014
  1983
    topWindow := aView topView.
cg@3014
  1984
cg@3014
  1985
    model catchEvents:true.
cg@3014
  1986
    self setRootItem:(ViewTreeItem buildViewsFrom:topWindow).
cg@3014
  1987
    self selectView:aView.
ca@2177
  1988
! !
ca@2177
  1989
cg@2744
  1990
!ViewTreeInspectorApplication::MenuDesc class methodsFor:'building'!
ca@2177
  1991
ca@2177
  1992
buildFromList:aList onGC:aMenu
ca@2177
  1993
    |tabSpec menu w menuPanel|
ca@2177
  1994
ca@2177
  1995
    w := 0.
ca@2177
  1996
    aList do:[:el| w := w max:(el widthOn:aMenu) ].
ca@2177
  1997
ca@2177
  1998
    tabSpec := TabulatorSpecification new.
ca@2177
  1999
    tabSpec unit:#pixel.
ca@2177
  2000
    tabSpec positions:#(0     1.5 ).
ca@2177
  2001
    tabSpec align:#(#left #left).
ca@2177
  2002
ca@2177
  2003
    w := w + 15.
ca@2177
  2004
    tabSpec positions:(Array with:0 with:w).
ca@2177
  2005
ca@2177
  2006
    menu := Menu new.
ca@2177
  2007
ca@2177
  2008
    aList do:[:el|
ca@2177
  2009
        menu addItem:(el asMenuItemWithTabulatorSpecification:tabSpec).
ca@2177
  2010
    ].
ca@2177
  2011
    menuPanel := MenuPanel menu:menu.
ca@2177
  2012
    ^ menuPanel
ca@2177
  2013
! !
ca@2177
  2014
cg@2744
  2015
!ViewTreeInspectorApplication::MenuDesc class methodsFor:'instance creation'!
ca@2177
  2016
ca@2177
  2017
separator
ca@2177
  2018
    ^ self new
ca@2177
  2019
!
ca@2177
  2020
ca@2177
  2021
title:aTitle value:aValue
ca@2177
  2022
    ^ self title:aTitle value:aValue action:nil
ca@2177
  2023
!
ca@2177
  2024
ca@2177
  2025
title:aTitle value:aValue action:anAction
ca@2177
  2026
    ^ self new title:aTitle value:aValue action:anAction
ca@2177
  2027
! !
ca@2177
  2028
cg@2744
  2029
!ViewTreeInspectorApplication::MenuDesc methodsFor:'accessing'!
ca@2177
  2030
ca@2177
  2031
title
ca@2177
  2032
    ^ title
ca@2177
  2033
! !
ca@2177
  2034
cg@2744
  2035
!ViewTreeInspectorApplication::MenuDesc methodsFor:'building'!
ca@2177
  2036
ca@2177
  2037
asMenuItemWithTabulatorSpecification:aTabSpec
ca@2177
  2038
    |array|
ca@2177
  2039
ca@2177
  2040
    title isNil ifTrue:[ ^ MenuItem label:value ].     "/ separator
ca@2177
  2041
ca@2177
  2042
    array := Array with:(title, ':') with:'------'.
ca@2177
  2043
ca@2177
  2044
    value notNil ifTrue:[
ca@2177
  2045
        array at:2 put:(value printString, ' ')
ca@2177
  2046
    ].
ca@2177
  2047
cg@2758
  2048
   ^ MenuItem 
cg@2758
  2049
        label:(MultiColListEntry fromStrings:array tabulatorSpecification:aTabSpec)
cg@2758
  2050
        value:action
ca@2177
  2051
! !
ca@2177
  2052
cg@2744
  2053
!ViewTreeInspectorApplication::MenuDesc methodsFor:'instance creation'!
ca@2177
  2054
ca@2177
  2055
title:aTitle value:aValue action:anAction
ca@2177
  2056
    "test for separator
ca@2177
  2057
    "
ca@2177
  2058
    title  := aTitle withoutSeparators.
ca@2177
  2059
    action := anAction.
ca@2177
  2060
ca@2177
  2061
    aValue notNil ifTrue:[
ca@2177
  2062
        value := aValue printString.
ca@2177
  2063
ca@2177
  2064
        value size > 70 ifTrue:[
ca@2177
  2065
            value := value copyFrom:1 to:70.
ca@2177
  2066
            value := value, '...'
ca@2177
  2067
        ]
ca@2177
  2068
    ].
ca@2177
  2069
! !
ca@2177
  2070
cg@2744
  2071
!ViewTreeInspectorApplication::MenuDesc methodsFor:'queries'!
ca@2177
  2072
ca@2177
  2073
isSeparator
ca@2177
  2074
    ^ title isNil
ca@2177
  2075
!
ca@2177
  2076
ca@2177
  2077
widthOn:aGC
ca@2177
  2078
    title isNil ifTrue:[^ 5].  "/ separator
cg@2758
  2079
    ^ title widthOn:aGC
ca@2177
  2080
! !
ca@2177
  2081
cg@2744
  2082
!ViewTreeInspectorApplication::ViewTreeItem class methodsFor:'building'!
cg@2744
  2083
cg@2744
  2084
buildViewsFrom:aView
cg@2744
  2085
    "build the items starting from a source view;
cg@2744
  2086
     returns the anhor.
cg@2744
  2087
    "
cg@2744
  2088
    |item subViews subItems|
cg@2744
  2089
cg@2744
  2090
    aView isNil ifTrue:[^ nil].
cg@2744
  2091
cg@2744
  2092
    item     := self forView:aView.
cg@2744
  2093
    subViews := aView subViews.
cg@2744
  2094
cg@2744
  2095
    subViews notEmptyOrNil ifTrue:[
cg@2744
  2096
        subItems := OrderedCollection new.
cg@2744
  2097
        subViews do:[:aSubView|
cg@2744
  2098
            subItems add:(self buildViewsFrom:aSubView).
cg@2744
  2099
        ].
cg@2744
  2100
        item children:subItems.
cg@2744
  2101
    ].
cg@2744
  2102
    ^ item
cg@2744
  2103
! !
cg@2744
  2104
cg@2744
  2105
!ViewTreeInspectorApplication::ViewTreeItem class methodsFor:'documentation'!
cg@2744
  2106
cg@2744
  2107
documentation
cg@2744
  2108
"
cg@2744
  2109
    ViewTreeItems represants a pickable object within a ViewTreeModel.
cg@2744
  2110
    The class is used to build up the hierarchical tree.
cg@2744
  2111
cg@2744
  2112
    [Instance variables:]
cg@2744
  2113
        widget        <View>            the widget represented by the item
cg@2744
  2114
        spec          <UISpecification> the UISpecification or nil
cg@2744
  2115
cg@2744
  2116
    [Class variables:]
cg@2744
  2117
        HandleExtent  <Point>           keeps the extent of a handle
cg@2744
  2118
cg@2744
  2119
cg@2744
  2120
    [author:]
cg@2744
  2121
        Claus Atzkern
cg@2744
  2122
cg@2744
  2123
    [see also:]
cg@2744
  2124
        HierarchicalItem
cg@2744
  2125
        ViewTreeModel
cg@2744
  2126
"
cg@2744
  2127
!
ca@2177
  2128
ca@2177
  2129
version
ca@2177
  2130
    ^ '$Header$'
ca@2177
  2131
! !
ca@2177
  2132
cg@2744
  2133
!ViewTreeInspectorApplication::ViewTreeItem class methodsFor:'initialization'!
cg@2744
  2134
cg@2744
  2135
initialize
cg@2744
  2136
    "set the extent of the Handle
cg@2744
  2137
    "
cg@2744
  2138
    HandleExtent := 6@6.
cg@2744
  2139
! !
cg@2744
  2140
cg@2744
  2141
!ViewTreeInspectorApplication::ViewTreeItem class methodsFor:'instance creation'!
cg@2744
  2142
cg@2744
  2143
forView:aView
cg@2744
  2144
    |item|
cg@2744
  2145
cg@2744
  2146
    item := self basicNew initialize.
cg@2744
  2147
    item forView:aView.
cg@2744
  2148
  ^ item
cg@2744
  2149
!
cg@2744
  2150
cg@2744
  2151
new
cg@2744
  2152
    self error:'not allowed'.
cg@2744
  2153
  ^ nil
cg@2744
  2154
!
cg@2744
  2155
cg@2744
  2156
on:aView withSpec:aSpec
cg@2744
  2157
    |item|
cg@2744
  2158
cg@2744
  2159
    item := self basicNew initialize.
cg@2744
  2160
    item on:aView withSpec:aSpec.
cg@2744
  2161
  ^ item
cg@2744
  2162
! !
cg@2744
  2163
cg@2744
  2164
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'accessing'!
cg@2744
  2165
cg@2744
  2166
applicationClass
cg@2744
  2167
    |appl|
cg@2744
  2168
cg@2744
  2169
    widget notNil ifTrue:[
cg@2744
  2170
        appl := widget application.
cg@2744
  2171
        appl notNil ifTrue:[^ appl class ].
cg@2744
  2172
    ].
cg@2744
  2173
    ^ nil
cg@2744
  2174
!
cg@2744
  2175
cg@2744
  2176
isDrawnShown
cg@2744
  2177
    "returns true if the last display operations was done during the widget was shown
cg@2744
  2178
    "
cg@2744
  2179
    ^ isDrawnShown
cg@2744
  2180
!
cg@2744
  2181
cg@2744
  2182
isDrawnShown:aBoolean
cg@2744
  2183
    isDrawnShown := aBoolean.
cg@2744
  2184
!
cg@2744
  2185
cg@2744
  2186
rootView
cg@2744
  2187
    "returns the widget assigned to the root or nil
cg@2744
  2188
    "
cg@2744
  2189
    ^ parent rootView
cg@2744
  2190
!
cg@2744
  2191
cg@2744
  2192
specClass
cg@2744
  2193
    "returns the spec-class assigned to the item
cg@2744
  2194
    "
cg@2744
  2195
    ^ widget specClass
cg@2744
  2196
!
cg@2744
  2197
cg@2744
  2198
treeModel
cg@2744
  2199
    "returns the assigned treeModel, an instance of ViewTreeModel
cg@2744
  2200
    "
cg@2744
  2201
    ^ parent treeModel
cg@2744
  2202
!
cg@2744
  2203
cg@2744
  2204
widget
cg@2744
  2205
    "returns the widget assigned to the item
cg@2744
  2206
    "
cg@2744
  2207
    ^ widget
cg@2744
  2208
! !
cg@2744
  2209
cg@2744
  2210
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'accessing layout'!
cg@2744
  2211
cg@2744
  2212
boundsRelativeToRoot
cg@2744
  2213
    "returns the bounds relative to the root widget
cg@2744
  2214
    "
cg@2744
  2215
    ^ self originRelativeToRoot extent:(widget extent)
cg@2744
  2216
!
cg@2744
  2217
cg@2744
  2218
cornerRelativeToRoot
cg@2744
  2219
    "returns the corner relative to the root widget
cg@2744
  2220
    "
cg@2744
  2221
    ^ self originRelativeToRoot + (widget extent)
cg@2744
  2222
!
cg@2744
  2223
cg@2744
  2224
extent
cg@2744
  2225
    "returns the extent of the widget
cg@2744
  2226
    "
cg@2744
  2227
    ^ widget extent
cg@2744
  2228
!
cg@2744
  2229
cg@2744
  2230
layoutType
cg@2744
  2231
    "returns the type of layout assigned to the wiget; nil if the
cg@2744
  2232
     superView cannot resize its sub widgets
cg@2744
  2233
    "
cg@2744
  2234
    |layout specClass superView|
cg@2744
  2235
cg@2744
  2236
    (superView := widget superView) isNil ifTrue:[
cg@2744
  2237
        ^ #Extent
cg@2744
  2238
    ].
cg@2744
  2239
        
cg@2744
  2240
    specClass := superView specClass.
cg@2744
  2241
cg@2744
  2242
    (specClass notNil and:[specClass isLayoutContainer]) ifTrue:[
cg@2744
  2243
        ^ specClass canResizeSubComponents ifTrue:[#Extent] ifFalse:[nil]
cg@2744
  2244
    ].
cg@2744
  2245
cg@2744
  2246
    (layout := widget geometryLayout) isNil ifTrue:[
cg@2744
  2247
        ^ #Extent
cg@2744
  2248
    ].
cg@2744
  2249
cg@2744
  2250
    layout isLayout ifTrue:[
cg@2744
  2251
        layout isLayoutFrame        ifTrue:[ ^ #LayoutFrame ].
cg@2744
  2252
        layout isAlignmentOrigin    ifTrue:[ ^ #AlignmentOrigin ].
cg@2744
  2253
        layout isLayoutOrigin       ifTrue:[ ^ #LayoutOrigin ].
cg@2744
  2254
    ] ifFalse:[
cg@2744
  2255
        layout isRectangle          ifTrue:[ ^ #Rectangle ].
cg@2744
  2256
        layout isPoint              ifTrue:[ ^ #Point ].
cg@2744
  2257
cg@2744
  2258
    ].
cg@2744
  2259
    Transcript showCR:'UNSUPPORTRD LAYOUT: ', layout printString.
cg@2744
  2260
  ^ nil
cg@2744
  2261
!
cg@2744
  2262
cg@2744
  2263
originRelativeToRoot
cg@2744
  2264
    "returns the origin relative to the root widget
cg@2744
  2265
    "
cg@2744
  2266
    ^ widget originRelativeTo:(self rootView)
cg@2744
  2267
! !
cg@2744
  2268
cg@2744
  2269
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'accessing optimize'!
cg@2744
  2270
cg@2744
  2271
children
cg@2744
  2272
    "redefined: optimize
cg@2744
  2273
    "
cg@2744
  2274
    ^ children
cg@2744
  2275
!
cg@2744
  2276
cg@2744
  2277
hasChildren
cg@2744
  2278
    |subViews list item|
cg@2744
  2279
cg@2744
  2280
    children size ~~ 0 ifTrue:[
cg@2744
  2281
        ^ true
cg@2744
  2282
    ].
cg@2744
  2283
    isExpanded := false.
cg@2744
  2284
    subViews   := widget subViews.
cg@2744
  2285
cg@2744
  2286
    subViews size == 0 ifTrue:[^ false].
cg@2744
  2287
cg@2744
  2288
    list := OrderedCollection new.
cg@2744
  2289
cg@2744
  2290
    subViews do:[:aSubView|
cg@2744
  2291
        item := self class buildViewsFrom:aSubView.
cg@2744
  2292
        item parent:self.
cg@2744
  2293
        list add:item.
cg@2744
  2294
    ].
cg@2744
  2295
    children := list.
cg@2744
  2296
    ^ true
cg@2744
  2297
!
cg@2744
  2298
cg@2744
  2299
size
cg@2744
  2300
    "redefined: returns list of children
cg@2744
  2301
    "
cg@2744
  2302
    ^ children size
cg@2744
  2303
! !
cg@2744
  2304
cg@2744
  2305
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'displaying'!
cg@2744
  2306
cg@2744
  2307
additionalLabelForItem:anItem
cg@3017
  2308
    "answer an additional label for an Item"
cg@2744
  2309
cg@2744
  2310
    parent notNil ifTrue:[
cg@2744
  2311
        ^ parent additionalLabelForItem:anItem
cg@2744
  2312
    ].
cg@2744
  2313
    ^ nil
cg@2744
  2314
!
cg@2744
  2315
cg@2744
  2316
displayIcon:anIcon atX:x y:y on:aGC
cg@2744
  2317
    |x0 y0 y1 w|
cg@2744
  2318
cg@2744
  2319
    super displayIcon:anIcon atX:x y:y on:aGC.
cg@2744
  2320
cg@2744
  2321
    self exists ifFalse:[
cg@2744
  2322
        aGC paint:(Color red).
cg@2744
  2323
cg@2744
  2324
        y0 := y + 1.
cg@2744
  2325
        y1 := y + anIcon height - 2.
cg@2744
  2326
cg@2744
  2327
        x0 := x - 1.
cg@2744
  2328
        w  := anIcon width.
cg@2744
  2329
cg@2744
  2330
        2 timesRepeat:[
cg@2744
  2331
            aGC displayLineFromX:x0 y:y0 toX:(x0 + w) y:y1.
cg@2744
  2332
            aGC displayLineFromX:x0 y:y1 toX:(x0 + w) y:y0.
cg@2744
  2333
            x0 := x0 + 1.
cg@2744
  2334
        ].
cg@2744
  2335
    ].
cg@2744
  2336
!
cg@2744
  2337
cg@2744
  2338
displayOn:aGC x:x y:y h:h
cg@2744
  2339
    |labelHeight additionalName label isValidAndShown|
cg@2744
  2340
cg@2744
  2341
    label := self label.
cg@2744
  2342
    label isEmptyOrNil ifTrue:[^ self].
cg@2744
  2343
cg@2744
  2344
    widget id isNil ifTrue:[
cg@2744
  2345
        isDrawnShown := false.
cg@2744
  2346
cg@2744
  2347
        self exists ifFalse:[
cg@2744
  2348
            xOffsetAdditionalName := nil.
cg@2744
  2349
        ].
cg@2744
  2350
        isValidAndShown := false.
cg@2744
  2351
    ] ifFalse:[
cg@2744
  2352
        isValidAndShown := widget shown.
cg@2744
  2353
    ].
cg@2744
  2354
    isValidAndShown ifFalse:[
cg@2762
  2355
        label := Text string:label emphasis:#italic.
cg@2762
  2356
        label colorizeAllWith:Color grey.
cg@2744
  2357
    ].
cg@2744
  2358
cg@2744
  2359
    labelHeight := self heightOn:aGC.
cg@2744
  2360
    self displayLabel:label h:labelHeight on:aGC x:x y:y h:h.
cg@2744
  2361
cg@2744
  2362
    xOffsetAdditionalName notNil ifTrue:[
cg@2744
  2363
        additionalName := self additionalLabelForItem:self.
cg@2744
  2364
cg@2744
  2365
        additionalName notNil ifTrue:[
cg@2744
  2366
            self displayLabel:additionalName
cg@2744
  2367
                            h:labelHeight on:aGC
cg@2744
  2368
                            x:(x + xOffsetAdditionalName)
cg@2744
  2369
                            y:y
cg@2744
  2370
                            h:h.
cg@2744
  2371
        ] ifFalse:[
cg@2744
  2372
            xOffsetAdditionalName := nil.
cg@2744
  2373
        ].
cg@2744
  2374
    ].
cg@2744
  2375
!
cg@2744
  2376
cg@2744
  2377
recursiveAdditionalNameBehaviourChanged
cg@2744
  2378
    width := xOffsetAdditionalName := nil.
cg@2744
  2379
cg@2744
  2380
    children notNil ifTrue:[
cg@2744
  2381
        children do:[:each| each recursiveAdditionalNameBehaviourChanged ]
cg@2744
  2382
    ].
cg@2744
  2383
!
cg@2744
  2384
cg@2744
  2385
widthOn:aGC
cg@2744
  2386
    "return the width of the receiver, if it is to be displayed on aGC
cg@2744
  2387
    "
cg@2744
  2388
    |additionalName|
cg@2744
  2389
cg@2744
  2390
    width isNil ifTrue:[
cg@2744
  2391
        width := self widthOf:(self label) on:aGC.
cg@2744
  2392
        width := width + 2.
cg@2744
  2393
cg@2744
  2394
        additionalName := self additionalLabelForItem:self.
cg@2744
  2395
cg@2744
  2396
        additionalName notNil ifTrue:[
cg@2744
  2397
            xOffsetAdditionalName := width + 10.
cg@2744
  2398
            width := xOffsetAdditionalName + (self widthOf:additionalName on:aGC).
cg@2744
  2399
            width := width + 2.
cg@2744
  2400
        ] ifFalse:[
cg@2744
  2401
            xOffsetAdditionalName := nil.
cg@2744
  2402
        ].
cg@2744
  2403
    ].
cg@2744
  2404
    ^ width
cg@2744
  2405
! !
cg@2744
  2406
cg@2744
  2407
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'enumerating'!
cg@2744
  2408
cg@2744
  2409
handlesDo:aTwoArgAction
cg@2744
  2410
    "evaluate the two arg block on each handle; the arguments to the block is
cg@2744
  2411
     the rectangle relative to the rootView and the handle type which is
cg@2744
  2412
     set to nil if not resizeable.
cg@2744
  2413
cg@2744
  2414
     TYPES:     type    position( X - Y )
cg@2744
  2415
                -------------------------        
cg@2744
  2416
                #LT     Left   - Top
cg@2744
  2417
                #LC     Left   - Center
cg@2744
  2418
                #LB     Left   - Bottom
cg@2744
  2419
                #CT     Center - Top
cg@2744
  2420
                #CB     Center - Bottom
cg@2744
  2421
                #RT     Right  - Top
cg@2744
  2422
                #RC     Right  - Center
cg@2744
  2423
                #RB     Right  - Bottom
cg@2744
  2424
cg@2744
  2425
                nil     ** handle not pickable **
cg@2744
  2426
    "
cg@2744
  2427
    |type relOrg relCrn maxExt rootView w h
cg@2744
  2428
     xL    "{ Class:SmallInteger }"
cg@2744
  2429
     xC    "{ Class:SmallInteger }"
cg@2744
  2430
     xR    "{ Class:SmallInteger }"
cg@2744
  2431
     yT    "{ Class:SmallInteger }"
cg@2744
  2432
     yC    "{ Class:SmallInteger }"
cg@2744
  2433
     yB    "{ Class:SmallInteger }"
cg@2744
  2434
    |
cg@2744
  2435
    rootView := self rootView.
cg@2744
  2436
    relOrg   := widget originRelativeTo:rootView.
cg@2744
  2437
    relOrg isNil ifTrue:[ ^ self ].    "/ widget destroyed
cg@2744
  2438
cg@2744
  2439
    relOrg   := relOrg - (HandleExtent // 2).
cg@2744
  2440
    relCrn   := relOrg + widget extent.
cg@2744
  2441
    maxExt   := rootView extent - HandleExtent.
cg@2744
  2442
cg@2744
  2443
    xL := relOrg x max:0.
cg@2744
  2444
    xR := relCrn x min:(maxExt x).
cg@2744
  2445
    xC := xR + xL // 2.
cg@2744
  2446
cg@2744
  2447
    yT := relOrg y max:0.
cg@2744
  2448
    yB := relCrn y min:(maxExt y).
cg@2744
  2449
    yC := yB + yT // 2.
cg@2744
  2450
cg@2744
  2451
    type := self layoutType.
cg@2744
  2452
    w   := HandleExtent x.
cg@2744
  2453
    h   := HandleExtent y.
cg@2744
  2454
cg@2744
  2455
    (type == #LayoutFrame or:[type == #Rectangle]) ifTrue:[
cg@2744
  2456
        aTwoArgAction value:(Rectangle left:xL top:yT width:w height:h) value:#LT.
cg@2744
  2457
        aTwoArgAction value:(Rectangle left:xL top:yC width:w height:h) value:#LC.
cg@2744
  2458
        aTwoArgAction value:(Rectangle left:xL top:yB width:w height:h) value:#LB.
cg@2744
  2459
        aTwoArgAction value:(Rectangle left:xC top:yT width:w height:h) value:#CT.
cg@2744
  2460
        aTwoArgAction value:(Rectangle left:xC top:yB width:w height:h) value:#CB.
cg@2744
  2461
        aTwoArgAction value:(Rectangle left:xR top:yT width:w height:h) value:#RT.
cg@2744
  2462
        aTwoArgAction value:(Rectangle left:xR top:yC width:w height:h) value:#RC.
cg@2744
  2463
        aTwoArgAction value:(Rectangle left:xR top:yB width:w height:h) value:#RB.
cg@2744
  2464
      ^ self
cg@2744
  2465
    ].
cg@2744
  2466
cg@2744
  2467
    aTwoArgAction value:(Rectangle left:xL top:yT width:w height:h) value:nil.
cg@2744
  2468
    aTwoArgAction value:(Rectangle left:xL top:yB width:w height:h) value:nil.
cg@2744
  2469
    aTwoArgAction value:(Rectangle left:xR top:yT width:w height:h) value:nil.
cg@2744
  2470
cg@2744
  2471
    type == #Extent ifTrue:[
cg@2744
  2472
        aTwoArgAction value:(Rectangle left:xC top:yB width:w height:h) value:#CB.
cg@2744
  2473
        aTwoArgAction value:(Rectangle left:xR top:yC width:w height:h) value:#RC.
cg@2744
  2474
        aTwoArgAction value:(Rectangle left:xR top:yB width:w height:h) value:#RB.
cg@2744
  2475
      ^ self
cg@2744
  2476
    ].
cg@2744
  2477
    aTwoArgAction value:(Rectangle left:xR top:yB width:w height:h) value:nil.
cg@2744
  2478
!
cg@2744
  2479
cg@2744
  2480
recursiveEachVisibleItemDo:anOneArgBlock
cg@2744
  2481
    "recursive evaluate the block on each child which is visible
cg@2744
  2482
    "
cg@2744
  2483
    (isExpanded and:[children size > 0]) ifTrue:[
cg@2744
  2484
        children do:[:aChild|
cg@2744
  2485
            anOneArgBlock value:aChild.
cg@2744
  2486
            aChild recursiveEachVisibleItemDo:anOneArgBlock.
cg@2744
  2487
        ]
cg@2744
  2488
    ].
cg@2744
  2489
!
cg@2744
  2490
cg@2744
  2491
subViewsDo:aOneArgBlock
cg@2744
  2492
    "evaluate aBlock for all subviews other than InputView's   
cg@2744
  2493
    "
cg@2744
  2494
    |subViews|
cg@2744
  2495
cg@2744
  2496
    subViews := widget subViews.
cg@2744
  2497
cg@2744
  2498
    subViews notNil ifTrue:[
cg@2744
  2499
        subViews do:aOneArgBlock
cg@2744
  2500
    ].
cg@2744
  2501
! !
cg@2744
  2502
cg@2744
  2503
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'initialization'!
cg@2744
  2504
cg@2744
  2505
forView:aView
cg@2744
  2506
    widget := aView.
cg@2744
  2507
!
cg@2744
  2508
cg@2744
  2509
initialize
cg@2744
  2510
    "setup default attributes
cg@2744
  2511
    "
cg@2744
  2512
    super initialize.
cg@2744
  2513
    isDrawnShown := false.
cg@2744
  2514
    isExpanded   := false.
cg@2744
  2515
    children     := OrderedCollection new.
cg@2744
  2516
! !
cg@2744
  2517
cg@2744
  2518
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'operations delete'!
cg@2744
  2519
cg@2744
  2520
delete
cg@2744
  2521
    "delete self and all contained items; the assigned views are destroyed
cg@2744
  2522
     in case of rootView, only the children are deleted
cg@2744
  2523
    "
cg@2744
  2524
    parent isHierarchicalItem ifTrue:[
cg@2744
  2525
        self criticalDo:[
cg@2744
  2526
            parent remove:self.
cg@2744
  2527
            widget destroy.
cg@2744
  2528
        ]
cg@2744
  2529
    ] ifFalse:[
cg@2744
  2530
        self deleteAll
cg@2744
  2531
    ].
cg@2744
  2532
!
cg@2744
  2533
cg@2744
  2534
deleteAll
cg@2744
  2535
    "delete all contained items; the assigned views are destroyed
cg@2744
  2536
    "
cg@2744
  2537
    children size == 0 ifTrue:[^ self].
cg@2744
  2538
cg@2744
  2539
    self criticalDo:[
cg@2744
  2540
        self nonCriticalDo:[:el| el widget destroy ].
cg@2744
  2541
        self removeAll
cg@2744
  2542
    ].
cg@2744
  2543
! !
cg@2744
  2544
cg@2744
  2545
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'operations layout'!
cg@2744
  2546
cg@2744
  2547
asLayoutFrame
cg@2744
  2548
    "convert the layout of the widget to a LayoutFrame;
cg@2744
  2549
    "
cg@2744
  2550
    |extent layout newLyt lftFrc lftOff topFrc topOff|
cg@2744
  2551
cg@2744
  2552
    layout := widget geometryLayout.
cg@2744
  2553
cg@2744
  2554
    layout isNil ifTrue:[
cg@2744
  2555
        ^ widget bounds asLayout
cg@2744
  2556
    ].
cg@2744
  2557
cg@2744
  2558
    layout isLayout ifFalse:[
cg@2744
  2559
        layout isRectangle ifTrue:[
cg@2744
  2560
            ^ LayoutFrame leftOffset:(layout left) rightOffset:(layout right)
cg@2744
  2561
                           topOffset:(layout top) bottomOffset:(layout bottom)
cg@2744
  2562
        ].
cg@2744
  2563
        layout isPoint ifTrue:[
cg@2744
  2564
            extent := widget extent.
cg@2744
  2565
          ^ LayoutFrame leftOffset:(layout x)  rightOffset:(layout x + extent x)
cg@2744
  2566
                         topOffset:(layout y) bottomOffset:(layout y + extent y)
cg@2744
  2567
        ].
cg@2744
  2568
cg@2744
  2569
        Transcript showCR:'UNSUPPORTRD LAYOUT: ', layout printString.
cg@2744
  2570
      ^ nil
cg@2744
  2571
    ].
cg@2744
  2572
cg@2744
  2573
    layout isLayoutFrame ifTrue:[ ^ layout copy ].    
cg@2744
  2574
cg@2744
  2575
    lftFrc := layout leftFraction.
cg@2744
  2576
    lftOff := layout leftOffset.
cg@2744
  2577
    topFrc := layout topFraction.
cg@2744
  2578
    topOff := layout topOffset.
cg@2744
  2579
    extent := widget extent.
cg@2744
  2580
cg@2744
  2581
    newLyt := LayoutFrame leftFraction:lftFrc offset:lftOff
cg@2744
  2582
                         rightFraction:lftFrc offset:(lftOff + extent x)
cg@2744
  2583
                           topFraction:topFrc offset:topOff
cg@2744
  2584
                        bottomFraction:topFrc offset:(topOff + extent y).
cg@2744
  2585
cg@2744
  2586
    (      layout isAlignmentOrigin
cg@2744
  2587
     and:[(layout leftAlignmentFraction ~= 0 or:[layout topAlignmentFraction ~= 0])]
cg@2744
  2588
    ) ifTrue:[
cg@2744
  2589
        |svRc prBd dlta|
cg@2744
  2590
cg@2744
  2591
        svRc := widget superView viewRectangle.
cg@2744
  2592
        prBd := widget preferredBounds.
cg@2744
  2593
cg@2744
  2594
        dlta := (  ((layout rectangleRelativeTo:svRc preferred:prBd) corner)
cg@2744
  2595
                 - ((newLyt rectangleRelativeTo:svRc preferred:prBd) corner)
cg@2744
  2596
                ) rounded.
cg@2744
  2597
cg@2744
  2598
        newLyt   leftOffset:(lftOff + dlta x).
cg@2744
  2599
        newLyt  rightOffset:(lftOff + extent x + dlta x).
cg@2744
  2600
        newLyt    topOffset:(topOff + dlta y).
cg@2744
  2601
        newLyt bottomOffset:(topOff + extent y + dlta y).
cg@2744
  2602
    ].
cg@2744
  2603
    ^ newLyt
cg@2744
  2604
!
cg@2744
  2605
cg@2744
  2606
moveLeft:l top:t
cg@2744
  2607
    "move the widget n pixele left and right
cg@2744
  2608
    "
cg@2744
  2609
    |layout|
cg@2744
  2610
cg@2744
  2611
    self isMoveable ifFalse:[ ^ self ].
cg@2744
  2612
cg@2744
  2613
    (layout := widget geometryLayout) isNil ifTrue:[
cg@2744
  2614
        "Extent"
cg@2744
  2615
        widget origin:(widget origin + (l@t)).
cg@2744
  2616
      ^ self
cg@2744
  2617
    ].
cg@2744
  2618
cg@2744
  2619
    layout := layout copy.
cg@2744
  2620
cg@2744
  2621
    layout isLayout ifTrue:[
cg@2744
  2622
        layout leftOffset:(layout leftOffset + l)
cg@2744
  2623
                topOffset:(layout topOffset  + t).
cg@2744
  2624
cg@2744
  2625
        layout isLayoutFrame ifTrue:[
cg@2744
  2626
            layout  rightOffset:(layout rightOffset  + l).
cg@2744
  2627
            layout bottomOffset:(layout bottomOffset + t).
cg@2744
  2628
        ]
cg@2744
  2629
cg@2744
  2630
    ] ifFalse:[
cg@2744
  2631
        layout isRectangle ifTrue:[
cg@2744
  2632
            layout setLeft:(layout left + l).
cg@2744
  2633
            layout  setTop:(layout top  + t).
cg@2744
  2634
        ] ifFalse:[
cg@2744
  2635
            layout isPoint ifFalse:[^ self].
cg@2744
  2636
            layout x:(layout x + l) y:(layout y + t).
cg@2744
  2637
        ]
cg@2744
  2638
    ].
cg@2744
  2639
    widget geometryLayout:layout.
cg@2744
  2640
!
cg@2744
  2641
cg@2744
  2642
resizeLeft:l top:t right:r bottom:b
cg@2744
  2643
    "resize the widget measured in pixels
cg@2744
  2644
    "
cg@2744
  2645
    |layout|
cg@2744
  2646
cg@2744
  2647
    self isResizeable ifFalse:[
cg@2744
  2648
        ^ self
cg@2744
  2649
    ].
cg@2744
  2650
cg@2744
  2651
    (layout := widget geometryLayout) isNil ifTrue:[
cg@2744
  2652
        "Extent"
cg@2744
  2653
        (r == l and:[b == t]) ifFalse:[
cg@2744
  2654
            widget extent:(widget computeExtent + ((r-l) @ (b-t))).
cg@2744
  2655
        ].
cg@2744
  2656
        ^ self
cg@2744
  2657
    ].
cg@2744
  2658
cg@2744
  2659
    layout isLayout ifTrue:[
cg@2744
  2660
        layout := layout copy.
cg@2744
  2661
cg@2744
  2662
        layout leftOffset:(layout leftOffset + l)
cg@2744
  2663
                topOffset:(layout topOffset  + t).
cg@2744
  2664
cg@2744
  2665
        layout isLayoutFrame ifTrue:[
cg@2744
  2666
            layout bottomOffset:(layout bottomOffset + b).
cg@2744
  2667
            layout  rightOffset:(layout rightOffset  + r).
cg@2744
  2668
        ]
cg@2744
  2669
    ] ifFalse:[
cg@2744
  2670
        layout isRectangle ifFalse:[^ self].
cg@2744
  2671
        layout := layout copy.
cg@2744
  2672
cg@2744
  2673
        layout left:(layout left   + l)
cg@2744
  2674
              right:(layout right  + r)
cg@2744
  2675
                top:(layout top    + t)
cg@2744
  2676
             bottom:(layout bottom + b).
cg@2744
  2677
    ].
cg@2744
  2678
    widget geometryLayout:layout.
cg@2744
  2679
! !
cg@2744
  2680
cg@2744
  2681
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'operations update'!
cg@2744
  2682
cg@2744
  2683
updateChildren
cg@2744
  2684
    |list|
cg@2744
  2685
cg@2744
  2686
    self do:[:el|
cg@2744
  2687
        el exists ifTrue:[
cg@2744
  2688
            el updateChildren.
cg@2744
  2689
        ] ifFalse:[
cg@2744
  2690
            list isNil ifTrue:[list := OrderedCollection new].
cg@2744
  2691
            list add:el.
cg@2744
  2692
        ]
cg@2744
  2693
    ].
cg@2744
  2694
    list notNil ifTrue:[
cg@2744
  2695
        list do:[:el| self remove:el ].
cg@2744
  2696
    ].
cg@2744
  2697
!
cg@2744
  2698
cg@2744
  2699
updateFromChildren:mergedList
cg@2744
  2700
    "update my children against the list of items derived from
cg@2744
  2701
     the merged list.
cg@2744
  2702
    "
cg@2744
  2703
cg@2744
  2704
    mergedList size == 0 ifTrue:[ ^ self removeAll ].
cg@2744
  2705
    children   size == 0 ifTrue:[ ^ self addAll:mergedList ].
cg@2744
  2706
cg@2744
  2707
    self criticalDo:[
cg@2744
  2708
        self nonCriticalDo:[:el| |wdg|
cg@2744
  2709
            wdg := el widget.
cg@2744
  2710
            mergedList detect:[:e2| e2 widget == wdg ] ifNone:[ self remove:el ].
cg@2744
  2711
        ].
cg@2744
  2712
cg@2744
  2713
        mergedList keysAndValuesDo:[:i :el| |wdg e2|
cg@2744
  2714
            wdg := el widget.
cg@2744
  2715
cg@2744
  2716
            e2  := self at:i ifAbsent:nil.
cg@2744
  2717
cg@2744
  2718
            (e2 isNil or:[e2 widget ~~ wdg]) ifTrue:[
cg@2744
  2719
                self add:el beforeIndex:i
cg@2744
  2720
            ]
cg@2744
  2721
        ]
cg@2744
  2722
    ].
cg@2744
  2723
! !
cg@2744
  2724
cg@2744
  2725
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'printing & storing'!
cg@2744
  2726
cg@2744
  2727
icon
cg@2744
  2728
    "get the icon used for presentation
cg@2744
  2729
    "
cg@2744
  2730
    |specClass model|
cg@2744
  2731
cg@2744
  2732
    specClass := self specClass.
cg@2744
  2733
    specClass isNil ifTrue:[^ nil].
cg@2744
  2734
cg@2744
  2735
    model := self treeModel.
cg@2744
  2736
cg@2744
  2737
    model notNil ifTrue:[
cg@2744
  2738
        ^ model iconAt:specClass ifNonePut:[specClass icon]
cg@2744
  2739
    ].
cg@2744
  2740
    ^ specClass icon
cg@2744
  2741
!
cg@2744
  2742
cg@2744
  2743
label
cg@2744
  2744
    "get the label used for presentation
cg@2744
  2745
    "
cg@2744
  2746
    ^ self string
cg@2744
  2747
!
cg@2744
  2748
cg@2744
  2749
printOn:aStream
cg@2744
  2750
    "append a a printed representation of the item to aStream
cg@2744
  2751
    "
cg@2744
  2752
    aStream nextPutAll:(self string)
cg@2744
  2753
!
cg@2744
  2754
cg@2744
  2755
string
cg@2744
  2756
    "get the string
cg@2744
  2757
    "
cg@2744
  2758
    ^ widget class name.
cg@2744
  2759
! !
cg@2744
  2760
cg@2744
  2761
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'queries'!
cg@2744
  2762
cg@2744
  2763
canChangeLayout
cg@2744
  2764
    "returns true if the layout of the widget can be changed and the
cg@2744
  2765
     layout is not organized by its superView
cg@2744
  2766
    "
cg@2744
  2767
    ^ self isResizeable
cg@2744
  2768
!
cg@2744
  2769
cg@2744
  2770
canResizeSubComponents
cg@2744
  2771
    "returns true if the widget can resize its sub components
cg@2744
  2772
    "
cg@2744
  2773
    |specClass|
cg@2744
  2774
cg@2744
  2775
    specClass := self specClass.
cg@2744
  2776
cg@2744
  2777
    specClass notNil ifTrue:[
cg@2744
  2778<