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