View.st
author Claus Gittinger <cg@exept.de>
Mon, 23 Dec 1996 13:45:37 +0100
changeset 1146 0167191529dd
parent 621 decaeae1910d
child 1147 83ed804938e7
permissions -rw-r--r--
moved menuHolder/menuPerformer up in the hierarchy
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
1146
0167191529dd moved menuHolder/menuPerformer up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    14
	instanceVariableNames:'model aspectMsg changeMsg menuMsg menuHolder menuPerformer'
616
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:]
621
decaeae1910d examples
Claus Gittinger <cg@exept.de>
parents: 616
diff changeset
    63
        StandardSystemView TopView DialogBox
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    64
        WindowGroup
621
decaeae1910d examples
Claus Gittinger <cg@exept.de>
parents: 616
diff changeset
    65
        Model ValueHolder
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    66
        ( introduction to view programming :html: programming/viewintro.html )
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    67
        
140
claus
parents: 135
diff changeset
    68
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    69
    [author:]
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    70
        Claus Gittinger
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
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    74
examples
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    75
"
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    76
    a subView in a topView:
621
decaeae1910d examples
Claus Gittinger <cg@exept.de>
parents: 616
diff changeset
    77
                                                                        [exBegin]
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    78
        |top v|
140
claus
parents: 135
diff changeset
    79
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    80
        topView := StandardSystemView new.
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    81
        v := View new.
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    82
        v origin:0.25 @ 0.25 corner:0.75 @ 0.75.
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    83
        top addSubView:v.
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    84
        top open
621
decaeae1910d examples
Claus Gittinger <cg@exept.de>
parents: 616
diff changeset
    85
                                                                        [exEnd]
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    86
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    87
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    88
    the same, a bit more compact:
621
decaeae1910d examples
Claus Gittinger <cg@exept.de>
parents: 616
diff changeset
    89
                                                                        [exBegin]
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    90
        |top v|
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    91
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    92
        topView := StandardSystemView new.
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    93
        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
    94
        top open
621
decaeae1910d examples
Claus Gittinger <cg@exept.de>
parents: 616
diff changeset
    95
                                                                        [exEnd]
decaeae1910d examples
Claus Gittinger <cg@exept.de>
parents: 616
diff changeset
    96
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
    97
"
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
    98
! !
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    99
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   100
!View class methodsFor:'instance creation'!
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   101
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   102
model:aModel
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   103
    "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
   104
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   105
    ^ self new model:aModel
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   106
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   107
140
claus
parents: 135
diff changeset
   108
on:aModel aspect:aspectMsg
claus
parents: 135
diff changeset
   109
    "st-80 style view creation: create a new view, set its model
claus
parents: 135
diff changeset
   110
     and selectors for aspect"
claus
parents: 135
diff changeset
   111
claus
parents: 135
diff changeset
   112
    ^ self new 
claus
parents: 135
diff changeset
   113
	on:aModel
claus
parents: 135
diff changeset
   114
	aspect:aspectMsg
claus
parents: 135
diff changeset
   115
!
claus
parents: 135
diff changeset
   116
claus
parents: 135
diff changeset
   117
on:aModel aspect:aspectMsg change:changeMsg
claus
parents: 135
diff changeset
   118
    "st-80 style view creation: create a new view, set its model
claus
parents: 135
diff changeset
   119
     and selectors for aspect and change"
claus
parents: 135
diff changeset
   120
claus
parents: 135
diff changeset
   121
    ^ self new 
claus
parents: 135
diff changeset
   122
	on:aModel
claus
parents: 135
diff changeset
   123
	aspect:aspectMsg
claus
parents: 135
diff changeset
   124
	change:changeMsg
claus
parents: 135
diff changeset
   125
!
claus
parents: 135
diff changeset
   126
135
claus
parents: 133
diff changeset
   127
on:aModel aspect:aspectMsg change:changeMsg menu:menuMsg
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   128
    "st-80 style view creation: create a new view, set its model
140
claus
parents: 135
diff changeset
   129
     and selectors for aspect, change and menu"
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   130
135
claus
parents: 133
diff changeset
   131
    ^ self new 
claus
parents: 133
diff changeset
   132
	on:aModel
claus
parents: 133
diff changeset
   133
	aspect:aspectMsg
claus
parents: 133
diff changeset
   134
	change:changeMsg
claus
parents: 133
diff changeset
   135
	menu:menuMsg
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   136
!
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   137
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   138
on:aModel aspect:aspectMsg menu:menuMsg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   139
    "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
   140
     and selectors for aspect and menu"
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   141
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   142
    ^ self new 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   143
	on:aModel
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   144
	aspect:aspectMsg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   145
	menu:menuMsg
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   146
! !
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   147
123
9f8c7f20fdb2 *** empty log message ***
claus
parents: 121
diff changeset
   148
!View class methodsFor:'defaults'!
9f8c7f20fdb2 *** empty log message ***
claus
parents: 121
diff changeset
   149
140
claus
parents: 135
diff changeset
   150
defaultAspectMessage   
135
claus
parents: 133
diff changeset
   151
    "subclasses which by default do NOT want to be informed about changed
claus
parents: 133
diff changeset
   152
     models should redefine this to return nil"
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   153
135
claus
parents: 133
diff changeset
   154
    ^ #value
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   155
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   156
140
claus
parents: 135
diff changeset
   157
defaultChangeMessage   
135
claus
parents: 133
diff changeset
   158
    "subclasses which by default do NOT want to inform the model
claus
parents: 133
diff changeset
   159
     should redefine this to return nil"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   160
135
claus
parents: 133
diff changeset
   161
    ^ #value:
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   162
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   163
170
claus
parents: 147
diff changeset
   164
!View methodsFor:'accessing-channels'!
claus
parents: 147
diff changeset
   165
claus
parents: 147
diff changeset
   166
setupChannel:newChannel for:changeSelector withOld:oldChannel
claus
parents: 147
diff changeset
   167
    "common code to change a channel"
claus
parents: 147
diff changeset
   168
claus
parents: 147
diff changeset
   169
    |oldValue|
claus
parents: 147
diff changeset
   170
claus
parents: 147
diff changeset
   171
    oldChannel notNil ifTrue:[
321
f31da2a1d387 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
   172
	oldChannel retractInterestsFor:self.
170
claus
parents: 147
diff changeset
   173
	oldValue := oldChannel value.
claus
parents: 147
diff changeset
   174
    ].
claus
parents: 147
diff changeset
   175
    newChannel onChangeSend:changeSelector to:self.
claus
parents: 147
diff changeset
   176
    self perform:changeSelector.
claus
parents: 147
diff changeset
   177
    ^ newChannel
claus
parents: 147
diff changeset
   178
! !
claus
parents: 147
diff changeset
   179
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   180
!View methodsFor:'accessing-menus'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   181
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   182
menuHolder
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   183
    "who has the menu ? 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   184
     By default, its the model if I have one."
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
    model notNil ifTrue:[^ model].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   187
    ^ self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   188
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   189
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   190
menuPerformer
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   191
    "who should perform the menu actions ? 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   192
     By default, its the model if I have one."
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
    model notNil ifTrue:[^ model].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   195
    ^ self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   196
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   197
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   198
!View methodsFor:'accessing-mvc'!
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   199
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   200
addModelInterfaceTo:aDictionary
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   201
    "this adds entries for all messages sent to my model
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   202
     to aDictionary"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   203
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   204
    aDictionary at:#aspectMessage put:aspectMsg.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   205
    aDictionary at:#changeMessage put:changeMsg.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   206
    aDictionary at:#menuMessage put:menuMsg.
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
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   209
     Button new modelInterface 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   210
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   211
!
135
claus
parents: 133
diff changeset
   212
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   213
aspect
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   214
    "Return the aspect used with changes from/to the model"
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
    ^ aspectMsg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   217
!
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
aspectMessage
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   220
    "Return the aspect used with changes from/to the model"
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
    ^ aspectMsg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   223
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   224
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   225
aspectMessage:aspectSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   226
    "ST-80 style updating: If a views aspectSymbol is nonNil, 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   227
     it will respond to changes of this aspect from the model."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   228
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   229
    aspectMsg := aspectSymbol
135
claus
parents: 133
diff changeset
   230
!
claus
parents: 133
diff changeset
   231
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   232
change:changeSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   233
    "ST-80 style change notification: If a views changeSymbol is nonNil, 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   234
     it will send it to its model when something changes.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   235
     Alias for changeMessage: for ST-80 compatibility."
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
    self changeMessage:changeSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   238
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   239
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   240
changeMessage
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   241
    "Return the symbol sent to the model if nonNil when something changes."
135
claus
parents: 133
diff changeset
   242
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   243
    ^ changeMsg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   244
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   245
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   246
changeMessage:aSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   247
    "ST-80 style change notification: If a views changeSymbol is nonNil, 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   248
     it will send it to its model when something changes.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   249
     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
   250
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   251
    changeMsg := aSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   252
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   253
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   254
controller:aController
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   255
    "set the controller"
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   256
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   257
    super controller:aController.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   258
    controller notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   259
	controller model:model
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   260
    ]
48194c26a46c Initial revision
claus
parents:
diff changeset
   261
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   262
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   263
menu:menuSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   264
    "ST-80 style menus: If a views menuSymbol is nonNil, it
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   265
     will send it to its model when the middleButton is pressed.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   266
     That method should return nil or the menu to be shown.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   267
     This is useful for very dynamic menus, where it does not
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   268
     make sense to define an initial menu.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   269
     Alias for #menuMessage:, for ST-80 compatibility."
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
    menuMsg := menuSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   272
!
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
menuMessage
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   275
    "Return the symbol sent to the model to aquire the menu"
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
    ^ menuMsg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   278
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   279
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   280
menuMessage:aSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   281
    "ST-80 style menus: If a views menuSymbol is nonNil, it
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   282
     will send it to its model when the middleButton is pressed.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   283
     That method should return nil or the menu to be shown.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   284
     This is useful for very dynamic menus, where it does not
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   285
     make sense to define an initial menu.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   286
     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
   287
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   288
    menuMsg := aSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   289
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   290
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   291
model
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   292
    "return the model, for non-MVC views,
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   293
     this is nil or the receiver"
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   294
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   295
    ^ model
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   296
!
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   297
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   298
model:aModel
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   299
    "set the model"
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   300
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   301
    model notNil ifTrue:[
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   302
	model removeDependent:self
89
ea2bf46eb669 *** empty log message ***
claus
parents: 87
diff changeset
   303
    ].
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   304
    model := aModel.
135
claus
parents: 133
diff changeset
   305
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   306
    model notNil ifTrue:[
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   307
	aModel addDependent:self
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   308
    ].
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   309
    controller notNil ifTrue:[
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   310
	controller model:aModel
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   311
    ]
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   312
!
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   313
140
claus
parents: 135
diff changeset
   314
modelInterface
claus
parents: 135
diff changeset
   315
    "this returns a dictionary of messages sent to my model.
claus
parents: 135
diff changeset
   316
     It can be used for builders and wrappers to get information
claus
parents: 135
diff changeset
   317
     about the messages sent to my model.
claus
parents: 135
diff changeset
   318
     The returned dictionary contains one entry for each get-Msg,
claus
parents: 135
diff changeset
   319
     and the recevier will implement corresponding messages (with a colon)
claus
parents: 135
diff changeset
   320
     to set the message symbol."
claus
parents: 135
diff changeset
   321
claus
parents: 135
diff changeset
   322
    |d|
claus
parents: 135
diff changeset
   323
claus
parents: 135
diff changeset
   324
    d := IdentityDictionary new.
claus
parents: 135
diff changeset
   325
    self addModelInterfaceTo:d.
claus
parents: 135
diff changeset
   326
    ^ d
claus
parents: 135
diff changeset
   327
claus
parents: 135
diff changeset
   328
    "
claus
parents: 135
diff changeset
   329
     Button new modelInterface
claus
parents: 135
diff changeset
   330
     Label new modelInterface 
claus
parents: 135
diff changeset
   331
    "
claus
parents: 135
diff changeset
   332
claus
parents: 135
diff changeset
   333
    "
claus
parents: 135
diff changeset
   334
     does the view support setting the menuMessage ?
claus
parents: 135
diff changeset
   335
claus
parents: 135
diff changeset
   336
     SelectionInListView new modelInterface includesKey:#menuMessage 
claus
parents: 135
diff changeset
   337
    "
claus
parents: 135
diff changeset
   338
claus
parents: 135
diff changeset
   339
    "
claus
parents: 135
diff changeset
   340
     turn off all interaction to the model:
claus
parents: 135
diff changeset
   341
claus
parents: 135
diff changeset
   342
     |m v if|
claus
parents: 135
diff changeset
   343
claus
parents: 135
diff changeset
   344
     m := SelectionInList new.
claus
parents: 135
diff changeset
   345
     m list:#('one' 'two' 'tree' 'four') asValue.
claus
parents: 135
diff changeset
   346
     m selection:1 asValue.
claus
parents: 135
diff changeset
   347
     v := SelectionInListView on:m.
claus
parents: 135
diff changeset
   348
     v open.
claus
parents: 135
diff changeset
   349
     v inspect.
claus
parents: 135
diff changeset
   350
claus
parents: 135
diff changeset
   351
     if := v modelInterface.
claus
parents: 135
diff changeset
   352
     if inspect.
claus
parents: 135
diff changeset
   353
claus
parents: 135
diff changeset
   354
     if keysAndValuesDo:[:what :msg |
claus
parents: 135
diff changeset
   355
	 v perform:(what , ':') asSymbol with:nil.
claus
parents: 135
diff changeset
   356
     ].
claus
parents: 135
diff changeset
   357
    "
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   358
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   359
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   360
on:aModel aspect:aspectSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   361
    "ST-80 compatibility: set model and aspect
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   362
     messages - needs a view which uses these"
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
    aspectMsg := aspectSymbol.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   365
    self model:aModel.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   366
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   367
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   368
on:aModel aspect:aspectSymbol change:changeSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   369
    "ST-80 compatibility: set model, aspect and change
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   370
     messages - needs a view which uses these"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   371
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   372
    aspectMsg := aspectSymbol.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   373
    changeMsg := changeSymbol.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   374
    self model:aModel.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   375
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   376
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   377
on:aModel aspect:aspectSymbol change:changeSymbol menu:menuSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   378
    "ST-80 compatibility: set model, aspect, change and menu
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   379
     messages - needs a view which uses these"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   380
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   381
    aspectMsg := aspectSymbol.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   382
    changeMsg := changeSymbol.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   383
    menuMsg := menuSymbol.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   384
    self model:aModel.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   385
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   386
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   387
on:aModel aspect:aspectSymbol menu:menuSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   388
    "ST-80 compatibility: set model, aspect and menu
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   389
     messages - needs a view which uses these"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   390
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   391
    aspectMsg := aspectSymbol.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   392
    menuMsg := menuSymbol.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   393
    self model:aModel.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   394
!
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
sendChangeMessage:aSelector with:arg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   397
    "tell the model about a change"
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
    |n selector|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   400
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   401
    "/
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   402
    "/ MVC way of doing it:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   403
    "/ if the model is a block, evaluate it, optionally
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   404
    "/ passing the arg and the receiver as arguments.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   405
    "/
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   406
    "/ otherwise (the common case) send it a changeMsg message
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   407
    "/ 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
   408
    "/ as defined by the selector).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   409
    "/
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   410
    (model notNil and:[aSelector notNil]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   411
	n := aSelector numArgs.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   412
	model isBlock ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   413
	    n := model numArgs.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   414
	    n == 0 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
		n == 1 ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   418
		    selector := #value:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   419
		] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   420
		    selector := #value:value:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   421
		]
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
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   424
	    selector := aSelector
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   425
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   426
	n == 0 ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   427
	    model perform:selector 
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
	    n == 1 ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   430
		model perform:selector with:arg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   431
	    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   432
		model perform:selector with:arg with:self 
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
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   436
!
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
sendChangeMessageWith:arg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   439
    "tell the model about a change"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   440
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   441
    self sendChangeMessage:changeMsg with:arg
72
3e84121988c3 *** empty log message ***
claus
parents: 60
diff changeset
   442
! !
3e84121988c3 *** empty log message ***
claus
parents: 60
diff changeset
   443
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   444
!View methodsFor:'drawing'!
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   445
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   446
redraw
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   447
    "redraw myself
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   448
     if there is a model, this one shall redraw itself,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   449
     otherwise we cannot do much here - has to be redefined in subclasses"
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   450
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   451
    model notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   452
	model update:self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   453
    ]
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   454
! !
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   455
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   456
!View methodsFor:'initialization'!
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   457
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   458
initialize
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   459
    super initialize.
140
claus
parents: 135
diff changeset
   460
claus
parents: 135
diff changeset
   461
    aspectMsg := self class defaultAspectMessage.
claus
parents: 135
diff changeset
   462
    changeMsg := self class defaultChangeMessage.
claus
parents: 135
diff changeset
   463
135
claus
parents: 133
diff changeset
   464
    model notNil ifTrue:[
claus
parents: 133
diff changeset
   465
	controller notNil ifTrue:[
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   466
	    controller model:model
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   467
	]
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
   468
    ].
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   469
! !
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   470
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   471
!View methodsFor:'realization'!
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   472
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   473
destroy
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   474
    "unrealize & destroy - make me invisible, destroy subviews then
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   475
     make me unknown to the device"
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   476
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   477
    model notNil ifTrue:[
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   478
	model removeDependent:self.
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   479
	model := nil.
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   480
    ].
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   481
    super destroy.
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   482
! !
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   483
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   484
!View class methodsFor:'documentation'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   485
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   486
version
1146
0167191529dd moved menuHolder/menuPerformer up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
   487
    ^ '$Header: /cvs/stx/stx/libview/View.st,v 1.52 1996-12-23 12:45:37 cg Exp $'
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   488
! !