View.st
author Claus Gittinger <cg@exept.de>
Thu, 25 Apr 1996 19:17:58 +0200
changeset 616 56cf67c82664
parent 321 f31da2a1d387
child 621 decaeae1910d
permissions -rw-r--r--
documentation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
48194c26a46c Initial revision
claus
parents:
diff changeset
     1
"
6
7ee0cfde237d *** empty log message ***
claus
parents: 5
diff changeset
     2
 COPYRIGHT (c) 1989 by Claus Gittinger
72
3e84121988c3 *** empty log message ***
claus
parents: 60
diff changeset
     3
	      All Rights Reserved
0
48194c26a46c Initial revision
claus
parents:
diff changeset
     4
48194c26a46c Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
48194c26a46c Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
48194c26a46c Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
48194c26a46c Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
48194c26a46c Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
48194c26a46c Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
48194c26a46c Initial revision
claus
parents:
diff changeset
    11
"
48194c26a46c Initial revision
claus
parents:
diff changeset
    12
135
claus
parents: 133
diff changeset
    13
SimpleView subclass:#View
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    14
	instanceVariableNames:'model aspectMsg changeMsg menuMsg'
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    15
	classVariableNames:''
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    16
	poolDictionaries:''
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    17
	category:'Views-Basic'
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    18
!
48194c26a46c Initial revision
claus
parents:
diff changeset
    19
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
    20
!View class methodsFor:'documentation'!
41
08a32edcaaa0 *** empty log message ***
claus
parents: 36
diff changeset
    21
46
7b331e9012fd *** empty log message ***
claus
parents: 42
diff changeset
    22
copyright
7b331e9012fd *** empty log message ***
claus
parents: 42
diff changeset
    23
"
7b331e9012fd *** empty log message ***
claus
parents: 42
diff changeset
    24
 COPYRIGHT (c) 1989 by Claus Gittinger
72
3e84121988c3 *** empty log message ***
claus
parents: 60
diff changeset
    25
	      All Rights Reserved
46
7b331e9012fd *** empty log message ***
claus
parents: 42
diff changeset
    26
7b331e9012fd *** empty log message ***
claus
parents: 42
diff changeset
    27
 This software is furnished under a license and may be used
7b331e9012fd *** empty log message ***
claus
parents: 42
diff changeset
    28
 only in accordance with the terms of that license and with the
7b331e9012fd *** empty log message ***
claus
parents: 42
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
7b331e9012fd *** empty log message ***
claus
parents: 42
diff changeset
    30
 be provided or otherwise made available to, or used by, any
7b331e9012fd *** empty log message ***
claus
parents: 42
diff changeset
    31
 other person.  No title to or ownership of the software is
7b331e9012fd *** empty log message ***
claus
parents: 42
diff changeset
    32
 hereby transferred.
7b331e9012fd *** empty log message ***
claus
parents: 42
diff changeset
    33
"
7b331e9012fd *** empty log message ***
claus
parents: 42
diff changeset
    34
!
7b331e9012fd *** empty log message ***
claus
parents: 42
diff changeset
    35
41
08a32edcaaa0 *** empty log message ***
claus
parents: 36
diff changeset
    36
documentation
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
    37
"
135
claus
parents: 133
diff changeset
    38
    this class adds provisions for views which show or work on a model.
claus
parents: 133
diff changeset
    39
    This functionality used to be in View, but has been extracted into SimpleView and
claus
parents: 133
diff changeset
    40
    this new View class, to take some of the stuff out of views which do not need
claus
parents: 133
diff changeset
    41
    this functionality (i.e. all views which do only geometry management).
82
98a70bce6d51 *** empty log message ***
claus
parents: 81
diff changeset
    42
    Instances of View are seldom used, most views in the system inherit 
98a70bce6d51 *** empty log message ***
claus
parents: 81
diff changeset
    43
    from this class. 
41
08a32edcaaa0 *** empty log message ***
claus
parents: 36
diff changeset
    44
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    45
    [Instance variables:]
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    46
        model           <nil | any>         the model (if any)
41
08a32edcaaa0 *** empty log message ***
claus
parents: 36
diff changeset
    47
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    48
        aspectMsg       <nil | Symbol>      the aspect; typically
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    49
                                            dependentViews react on changes
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    50
                                            of this aspect and update their contents.
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    51
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    52
        changeMsg       <nil | Symbol>      the changeMessage; typically
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    53
                                            dependentViews send this message to
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    54
                                            the model to tell it about changes.
140
claus
parents: 135
diff changeset
    55
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    56
        menuMsg         <nil | Symbol>      the menuMessage; typically
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    57
                                            dependentViews send this message to
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    58
                                            the model to ask for a popup menu.
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    59
                                            Some classes allow setting an explicit
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    60
                                            menuHolder and menuPerformer.
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    61
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    62
    [see also:]
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    63
        StandardSystemView TopView
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    64
        WindowGroup
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    65
        ( introduction to view programming :html: programming/viewintro.html )
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    66
        
140
claus
parents: 135
diff changeset
    67
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    68
    [author:]
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    69
        Claus Gittinger
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    70
"
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    71
!
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    72
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    73
examples
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    74
"
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    75
    a subView in a topView:
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    76
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    77
        |top v|
140
claus
parents: 135
diff changeset
    78
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    79
        topView := StandardSystemView new.
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    80
        v := View new.
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    81
        v origin:0.25 @ 0.25 corner:0.75 @ 0.75.
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    82
        top addSubView:v.
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    83
        top open
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    84
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    85
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    86
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    87
    the same, a bit more compact:
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    88
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    89
        |top v|
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    90
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    91
        topView := StandardSystemView new.
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    92
        v := View origin:0.25 @ 0.25 corner:0.75 @ 0.75 in:topView.
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    93
        top open
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
    94
"
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
    95
! !
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    96
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
    97
!View class methodsFor:'instance creation'!
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
    98
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    99
model:aModel
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   100
    "st-80 style view creation: create a new view and set its model"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   101
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   102
    ^ self new model:aModel
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   103
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   104
140
claus
parents: 135
diff changeset
   105
on:aModel aspect:aspectMsg
claus
parents: 135
diff changeset
   106
    "st-80 style view creation: create a new view, set its model
claus
parents: 135
diff changeset
   107
     and selectors for aspect"
claus
parents: 135
diff changeset
   108
claus
parents: 135
diff changeset
   109
    ^ self new 
claus
parents: 135
diff changeset
   110
	on:aModel
claus
parents: 135
diff changeset
   111
	aspect:aspectMsg
claus
parents: 135
diff changeset
   112
!
claus
parents: 135
diff changeset
   113
claus
parents: 135
diff changeset
   114
on:aModel aspect:aspectMsg change:changeMsg
claus
parents: 135
diff changeset
   115
    "st-80 style view creation: create a new view, set its model
claus
parents: 135
diff changeset
   116
     and selectors for aspect and change"
claus
parents: 135
diff changeset
   117
claus
parents: 135
diff changeset
   118
    ^ self new 
claus
parents: 135
diff changeset
   119
	on:aModel
claus
parents: 135
diff changeset
   120
	aspect:aspectMsg
claus
parents: 135
diff changeset
   121
	change:changeMsg
claus
parents: 135
diff changeset
   122
!
claus
parents: 135
diff changeset
   123
135
claus
parents: 133
diff changeset
   124
on:aModel aspect:aspectMsg change:changeMsg menu:menuMsg
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   125
    "st-80 style view creation: create a new view, set its model
140
claus
parents: 135
diff changeset
   126
     and selectors for aspect, change and menu"
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   127
135
claus
parents: 133
diff changeset
   128
    ^ self new 
claus
parents: 133
diff changeset
   129
	on:aModel
claus
parents: 133
diff changeset
   130
	aspect:aspectMsg
claus
parents: 133
diff changeset
   131
	change:changeMsg
claus
parents: 133
diff changeset
   132
	menu:menuMsg
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   133
!
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   134
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   135
on:aModel aspect:aspectMsg menu:menuMsg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   136
    "st-80 style view creation: create a new view, set its model
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   137
     and selectors for aspect and menu"
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   138
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   139
    ^ self new 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   140
	on:aModel
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   141
	aspect:aspectMsg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   142
	menu:menuMsg
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   143
! !
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   144
123
9f8c7f20fdb2 *** empty log message ***
claus
parents: 121
diff changeset
   145
!View class methodsFor:'defaults'!
9f8c7f20fdb2 *** empty log message ***
claus
parents: 121
diff changeset
   146
140
claus
parents: 135
diff changeset
   147
defaultAspectMessage   
135
claus
parents: 133
diff changeset
   148
    "subclasses which by default do NOT want to be informed about changed
claus
parents: 133
diff changeset
   149
     models should redefine this to return nil"
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   150
135
claus
parents: 133
diff changeset
   151
    ^ #value
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   152
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   153
140
claus
parents: 135
diff changeset
   154
defaultChangeMessage   
135
claus
parents: 133
diff changeset
   155
    "subclasses which by default do NOT want to inform the model
claus
parents: 133
diff changeset
   156
     should redefine this to return nil"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   157
135
claus
parents: 133
diff changeset
   158
    ^ #value:
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   159
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   160
170
claus
parents: 147
diff changeset
   161
!View methodsFor:'accessing-channels'!
claus
parents: 147
diff changeset
   162
claus
parents: 147
diff changeset
   163
setupChannel:newChannel for:changeSelector withOld:oldChannel
claus
parents: 147
diff changeset
   164
    "common code to change a channel"
claus
parents: 147
diff changeset
   165
claus
parents: 147
diff changeset
   166
    |oldValue|
claus
parents: 147
diff changeset
   167
claus
parents: 147
diff changeset
   168
    oldChannel notNil ifTrue:[
321
f31da2a1d387 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
   169
	oldChannel retractInterestsFor:self.
170
claus
parents: 147
diff changeset
   170
	oldValue := oldChannel value.
claus
parents: 147
diff changeset
   171
    ].
claus
parents: 147
diff changeset
   172
    newChannel onChangeSend:changeSelector to:self.
claus
parents: 147
diff changeset
   173
    self perform:changeSelector.
claus
parents: 147
diff changeset
   174
    ^ newChannel
claus
parents: 147
diff changeset
   175
! !
claus
parents: 147
diff changeset
   176
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   177
!View methodsFor:'accessing-menus'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   178
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   179
menuHolder
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   180
    "who has the menu ? 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   181
     By default, its the model if I have one."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   182
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   183
    model notNil ifTrue:[^ model].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   184
    ^ self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   185
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   186
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   187
menuPerformer
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   188
    "who should perform the menu actions ? 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   189
     By default, its the model if I have one."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   190
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   191
    model notNil ifTrue:[^ model].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   192
    ^ self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   193
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   194
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   195
!View methodsFor:'accessing-mvc'!
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   196
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   197
addModelInterfaceTo:aDictionary
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   198
    "this adds entries for all messages sent to my model
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   199
     to aDictionary"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   200
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   201
    aDictionary at:#aspectMessage put:aspectMsg.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   202
    aDictionary at:#changeMessage put:changeMsg.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   203
    aDictionary at:#menuMessage put:menuMsg.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   204
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   205
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   206
     Button new modelInterface 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   207
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   208
!
135
claus
parents: 133
diff changeset
   209
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   210
aspect
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   211
    "Return the aspect used with changes from/to the model"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   212
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   213
    ^ aspectMsg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   214
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   215
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   216
aspectMessage
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   217
    "Return the aspect used with changes from/to the model"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   218
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   219
    ^ aspectMsg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   220
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   221
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   222
aspectMessage:aspectSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   223
    "ST-80 style updating: If a views aspectSymbol is nonNil, 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   224
     it will respond to changes of this aspect from the model."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   225
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   226
    aspectMsg := aspectSymbol
135
claus
parents: 133
diff changeset
   227
!
claus
parents: 133
diff changeset
   228
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   229
change:changeSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   230
    "ST-80 style change notification: If a views changeSymbol is nonNil, 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   231
     it will send it to its model when something changes.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   232
     Alias for changeMessage: for ST-80 compatibility."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   233
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   234
    self changeMessage:changeSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   235
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   236
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   237
changeMessage
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   238
    "Return the symbol sent to the model if nonNil when something changes."
135
claus
parents: 133
diff changeset
   239
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   240
    ^ changeMsg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   241
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   242
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   243
changeMessage:aSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   244
    "ST-80 style change notification: If a views changeSymbol is nonNil, 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   245
     it will send it to its model when something changes.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   246
     This is the same as change: which was added for ST-80 compatibility."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   247
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   248
    changeMsg := aSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   249
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   250
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   251
controller:aController
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   252
    "set the controller"
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   253
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   254
    super controller:aController.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   255
    controller notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   256
	controller model:model
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   257
    ]
48194c26a46c Initial revision
claus
parents:
diff changeset
   258
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   259
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   260
menu:menuSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   261
    "ST-80 style menus: If a views menuSymbol is nonNil, it
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   262
     will send it to its model when the middleButton is pressed.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   263
     That method should return nil or the menu to be shown.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   264
     This is useful for very dynamic menus, where it does not
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   265
     make sense to define an initial menu.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   266
     Alias for #menuMessage:, for ST-80 compatibility."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   267
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   268
    menuMsg := menuSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   269
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   270
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   271
menuMessage
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   272
    "Return the symbol sent to the model to aquire the menu"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   273
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   274
    ^ menuMsg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   275
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   276
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   277
menuMessage:aSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   278
    "ST-80 style menus: If a views menuSymbol is nonNil, it
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   279
     will send it to its model when the middleButton is pressed.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   280
     That method should return nil or the menu to be shown.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   281
     This is useful for very dynamic menus, where it does not
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   282
     make sense to define an initial menu.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   283
     This is the same as #menu: which was added for ST-80 compatibility."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   284
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   285
    menuMsg := aSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   286
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   287
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   288
model
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   289
    "return the model, for non-MVC views,
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   290
     this is nil or the receiver"
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   291
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   292
    ^ model
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   293
!
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   294
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   295
model:aModel
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   296
    "set the model"
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   297
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   298
    model notNil ifTrue:[
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   299
	model removeDependent:self
89
ea2bf46eb669 *** empty log message ***
claus
parents: 87
diff changeset
   300
    ].
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   301
    model := aModel.
135
claus
parents: 133
diff changeset
   302
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   303
    model notNil ifTrue:[
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   304
	aModel addDependent:self
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   305
    ].
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   306
    controller notNil ifTrue:[
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   307
	controller model:aModel
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   308
    ]
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   309
!
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   310
140
claus
parents: 135
diff changeset
   311
modelInterface
claus
parents: 135
diff changeset
   312
    "this returns a dictionary of messages sent to my model.
claus
parents: 135
diff changeset
   313
     It can be used for builders and wrappers to get information
claus
parents: 135
diff changeset
   314
     about the messages sent to my model.
claus
parents: 135
diff changeset
   315
     The returned dictionary contains one entry for each get-Msg,
claus
parents: 135
diff changeset
   316
     and the recevier will implement corresponding messages (with a colon)
claus
parents: 135
diff changeset
   317
     to set the message symbol."
claus
parents: 135
diff changeset
   318
claus
parents: 135
diff changeset
   319
    |d|
claus
parents: 135
diff changeset
   320
claus
parents: 135
diff changeset
   321
    d := IdentityDictionary new.
claus
parents: 135
diff changeset
   322
    self addModelInterfaceTo:d.
claus
parents: 135
diff changeset
   323
    ^ d
claus
parents: 135
diff changeset
   324
claus
parents: 135
diff changeset
   325
    "
claus
parents: 135
diff changeset
   326
     Button new modelInterface
claus
parents: 135
diff changeset
   327
     Label new modelInterface 
claus
parents: 135
diff changeset
   328
    "
claus
parents: 135
diff changeset
   329
claus
parents: 135
diff changeset
   330
    "
claus
parents: 135
diff changeset
   331
     does the view support setting the menuMessage ?
claus
parents: 135
diff changeset
   332
claus
parents: 135
diff changeset
   333
     SelectionInListView new modelInterface includesKey:#menuMessage 
claus
parents: 135
diff changeset
   334
    "
claus
parents: 135
diff changeset
   335
claus
parents: 135
diff changeset
   336
    "
claus
parents: 135
diff changeset
   337
     turn off all interaction to the model:
claus
parents: 135
diff changeset
   338
claus
parents: 135
diff changeset
   339
     |m v if|
claus
parents: 135
diff changeset
   340
claus
parents: 135
diff changeset
   341
     m := SelectionInList new.
claus
parents: 135
diff changeset
   342
     m list:#('one' 'two' 'tree' 'four') asValue.
claus
parents: 135
diff changeset
   343
     m selection:1 asValue.
claus
parents: 135
diff changeset
   344
     v := SelectionInListView on:m.
claus
parents: 135
diff changeset
   345
     v open.
claus
parents: 135
diff changeset
   346
     v inspect.
claus
parents: 135
diff changeset
   347
claus
parents: 135
diff changeset
   348
     if := v modelInterface.
claus
parents: 135
diff changeset
   349
     if inspect.
claus
parents: 135
diff changeset
   350
claus
parents: 135
diff changeset
   351
     if keysAndValuesDo:[:what :msg |
claus
parents: 135
diff changeset
   352
	 v perform:(what , ':') asSymbol with:nil.
claus
parents: 135
diff changeset
   353
     ].
claus
parents: 135
diff changeset
   354
    "
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   355
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   356
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   357
on:aModel aspect:aspectSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   358
    "ST-80 compatibility: set model and aspect
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   359
     messages - needs a view which uses these"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   360
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   361
    aspectMsg := aspectSymbol.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   362
    self model:aModel.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   363
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   364
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   365
on:aModel aspect:aspectSymbol change:changeSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   366
    "ST-80 compatibility: set model, aspect and change
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   367
     messages - needs a view which uses these"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   368
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   369
    aspectMsg := aspectSymbol.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   370
    changeMsg := changeSymbol.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   371
    self model:aModel.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   372
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   373
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   374
on:aModel aspect:aspectSymbol change:changeSymbol menu:menuSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   375
    "ST-80 compatibility: set model, aspect, change and menu
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   376
     messages - needs a view which uses these"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   377
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   378
    aspectMsg := aspectSymbol.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   379
    changeMsg := changeSymbol.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   380
    menuMsg := menuSymbol.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   381
    self model:aModel.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   382
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   383
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   384
on:aModel aspect:aspectSymbol menu:menuSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   385
    "ST-80 compatibility: set model, aspect and menu
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   386
     messages - needs a view which uses these"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   387
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   388
    aspectMsg := aspectSymbol.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   389
    menuMsg := menuSymbol.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   390
    self model:aModel.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   391
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   392
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   393
sendChangeMessage:aSelector with:arg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   394
    "tell the model about a change"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   395
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   396
    |n selector|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   397
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   398
    "/
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   399
    "/ MVC way of doing it:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   400
    "/ if the model is a block, evaluate it, optionally
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   401
    "/ passing the arg and the receiver as arguments.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   402
    "/
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   403
    "/ otherwise (the common case) send it a changeMsg message
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   404
    "/ also with arg and the receiver (depending on the number of arguments
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   405
    "/ as defined by the selector).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   406
    "/
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   407
    (model notNil and:[aSelector notNil]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   408
	n := aSelector numArgs.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   409
	model isBlock ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   410
	    n := model numArgs.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   411
	    n == 0 ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   412
		selector := #value
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   413
	    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   414
		n == 1 ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   415
		    selector := #value:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   416
		] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   417
		    selector := #value:value:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   418
		]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   419
	    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   420
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   421
	    selector := aSelector
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   422
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   423
	n == 0 ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   424
	    model perform:selector 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   425
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   426
	    n == 1 ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   427
		model perform:selector with:arg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   428
	    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   429
		model perform:selector with:arg with:self 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   430
	    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   431
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   432
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   433
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   434
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   435
sendChangeMessageWith:arg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   436
    "tell the model about a change"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   437
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   438
    self sendChangeMessage:changeMsg with:arg
72
3e84121988c3 *** empty log message ***
claus
parents: 60
diff changeset
   439
! !
3e84121988c3 *** empty log message ***
claus
parents: 60
diff changeset
   440
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   441
!View methodsFor:'drawing'!
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   442
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   443
redraw
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   444
    "redraw myself
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   445
     if there is a model, this one shall redraw itself,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   446
     otherwise we cannot do much here - has to be redefined in subclasses"
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   447
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   448
    model notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   449
	model update:self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   450
    ]
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   451
! !
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   452
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   453
!View methodsFor:'initialization'!
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   454
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   455
initialize
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   456
    super initialize.
140
claus
parents: 135
diff changeset
   457
claus
parents: 135
diff changeset
   458
    aspectMsg := self class defaultAspectMessage.
claus
parents: 135
diff changeset
   459
    changeMsg := self class defaultChangeMessage.
claus
parents: 135
diff changeset
   460
135
claus
parents: 133
diff changeset
   461
    model notNil ifTrue:[
claus
parents: 133
diff changeset
   462
	controller notNil ifTrue:[
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   463
	    controller model:model
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   464
	]
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
   465
    ].
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   466
! !
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   467
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   468
!View methodsFor:'realization'!
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   469
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   470
destroy
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   471
    "unrealize & destroy - make me invisible, destroy subviews then
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   472
     make me unknown to the device"
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   473
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   474
    model notNil ifTrue:[
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   475
	model removeDependent:self.
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   476
	model := nil.
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   477
    ].
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   478
    super destroy.
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   479
! !
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   480
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   481
!View class methodsFor:'documentation'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   482
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   483
version
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
   484
    ^ '$Header: /cvs/stx/stx/libview/View.st,v 1.50 1996-04-25 17:15:42 cg Exp $'
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   485
! !