Tools__ViewTreeItem.st
author sr
Fri, 23 Oct 2009 15:38:34 +0200
changeset 2682 54418b0e52fb
parent 2456 3d8a5dd293ba
permissions -rw-r--r--
some tries for UNIX - unfinished
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2178
d970c06282d7 initial checkin
ca
parents:
diff changeset
     1
"{ Package: 'stx:libtool2' }"
d970c06282d7 initial checkin
ca
parents:
diff changeset
     2
d970c06282d7 initial checkin
ca
parents:
diff changeset
     3
"{ NameSpace: Tools }"
d970c06282d7 initial checkin
ca
parents:
diff changeset
     4
d970c06282d7 initial checkin
ca
parents:
diff changeset
     5
HierarchicalItem subclass:#ViewTreeItem
2452
7892f26996b7 *** empty log message ***
ca
parents: 2405
diff changeset
     6
	instanceVariableNames:'widget isDrawnShown exists xOffsetAdditionalName'
2178
d970c06282d7 initial checkin
ca
parents:
diff changeset
     7
	classVariableNames:'HandleExtent'
d970c06282d7 initial checkin
ca
parents:
diff changeset
     8
	poolDictionaries:''
d970c06282d7 initial checkin
ca
parents:
diff changeset
     9
	category:'A-Views-Support'
d970c06282d7 initial checkin
ca
parents:
diff changeset
    10
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
    11
d970c06282d7 initial checkin
ca
parents:
diff changeset
    12
!ViewTreeItem class methodsFor:'documentation'!
d970c06282d7 initial checkin
ca
parents:
diff changeset
    13
d970c06282d7 initial checkin
ca
parents:
diff changeset
    14
documentation
d970c06282d7 initial checkin
ca
parents:
diff changeset
    15
"
d970c06282d7 initial checkin
ca
parents:
diff changeset
    16
    ViewTreeItems represants a pickable object within a ViewTreeModel.
d970c06282d7 initial checkin
ca
parents:
diff changeset
    17
    The class is used to build up the hierarchical tree.
d970c06282d7 initial checkin
ca
parents:
diff changeset
    18
d970c06282d7 initial checkin
ca
parents:
diff changeset
    19
    [Instance variables:]
d970c06282d7 initial checkin
ca
parents:
diff changeset
    20
        widget        <View>            the widget represented by the item
d970c06282d7 initial checkin
ca
parents:
diff changeset
    21
        spec          <UISpecification> the UISpecification or nil
d970c06282d7 initial checkin
ca
parents:
diff changeset
    22
d970c06282d7 initial checkin
ca
parents:
diff changeset
    23
    [Class variables:]
d970c06282d7 initial checkin
ca
parents:
diff changeset
    24
        HandleExtent  <Point>           keeps the extent of a handle
d970c06282d7 initial checkin
ca
parents:
diff changeset
    25
d970c06282d7 initial checkin
ca
parents:
diff changeset
    26
d970c06282d7 initial checkin
ca
parents:
diff changeset
    27
    [author:]
d970c06282d7 initial checkin
ca
parents:
diff changeset
    28
        Claus Atzkern
d970c06282d7 initial checkin
ca
parents:
diff changeset
    29
d970c06282d7 initial checkin
ca
parents:
diff changeset
    30
    [see also:]
d970c06282d7 initial checkin
ca
parents:
diff changeset
    31
        HierarchicalItem
d970c06282d7 initial checkin
ca
parents:
diff changeset
    32
        ViewTreeModel
d970c06282d7 initial checkin
ca
parents:
diff changeset
    33
"
d970c06282d7 initial checkin
ca
parents:
diff changeset
    34
! !
d970c06282d7 initial checkin
ca
parents:
diff changeset
    35
d970c06282d7 initial checkin
ca
parents:
diff changeset
    36
!ViewTreeItem class methodsFor:'initialization'!
d970c06282d7 initial checkin
ca
parents:
diff changeset
    37
d970c06282d7 initial checkin
ca
parents:
diff changeset
    38
initialize
d970c06282d7 initial checkin
ca
parents:
diff changeset
    39
    "set the extent of the Handle
d970c06282d7 initial checkin
ca
parents:
diff changeset
    40
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
    41
    HandleExtent := 6@6.
d970c06282d7 initial checkin
ca
parents:
diff changeset
    42
! !
d970c06282d7 initial checkin
ca
parents:
diff changeset
    43
d970c06282d7 initial checkin
ca
parents:
diff changeset
    44
!ViewTreeItem class methodsFor:'instance creation'!
d970c06282d7 initial checkin
ca
parents:
diff changeset
    45
d970c06282d7 initial checkin
ca
parents:
diff changeset
    46
forView:aView
d970c06282d7 initial checkin
ca
parents:
diff changeset
    47
    |item|
d970c06282d7 initial checkin
ca
parents:
diff changeset
    48
d970c06282d7 initial checkin
ca
parents:
diff changeset
    49
    item := self basicNew initialize.
d970c06282d7 initial checkin
ca
parents:
diff changeset
    50
    item forView:aView.
d970c06282d7 initial checkin
ca
parents:
diff changeset
    51
  ^ item
d970c06282d7 initial checkin
ca
parents:
diff changeset
    52
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
    53
d970c06282d7 initial checkin
ca
parents:
diff changeset
    54
new
d970c06282d7 initial checkin
ca
parents:
diff changeset
    55
    self error:'not allowed'.
d970c06282d7 initial checkin
ca
parents:
diff changeset
    56
  ^ nil
d970c06282d7 initial checkin
ca
parents:
diff changeset
    57
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
    58
d970c06282d7 initial checkin
ca
parents:
diff changeset
    59
on:aView withSpec:aSpec
d970c06282d7 initial checkin
ca
parents:
diff changeset
    60
    |item|
d970c06282d7 initial checkin
ca
parents:
diff changeset
    61
d970c06282d7 initial checkin
ca
parents:
diff changeset
    62
    item := self basicNew initialize.
d970c06282d7 initial checkin
ca
parents:
diff changeset
    63
    item on:aView withSpec:aSpec.
d970c06282d7 initial checkin
ca
parents:
diff changeset
    64
  ^ item
d970c06282d7 initial checkin
ca
parents:
diff changeset
    65
! !
d970c06282d7 initial checkin
ca
parents:
diff changeset
    66
d970c06282d7 initial checkin
ca
parents:
diff changeset
    67
!ViewTreeItem class methodsFor:'building'!
d970c06282d7 initial checkin
ca
parents:
diff changeset
    68
d970c06282d7 initial checkin
ca
parents:
diff changeset
    69
buildViewsFrom:aView
d970c06282d7 initial checkin
ca
parents:
diff changeset
    70
    "build the items starting from a source view;
d970c06282d7 initial checkin
ca
parents:
diff changeset
    71
     returns the anhor.
d970c06282d7 initial checkin
ca
parents:
diff changeset
    72
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
    73
    |item subViews subItems|
d970c06282d7 initial checkin
ca
parents:
diff changeset
    74
d970c06282d7 initial checkin
ca
parents:
diff changeset
    75
    aView isNil ifTrue:[^ nil].
d970c06282d7 initial checkin
ca
parents:
diff changeset
    76
d970c06282d7 initial checkin
ca
parents:
diff changeset
    77
    item     := self forView:aView.
d970c06282d7 initial checkin
ca
parents:
diff changeset
    78
    subViews := aView subViews.
d970c06282d7 initial checkin
ca
parents:
diff changeset
    79
d970c06282d7 initial checkin
ca
parents:
diff changeset
    80
    subViews notEmptyOrNil ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
    81
        subItems := OrderedCollection new.
d970c06282d7 initial checkin
ca
parents:
diff changeset
    82
        subViews do:[:aSubView|
d970c06282d7 initial checkin
ca
parents:
diff changeset
    83
            subItems add:(self buildViewsFrom:aSubView).
d970c06282d7 initial checkin
ca
parents:
diff changeset
    84
        ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
    85
        item children:subItems.
d970c06282d7 initial checkin
ca
parents:
diff changeset
    86
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
    87
    ^ item
d970c06282d7 initial checkin
ca
parents:
diff changeset
    88
! !
d970c06282d7 initial checkin
ca
parents:
diff changeset
    89
d970c06282d7 initial checkin
ca
parents:
diff changeset
    90
!ViewTreeItem methodsFor:'accessing'!
d970c06282d7 initial checkin
ca
parents:
diff changeset
    91
d970c06282d7 initial checkin
ca
parents:
diff changeset
    92
applicationClass
d970c06282d7 initial checkin
ca
parents:
diff changeset
    93
    |appl|
d970c06282d7 initial checkin
ca
parents:
diff changeset
    94
d970c06282d7 initial checkin
ca
parents:
diff changeset
    95
    widget notNil ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
    96
        appl := widget application.
d970c06282d7 initial checkin
ca
parents:
diff changeset
    97
        appl notNil ifTrue:[^ appl class ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
    98
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
    99
    ^ nil
d970c06282d7 initial checkin
ca
parents:
diff changeset
   100
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   101
d970c06282d7 initial checkin
ca
parents:
diff changeset
   102
isDrawnShown
d970c06282d7 initial checkin
ca
parents:
diff changeset
   103
    "returns true if the last display operations was done during the widget was shown
d970c06282d7 initial checkin
ca
parents:
diff changeset
   104
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
   105
    ^ isDrawnShown
d970c06282d7 initial checkin
ca
parents:
diff changeset
   106
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   107
d970c06282d7 initial checkin
ca
parents:
diff changeset
   108
isDrawnShown:aBoolean
d970c06282d7 initial checkin
ca
parents:
diff changeset
   109
    isDrawnShown := aBoolean.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   110
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   111
d970c06282d7 initial checkin
ca
parents:
diff changeset
   112
rootView
d970c06282d7 initial checkin
ca
parents:
diff changeset
   113
    "returns the widget assigned to the root or nil
d970c06282d7 initial checkin
ca
parents:
diff changeset
   114
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
   115
    ^ parent rootView
d970c06282d7 initial checkin
ca
parents:
diff changeset
   116
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   117
d970c06282d7 initial checkin
ca
parents:
diff changeset
   118
specClass
d970c06282d7 initial checkin
ca
parents:
diff changeset
   119
    "returns the spec-class assigned to the item
d970c06282d7 initial checkin
ca
parents:
diff changeset
   120
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
   121
    ^ widget specClass
d970c06282d7 initial checkin
ca
parents:
diff changeset
   122
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   123
d970c06282d7 initial checkin
ca
parents:
diff changeset
   124
treeModel
d970c06282d7 initial checkin
ca
parents:
diff changeset
   125
    "returns the assigned treeModel, an instance of ViewTreeModel
d970c06282d7 initial checkin
ca
parents:
diff changeset
   126
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
   127
    ^ parent treeModel
d970c06282d7 initial checkin
ca
parents:
diff changeset
   128
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   129
d970c06282d7 initial checkin
ca
parents:
diff changeset
   130
widget
d970c06282d7 initial checkin
ca
parents:
diff changeset
   131
    "returns the widget assigned to the item
d970c06282d7 initial checkin
ca
parents:
diff changeset
   132
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
   133
    ^ widget
d970c06282d7 initial checkin
ca
parents:
diff changeset
   134
! !
d970c06282d7 initial checkin
ca
parents:
diff changeset
   135
d970c06282d7 initial checkin
ca
parents:
diff changeset
   136
!ViewTreeItem methodsFor:'accessing layout'!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   137
d970c06282d7 initial checkin
ca
parents:
diff changeset
   138
boundsRelativeToRoot
d970c06282d7 initial checkin
ca
parents:
diff changeset
   139
    "returns the bounds relative to the root widget
d970c06282d7 initial checkin
ca
parents:
diff changeset
   140
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
   141
    ^ self originRelativeToRoot extent:(widget extent)
d970c06282d7 initial checkin
ca
parents:
diff changeset
   142
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   143
d970c06282d7 initial checkin
ca
parents:
diff changeset
   144
cornerRelativeToRoot
d970c06282d7 initial checkin
ca
parents:
diff changeset
   145
    "returns the corner relative to the root widget
d970c06282d7 initial checkin
ca
parents:
diff changeset
   146
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
   147
    ^ self originRelativeToRoot + (widget extent)
d970c06282d7 initial checkin
ca
parents:
diff changeset
   148
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   149
d970c06282d7 initial checkin
ca
parents:
diff changeset
   150
extent
d970c06282d7 initial checkin
ca
parents:
diff changeset
   151
    "returns the extent of the widget
d970c06282d7 initial checkin
ca
parents:
diff changeset
   152
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
   153
    ^ widget extent
d970c06282d7 initial checkin
ca
parents:
diff changeset
   154
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   155
d970c06282d7 initial checkin
ca
parents:
diff changeset
   156
layoutType
d970c06282d7 initial checkin
ca
parents:
diff changeset
   157
    "returns the type of layout assigned to the wiget; nil if the
d970c06282d7 initial checkin
ca
parents:
diff changeset
   158
     superView cannot resize its sub widgets
d970c06282d7 initial checkin
ca
parents:
diff changeset
   159
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
   160
    |layout specClass superView|
d970c06282d7 initial checkin
ca
parents:
diff changeset
   161
d970c06282d7 initial checkin
ca
parents:
diff changeset
   162
    (superView := widget superView) isNil ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   163
        ^ #Extent
d970c06282d7 initial checkin
ca
parents:
diff changeset
   164
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   165
        
d970c06282d7 initial checkin
ca
parents:
diff changeset
   166
    specClass := superView specClass.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   167
d970c06282d7 initial checkin
ca
parents:
diff changeset
   168
    (specClass notNil and:[specClass isLayoutContainer]) ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   169
        ^ specClass canResizeSubComponents ifTrue:[#Extent] ifFalse:[nil]
d970c06282d7 initial checkin
ca
parents:
diff changeset
   170
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   171
d970c06282d7 initial checkin
ca
parents:
diff changeset
   172
    (layout := widget geometryLayout) isNil ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   173
        ^ #Extent
d970c06282d7 initial checkin
ca
parents:
diff changeset
   174
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   175
d970c06282d7 initial checkin
ca
parents:
diff changeset
   176
    layout isLayout ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   177
        layout isLayoutFrame        ifTrue:[ ^ #LayoutFrame ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   178
        layout isAlignmentOrigin    ifTrue:[ ^ #AlignmentOrigin ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   179
        layout isLayoutOrigin       ifTrue:[ ^ #LayoutOrigin ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   180
    ] ifFalse:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   181
        layout isRectangle          ifTrue:[ ^ #Rectangle ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   182
        layout isPoint              ifTrue:[ ^ #Point ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   183
d970c06282d7 initial checkin
ca
parents:
diff changeset
   184
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   185
    Transcript showCR:'UNSUPPORTRD LAYOUT: ', layout printString.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   186
  ^ nil
d970c06282d7 initial checkin
ca
parents:
diff changeset
   187
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   188
d970c06282d7 initial checkin
ca
parents:
diff changeset
   189
originRelativeToRoot
d970c06282d7 initial checkin
ca
parents:
diff changeset
   190
    "returns the origin relative to the root widget
d970c06282d7 initial checkin
ca
parents:
diff changeset
   191
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
   192
    ^ widget originRelativeTo:(self rootView)
d970c06282d7 initial checkin
ca
parents:
diff changeset
   193
! !
d970c06282d7 initial checkin
ca
parents:
diff changeset
   194
d970c06282d7 initial checkin
ca
parents:
diff changeset
   195
!ViewTreeItem methodsFor:'accessing optimize'!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   196
d970c06282d7 initial checkin
ca
parents:
diff changeset
   197
children
d970c06282d7 initial checkin
ca
parents:
diff changeset
   198
    "redefined: optimize
d970c06282d7 initial checkin
ca
parents:
diff changeset
   199
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
   200
    ^ children
d970c06282d7 initial checkin
ca
parents:
diff changeset
   201
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   202
d970c06282d7 initial checkin
ca
parents:
diff changeset
   203
hasChildren
d970c06282d7 initial checkin
ca
parents:
diff changeset
   204
    |subViews list item|
d970c06282d7 initial checkin
ca
parents:
diff changeset
   205
d970c06282d7 initial checkin
ca
parents:
diff changeset
   206
    children size ~~ 0 ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   207
        ^ true
d970c06282d7 initial checkin
ca
parents:
diff changeset
   208
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   209
    isExpanded := false.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   210
    subViews   := widget subViews.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   211
d970c06282d7 initial checkin
ca
parents:
diff changeset
   212
    subViews size == 0 ifTrue:[^ false].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   213
d970c06282d7 initial checkin
ca
parents:
diff changeset
   214
    list := OrderedCollection new.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   215
d970c06282d7 initial checkin
ca
parents:
diff changeset
   216
    subViews do:[:aSubView|
d970c06282d7 initial checkin
ca
parents:
diff changeset
   217
        item := self class buildViewsFrom:aSubView.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   218
        item parent:self.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   219
        list add:item.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   220
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   221
    children := list.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   222
    ^ true
d970c06282d7 initial checkin
ca
parents:
diff changeset
   223
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   224
d970c06282d7 initial checkin
ca
parents:
diff changeset
   225
size
d970c06282d7 initial checkin
ca
parents:
diff changeset
   226
    "redefined: returns list of children
d970c06282d7 initial checkin
ca
parents:
diff changeset
   227
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
   228
    ^ children size
d970c06282d7 initial checkin
ca
parents:
diff changeset
   229
! !
d970c06282d7 initial checkin
ca
parents:
diff changeset
   230
d970c06282d7 initial checkin
ca
parents:
diff changeset
   231
!ViewTreeItem methodsFor:'displaying'!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   232
2452
7892f26996b7 *** empty log message ***
ca
parents: 2405
diff changeset
   233
additionalLabelForItem:anItem
7892f26996b7 *** empty log message ***
ca
parents: 2405
diff changeset
   234
    "answer an additional item for an Item or nil"
7892f26996b7 *** empty log message ***
ca
parents: 2405
diff changeset
   235
7892f26996b7 *** empty log message ***
ca
parents: 2405
diff changeset
   236
    parent notNil ifTrue:[
7892f26996b7 *** empty log message ***
ca
parents: 2405
diff changeset
   237
        ^ parent additionalLabelForItem:anItem
7892f26996b7 *** empty log message ***
ca
parents: 2405
diff changeset
   238
    ].
7892f26996b7 *** empty log message ***
ca
parents: 2405
diff changeset
   239
    ^ nil
7892f26996b7 *** empty log message ***
ca
parents: 2405
diff changeset
   240
!
7892f26996b7 *** empty log message ***
ca
parents: 2405
diff changeset
   241
2456
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   242
displayIcon:anIcon atX:x y:y on:aGC
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   243
    |x0 y0 y1 w|
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   244
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   245
    super displayIcon:anIcon atX:x y:y on:aGC.
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   246
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   247
    self exists ifFalse:[
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   248
        aGC paint:(Color red).
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   249
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   250
        y0 := y + 1.
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   251
        y1 := y + anIcon height - 2.
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   252
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   253
        x0 := x - 1.
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   254
        w  := anIcon width.
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   255
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   256
        2 timesRepeat:[
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   257
            aGC displayLineFromX:x0 y:y0 toX:(x0 + w) y:y1.
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   258
            aGC displayLineFromX:x0 y:y1 toX:(x0 + w) y:y0.
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   259
            x0 := x0 + 1.
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   260
        ].
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   261
    ].
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   262
!
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   263
2178
d970c06282d7 initial checkin
ca
parents:
diff changeset
   264
displayOn:aGC x:x y:y h:h
2456
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   265
    |labelHeight additionalName label isValidAndShown|
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   266
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   267
    label := self label.
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   268
    label isEmptyOrNil ifTrue:[^ self].
2178
d970c06282d7 initial checkin
ca
parents:
diff changeset
   269
d970c06282d7 initial checkin
ca
parents:
diff changeset
   270
    widget id isNil ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   271
        isDrawnShown := false.
2456
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   272
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   273
        self exists ifFalse:[
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   274
            xOffsetAdditionalName := nil.
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   275
        ].
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   276
        isValidAndShown := false.
2178
d970c06282d7 initial checkin
ca
parents:
diff changeset
   277
    ] ifFalse:[
2456
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   278
        isValidAndShown := widget shown.
2178
d970c06282d7 initial checkin
ca
parents:
diff changeset
   279
    ].
2456
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   280
    isValidAndShown ifFalse:[
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   281
        label := Text string:label emphasis:#italic
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   282
    ].
2178
d970c06282d7 initial checkin
ca
parents:
diff changeset
   283
d970c06282d7 initial checkin
ca
parents:
diff changeset
   284
    labelHeight := self heightOn:aGC.
2456
3d8a5dd293ba donot change color during drawing...
ca
parents: 2452
diff changeset
   285
    self displayLabel:label h:labelHeight on:aGC x:x y:y h:h.
2178
d970c06282d7 initial checkin
ca
parents:
diff changeset
   286
2452
7892f26996b7 *** empty log message ***
ca
parents: 2405
diff changeset
   287
    xOffsetAdditionalName notNil ifTrue:[
7892f26996b7 *** empty log message ***
ca
parents: 2405
diff changeset
   288
        additionalName := self additionalLabelForItem:self.
7892f26996b7 *** empty log message ***
ca
parents: 2405
diff changeset
   289
7892f26996b7 *** empty log message ***
ca
parents: 2405
diff changeset
   290
        additionalName notNil ifTrue:[
7892f26996b7 *** empty log message ***
ca
parents: 2405
diff changeset
   291
            self displayLabel:additionalName
2178
d970c06282d7 initial checkin
ca
parents:
diff changeset
   292
                            h:labelHeight on:aGC
2452
7892f26996b7 *** empty log message ***
ca
parents: 2405
diff changeset
   293
                            x:(x + xOffsetAdditionalName)
2178
d970c06282d7 initial checkin
ca
parents:
diff changeset
   294
                            y:y
d970c06282d7 initial checkin
ca
parents:
diff changeset
   295
                            h:h.
2452
7892f26996b7 *** empty log message ***
ca
parents: 2405
diff changeset
   296
        ] ifFalse:[
7892f26996b7 *** empty log message ***
ca
parents: 2405
diff changeset
   297
            xOffsetAdditionalName := nil.
2178
d970c06282d7 initial checkin
ca
parents:
diff changeset
   298
        ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   299
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   300
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   301
2452
7892f26996b7 *** empty log message ***
ca
parents: 2405
diff changeset
   302
recursiveAdditionalNameBehaviourChanged
7892f26996b7 *** empty log message ***
ca
parents: 2405
diff changeset
   303
    width := xOffsetAdditionalName := nil.
2405
ec54aeed9a42 *** empty log message ***
ca
parents: 2178
diff changeset
   304
2452
7892f26996b7 *** empty log message ***
ca
parents: 2405
diff changeset
   305
    children notNil ifTrue:[
7892f26996b7 *** empty log message ***
ca
parents: 2405
diff changeset
   306
        children do:[:each| each recursiveAdditionalNameBehaviourChanged ]
2405
ec54aeed9a42 *** empty log message ***
ca
parents: 2178
diff changeset
   307
    ].
ec54aeed9a42 *** empty log message ***
ca
parents: 2178
diff changeset
   308
!
ec54aeed9a42 *** empty log message ***
ca
parents: 2178
diff changeset
   309
2178
d970c06282d7 initial checkin
ca
parents:
diff changeset
   310
widthOn:aGC
d970c06282d7 initial checkin
ca
parents:
diff changeset
   311
    "return the width of the receiver, if it is to be displayed on aGC
d970c06282d7 initial checkin
ca
parents:
diff changeset
   312
    "
2452
7892f26996b7 *** empty log message ***
ca
parents: 2405
diff changeset
   313
    |additionalName|
2405
ec54aeed9a42 *** empty log message ***
ca
parents: 2178
diff changeset
   314
2178
d970c06282d7 initial checkin
ca
parents:
diff changeset
   315
    width isNil ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   316
        width := self widthOf:(self label) on:aGC.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   317
        width := width + 2.
2405
ec54aeed9a42 *** empty log message ***
ca
parents: 2178
diff changeset
   318
2452
7892f26996b7 *** empty log message ***
ca
parents: 2405
diff changeset
   319
        additionalName := self additionalLabelForItem:self.
2405
ec54aeed9a42 *** empty log message ***
ca
parents: 2178
diff changeset
   320
2452
7892f26996b7 *** empty log message ***
ca
parents: 2405
diff changeset
   321
        additionalName notNil ifTrue:[
7892f26996b7 *** empty log message ***
ca
parents: 2405
diff changeset
   322
            xOffsetAdditionalName := width + 10.
7892f26996b7 *** empty log message ***
ca
parents: 2405
diff changeset
   323
            width := xOffsetAdditionalName + (self widthOf:additionalName on:aGC).
2405
ec54aeed9a42 *** empty log message ***
ca
parents: 2178
diff changeset
   324
            width := width + 2.
2452
7892f26996b7 *** empty log message ***
ca
parents: 2405
diff changeset
   325
        ] ifFalse:[
7892f26996b7 *** empty log message ***
ca
parents: 2405
diff changeset
   326
            xOffsetAdditionalName := nil.
2405
ec54aeed9a42 *** empty log message ***
ca
parents: 2178
diff changeset
   327
        ].
2178
d970c06282d7 initial checkin
ca
parents:
diff changeset
   328
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   329
    ^ width
d970c06282d7 initial checkin
ca
parents:
diff changeset
   330
! !
d970c06282d7 initial checkin
ca
parents:
diff changeset
   331
d970c06282d7 initial checkin
ca
parents:
diff changeset
   332
!ViewTreeItem methodsFor:'enumerating'!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   333
d970c06282d7 initial checkin
ca
parents:
diff changeset
   334
handlesDo:aTwoArgAction
d970c06282d7 initial checkin
ca
parents:
diff changeset
   335
    "evaluate the two arg block on each handle; the arguments to the block is
d970c06282d7 initial checkin
ca
parents:
diff changeset
   336
     the rectangle relative to the rootView and the handle type which is
d970c06282d7 initial checkin
ca
parents:
diff changeset
   337
     set to nil if not resizeable.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   338
d970c06282d7 initial checkin
ca
parents:
diff changeset
   339
     TYPES:     type    position( X - Y )
d970c06282d7 initial checkin
ca
parents:
diff changeset
   340
                -------------------------        
d970c06282d7 initial checkin
ca
parents:
diff changeset
   341
                #LT     Left   - Top
d970c06282d7 initial checkin
ca
parents:
diff changeset
   342
                #LC     Left   - Center
d970c06282d7 initial checkin
ca
parents:
diff changeset
   343
                #LB     Left   - Bottom
d970c06282d7 initial checkin
ca
parents:
diff changeset
   344
                #CT     Center - Top
d970c06282d7 initial checkin
ca
parents:
diff changeset
   345
                #CB     Center - Bottom
d970c06282d7 initial checkin
ca
parents:
diff changeset
   346
                #RT     Right  - Top
d970c06282d7 initial checkin
ca
parents:
diff changeset
   347
                #RC     Right  - Center
d970c06282d7 initial checkin
ca
parents:
diff changeset
   348
                #RB     Right  - Bottom
d970c06282d7 initial checkin
ca
parents:
diff changeset
   349
d970c06282d7 initial checkin
ca
parents:
diff changeset
   350
                nil     ** handle not pickable **
d970c06282d7 initial checkin
ca
parents:
diff changeset
   351
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
   352
    |type relOrg relCrn maxExt rootView w h
d970c06282d7 initial checkin
ca
parents:
diff changeset
   353
     xL    "{ Class:SmallInteger }"
d970c06282d7 initial checkin
ca
parents:
diff changeset
   354
     xC    "{ Class:SmallInteger }"
d970c06282d7 initial checkin
ca
parents:
diff changeset
   355
     xR    "{ Class:SmallInteger }"
d970c06282d7 initial checkin
ca
parents:
diff changeset
   356
     yT    "{ Class:SmallInteger }"
d970c06282d7 initial checkin
ca
parents:
diff changeset
   357
     yC    "{ Class:SmallInteger }"
d970c06282d7 initial checkin
ca
parents:
diff changeset
   358
     yB    "{ Class:SmallInteger }"
d970c06282d7 initial checkin
ca
parents:
diff changeset
   359
    |
d970c06282d7 initial checkin
ca
parents:
diff changeset
   360
    rootView := self rootView.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   361
    relOrg   := widget originRelativeTo:rootView.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   362
    relOrg isNil ifTrue:[ ^ self ].    "/ widget destroyed
d970c06282d7 initial checkin
ca
parents:
diff changeset
   363
d970c06282d7 initial checkin
ca
parents:
diff changeset
   364
    relOrg   := relOrg - (HandleExtent // 2).
d970c06282d7 initial checkin
ca
parents:
diff changeset
   365
    relCrn   := relOrg + widget extent.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   366
    maxExt   := rootView extent - HandleExtent.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   367
d970c06282d7 initial checkin
ca
parents:
diff changeset
   368
    xL := relOrg x max:0.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   369
    xR := relCrn x min:(maxExt x).
d970c06282d7 initial checkin
ca
parents:
diff changeset
   370
    xC := xR + xL // 2.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   371
d970c06282d7 initial checkin
ca
parents:
diff changeset
   372
    yT := relOrg y max:0.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   373
    yB := relCrn y min:(maxExt y).
d970c06282d7 initial checkin
ca
parents:
diff changeset
   374
    yC := yB + yT // 2.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   375
d970c06282d7 initial checkin
ca
parents:
diff changeset
   376
    type := self layoutType.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   377
    w   := HandleExtent x.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   378
    h   := HandleExtent y.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   379
d970c06282d7 initial checkin
ca
parents:
diff changeset
   380
    (type == #LayoutFrame or:[type == #Rectangle]) ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   381
        aTwoArgAction value:(Rectangle left:xL top:yT width:w height:h) value:#LT.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   382
        aTwoArgAction value:(Rectangle left:xL top:yC width:w height:h) value:#LC.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   383
        aTwoArgAction value:(Rectangle left:xL top:yB width:w height:h) value:#LB.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   384
        aTwoArgAction value:(Rectangle left:xC top:yT width:w height:h) value:#CT.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   385
        aTwoArgAction value:(Rectangle left:xC top:yB width:w height:h) value:#CB.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   386
        aTwoArgAction value:(Rectangle left:xR top:yT width:w height:h) value:#RT.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   387
        aTwoArgAction value:(Rectangle left:xR top:yC width:w height:h) value:#RC.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   388
        aTwoArgAction value:(Rectangle left:xR top:yB width:w height:h) value:#RB.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   389
      ^ self
d970c06282d7 initial checkin
ca
parents:
diff changeset
   390
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   391
d970c06282d7 initial checkin
ca
parents:
diff changeset
   392
    aTwoArgAction value:(Rectangle left:xL top:yT width:w height:h) value:nil.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   393
    aTwoArgAction value:(Rectangle left:xL top:yB width:w height:h) value:nil.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   394
    aTwoArgAction value:(Rectangle left:xR top:yT width:w height:h) value:nil.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   395
d970c06282d7 initial checkin
ca
parents:
diff changeset
   396
    type == #Extent ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   397
        aTwoArgAction value:(Rectangle left:xC top:yB width:w height:h) value:#CB.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   398
        aTwoArgAction value:(Rectangle left:xR top:yC width:w height:h) value:#RC.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   399
        aTwoArgAction value:(Rectangle left:xR top:yB width:w height:h) value:#RB.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   400
      ^ self
d970c06282d7 initial checkin
ca
parents:
diff changeset
   401
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   402
    aTwoArgAction value:(Rectangle left:xR top:yB width:w height:h) value:nil.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   403
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   404
d970c06282d7 initial checkin
ca
parents:
diff changeset
   405
recursiveEachVisibleItemDo:anOneArgBlock
d970c06282d7 initial checkin
ca
parents:
diff changeset
   406
    "recursive evaluate the block on each child which is visible
d970c06282d7 initial checkin
ca
parents:
diff changeset
   407
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
   408
    (isExpanded and:[children size > 0]) ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   409
        children do:[:aChild|
d970c06282d7 initial checkin
ca
parents:
diff changeset
   410
            anOneArgBlock value:aChild.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   411
            aChild recursiveEachVisibleItemDo:anOneArgBlock.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   412
        ]
d970c06282d7 initial checkin
ca
parents:
diff changeset
   413
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   414
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   415
d970c06282d7 initial checkin
ca
parents:
diff changeset
   416
subViewsDo:aOneArgBlock
d970c06282d7 initial checkin
ca
parents:
diff changeset
   417
    "evaluate aBlock for all subviews other than InputView's   
d970c06282d7 initial checkin
ca
parents:
diff changeset
   418
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
   419
    |subViews|
d970c06282d7 initial checkin
ca
parents:
diff changeset
   420
d970c06282d7 initial checkin
ca
parents:
diff changeset
   421
    subViews := widget subViews.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   422
d970c06282d7 initial checkin
ca
parents:
diff changeset
   423
    subViews notNil ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   424
        subViews do:aOneArgBlock
d970c06282d7 initial checkin
ca
parents:
diff changeset
   425
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   426
! !
d970c06282d7 initial checkin
ca
parents:
diff changeset
   427
d970c06282d7 initial checkin
ca
parents:
diff changeset
   428
!ViewTreeItem methodsFor:'initialization'!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   429
d970c06282d7 initial checkin
ca
parents:
diff changeset
   430
forView:aView
d970c06282d7 initial checkin
ca
parents:
diff changeset
   431
    widget := aView.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   432
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   433
d970c06282d7 initial checkin
ca
parents:
diff changeset
   434
initialize
d970c06282d7 initial checkin
ca
parents:
diff changeset
   435
    "setup default attributes
d970c06282d7 initial checkin
ca
parents:
diff changeset
   436
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
   437
    super initialize.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   438
    isDrawnShown := false.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   439
    isExpanded   := false.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   440
    children     := OrderedCollection new.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   441
! !
d970c06282d7 initial checkin
ca
parents:
diff changeset
   442
d970c06282d7 initial checkin
ca
parents:
diff changeset
   443
!ViewTreeItem methodsFor:'operations delete'!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   444
d970c06282d7 initial checkin
ca
parents:
diff changeset
   445
delete
d970c06282d7 initial checkin
ca
parents:
diff changeset
   446
    "delete self and all contained items; the assigned views are destroyed
d970c06282d7 initial checkin
ca
parents:
diff changeset
   447
     in case of rootView, only the children are deleted
d970c06282d7 initial checkin
ca
parents:
diff changeset
   448
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
   449
    parent isHierarchicalItem ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   450
        self criticalDo:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   451
            parent remove:self.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   452
            widget destroy.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   453
        ]
d970c06282d7 initial checkin
ca
parents:
diff changeset
   454
    ] ifFalse:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   455
        self deleteAll
d970c06282d7 initial checkin
ca
parents:
diff changeset
   456
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   457
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   458
d970c06282d7 initial checkin
ca
parents:
diff changeset
   459
deleteAll
d970c06282d7 initial checkin
ca
parents:
diff changeset
   460
    "delete all contained items; the assigned views are destroyed
d970c06282d7 initial checkin
ca
parents:
diff changeset
   461
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
   462
    children size == 0 ifTrue:[^ self].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   463
d970c06282d7 initial checkin
ca
parents:
diff changeset
   464
    self criticalDo:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   465
        self nonCriticalDo:[:el| el widget destroy ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   466
        self removeAll
d970c06282d7 initial checkin
ca
parents:
diff changeset
   467
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   468
! !
d970c06282d7 initial checkin
ca
parents:
diff changeset
   469
d970c06282d7 initial checkin
ca
parents:
diff changeset
   470
!ViewTreeItem methodsFor:'operations layout'!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   471
d970c06282d7 initial checkin
ca
parents:
diff changeset
   472
asLayoutFrame
d970c06282d7 initial checkin
ca
parents:
diff changeset
   473
    "convert the layout of the widget to a LayoutFrame;
d970c06282d7 initial checkin
ca
parents:
diff changeset
   474
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
   475
    |extent layout newLyt lftFrc lftOff topFrc topOff|
d970c06282d7 initial checkin
ca
parents:
diff changeset
   476
d970c06282d7 initial checkin
ca
parents:
diff changeset
   477
    layout := widget geometryLayout.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   478
d970c06282d7 initial checkin
ca
parents:
diff changeset
   479
    layout isNil ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   480
        ^ widget bounds asLayout
d970c06282d7 initial checkin
ca
parents:
diff changeset
   481
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   482
d970c06282d7 initial checkin
ca
parents:
diff changeset
   483
    layout isLayout ifFalse:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   484
        layout isRectangle ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   485
            ^ LayoutFrame leftOffset:(layout left) rightOffset:(layout right)
d970c06282d7 initial checkin
ca
parents:
diff changeset
   486
                           topOffset:(layout top) bottomOffset:(layout bottom)
d970c06282d7 initial checkin
ca
parents:
diff changeset
   487
        ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   488
        layout isPoint ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   489
            extent := widget extent.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   490
          ^ LayoutFrame leftOffset:(layout x)  rightOffset:(layout x + extent x)
d970c06282d7 initial checkin
ca
parents:
diff changeset
   491
                         topOffset:(layout y) bottomOffset:(layout y + extent y)
d970c06282d7 initial checkin
ca
parents:
diff changeset
   492
        ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   493
d970c06282d7 initial checkin
ca
parents:
diff changeset
   494
        Transcript showCR:'UNSUPPORTRD LAYOUT: ', layout printString.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   495
      ^ nil
d970c06282d7 initial checkin
ca
parents:
diff changeset
   496
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   497
d970c06282d7 initial checkin
ca
parents:
diff changeset
   498
    layout isLayoutFrame ifTrue:[ ^ layout copy ].    
d970c06282d7 initial checkin
ca
parents:
diff changeset
   499
d970c06282d7 initial checkin
ca
parents:
diff changeset
   500
    lftFrc := layout leftFraction.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   501
    lftOff := layout leftOffset.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   502
    topFrc := layout topFraction.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   503
    topOff := layout topOffset.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   504
    extent := widget extent.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   505
d970c06282d7 initial checkin
ca
parents:
diff changeset
   506
    newLyt := LayoutFrame leftFraction:lftFrc offset:lftOff
d970c06282d7 initial checkin
ca
parents:
diff changeset
   507
                         rightFraction:lftFrc offset:(lftOff + extent x)
d970c06282d7 initial checkin
ca
parents:
diff changeset
   508
                           topFraction:topFrc offset:topOff
d970c06282d7 initial checkin
ca
parents:
diff changeset
   509
                        bottomFraction:topFrc offset:(topOff + extent y).
d970c06282d7 initial checkin
ca
parents:
diff changeset
   510
d970c06282d7 initial checkin
ca
parents:
diff changeset
   511
    (      layout isAlignmentOrigin
d970c06282d7 initial checkin
ca
parents:
diff changeset
   512
     and:[(layout leftAlignmentFraction ~= 0 or:[layout topAlignmentFraction ~= 0])]
d970c06282d7 initial checkin
ca
parents:
diff changeset
   513
    ) ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   514
        |svRc prBd dlta|
d970c06282d7 initial checkin
ca
parents:
diff changeset
   515
d970c06282d7 initial checkin
ca
parents:
diff changeset
   516
        svRc := widget superView viewRectangle.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   517
        prBd := widget preferredBounds.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   518
d970c06282d7 initial checkin
ca
parents:
diff changeset
   519
        dlta := (  ((layout rectangleRelativeTo:svRc preferred:prBd) corner)
d970c06282d7 initial checkin
ca
parents:
diff changeset
   520
                 - ((newLyt rectangleRelativeTo:svRc preferred:prBd) corner)
d970c06282d7 initial checkin
ca
parents:
diff changeset
   521
                ) rounded.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   522
d970c06282d7 initial checkin
ca
parents:
diff changeset
   523
        newLyt   leftOffset:(lftOff + dlta x).
d970c06282d7 initial checkin
ca
parents:
diff changeset
   524
        newLyt  rightOffset:(lftOff + extent x + dlta x).
d970c06282d7 initial checkin
ca
parents:
diff changeset
   525
        newLyt    topOffset:(topOff + dlta y).
d970c06282d7 initial checkin
ca
parents:
diff changeset
   526
        newLyt bottomOffset:(topOff + extent y + dlta y).
d970c06282d7 initial checkin
ca
parents:
diff changeset
   527
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   528
    ^ newLyt
d970c06282d7 initial checkin
ca
parents:
diff changeset
   529
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   530
d970c06282d7 initial checkin
ca
parents:
diff changeset
   531
moveLeft:l top:t
d970c06282d7 initial checkin
ca
parents:
diff changeset
   532
    "move the widget n pixele left and right
d970c06282d7 initial checkin
ca
parents:
diff changeset
   533
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
   534
    |layout|
d970c06282d7 initial checkin
ca
parents:
diff changeset
   535
d970c06282d7 initial checkin
ca
parents:
diff changeset
   536
    self isMoveable ifFalse:[ ^ self ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   537
d970c06282d7 initial checkin
ca
parents:
diff changeset
   538
    (layout := widget geometryLayout) isNil ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   539
        "Extent"
d970c06282d7 initial checkin
ca
parents:
diff changeset
   540
        widget origin:(widget origin + (l@t)).
d970c06282d7 initial checkin
ca
parents:
diff changeset
   541
      ^ self
d970c06282d7 initial checkin
ca
parents:
diff changeset
   542
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   543
d970c06282d7 initial checkin
ca
parents:
diff changeset
   544
    layout := layout copy.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   545
d970c06282d7 initial checkin
ca
parents:
diff changeset
   546
    layout isLayout ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   547
        layout leftOffset:(layout leftOffset + l)
d970c06282d7 initial checkin
ca
parents:
diff changeset
   548
                topOffset:(layout topOffset  + t).
d970c06282d7 initial checkin
ca
parents:
diff changeset
   549
d970c06282d7 initial checkin
ca
parents:
diff changeset
   550
        layout isLayoutFrame ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   551
            layout  rightOffset:(layout rightOffset  + l).
d970c06282d7 initial checkin
ca
parents:
diff changeset
   552
            layout bottomOffset:(layout bottomOffset + t).
d970c06282d7 initial checkin
ca
parents:
diff changeset
   553
        ]
d970c06282d7 initial checkin
ca
parents:
diff changeset
   554
d970c06282d7 initial checkin
ca
parents:
diff changeset
   555
    ] ifFalse:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   556
        layout isRectangle ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   557
            layout setLeft:(layout left + l).
d970c06282d7 initial checkin
ca
parents:
diff changeset
   558
            layout  setTop:(layout top  + t).
d970c06282d7 initial checkin
ca
parents:
diff changeset
   559
        ] ifFalse:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   560
            layout isPoint ifFalse:[^ self].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   561
            layout x:(layout x + l) y:(layout y + t).
d970c06282d7 initial checkin
ca
parents:
diff changeset
   562
        ]
d970c06282d7 initial checkin
ca
parents:
diff changeset
   563
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   564
    widget geometryLayout:layout.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   565
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   566
d970c06282d7 initial checkin
ca
parents:
diff changeset
   567
resizeLeft:l top:t right:r bottom:b
d970c06282d7 initial checkin
ca
parents:
diff changeset
   568
    "resize the widget measured in pixels
d970c06282d7 initial checkin
ca
parents:
diff changeset
   569
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
   570
    |layout|
d970c06282d7 initial checkin
ca
parents:
diff changeset
   571
d970c06282d7 initial checkin
ca
parents:
diff changeset
   572
    self isResizeable ifFalse:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   573
        ^ self
d970c06282d7 initial checkin
ca
parents:
diff changeset
   574
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   575
d970c06282d7 initial checkin
ca
parents:
diff changeset
   576
    (layout := widget geometryLayout) isNil ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   577
        "Extent"
d970c06282d7 initial checkin
ca
parents:
diff changeset
   578
        (r == l and:[b == t]) ifFalse:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   579
            widget extent:(widget computeExtent + ((r-l) @ (b-t))).
d970c06282d7 initial checkin
ca
parents:
diff changeset
   580
        ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   581
        ^ self
d970c06282d7 initial checkin
ca
parents:
diff changeset
   582
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   583
d970c06282d7 initial checkin
ca
parents:
diff changeset
   584
    layout isLayout ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   585
        layout := layout copy.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   586
d970c06282d7 initial checkin
ca
parents:
diff changeset
   587
        layout leftOffset:(layout leftOffset + l)
d970c06282d7 initial checkin
ca
parents:
diff changeset
   588
                topOffset:(layout topOffset  + t).
d970c06282d7 initial checkin
ca
parents:
diff changeset
   589
d970c06282d7 initial checkin
ca
parents:
diff changeset
   590
        layout isLayoutFrame ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   591
            layout bottomOffset:(layout bottomOffset + b).
d970c06282d7 initial checkin
ca
parents:
diff changeset
   592
            layout  rightOffset:(layout rightOffset  + r).
d970c06282d7 initial checkin
ca
parents:
diff changeset
   593
        ]
d970c06282d7 initial checkin
ca
parents:
diff changeset
   594
    ] ifFalse:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   595
        layout isRectangle ifFalse:[^ self].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   596
        layout := layout copy.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   597
d970c06282d7 initial checkin
ca
parents:
diff changeset
   598
        layout left:(layout left   + l)
d970c06282d7 initial checkin
ca
parents:
diff changeset
   599
              right:(layout right  + r)
d970c06282d7 initial checkin
ca
parents:
diff changeset
   600
                top:(layout top    + t)
d970c06282d7 initial checkin
ca
parents:
diff changeset
   601
             bottom:(layout bottom + b).
d970c06282d7 initial checkin
ca
parents:
diff changeset
   602
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   603
    widget geometryLayout:layout.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   604
! !
d970c06282d7 initial checkin
ca
parents:
diff changeset
   605
d970c06282d7 initial checkin
ca
parents:
diff changeset
   606
!ViewTreeItem methodsFor:'operations update'!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   607
d970c06282d7 initial checkin
ca
parents:
diff changeset
   608
updateChildren
d970c06282d7 initial checkin
ca
parents:
diff changeset
   609
    |list|
d970c06282d7 initial checkin
ca
parents:
diff changeset
   610
d970c06282d7 initial checkin
ca
parents:
diff changeset
   611
    self do:[:el|
d970c06282d7 initial checkin
ca
parents:
diff changeset
   612
        el exists ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   613
            el updateChildren.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   614
        ] ifFalse:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   615
            list isNil ifTrue:[list := OrderedCollection new].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   616
            list add:el.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   617
        ]
d970c06282d7 initial checkin
ca
parents:
diff changeset
   618
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   619
    list notNil ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   620
        list do:[:el| self remove:el ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   621
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   622
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   623
d970c06282d7 initial checkin
ca
parents:
diff changeset
   624
updateFromChildren:mergedList
d970c06282d7 initial checkin
ca
parents:
diff changeset
   625
    "update my children against the list of items derived from
d970c06282d7 initial checkin
ca
parents:
diff changeset
   626
     the merged list.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   627
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
   628
d970c06282d7 initial checkin
ca
parents:
diff changeset
   629
    mergedList size == 0 ifTrue:[ ^ self removeAll ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   630
    children   size == 0 ifTrue:[ ^ self addAll:mergedList ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   631
d970c06282d7 initial checkin
ca
parents:
diff changeset
   632
    self criticalDo:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   633
        self nonCriticalDo:[:el| |wdg|
d970c06282d7 initial checkin
ca
parents:
diff changeset
   634
            wdg := el widget.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   635
            mergedList detect:[:e2| e2 widget == wdg ] ifNone:[ self remove:el ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   636
        ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   637
d970c06282d7 initial checkin
ca
parents:
diff changeset
   638
        mergedList keysAndValuesDo:[:i :el| |wdg e2|
d970c06282d7 initial checkin
ca
parents:
diff changeset
   639
            wdg := el widget.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   640
d970c06282d7 initial checkin
ca
parents:
diff changeset
   641
            e2  := self at:i ifAbsent:nil.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   642
d970c06282d7 initial checkin
ca
parents:
diff changeset
   643
            (e2 isNil or:[e2 widget ~~ wdg]) ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   644
                self add:el beforeIndex:i
d970c06282d7 initial checkin
ca
parents:
diff changeset
   645
            ]
d970c06282d7 initial checkin
ca
parents:
diff changeset
   646
        ]
d970c06282d7 initial checkin
ca
parents:
diff changeset
   647
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   648
! !
d970c06282d7 initial checkin
ca
parents:
diff changeset
   649
d970c06282d7 initial checkin
ca
parents:
diff changeset
   650
!ViewTreeItem methodsFor:'printing & storing'!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   651
d970c06282d7 initial checkin
ca
parents:
diff changeset
   652
icon
d970c06282d7 initial checkin
ca
parents:
diff changeset
   653
    "get the icon used for presentation
d970c06282d7 initial checkin
ca
parents:
diff changeset
   654
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
   655
    |specClass model|
d970c06282d7 initial checkin
ca
parents:
diff changeset
   656
d970c06282d7 initial checkin
ca
parents:
diff changeset
   657
    specClass := self specClass.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   658
    specClass isNil ifTrue:[^ nil].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   659
d970c06282d7 initial checkin
ca
parents:
diff changeset
   660
    model := self treeModel.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   661
d970c06282d7 initial checkin
ca
parents:
diff changeset
   662
    model notNil ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   663
        ^ model iconAt:specClass ifNonePut:[specClass icon]
d970c06282d7 initial checkin
ca
parents:
diff changeset
   664
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   665
    ^ specClass icon
d970c06282d7 initial checkin
ca
parents:
diff changeset
   666
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   667
d970c06282d7 initial checkin
ca
parents:
diff changeset
   668
label
d970c06282d7 initial checkin
ca
parents:
diff changeset
   669
    "get the label used for presentation
d970c06282d7 initial checkin
ca
parents:
diff changeset
   670
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
   671
    ^ self string
d970c06282d7 initial checkin
ca
parents:
diff changeset
   672
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   673
d970c06282d7 initial checkin
ca
parents:
diff changeset
   674
printOn:aStream
d970c06282d7 initial checkin
ca
parents:
diff changeset
   675
    "append a a printed representation of the item to aStream
d970c06282d7 initial checkin
ca
parents:
diff changeset
   676
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
   677
    aStream nextPutAll:(self string)
d970c06282d7 initial checkin
ca
parents:
diff changeset
   678
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   679
d970c06282d7 initial checkin
ca
parents:
diff changeset
   680
string
d970c06282d7 initial checkin
ca
parents:
diff changeset
   681
    "get the string
d970c06282d7 initial checkin
ca
parents:
diff changeset
   682
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
   683
    ^ widget class name.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   684
! !
d970c06282d7 initial checkin
ca
parents:
diff changeset
   685
d970c06282d7 initial checkin
ca
parents:
diff changeset
   686
!ViewTreeItem methodsFor:'queries'!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   687
d970c06282d7 initial checkin
ca
parents:
diff changeset
   688
canChangeLayout
d970c06282d7 initial checkin
ca
parents:
diff changeset
   689
    "returns true if the layout of the widget can be changed and the
d970c06282d7 initial checkin
ca
parents:
diff changeset
   690
     layout is not organized by its superView
d970c06282d7 initial checkin
ca
parents:
diff changeset
   691
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
   692
    ^ self isResizeable
d970c06282d7 initial checkin
ca
parents:
diff changeset
   693
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   694
d970c06282d7 initial checkin
ca
parents:
diff changeset
   695
canResizeSubComponents
d970c06282d7 initial checkin
ca
parents:
diff changeset
   696
    "returns true if the widget can resize its sub components
d970c06282d7 initial checkin
ca
parents:
diff changeset
   697
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
   698
    |specClass|
d970c06282d7 initial checkin
ca
parents:
diff changeset
   699
d970c06282d7 initial checkin
ca
parents:
diff changeset
   700
    specClass := self specClass.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   701
d970c06282d7 initial checkin
ca
parents:
diff changeset
   702
    specClass notNil ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   703
        ^ specClass canResizeSubComponents
d970c06282d7 initial checkin
ca
parents:
diff changeset
   704
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   705
    ^ false
d970c06282d7 initial checkin
ca
parents:
diff changeset
   706
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   707
d970c06282d7 initial checkin
ca
parents:
diff changeset
   708
exists
d970c06282d7 initial checkin
ca
parents:
diff changeset
   709
    widget id notNil ifTrue:[^ true ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   710
d970c06282d7 initial checkin
ca
parents:
diff changeset
   711
    exists ~~ false ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   712
        exists := false.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   713
d970c06282d7 initial checkin
ca
parents:
diff changeset
   714
        widget superView notNil ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   715
            (parent isHierarchicalItem and:[parent exists]) ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   716
                exists := (parent widget subViews includesIdentical:widget).
d970c06282d7 initial checkin
ca
parents:
diff changeset
   717
            ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   718
        ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   719
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   720
    ^ exists
d970c06282d7 initial checkin
ca
parents:
diff changeset
   721
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   722
d970c06282d7 initial checkin
ca
parents:
diff changeset
   723
isApplicationClass
d970c06282d7 initial checkin
ca
parents:
diff changeset
   724
    |cls|
d970c06282d7 initial checkin
ca
parents:
diff changeset
   725
d970c06282d7 initial checkin
ca
parents:
diff changeset
   726
    cls := widget class.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   727
d970c06282d7 initial checkin
ca
parents:
diff changeset
   728
    ^ (    cls == ApplicationSubView
d970c06282d7 initial checkin
ca
parents:
diff changeset
   729
        or:[cls == ApplicationWindow
d970c06282d7 initial checkin
ca
parents:
diff changeset
   730
        or:[cls == SubCanvas]]
d970c06282d7 initial checkin
ca
parents:
diff changeset
   731
      ) 
d970c06282d7 initial checkin
ca
parents:
diff changeset
   732
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   733
d970c06282d7 initial checkin
ca
parents:
diff changeset
   734
isSelected
d970c06282d7 initial checkin
ca
parents:
diff changeset
   735
    |model|
d970c06282d7 initial checkin
ca
parents:
diff changeset
   736
d970c06282d7 initial checkin
ca
parents:
diff changeset
   737
    model := self treeModel.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   738
    model notNil ifTrue:[^ model isSelected:self].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   739
    ^ false
d970c06282d7 initial checkin
ca
parents:
diff changeset
   740
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   741
d970c06282d7 initial checkin
ca
parents:
diff changeset
   742
supportsSubComponents
d970c06282d7 initial checkin
ca
parents:
diff changeset
   743
    "returns true if the widget supports sub components
d970c06282d7 initial checkin
ca
parents:
diff changeset
   744
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
   745
    |specClass|
d970c06282d7 initial checkin
ca
parents:
diff changeset
   746
d970c06282d7 initial checkin
ca
parents:
diff changeset
   747
    widget isScrollWrapper ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   748
        ^ false
d970c06282d7 initial checkin
ca
parents:
diff changeset
   749
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   750
    specClass := self specClass.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   751
d970c06282d7 initial checkin
ca
parents:
diff changeset
   752
    specClass notNil ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   753
        ^ specClass supportsSubComponents
d970c06282d7 initial checkin
ca
parents:
diff changeset
   754
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   755
    ^ false
d970c06282d7 initial checkin
ca
parents:
diff changeset
   756
! !
d970c06282d7 initial checkin
ca
parents:
diff changeset
   757
d970c06282d7 initial checkin
ca
parents:
diff changeset
   758
!ViewTreeItem methodsFor:'testing'!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   759
d970c06282d7 initial checkin
ca
parents:
diff changeset
   760
isInLayoutContainer
d970c06282d7 initial checkin
ca
parents:
diff changeset
   761
    "returns true if the widget is in a layout container
d970c06282d7 initial checkin
ca
parents:
diff changeset
   762
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
   763
    |sv specClass|
d970c06282d7 initial checkin
ca
parents:
diff changeset
   764
d970c06282d7 initial checkin
ca
parents:
diff changeset
   765
    sv := widget superView.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   766
d970c06282d7 initial checkin
ca
parents:
diff changeset
   767
    sv notNil ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   768
        specClass := sv specClass.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   769
d970c06282d7 initial checkin
ca
parents:
diff changeset
   770
        specClass notNil ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   771
            ^ specClass isLayoutContainer
d970c06282d7 initial checkin
ca
parents:
diff changeset
   772
        ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   773
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   774
    ^ false
d970c06282d7 initial checkin
ca
parents:
diff changeset
   775
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   776
d970c06282d7 initial checkin
ca
parents:
diff changeset
   777
isLayoutContainer
d970c06282d7 initial checkin
ca
parents:
diff changeset
   778
    "answer whether corresponding view instances of the spec class can contain
d970c06282d7 initial checkin
ca
parents:
diff changeset
   779
     (and arrange) other view
d970c06282d7 initial checkin
ca
parents:
diff changeset
   780
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
   781
    |specClass|
d970c06282d7 initial checkin
ca
parents:
diff changeset
   782
d970c06282d7 initial checkin
ca
parents:
diff changeset
   783
    specClass := self specClass.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   784
d970c06282d7 initial checkin
ca
parents:
diff changeset
   785
    specClass notNil ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   786
        ^ specClass isLayoutContainer
d970c06282d7 initial checkin
ca
parents:
diff changeset
   787
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   788
    ^ false
d970c06282d7 initial checkin
ca
parents:
diff changeset
   789
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   790
d970c06282d7 initial checkin
ca
parents:
diff changeset
   791
isMoveable
d970c06282d7 initial checkin
ca
parents:
diff changeset
   792
    "returns true if the widget is not in a layout container
d970c06282d7 initial checkin
ca
parents:
diff changeset
   793
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
   794
    self isInLayoutContainer ifFalse:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   795
        ^ widget superView notNil
d970c06282d7 initial checkin
ca
parents:
diff changeset
   796
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   797
    ^ false
d970c06282d7 initial checkin
ca
parents:
diff changeset
   798
!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   799
d970c06282d7 initial checkin
ca
parents:
diff changeset
   800
isResizeable
d970c06282d7 initial checkin
ca
parents:
diff changeset
   801
    "returns true if the widget is resizeable
d970c06282d7 initial checkin
ca
parents:
diff changeset
   802
    "
d970c06282d7 initial checkin
ca
parents:
diff changeset
   803
    |sv specClass|
d970c06282d7 initial checkin
ca
parents:
diff changeset
   804
d970c06282d7 initial checkin
ca
parents:
diff changeset
   805
    sv := widget superView.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   806
d970c06282d7 initial checkin
ca
parents:
diff changeset
   807
    sv notNil ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   808
        specClass := sv specClass.
d970c06282d7 initial checkin
ca
parents:
diff changeset
   809
d970c06282d7 initial checkin
ca
parents:
diff changeset
   810
        specClass notNil ifTrue:[
d970c06282d7 initial checkin
ca
parents:
diff changeset
   811
            ^ specClass canResizeSubComponents
d970c06282d7 initial checkin
ca
parents:
diff changeset
   812
        ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   813
    ].
d970c06282d7 initial checkin
ca
parents:
diff changeset
   814
    ^ false
d970c06282d7 initial checkin
ca
parents:
diff changeset
   815
! !
d970c06282d7 initial checkin
ca
parents:
diff changeset
   816
d970c06282d7 initial checkin
ca
parents:
diff changeset
   817
!ViewTreeItem class methodsFor:'documentation'!
d970c06282d7 initial checkin
ca
parents:
diff changeset
   818
d970c06282d7 initial checkin
ca
parents:
diff changeset
   819
version
d970c06282d7 initial checkin
ca
parents:
diff changeset
   820
    ^ '$Header$'
d970c06282d7 initial checkin
ca
parents:
diff changeset
   821
! !
d970c06282d7 initial checkin
ca
parents:
diff changeset
   822
d970c06282d7 initial checkin
ca
parents:
diff changeset
   823
ViewTreeItem initialize!