View.st
author Claus Gittinger <cg@exept.de>
Tue, 31 Oct 2000 13:39:19 +0100
changeset 3355 2ec13d9b93ca
parent 3204 ed184af034d3
child 3365 a76614b953c7
permissions -rw-r--r--
in allViewBackground: do not change the bg, if I have a bg-channel
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
3204
ed184af034d3 Remove dependents on various channels when destroying.
Stefan Vogel <sv@exept.de>
parents: 3170
diff changeset
    13
"{ Package: 'stx:libview' }"
ed184af034d3 Remove dependents on various channels when destroying.
Stefan Vogel <sv@exept.de>
parents: 3170
diff changeset
    14
135
claus
parents: 133
diff changeset
    15
SimpleView subclass:#View
2548
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
    16
	instanceVariableNames:'model aspectMsg changeMsg menuMsg menuHolder menuPerformer
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
    17
		visibilityChannel enableChannel foregroundChannel
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
    18
		backgroundChannel'
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    19
	classVariableNames:''
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    20
	poolDictionaries:''
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    21
	category:'Views-Basic'
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    22
!
48194c26a46c Initial revision
claus
parents:
diff changeset
    23
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
    24
!View class methodsFor:'documentation'!
41
08a32edcaaa0 *** empty log message ***
claus
parents: 36
diff changeset
    25
46
7b331e9012fd *** empty log message ***
claus
parents: 42
diff changeset
    26
copyright
7b331e9012fd *** empty log message ***
claus
parents: 42
diff changeset
    27
"
7b331e9012fd *** empty log message ***
claus
parents: 42
diff changeset
    28
 COPYRIGHT (c) 1989 by Claus Gittinger
72
3e84121988c3 *** empty log message ***
claus
parents: 60
diff changeset
    29
	      All Rights Reserved
46
7b331e9012fd *** empty log message ***
claus
parents: 42
diff changeset
    30
7b331e9012fd *** empty log message ***
claus
parents: 42
diff changeset
    31
 This software is furnished under a license and may be used
7b331e9012fd *** empty log message ***
claus
parents: 42
diff changeset
    32
 only in accordance with the terms of that license and with the
7b331e9012fd *** empty log message ***
claus
parents: 42
diff changeset
    33
 inclusion of the above copyright notice.   This software may not
7b331e9012fd *** empty log message ***
claus
parents: 42
diff changeset
    34
 be provided or otherwise made available to, or used by, any
7b331e9012fd *** empty log message ***
claus
parents: 42
diff changeset
    35
 other person.  No title to or ownership of the software is
7b331e9012fd *** empty log message ***
claus
parents: 42
diff changeset
    36
 hereby transferred.
7b331e9012fd *** empty log message ***
claus
parents: 42
diff changeset
    37
"
7b331e9012fd *** empty log message ***
claus
parents: 42
diff changeset
    38
!
7b331e9012fd *** empty log message ***
claus
parents: 42
diff changeset
    39
41
08a32edcaaa0 *** empty log message ***
claus
parents: 36
diff changeset
    40
documentation
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
    41
"
135
claus
parents: 133
diff changeset
    42
    this class adds provisions for views which show or work on a model.
claus
parents: 133
diff changeset
    43
    This functionality used to be in View, but has been extracted into SimpleView and
claus
parents: 133
diff changeset
    44
    this new View class, to take some of the stuff out of views which do not need
claus
parents: 133
diff changeset
    45
    this functionality (i.e. all views which do only geometry management).
82
98a70bce6d51 *** empty log message ***
claus
parents: 81
diff changeset
    46
    Instances of View are seldom used, most views in the system inherit 
98a70bce6d51 *** empty log message ***
claus
parents: 81
diff changeset
    47
    from this class. 
41
08a32edcaaa0 *** empty log message ***
claus
parents: 36
diff changeset
    48
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    49
    [Instance variables:]
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    50
        model           <nil | any>         the model (if any)
41
08a32edcaaa0 *** empty log message ***
claus
parents: 36
diff changeset
    51
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    52
        aspectMsg       <nil | Symbol>      the aspect; typically
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    53
                                            dependentViews react on changes
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    54
                                            of this aspect and update their contents.
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    55
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    56
        changeMsg       <nil | Symbol>      the changeMessage; 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 tell it about changes.
140
claus
parents: 135
diff changeset
    59
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    60
        menuMsg         <nil | Symbol>      the menuMessage; typically
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    61
                                            dependentViews send this message to
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    62
                                            the model to ask for a popup menu.
1151
1a3682212ea9 Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents: 1149
diff changeset
    63
1a3682212ea9 Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents: 1149
diff changeset
    64
1152
21c666e130dd menuHolder/menuPerformer stuff.
Stefan Vogel <sv@exept.de>
parents: 1151
diff changeset
    65
        menuHolder      <any>               who has a menu 
21c666e130dd menuHolder/menuPerformer stuff.
Stefan Vogel <sv@exept.de>
parents: 1151
diff changeset
    66
                                            (default: nil i.e. model has menu)
21c666e130dd menuHolder/menuPerformer stuff.
Stefan Vogel <sv@exept.de>
parents: 1151
diff changeset
    67
21c666e130dd menuHolder/menuPerformer stuff.
Stefan Vogel <sv@exept.de>
parents: 1151
diff changeset
    68
        menuPerformer   <any>               who performs menu actions
21c666e130dd menuHolder/menuPerformer stuff.
Stefan Vogel <sv@exept.de>
parents: 1151
diff changeset
    69
                                            (default: nil i.e. model has menu)
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    70
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    71
    [see also:]
621
decaeae1910d examples
Claus Gittinger <cg@exept.de>
parents: 616
diff changeset
    72
        StandardSystemView TopView DialogBox
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    73
        WindowGroup
621
decaeae1910d examples
Claus Gittinger <cg@exept.de>
parents: 616
diff changeset
    74
        Model ValueHolder
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    75
        ( introduction to view programming :html: programming/viewintro.html )
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    76
        
140
claus
parents: 135
diff changeset
    77
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    78
    [author:]
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    79
        Claus Gittinger
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    80
"
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    81
!
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    82
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    83
examples
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    84
"
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    85
    a subView in a topView:
621
decaeae1910d examples
Claus Gittinger <cg@exept.de>
parents: 616
diff changeset
    86
                                                                        [exBegin]
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    87
        |top v|
140
claus
parents: 135
diff changeset
    88
2134
3e13a97eaf22 checkin from browser
tz
parents: 1945
diff changeset
    89
        top := StandardSystemView new.
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    90
        v := View new.
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    91
        v origin:0.25 @ 0.25 corner:0.75 @ 0.75.
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    92
        top addSubView:v.
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    93
        top open
621
decaeae1910d examples
Claus Gittinger <cg@exept.de>
parents: 616
diff changeset
    94
                                                                        [exEnd]
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    95
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    96
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    97
    the same, a bit more compact:
621
decaeae1910d examples
Claus Gittinger <cg@exept.de>
parents: 616
diff changeset
    98
                                                                        [exBegin]
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
    99
        |top v|
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
   100
2134
3e13a97eaf22 checkin from browser
tz
parents: 1945
diff changeset
   101
        top := StandardSystemView new.
3e13a97eaf22 checkin from browser
tz
parents: 1945
diff changeset
   102
        v := View origin:0.25 @ 0.25 corner:0.75 @ 0.75 in:top.
3e13a97eaf22 checkin from browser
tz
parents: 1945
diff changeset
   103
        top open
3e13a97eaf22 checkin from browser
tz
parents: 1945
diff changeset
   104
                                                                        [exEnd]
3e13a97eaf22 checkin from browser
tz
parents: 1945
diff changeset
   105
3e13a97eaf22 checkin from browser
tz
parents: 1945
diff changeset
   106
    menuHolder
3e13a97eaf22 checkin from browser
tz
parents: 1945
diff changeset
   107
                                                                        [exBegin]
3e13a97eaf22 checkin from browser
tz
parents: 1945
diff changeset
   108
        |top mh|
3e13a97eaf22 checkin from browser
tz
parents: 1945
diff changeset
   109
3e13a97eaf22 checkin from browser
tz
parents: 1945
diff changeset
   110
        mh := (PopUpMenu itemList:#( ('foo' foo) (#'bar' bar)) resources:nil) asValue.
3e13a97eaf22 checkin from browser
tz
parents: 1945
diff changeset
   111
3e13a97eaf22 checkin from browser
tz
parents: 1945
diff changeset
   112
        top := StandardSystemView extent:200@200.
3e13a97eaf22 checkin from browser
tz
parents: 1945
diff changeset
   113
        top menuHolder:mh.
3e13a97eaf22 checkin from browser
tz
parents: 1945
diff changeset
   114
        top open
3e13a97eaf22 checkin from browser
tz
parents: 1945
diff changeset
   115
                                                                        [exEnd]
3e13a97eaf22 checkin from browser
tz
parents: 1945
diff changeset
   116
3e13a97eaf22 checkin from browser
tz
parents: 1945
diff changeset
   117
3e13a97eaf22 checkin from browser
tz
parents: 1945
diff changeset
   118
    menuHolder
3e13a97eaf22 checkin from browser
tz
parents: 1945
diff changeset
   119
                                                                        [exBegin]
3e13a97eaf22 checkin from browser
tz
parents: 1945
diff changeset
   120
        |top mh|
3e13a97eaf22 checkin from browser
tz
parents: 1945
diff changeset
   121
3e13a97eaf22 checkin from browser
tz
parents: 1945
diff changeset
   122
        mh := (PopUpMenu itemList:#( ('foo' foo) (#'bar' bar)) resources:nil) asValue.
3e13a97eaf22 checkin from browser
tz
parents: 1945
diff changeset
   123
        [
3e13a97eaf22 checkin from browser
tz
parents: 1945
diff changeset
   124
            Delay waitForSeconds:5.
3e13a97eaf22 checkin from browser
tz
parents: 1945
diff changeset
   125
            mh value: (PopUpMenu itemList:#( ('waboo' foo) (#'baz' bar)) resources:nil)
3e13a97eaf22 checkin from browser
tz
parents: 1945
diff changeset
   126
        ] fork.
3e13a97eaf22 checkin from browser
tz
parents: 1945
diff changeset
   127
3e13a97eaf22 checkin from browser
tz
parents: 1945
diff changeset
   128
        top := StandardSystemView extent:200@200.
3e13a97eaf22 checkin from browser
tz
parents: 1945
diff changeset
   129
        top menuHolder:mh.
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
   130
        top open
621
decaeae1910d examples
Claus Gittinger <cg@exept.de>
parents: 616
diff changeset
   131
                                                                        [exEnd]
decaeae1910d examples
Claus Gittinger <cg@exept.de>
parents: 616
diff changeset
   132
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   133
"
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   134
! !
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   135
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   136
!View class methodsFor:'instance creation'!
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   137
140
claus
parents: 135
diff changeset
   138
on:aModel aspect:aspectMsg
claus
parents: 135
diff changeset
   139
    "st-80 style view creation: create a new view, set its model
claus
parents: 135
diff changeset
   140
     and selectors for aspect"
claus
parents: 135
diff changeset
   141
claus
parents: 135
diff changeset
   142
    ^ self new 
claus
parents: 135
diff changeset
   143
	on:aModel
claus
parents: 135
diff changeset
   144
	aspect:aspectMsg
claus
parents: 135
diff changeset
   145
!
claus
parents: 135
diff changeset
   146
claus
parents: 135
diff changeset
   147
on:aModel aspect:aspectMsg change:changeMsg
claus
parents: 135
diff changeset
   148
    "st-80 style view creation: create a new view, set its model
claus
parents: 135
diff changeset
   149
     and selectors for aspect and change"
claus
parents: 135
diff changeset
   150
claus
parents: 135
diff changeset
   151
    ^ self new 
claus
parents: 135
diff changeset
   152
	on:aModel
claus
parents: 135
diff changeset
   153
	aspect:aspectMsg
claus
parents: 135
diff changeset
   154
	change:changeMsg
claus
parents: 135
diff changeset
   155
!
claus
parents: 135
diff changeset
   156
135
claus
parents: 133
diff changeset
   157
on:aModel aspect:aspectMsg change:changeMsg menu:menuMsg
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   158
    "st-80 style view creation: create a new view, set its model
140
claus
parents: 135
diff changeset
   159
     and selectors for aspect, change and menu"
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   160
135
claus
parents: 133
diff changeset
   161
    ^ self new 
claus
parents: 133
diff changeset
   162
	on:aModel
claus
parents: 133
diff changeset
   163
	aspect:aspectMsg
claus
parents: 133
diff changeset
   164
	change:changeMsg
claus
parents: 133
diff changeset
   165
	menu:menuMsg
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   166
!
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   167
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   168
on:aModel aspect:aspectMsg menu:menuMsg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   169
    "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
   170
     and selectors for aspect and menu"
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   171
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   172
    ^ self new 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   173
	on:aModel
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   174
	aspect:aspectMsg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   175
	menu:menuMsg
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   176
! !
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   177
123
9f8c7f20fdb2 *** empty log message ***
claus
parents: 121
diff changeset
   178
!View class methodsFor:'defaults'!
9f8c7f20fdb2 *** empty log message ***
claus
parents: 121
diff changeset
   179
140
claus
parents: 135
diff changeset
   180
defaultAspectMessage   
135
claus
parents: 133
diff changeset
   181
    "subclasses which by default do NOT want to be informed about changed
claus
parents: 133
diff changeset
   182
     models should redefine this to return nil"
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   183
135
claus
parents: 133
diff changeset
   184
    ^ #value
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   185
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   186
140
claus
parents: 135
diff changeset
   187
defaultChangeMessage   
135
claus
parents: 133
diff changeset
   188
    "subclasses which by default do NOT want to inform the model
claus
parents: 133
diff changeset
   189
     should redefine this to return nil"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   190
135
claus
parents: 133
diff changeset
   191
    ^ #value:
1151
1a3682212ea9 Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents: 1149
diff changeset
   192
!
1a3682212ea9 Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents: 1149
diff changeset
   193
1a3682212ea9 Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents: 1149
diff changeset
   194
defaultMenuMessage   
1a3682212ea9 Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents: 1149
diff changeset
   195
    "subclasses which by default do NOT want to send menu messages
1a3682212ea9 Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents: 1149
diff changeset
   196
     should return nil"
1a3682212ea9 Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents: 1149
diff changeset
   197
1a3682212ea9 Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents: 1149
diff changeset
   198
    ^ nil
1a3682212ea9 Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents: 1149
diff changeset
   199
1a3682212ea9 Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents: 1149
diff changeset
   200
    "Created: 3.1.1997 / 01:50:36 / stefan"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   201
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   202
3355
2ec13d9b93ca in allViewBackground: do not change the bg, if I have a bg-channel
Claus Gittinger <cg@exept.de>
parents: 3204
diff changeset
   203
!View methodsFor:'accessing-bg & border'!
2ec13d9b93ca in allViewBackground: do not change the bg, if I have a bg-channel
Claus Gittinger <cg@exept.de>
parents: 3204
diff changeset
   204
2ec13d9b93ca in allViewBackground: do not change the bg, if I have a bg-channel
Claus Gittinger <cg@exept.de>
parents: 3204
diff changeset
   205
allViewBackground:something
2ec13d9b93ca in allViewBackground: do not change the bg, if I have a bg-channel
Claus Gittinger <cg@exept.de>
parents: 3204
diff changeset
   206
    "set the viewBackground to something, a color, image or form,
2ec13d9b93ca in allViewBackground: do not change the bg, if I have a bg-channel
Claus Gittinger <cg@exept.de>
parents: 3204
diff changeset
   207
     in myself and recursively in all of my subviews.
2ec13d9b93ca in allViewBackground: do not change the bg, if I have a bg-channel
Claus Gittinger <cg@exept.de>
parents: 3204
diff changeset
   208
     However, if I have a backgroundChannel, dont change my own bg."
2ec13d9b93ca in allViewBackground: do not change the bg, if I have a bg-channel
Claus Gittinger <cg@exept.de>
parents: 3204
diff changeset
   209
2ec13d9b93ca in allViewBackground: do not change the bg, if I have a bg-channel
Claus Gittinger <cg@exept.de>
parents: 3204
diff changeset
   210
    backgroundChannel isNil ifTrue:[
2ec13d9b93ca in allViewBackground: do not change the bg, if I have a bg-channel
Claus Gittinger <cg@exept.de>
parents: 3204
diff changeset
   211
        ^ super allViewBackground:something
2ec13d9b93ca in allViewBackground: do not change the bg, if I have a bg-channel
Claus Gittinger <cg@exept.de>
parents: 3204
diff changeset
   212
    ].
2ec13d9b93ca in allViewBackground: do not change the bg, if I have a bg-channel
Claus Gittinger <cg@exept.de>
parents: 3204
diff changeset
   213
2ec13d9b93ca in allViewBackground: do not change the bg, if I have a bg-channel
Claus Gittinger <cg@exept.de>
parents: 3204
diff changeset
   214
    self allSubViewsBackground:something
2ec13d9b93ca in allViewBackground: do not change the bg, if I have a bg-channel
Claus Gittinger <cg@exept.de>
parents: 3204
diff changeset
   215
2ec13d9b93ca in allViewBackground: do not change the bg, if I have a bg-channel
Claus Gittinger <cg@exept.de>
parents: 3204
diff changeset
   216
    "Modified: / 31.10.2000 / 13:06:57 / bg"
2ec13d9b93ca in allViewBackground: do not change the bg, if I have a bg-channel
Claus Gittinger <cg@exept.de>
parents: 3204
diff changeset
   217
! !
2ec13d9b93ca in allViewBackground: do not change the bg, if I have a bg-channel
Claus Gittinger <cg@exept.de>
parents: 3204
diff changeset
   218
170
claus
parents: 147
diff changeset
   219
!View methodsFor:'accessing-channels'!
claus
parents: 147
diff changeset
   220
2548
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   221
backgroundChannel 
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   222
    "return a valueHolder for background color"
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   223
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   224
    ^ backgroundChannel
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   225
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   226
    "Modified: / 30.3.1999 / 13:49:28 / stefan"
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   227
    "Created: / 30.3.1999 / 13:50:55 / stefan"
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   228
!
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   229
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   230
backgroundChannel:aValueHolder
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   231
    "set the foregroundChannel - a valueHolder holding a color"
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   232
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   233
    |prev|
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   234
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   235
    prev := backgroundChannel.
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   236
    backgroundChannel := aValueHolder.
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   237
    self setupChannel:aValueHolder for:nil withOld:prev
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   238
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   239
    "Modified: / 31.10.1997 / 14:38:38 / cg"
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   240
    "Created: / 30.3.1999 / 13:48:42 / stefan"
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   241
!
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   242
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   243
enableChannel 
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   244
    "return a valueHolder for enable/disable"
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   245
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   246
    ^ enableChannel
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   247
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   248
    "Created: / 30.3.1999 / 13:46:43 / stefan"
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   249
!
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   250
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   251
enableChannel:aValueHolder 
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   252
    "set the valueHolder, which holds the enable boolean value"
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   253
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   254
    |prev|
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   255
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   256
    prev := enableChannel.
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   257
    enableChannel := aValueHolder.
2950
705ddb097eec Fix visibilityChannel and enableChannel stuff
Claus Gittinger <cg@exept.de>
parents: 2573
diff changeset
   258
    self setupChannel:aValueHolder for:#enableStateChanged withOld:prev
2548
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   259
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   260
    "Modified: / 14.11.1997 / 13:52:44 / cg"
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   261
    "Modified: / 30.3.1999 / 13:50:15 / stefan"
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   262
!
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   263
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   264
foregroundChannel 
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   265
    "return a valueHolder for foreground color"
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   266
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   267
    ^ foregroundChannel
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   268
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   269
    "Modified: / 30.3.1999 / 13:49:28 / stefan"
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   270
!
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   271
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   272
foregroundChannel:aValueHolder
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   273
    "set the foregroundChannel - a valueHolder holding a color"
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   274
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   275
    |prev|
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   276
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   277
    prev := foregroundChannel.
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   278
    foregroundChannel := aValueHolder.
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   279
    self setupChannel:aValueHolder for:nil withOld:prev
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   280
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   281
    "Modified: / 31.10.1997 / 14:38:38 / cg"
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   282
    "Modified: / 30.3.1999 / 13:50:08 / stefan"
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   283
!
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   284
3141
5023711943b3 some visibility stuff moved to superclass
Claus Gittinger <cg@exept.de>
parents: 3095
diff changeset
   285
setVisibilityChannel:aValueHolder 
5023711943b3 some visibility stuff moved to superclass
Claus Gittinger <cg@exept.de>
parents: 3095
diff changeset
   286
    "set the valueHolder, which holds the visible boolean value"
170
claus
parents: 147
diff changeset
   287
3141
5023711943b3 some visibility stuff moved to superclass
Claus Gittinger <cg@exept.de>
parents: 3095
diff changeset
   288
    visibilityChannel := aValueHolder.
170
claus
parents: 147
diff changeset
   289
3141
5023711943b3 some visibility stuff moved to superclass
Claus Gittinger <cg@exept.de>
parents: 3095
diff changeset
   290
    "
5023711943b3 some visibility stuff moved to superclass
Claus Gittinger <cg@exept.de>
parents: 3095
diff changeset
   291
      |v h|
1945
4d6391460133 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   292
3141
5023711943b3 some visibility stuff moved to superclass
Claus Gittinger <cg@exept.de>
parents: 3095
diff changeset
   293
      v := View new.
5023711943b3 some visibility stuff moved to superclass
Claus Gittinger <cg@exept.de>
parents: 3095
diff changeset
   294
      v visibilityChannel:(h := ValueHolder with:true).
5023711943b3 some visibility stuff moved to superclass
Claus Gittinger <cg@exept.de>
parents: 3095
diff changeset
   295
      v open.
5023711943b3 some visibility stuff moved to superclass
Claus Gittinger <cg@exept.de>
parents: 3095
diff changeset
   296
      Delay waitForSeconds:2.
5023711943b3 some visibility stuff moved to superclass
Claus Gittinger <cg@exept.de>
parents: 3095
diff changeset
   297
      h value:false.
5023711943b3 some visibility stuff moved to superclass
Claus Gittinger <cg@exept.de>
parents: 3095
diff changeset
   298
      Delay waitForSeconds:2.
5023711943b3 some visibility stuff moved to superclass
Claus Gittinger <cg@exept.de>
parents: 3095
diff changeset
   299
      h value:true.
5023711943b3 some visibility stuff moved to superclass
Claus Gittinger <cg@exept.de>
parents: 3095
diff changeset
   300
      Delay waitForSeconds:2.
5023711943b3 some visibility stuff moved to superclass
Claus Gittinger <cg@exept.de>
parents: 3095
diff changeset
   301
    "
1945
4d6391460133 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   302
3141
5023711943b3 some visibility stuff moved to superclass
Claus Gittinger <cg@exept.de>
parents: 3095
diff changeset
   303
    "Created: / 14.1.1998 / 17:11:15 / stefan"
5023711943b3 some visibility stuff moved to superclass
Claus Gittinger <cg@exept.de>
parents: 3095
diff changeset
   304
    "Modified: / 14.1.1998 / 17:33:40 / stefan"
2548
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   305
!
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   306
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   307
visibilityChannel 
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   308
    "return a valueHolder for visible/invisible"
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   309
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   310
    ^ visibilityChannel
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   311
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   312
    "Modified: / 30.3.1999 / 13:49:56 / stefan"
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   313
!
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   314
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   315
visibilityChannel:aValueHolder 
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   316
    "set the valueHolder, which holds the visible boolean value"
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   317
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   318
    |prev|
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   319
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   320
    prev := visibilityChannel.
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   321
    visibilityChannel := aValueHolder.
2950
705ddb097eec Fix visibilityChannel and enableChannel stuff
Claus Gittinger <cg@exept.de>
parents: 2573
diff changeset
   322
    self setupChannel:aValueHolder for:#visibilityStateChanged withOld:prev
2548
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   323
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   324
    "
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   325
      |v h|
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   326
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   327
      v := View new.
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   328
      v visibilityChannel:(h := ValueHolder with:true).
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   329
      v open.
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   330
      Delay waitForSeconds:2.
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   331
      h value:false.
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   332
      Delay waitForSeconds:2.
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   333
      h value:true.
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   334
      Delay waitForSeconds:2.
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   335
    "
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   336
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   337
    "Created: / 14.1.1998 / 17:11:15 / stefan"
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   338
    "Modified: / 14.1.1998 / 17:33:40 / stefan"
170
claus
parents: 147
diff changeset
   339
! !
claus
parents: 147
diff changeset
   340
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   341
!View methodsFor:'accessing-menus'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   342
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   343
menuHolder
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   344
    "who has the menu ? 
1147
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   345
     If no explicit menuHolder was defined, its the model if I have one.
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   346
     Otherwise, its the menuHolder (if nonNil) or mySelf.
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   347
     The menuHolder is supposed to return a popUpMenu when asked via the
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   348
     menuMessage."
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   349
1147
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   350
    menuHolder notNil ifTrue:[^ menuHolder].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   351
    model notNil ifTrue:[^ model].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   352
    ^ self
1147
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   353
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   354
    "Modified: 23.12.1996 / 13:56:55 / cg"
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   355
!
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   356
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   357
menuHolder:anObject
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   358
    "change the one that provides the menu (via menuMsg)."
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   359
2134
3e13a97eaf22 checkin from browser
tz
parents: 1945
diff changeset
   360
    menuHolder := anObject.
3e13a97eaf22 checkin from browser
tz
parents: 1945
diff changeset
   361
    menuMsg isNil ifTrue:[menuMsg := #value].
1147
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   362
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   363
    "Created: 23.12.1996 / 13:54:33 / cg"
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   364
!
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   365
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   366
menuMessage
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   367
    "Return the symbol sent to the model to aquire the menu"
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   368
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   369
    ^ menuMsg
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   370
!
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   371
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   372
menuMessage:aSymbol
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   373
    "ST-80 style menus: If a views menuSymbol is nonNil, it
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   374
     will send it to its model when the middleButton is pressed.
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   375
     That method should return nil or the menu to be shown.
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   376
     This is useful for very dynamic menus, where it does not
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   377
     make sense to define an initial menu.
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   378
     This is the same as #menu: which was added for ST-80 compatibility."
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   379
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   380
    menuMsg := aSymbol
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   381
!
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
menuPerformer
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   384
    "who should perform the menu actions ? 
1147
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   385
     If no menuPerformer was defined, its the model if I have one.
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   386
     Otherwise its the menuPerformer (if nonNil), or myself.
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   387
     The menuPerformer get messages from the menu"
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   388
1147
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   389
    menuPerformer notNil ifTrue:[^ menuPerformer].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   390
    model notNil ifTrue:[^ model].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   391
    ^ self
1147
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   392
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   393
    "Modified: 23.12.1996 / 13:57:18 / cg"
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   394
!
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   395
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   396
menuPerformer:anObject
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   397
    "change the one that does the menu actions.
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   398
     See the comment in SimpleView>>activateMenu on who gets the menus
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   399
     message."
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   400
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   401
    menuPerformer := anObject
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   402
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   403
    "
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   404
     |top textV plug|
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   405
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   406
     plug := Plug new.
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   407
     plug respondTo:#textMenu
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   408
               with:[ |m|
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   409
                        m := PopUpMenu
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   410
                                  labels:#('copy' 'foo' '-' 'others')
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   411
                                  selectors:#(copySelection foo nil others).
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   412
                        m subMenuAt:#others
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   413
                                put:(PopUpMenu 
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   414
                                        labels:#('bar' 'goto')
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   415
                                        selectors:#(bar gotoLine))        
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   416
                    ].
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   417
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   418
     top := StandardSystemView new.
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   419
     top extent:300@300.
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   420
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   421
     textV := TextView origin:0.0@0.0 corner:1.0@1.0 in:top.
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   422
     textV menuHolder:plug; menuMessage:#textMenu; menuPerformer:plug.
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   423
     textV contents:'hello world'.
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   424
     top open.
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   425
    "
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   426
83ed804938e7 moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1146
diff changeset
   427
    "Created: 23.12.1996 / 13:57:28 / cg"
2166
d6e05def4f83 added #performer: (dummy - ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2134
diff changeset
   428
!
d6e05def4f83 added #performer: (dummy - ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2134
diff changeset
   429
d6e05def4f83 added #performer: (dummy - ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2134
diff changeset
   430
performer:anObject
d6e05def4f83 added #performer: (dummy - ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2134
diff changeset
   431
    "same as #menuPerformer - ST80 compatibility"
d6e05def4f83 added #performer: (dummy - ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2134
diff changeset
   432
d6e05def4f83 added #performer: (dummy - ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2134
diff changeset
   433
    self menuPerformer:anObject
d6e05def4f83 added #performer: (dummy - ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2134
diff changeset
   434
d6e05def4f83 added #performer: (dummy - ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2134
diff changeset
   435
    "Created: / 6.7.1998 / 13:38:32 / cg"
269
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
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   438
!View methodsFor:'accessing-mvc'!
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   439
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   440
addModelInterfaceTo:aDictionary
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   441
    "this adds entries for all messages sent to my model
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   442
     to aDictionary"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   443
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   444
    aDictionary at:#aspectMessage put:aspectMsg.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   445
    aDictionary at:#changeMessage put:changeMsg.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   446
    aDictionary at:#menuMessage put:menuMsg.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   447
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   448
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   449
     Button new modelInterface 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   450
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   451
!
135
claus
parents: 133
diff changeset
   452
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   453
aspect
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   454
    "Return the aspect used with changes from/to the model"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   455
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   456
    ^ aspectMsg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   457
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   458
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   459
aspectMessage
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   460
    "Return the aspect used with changes from/to the model"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   461
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   462
    ^ aspectMsg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   463
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   464
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   465
aspectMessage:aspectSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   466
    "ST-80 style updating: If a views aspectSymbol is nonNil, 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   467
     it will respond to changes of this aspect from the model."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   468
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   469
    aspectMsg := aspectSymbol
135
claus
parents: 133
diff changeset
   470
!
claus
parents: 133
diff changeset
   471
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   472
change:changeSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   473
    "ST-80 style change notification: If a views changeSymbol is nonNil, 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   474
     it will send it to its model when something changes.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   475
     Alias for changeMessage: for ST-80 compatibility."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   476
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   477
    self changeMessage:changeSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   478
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   479
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   480
changeMessage
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   481
    "Return the symbol sent to the model if nonNil when something changes."
135
claus
parents: 133
diff changeset
   482
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   483
    ^ changeMsg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   484
!
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
changeMessage:aSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   487
    "ST-80 style change notification: If a views changeSymbol is nonNil, 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   488
     it will send it to its model when something changes.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   489
     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
   490
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   491
    changeMsg := aSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   492
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   493
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   494
controller:aController
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   495
    "set the controller"
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   496
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   497
    super controller:aController.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   498
    controller notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   499
	controller model:model
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   500
    ]
48194c26a46c Initial revision
claus
parents:
diff changeset
   501
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   502
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   503
menu:menuSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   504
    "ST-80 style menus: If a views menuSymbol is nonNil, it
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   505
     will send it to its model when the middleButton is pressed.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   506
     That method should return nil or the menu to be shown.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   507
     This is useful for very dynamic menus, where it does not
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   508
     make sense to define an initial menu.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   509
     Alias for #menuMessage:, for ST-80 compatibility."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   510
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   511
    menuMsg := menuSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   512
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   513
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   514
model
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   515
    "return the model, for non-MVC views,
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   516
     this is nil or the receiver"
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   517
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   518
    ^ model
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   519
!
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   520
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   521
model:aModel
1151
1a3682212ea9 Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents: 1149
diff changeset
   522
    "Set the model.
1149
a3a75ffb29ce Set meuPerformer also, when model is set.
Stefan Vogel <sv@exept.de>
parents: 1147
diff changeset
   523
     Here, if I am my own menuPerformer/menuHolder,
1151
1a3682212ea9 Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents: 1149
diff changeset
   524
     set the menuHolder and menuPerformer to the model. 
1a3682212ea9 Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents: 1149
diff changeset
   525
     This is a compatibility kludge,
1149
a3a75ffb29ce Set meuPerformer also, when model is set.
Stefan Vogel <sv@exept.de>
parents: 1147
diff changeset
   526
     since typically, ST-80 code expects the model to provide a menu
1151
1a3682212ea9 Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents: 1149
diff changeset
   527
     and perform it. If the model does not support a menu message,
1a3682212ea9 Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents: 1149
diff changeset
   528
     it will be forwarded to the view.
1149
a3a75ffb29ce Set meuPerformer also, when model is set.
Stefan Vogel <sv@exept.de>
parents: 1147
diff changeset
   529
     Those apps which want the view to provide the (default) menu have to reset
a3a75ffb29ce Set meuPerformer also, when model is set.
Stefan Vogel <sv@exept.de>
parents: 1147
diff changeset
   530
     this by sending #menuHolder: message (again)"
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   531
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   532
    model notNil ifTrue:[
1149
a3a75ffb29ce Set meuPerformer also, when model is set.
Stefan Vogel <sv@exept.de>
parents: 1147
diff changeset
   533
        model removeDependent:self
89
ea2bf46eb669 *** empty log message ***
claus
parents: 87
diff changeset
   534
    ].
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   535
    model := aModel.
2524
6a32a348aaa4 relaxed setting of menuPerformer to model,
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
   536
6a32a348aaa4 relaxed setting of menuPerformer to model,
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
   537
    "/ ST80 kludge start
6a32a348aaa4 relaxed setting of menuPerformer to model,
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
   538
    (menuPerformer == self 
6a32a348aaa4 relaxed setting of menuPerformer to model,
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
   539
    and:[menuHolder == self
6a32a348aaa4 relaxed setting of menuPerformer to model,
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
   540
    and:[model isValueModel not]]) ifTrue:[
1149
a3a75ffb29ce Set meuPerformer also, when model is set.
Stefan Vogel <sv@exept.de>
parents: 1147
diff changeset
   541
        menuPerformer := menuHolder := model
a3a75ffb29ce Set meuPerformer also, when model is set.
Stefan Vogel <sv@exept.de>
parents: 1147
diff changeset
   542
    ].
2524
6a32a348aaa4 relaxed setting of menuPerformer to model,
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
   543
    "/ ST80 kludge end.
6a32a348aaa4 relaxed setting of menuPerformer to model,
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
   544
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   545
    model notNil ifTrue:[
1149
a3a75ffb29ce Set meuPerformer also, when model is set.
Stefan Vogel <sv@exept.de>
parents: 1147
diff changeset
   546
        aModel addDependent:self
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   547
    ].
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   548
    controller notNil ifTrue:[
1149
a3a75ffb29ce Set meuPerformer also, when model is set.
Stefan Vogel <sv@exept.de>
parents: 1147
diff changeset
   549
        controller model:aModel
1395
7218ca27d752 moved class>.model to superClass.
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   550
    ].
1149
a3a75ffb29ce Set meuPerformer also, when model is set.
Stefan Vogel <sv@exept.de>
parents: 1147
diff changeset
   551
1395
7218ca27d752 moved class>.model to superClass.
Claus Gittinger <cg@exept.de>
parents: 1152
diff changeset
   552
    "Modified: 28.2.1997 / 19:23:06 / cg"
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   553
!
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   554
140
claus
parents: 135
diff changeset
   555
modelInterface
claus
parents: 135
diff changeset
   556
    "this returns a dictionary of messages sent to my model.
claus
parents: 135
diff changeset
   557
     It can be used for builders and wrappers to get information
claus
parents: 135
diff changeset
   558
     about the messages sent to my model.
claus
parents: 135
diff changeset
   559
     The returned dictionary contains one entry for each get-Msg,
claus
parents: 135
diff changeset
   560
     and the recevier will implement corresponding messages (with a colon)
claus
parents: 135
diff changeset
   561
     to set the message symbol."
claus
parents: 135
diff changeset
   562
claus
parents: 135
diff changeset
   563
    |d|
claus
parents: 135
diff changeset
   564
claus
parents: 135
diff changeset
   565
    d := IdentityDictionary new.
claus
parents: 135
diff changeset
   566
    self addModelInterfaceTo:d.
claus
parents: 135
diff changeset
   567
    ^ d
claus
parents: 135
diff changeset
   568
claus
parents: 135
diff changeset
   569
    "
claus
parents: 135
diff changeset
   570
     Button new modelInterface
claus
parents: 135
diff changeset
   571
     Label new modelInterface 
claus
parents: 135
diff changeset
   572
    "
claus
parents: 135
diff changeset
   573
claus
parents: 135
diff changeset
   574
    "
claus
parents: 135
diff changeset
   575
     does the view support setting the menuMessage ?
claus
parents: 135
diff changeset
   576
claus
parents: 135
diff changeset
   577
     SelectionInListView new modelInterface includesKey:#menuMessage 
claus
parents: 135
diff changeset
   578
    "
claus
parents: 135
diff changeset
   579
claus
parents: 135
diff changeset
   580
    "
claus
parents: 135
diff changeset
   581
     turn off all interaction to the model:
claus
parents: 135
diff changeset
   582
claus
parents: 135
diff changeset
   583
     |m v if|
claus
parents: 135
diff changeset
   584
claus
parents: 135
diff changeset
   585
     m := SelectionInList new.
claus
parents: 135
diff changeset
   586
     m list:#('one' 'two' 'tree' 'four') asValue.
claus
parents: 135
diff changeset
   587
     m selection:1 asValue.
claus
parents: 135
diff changeset
   588
     v := SelectionInListView on:m.
claus
parents: 135
diff changeset
   589
     v open.
claus
parents: 135
diff changeset
   590
     v inspect.
claus
parents: 135
diff changeset
   591
claus
parents: 135
diff changeset
   592
     if := v modelInterface.
claus
parents: 135
diff changeset
   593
     if inspect.
claus
parents: 135
diff changeset
   594
claus
parents: 135
diff changeset
   595
     if keysAndValuesDo:[:what :msg |
claus
parents: 135
diff changeset
   596
	 v perform:(what , ':') asSymbol with:nil.
claus
parents: 135
diff changeset
   597
     ].
claus
parents: 135
diff changeset
   598
    "
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   599
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   600
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   601
on:aModel aspect:aspectSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   602
    "ST-80 compatibility: set model and aspect
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   603
     messages - needs a view which uses these"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   604
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   605
    aspectMsg := aspectSymbol.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   606
    self model:aModel.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   607
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   608
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   609
on:aModel aspect:aspectSymbol change:changeSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   610
    "ST-80 compatibility: set model, aspect and change
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   611
     messages - needs a view which uses these"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   612
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   613
    aspectMsg := aspectSymbol.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   614
    changeMsg := changeSymbol.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   615
    self model:aModel.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   616
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   617
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   618
on:aModel aspect:aspectSymbol change:changeSymbol menu:menuSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   619
    "ST-80 compatibility: set model, aspect, change and menu
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   620
     messages - needs a view which uses these"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   621
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   622
    aspectMsg := aspectSymbol.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   623
    changeMsg := changeSymbol.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   624
    menuMsg := menuSymbol.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   625
    self model:aModel.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   626
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   627
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   628
on:aModel aspect:aspectSymbol menu:menuSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   629
    "ST-80 compatibility: set model, aspect and menu
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   630
     messages - needs a view which uses these"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   631
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   632
    aspectMsg := aspectSymbol.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   633
    menuMsg := menuSymbol.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   634
    self model:aModel.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   635
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   636
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   637
sendChangeMessage:aSelector with:arg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   638
    "tell the model about a change"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   639
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   640
    |n selector|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   641
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   642
    "/
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   643
    "/ MVC way of doing it:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   644
    "/ if the model is a block, evaluate it, optionally
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   645
    "/ passing the arg and the receiver as arguments.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   646
    "/
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   647
    "/ otherwise (the common case) send it a changeMsg message
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   648
    "/ 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
   649
    "/ as defined by the selector).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   650
    "/
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   651
    (model notNil and:[aSelector notNil]) ifTrue:[
3170
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   652
        n := aSelector numArgs.
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   653
        model isBlock ifTrue:[
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   654
            n := model numArgs.
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   655
            n == 0 ifTrue:[
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   656
                selector := #value
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   657
            ] ifFalse:[
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   658
                n == 1 ifTrue:[
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   659
                    selector := #value:
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   660
                ] ifFalse:[
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   661
                    selector := #value:value:
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   662
                ]
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   663
            ]
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   664
        ] ifFalse:[
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   665
            selector := aSelector
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   666
        ].
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   667
        n == 0 ifTrue:[
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   668
            model perform:selector 
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   669
        ] ifFalse:[
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   670
            selector == #value: ifTrue:[
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   671
                "/ must take care, if model is == to the selection-collection
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   672
                "/ in this case, we must force a change on the model
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   673
                "/ (valueHolder would not send a change in the == case)
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   674
                "/ Q: is this a good idea, or should it be done
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   675
                "/    at the invoking side
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   676
"/                model isValueModel ifTrue:[
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   677
"/                    model value == arg ifTrue:[
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   678
"/                        model setValue:nil.
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   679
"/                    ]
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   680
"/                ].
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   681
                model value:arg
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   682
            ] ifFalse:[
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   683
                n == 1 ifTrue:[
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   684
                    model perform:selector with:arg
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   685
                ] ifFalse:[
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   686
                    model perform:selector with:arg with:self 
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   687
                ]
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   688
            ]
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   689
        ]
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   690
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   691
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   692
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   693
sendChangeMessageWith:arg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   694
    "tell the model about a change"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   695
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   696
    self sendChangeMessage:changeMsg with:arg
72
3e84121988c3 *** empty log message ***
claus
parents: 60
diff changeset
   697
! !
3e84121988c3 *** empty log message ***
claus
parents: 60
diff changeset
   698
2548
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   699
!View methodsFor:'change & update'!
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   700
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   701
update:something with:aParameter from:changedObject
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   702
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   703
    changedObject == backgroundChannel ifTrue:[
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   704
        self backgroundColor:(backgroundChannel value).
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   705
        ^ self
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   706
    ].
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   707
    changedObject == foregroundChannel ifTrue:[
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   708
        self foregroundColor:(foregroundChannel value).
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   709
        ^ self
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   710
    ].
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   711
    super update:something with:aParameter from:changedObject
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   712
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   713
    "Created: / 14.1.1998 / 17:10:11 / stefan"
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   714
    "Modified: / 30.3.1999 / 13:52:31 / stefan"
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   715
! !
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   716
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   717
!View methodsFor:'drawing'!
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   718
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   719
redraw
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   720
    "redraw myself
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   721
     if there is a model, this one shall redraw itself,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   722
     otherwise we cannot do much here - has to be redefined in subclasses"
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   723
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   724
    model notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   725
	model update:self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   726
    ]
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   727
! !
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   728
2548
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   729
!View methodsFor:'event handling'!
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   730
2556
27e9e1cc8cb3 renambe #enableStateChange and #visibilityStateChange
Claus Gittinger <cg@exept.de>
parents: 2548
diff changeset
   731
enableStateChanged
2548
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   732
    "called to update enable/disable state"
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   733
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   734
    self enabled:(enableChannel value)
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   735
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   736
    "Modified: / 30.3.1999 / 16:07:08 / stefan"
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   737
! !
804e5f66a240 Move coomon channels to view.
Stefan Vogel <sv@exept.de>
parents: 2524
diff changeset
   738
3095
d7b5e6495c79 pure layout views dont want the focusWithButtonPress
ca
parents: 2950
diff changeset
   739
!View methodsFor:'focus handling'!
d7b5e6495c79 pure layout views dont want the focusWithButtonPress
ca
parents: 2950
diff changeset
   740
d7b5e6495c79 pure layout views dont want the focusWithButtonPress
ca
parents: 2950
diff changeset
   741
wantsFocusWithButtonPress
d7b5e6495c79 pure layout views dont want the focusWithButtonPress
ca
parents: 2950
diff changeset
   742
    "views which do not like to take the keyboard focus
d7b5e6495c79 pure layout views dont want the focusWithButtonPress
ca
parents: 2950
diff changeset
   743
     with buttonPress can do so by redefining this
d7b5e6495c79 pure layout views dont want the focusWithButtonPress
ca
parents: 2950
diff changeset
   744
     to return false"
d7b5e6495c79 pure layout views dont want the focusWithButtonPress
ca
parents: 2950
diff changeset
   745
d7b5e6495c79 pure layout views dont want the focusWithButtonPress
ca
parents: 2950
diff changeset
   746
    (self class == View) ifTrue:[
d7b5e6495c79 pure layout views dont want the focusWithButtonPress
ca
parents: 2950
diff changeset
   747
        "/ a pure filler/geometric layout view
d7b5e6495c79 pure layout views dont want the focusWithButtonPress
ca
parents: 2950
diff changeset
   748
        ^ false
d7b5e6495c79 pure layout views dont want the focusWithButtonPress
ca
parents: 2950
diff changeset
   749
    ].
d7b5e6495c79 pure layout views dont want the focusWithButtonPress
ca
parents: 2950
diff changeset
   750
    ^ super wantsFocusWithButtonPress
d7b5e6495c79 pure layout views dont want the focusWithButtonPress
ca
parents: 2950
diff changeset
   751
d7b5e6495c79 pure layout views dont want the focusWithButtonPress
ca
parents: 2950
diff changeset
   752
d7b5e6495c79 pure layout views dont want the focusWithButtonPress
ca
parents: 2950
diff changeset
   753
! !
d7b5e6495c79 pure layout views dont want the focusWithButtonPress
ca
parents: 2950
diff changeset
   754
3170
5ef7c961d23d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
   755
!View methodsFor:'initialization & release'!
2573
437ff42d1ba3 category change
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
   756
437ff42d1ba3 category change
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
   757
destroy
437ff42d1ba3 category change
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
   758
    "unrealize & destroy - make me invisible, destroy subviews then
437ff42d1ba3 category change
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
   759
     make me unknown to the device"
437ff42d1ba3 category change
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
   760
437ff42d1ba3 category change
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
   761
    model notNil ifTrue:[
3204
ed184af034d3 Remove dependents on various channels when destroying.
Stefan Vogel <sv@exept.de>
parents: 3170
diff changeset
   762
        model removeDependent:self.
ed184af034d3 Remove dependents on various channels when destroying.
Stefan Vogel <sv@exept.de>
parents: 3170
diff changeset
   763
        model := nil.
2573
437ff42d1ba3 category change
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
   764
    ].
3204
ed184af034d3 Remove dependents on various channels when destroying.
Stefan Vogel <sv@exept.de>
parents: 3170
diff changeset
   765
    visibilityChannel notNil ifTrue:[visibilityChannel removeDependent:self. visibilityChannel := nil].
ed184af034d3 Remove dependents on various channels when destroying.
Stefan Vogel <sv@exept.de>
parents: 3170
diff changeset
   766
    enableChannel notNil ifTrue:[enableChannel removeDependent:self. enableChannel := nil].
ed184af034d3 Remove dependents on various channels when destroying.
Stefan Vogel <sv@exept.de>
parents: 3170
diff changeset
   767
    foregroundChannel notNil ifTrue:[foregroundChannel removeDependent:self. foregroundChannel := nil].
ed184af034d3 Remove dependents on various channels when destroying.
Stefan Vogel <sv@exept.de>
parents: 3170
diff changeset
   768
    backgroundChannel notNil ifTrue:[backgroundChannel removeDependent:self. backgroundChannel := nil].
2573
437ff42d1ba3 category change
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
   769
    super destroy.
437ff42d1ba3 category change
Claus Gittinger <cg@exept.de>
parents: 2556
diff changeset
   770
!
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   771
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   772
initialize
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   773
    super initialize.
140
claus
parents: 135
diff changeset
   774
claus
parents: 135
diff changeset
   775
    aspectMsg := self class defaultAspectMessage.
claus
parents: 135
diff changeset
   776
    changeMsg := self class defaultChangeMessage.
1151
1a3682212ea9 Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents: 1149
diff changeset
   777
    menuMsg := self class defaultMenuMessage.
1a3682212ea9 Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents: 1149
diff changeset
   778
135
claus
parents: 133
diff changeset
   779
    model notNil ifTrue:[
1151
1a3682212ea9 Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents: 1149
diff changeset
   780
        controller notNil ifTrue:[
1a3682212ea9 Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents: 1149
diff changeset
   781
            controller model:model
1a3682212ea9 Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents: 1149
diff changeset
   782
        ]
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
   783
    ].
1151
1a3682212ea9 Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents: 1149
diff changeset
   784
1152
21c666e130dd menuHolder/menuPerformer stuff.
Stefan Vogel <sv@exept.de>
parents: 1151
diff changeset
   785
    "Modified: 3.1.1997 / 02:11:15 / stefan"
118
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   786
! !
25e775072a89 *** empty log message ***
claus
parents: 116
diff changeset
   787
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   788
!View class methodsFor:'documentation'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   789
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   790
version
3355
2ec13d9b93ca in allViewBackground: do not change the bg, if I have a bg-channel
Claus Gittinger <cg@exept.de>
parents: 3204
diff changeset
   791
    ^ '$Header: /cvs/stx/stx/libview/View.st,v 1.71 2000-10-31 12:39:19 cg Exp $'
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   792
! !