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