UIBuilder.st
author Claus Gittinger <cg@exept.de>
Tue, 28 Oct 1997 20:14:37 +0100
changeset 721 1889d708a951
parent 667 fe63e8ecb0d3
child 734 f1079f443a75
permissions -rw-r--r--
provide a handle to the applications menuBar (req'd by some ST80 apps)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
88
claus
parents: 86
diff changeset
     1
"
claus
parents: 86
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger
100
claus
parents: 96
diff changeset
     3
	      All Rights Reserved
88
claus
parents: 86
diff changeset
     4
claus
parents: 86
diff changeset
     5
 This software is furnished under a license and may be used
claus
parents: 86
diff changeset
     6
 only in accordance with the terms of that license and with the
claus
parents: 86
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
claus
parents: 86
diff changeset
     8
 be provided or otherwise made available to, or used by, any
claus
parents: 86
diff changeset
     9
 other person.  No title to or ownership of the software is
claus
parents: 86
diff changeset
    10
 hereby transferred.
claus
parents: 86
diff changeset
    11
"
claus
parents: 86
diff changeset
    12
100
claus
parents: 96
diff changeset
    13
WindowBuilder subclass:#UIBuilder
478
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
    14
	instanceVariableNames:'view currentMenuSelector menuAspect spec specStack composite
721
1889d708a951 provide a handle to the applications menuBar
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
    15
		lastComponent compositeView menuBar'
223
b65dc250db8d documentation
Claus Gittinger <cg@exept.de>
parents: 139
diff changeset
    16
	classVariableNames:'Verbose'
b65dc250db8d documentation
Claus Gittinger <cg@exept.de>
parents: 139
diff changeset
    17
	poolDictionaries:''
b65dc250db8d documentation
Claus Gittinger <cg@exept.de>
parents: 139
diff changeset
    18
	category:'Interface-Support-UI'
66
claus
parents:
diff changeset
    19
!
claus
parents:
diff changeset
    20
claus
parents:
diff changeset
    21
!UIBuilder class methodsFor:'documentation'!
claus
parents:
diff changeset
    22
125
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    23
copyright
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    24
"
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    25
 COPYRIGHT (c) 1995 by Claus Gittinger
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    26
	      All Rights Reserved
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    27
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    28
 This software is furnished under a license and may be used
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    29
 only in accordance with the terms of that license and with the
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    31
 be provided or otherwise made available to, or used by, any
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    32
 other person.  No title to or ownership of the software is
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    33
 hereby transferred.
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    34
"
88
claus
parents: 86
diff changeset
    35
!
claus
parents: 86
diff changeset
    36
66
claus
parents:
diff changeset
    37
documentation
claus
parents:
diff changeset
    38
"
claus
parents:
diff changeset
    39
    this class will (eventually) allow parsing windowSpecs as
claus
parents:
diff changeset
    40
    created by ST-80's UIPainter, and thereby allow to run applications
claus
parents:
diff changeset
    41
    built with this tool.
claus
parents:
diff changeset
    42
    It was created to allow execution of PD applications which were
claus
parents:
diff changeset
    43
    written using that tool (and more and more are appearing ...).
claus
parents:
diff changeset
    44
claus
parents:
diff changeset
    45
    The class is not completed yet and certainly not bug free.
claus
parents:
diff changeset
    46
    Also, it is not quaranteed that all winSpecs are understood.
223
b65dc250db8d documentation
Claus Gittinger <cg@exept.de>
parents: 139
diff changeset
    47
373
66283cb455bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 372
diff changeset
    48
    Notice: 
66283cb455bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 372
diff changeset
    49
        this class was implemented using protocol information
66283cb455bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 372
diff changeset
    50
        from alpha testers, literature and by read public domain code
66283cb455bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 372
diff changeset
    51
        - it may not be complete or compatible to
66283cb455bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 372
diff changeset
    52
        the corresponding ST-80 class. 
66283cb455bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 372
diff changeset
    53
        If you encounter any incompatibilities, please forward a note 
66283cb455bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 372
diff changeset
    54
        describing the incompatibility verbal (i.e. no code) to the ST/X team.
66283cb455bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 372
diff changeset
    55
223
b65dc250db8d documentation
Claus Gittinger <cg@exept.de>
parents: 139
diff changeset
    56
    [author:]
b65dc250db8d documentation
Claus Gittinger <cg@exept.de>
parents: 139
diff changeset
    57
        Claus Gittinger
66
claus
parents:
diff changeset
    58
"
478
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
    59
!
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
    60
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
    61
examples
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
    62
"
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
    63
    examples to be added.
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
    64
"
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
    65
!
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
    66
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
    67
history
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
    68
    "Created: 3.3.1997 / 19:33:13 / cg"
66
claus
parents:
diff changeset
    69
! !
claus
parents:
diff changeset
    70
claus
parents:
diff changeset
    71
!UIBuilder class methodsFor:'initialization'!
claus
parents:
diff changeset
    72
claus
parents:
diff changeset
    73
initialize
claus
parents:
diff changeset
    74
    Verbose := false    "/ debugging flag
claus
parents:
diff changeset
    75
! !
claus
parents:
diff changeset
    76
86
claus
parents: 80
diff changeset
    77
!UIBuilder methodsFor:'accessing'!
claus
parents: 80
diff changeset
    78
claus
parents: 80
diff changeset
    79
menuAspect
claus
parents: 80
diff changeset
    80
    ^ menuAspect
721
1889d708a951 provide a handle to the applications menuBar
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
    81
!
1889d708a951 provide a handle to the applications menuBar
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
    82
1889d708a951 provide a handle to the applications menuBar
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
    83
menuBar
1889d708a951 provide a handle to the applications menuBar
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
    84
    "return the value of the instance variable 'menuBar' (automatically generated)"
1889d708a951 provide a handle to the applications menuBar
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
    85
1889d708a951 provide a handle to the applications menuBar
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
    86
    ^ menuBar
1889d708a951 provide a handle to the applications menuBar
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
    87
1889d708a951 provide a handle to the applications menuBar
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
    88
    "Created: / 27.10.1997 / 16:30:12 / cg"
1889d708a951 provide a handle to the applications menuBar
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
    89
!
1889d708a951 provide a handle to the applications menuBar
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
    90
1889d708a951 provide a handle to the applications menuBar
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
    91
menuBar:something
1889d708a951 provide a handle to the applications menuBar
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
    92
    "set the value of the instance variable 'menuBar' (automatically generated)"
1889d708a951 provide a handle to the applications menuBar
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
    93
1889d708a951 provide a handle to the applications menuBar
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
    94
    menuBar := something.
1889d708a951 provide a handle to the applications menuBar
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
    95
1889d708a951 provide a handle to the applications menuBar
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
    96
    "Created: / 27.10.1997 / 16:30:13 / cg"
86
claus
parents: 80
diff changeset
    97
! !
claus
parents: 80
diff changeset
    98
372
6d7718f3d298 more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
    99
!UIBuilder methodsFor:'building'!
66
claus
parents:
diff changeset
   100
367
7316abe03075 made obsolete stuff ignored
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   101
add:aSpec
478
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   102
    |collectedComponents|
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   103
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   104
    composite notNil ifTrue:[
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   105
        (collectedComponents := composite collection) isNil ifTrue:[
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   106
            composite collection:(collectedComponents := OrderedCollection new).
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   107
        ].
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   108
        collectedComponents add:aSpec.
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   109
        view := aSpec buildViewWithLayoutFor:self in:compositeView.
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   110
    ] ifFalse:[
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   111
        spec isNil ifTrue:[
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   112
            spec := FullSpec new.
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   113
        ].
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   114
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   115
        (aSpec isMemberOf:WindowSpec) ifTrue:[
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   116
            spec window:aSpec
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   117
        ] ifFalse:[
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   118
            ((aSpec isMemberOf:ComponentSpec)
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   119
            or:[(aSpec isMemberOf:SpecCollection)]) ifTrue:[
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   120
                spec component:aSpec.
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   121
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   122
                window isNil ifTrue:[
479
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   123
                    window := windowView := View new.
478
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   124
                ].
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   125
                aSpec buildViewWithLayoutFor:self in:window.
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   126
"/ builder window displayBox
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   127
                composite := aSpec.
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   128
                compositeView := window.
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   129
            ] ifFalse:[
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   130
                spec component isNil ifTrue:[
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   131
                    spec component:SpecCollection new.
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   132
                    spec component collection:OrderedCollection new.
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   133
                    composite := spec component.
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   134
                    window isNil ifTrue:[
479
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   135
                        window := windowView := View new.
478
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   136
                    ].
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   137
                    compositeView := window.
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   138
                ].
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   139
                spec component collection add:aSpec.
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   140
                view := aSpec buildViewWithLayoutFor:self in:compositeView.
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   141
            ].
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   142
        ]
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   143
    ].
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   144
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   145
    lastComponent := view.
367
7316abe03075 made obsolete stuff ignored
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   146
    ^ view
7316abe03075 made obsolete stuff ignored
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   147
479
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   148
    "Modified: 3.3.1997 / 22:03:02 / cg"
367
7316abe03075 made obsolete stuff ignored
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   149
!
7316abe03075 made obsolete stuff ignored
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   150
474
c337e7ad2220 buildin user defined window
ca
parents: 373
diff changeset
   151
buildFromSpec:aSpecOrSpecArray
100
claus
parents: 96
diff changeset
   152
    |m spec|
claus
parents: 96
diff changeset
   153
474
c337e7ad2220 buildin user defined window
ca
parents: 373
diff changeset
   154
    window notNil ifTrue:[
c337e7ad2220 buildin user defined window
ca
parents: 373
diff changeset
   155
        ^ self buildFromSpec:aSpecOrSpecArray in:window
c337e7ad2220 buildin user defined window
ca
parents: 373
diff changeset
   156
    ].
100
claus
parents: 96
diff changeset
   157
474
c337e7ad2220 buildin user defined window
ca
parents: 373
diff changeset
   158
    spec := UISpecification from:aSpecOrSpecArray.
478
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   159
    window := spec buildViewFor:self.
100
claus
parents: 96
diff changeset
   160
372
6d7718f3d298 more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   161
"/    menuAspect notNil ifTrue:[
6d7718f3d298 more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   162
"/        m := self componentAt:menuAspect.
6d7718f3d298 more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   163
"/        m notNil ifTrue:[
6d7718f3d298 more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   164
"/            m := m value.
6d7718f3d298 more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   165
"/            m notNil ifTrue:[
6d7718f3d298 more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   166
"/                m receiver:application.
6d7718f3d298 more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   167
"/                window add:m.
6d7718f3d298 more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   168
"/                view topInset:(m heightIncludingBorder).
6d7718f3d298 more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   169
"/            ]
6d7718f3d298 more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   170
"/        ]
6d7718f3d298 more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   171
"/    ].
86
claus
parents: 80
diff changeset
   172
372
6d7718f3d298 more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   173
    ^ window
66
claus
parents:
diff changeset
   174
100
claus
parents: 96
diff changeset
   175
    "Modified: 5.9.1995 / 21:43:29 / claus"
478
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   176
    "Modified: 3.3.1997 / 18:43:50 / cg"
125
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   177
!
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   178
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   179
buildFromSpec:aSpecArray in:aView
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   180
    |m spec|
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   181
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   182
    spec := UISpecification from:aSpecArray.
478
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   183
    ^ spec buildViewFor:self in:aView.
125
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   184
478
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   185
    "Modified: 3.3.1997 / 18:44:02 / cg"
363
c7a26a5ebaba doFinalHookup (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
   186
!
c7a26a5ebaba doFinalHookup (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
   187
c7a26a5ebaba doFinalHookup (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
   188
doFinalHookup
c7a26a5ebaba doFinalHookup (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
   189
c7a26a5ebaba doFinalHookup (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 344
diff changeset
   190
    "Created: 14.2.1997 / 14:52:27 / cg"
478
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   191
!
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   192
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   193
endComposite
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   194
    |entry|
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   195
497
6544ec670fe0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 479
diff changeset
   196
    (specStack notNil and:[specStack notEmpty]) ifTrue:[
478
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   197
        entry := specStack removeLast.
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   198
        composite := entry key.
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   199
        compositeView := entry value.
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   200
    ].
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   201
    ^ composite
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   202
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   203
    "Created: 3.3.1997 / 17:17:43 / cg"
497
6544ec670fe0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 479
diff changeset
   204
    "Modified: 6.3.1997 / 16:18:05 / cg"
478
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   205
!
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   206
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   207
endCompositeLayout:layout
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   208
    composite compositeSpec:(CompositeSpec new layout:layout).
479
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   209
    compositeView layout:layout.
478
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   210
    self endComposite
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   211
479
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   212
    "Modified: 3.3.1997 / 20:54:35 / cg"
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   213
!
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   214
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   215
endCompositeLayout:layout properties:props
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   216
    self endCompositeLayout:layout
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   217
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   218
    "Created: 3.3.1997 / 22:15:17 / cg"
478
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   219
!
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   220
585
458fc4cd1437 creation of
ca
parents: 503
diff changeset
   221
menuAt:aKey
458fc4cd1437 creation of
ca
parents: 503
diff changeset
   222
    "Find a binding for the menu named aKey, either in the bindings 
458fc4cd1437 creation of
ca
parents: 503
diff changeset
   223
     cache, or from the source 
458fc4cd1437 creation of
ca
parents: 503
diff changeset
   224
    "
458fc4cd1437 creation of
ca
parents: 503
diff changeset
   225
    | menu |
458fc4cd1437 creation of
ca
parents: 503
diff changeset
   226
458fc4cd1437 creation of
ca
parents: 503
diff changeset
   227
    menu := self bindingAt:aKey.
458fc4cd1437 creation of
ca
parents: 503
diff changeset
   228
    menu isNil ifTrue:[
458fc4cd1437 creation of
ca
parents: 503
diff changeset
   229
        menu := self safelyPerform:#menuFor: with:aKey.
458fc4cd1437 creation of
ca
parents: 503
diff changeset
   230
        menu isNil ifTrue:[
458fc4cd1437 creation of
ca
parents: 503
diff changeset
   231
            menu := self safelyPerform:aKey
458fc4cd1437 creation of
ca
parents: 503
diff changeset
   232
        ].
458fc4cd1437 creation of
ca
parents: 503
diff changeset
   233
        menu := menu value.
458fc4cd1437 creation of
ca
parents: 503
diff changeset
   234
458fc4cd1437 creation of
ca
parents: 503
diff changeset
   235
        (application notNil and:[menu notNil]) ifTrue:[
667
fe63e8ecb0d3 menuAt:aKey
ca
parents: 607
diff changeset
   236
            menu isArray ifTrue:[
fe63e8ecb0d3 menuAt:aKey
ca
parents: 607
diff changeset
   237
                menu := Menu new fromLiteralArrayEncoding:menu.
fe63e8ecb0d3 menuAt:aKey
ca
parents: 607
diff changeset
   238
                menu receiver:application.
fe63e8ecb0d3 menuAt:aKey
ca
parents: 607
diff changeset
   239
              ^ menu
fe63e8ecb0d3 menuAt:aKey
ca
parents: 607
diff changeset
   240
            ].
585
458fc4cd1437 creation of
ca
parents: 503
diff changeset
   241
            menu findGuiResourcesIn:application
458fc4cd1437 creation of
ca
parents: 503
diff changeset
   242
        ]
458fc4cd1437 creation of
ca
parents: 503
diff changeset
   243
    ].
458fc4cd1437 creation of
ca
parents: 503
diff changeset
   244
  ^ menu
458fc4cd1437 creation of
ca
parents: 503
diff changeset
   245
458fc4cd1437 creation of
ca
parents: 503
diff changeset
   246
!
458fc4cd1437 creation of
ca
parents: 503
diff changeset
   247
458fc4cd1437 creation of
ca
parents: 503
diff changeset
   248
menuAt:aSymbol put:aModel
458fc4cd1437 creation of
ca
parents: 503
diff changeset
   249
    "Install value as the binding for the menu named aKey in the
458fc4cd1437 creation of
ca
parents: 503
diff changeset
   250
     bindings cache
458fc4cd1437 creation of
ca
parents: 503
diff changeset
   251
    "
458fc4cd1437 creation of
ca
parents: 503
diff changeset
   252
  ^ self aspectAt:aSymbol put:aModel
458fc4cd1437 creation of
ca
parents: 503
diff changeset
   253
!
458fc4cd1437 creation of
ca
parents: 503
diff changeset
   254
478
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   255
newComposite
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   256
    |newComposite|
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   257
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   258
    specStack isNil ifTrue:[
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   259
        specStack := OrderedCollection new
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   260
    ].
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   261
    specStack addLast:(composite->compositeView).
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   262
    newComposite := CompositeSpecCollection new.
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   263
    newComposite compositeSpec:(CompositeSpec new).
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   264
    compositeView := self add:newComposite.
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   265
    composite := newComposite.
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   266
    ^ compositeView
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   267
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   268
    "Created: 3.3.1997 / 17:15:36 / cg"
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   269
    "Modified: 3.3.1997 / 18:55:13 / cg"
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   270
!
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   271
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   272
wrapper
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   273
    ^ view
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   274
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   275
    "Created: 3.3.1997 / 18:28:31 / cg"
ae8c1aaac281 more ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
   276
    "Modified: 3.3.1997 / 18:44:12 / cg"
100
claus
parents: 96
diff changeset
   277
! !
86
claus
parents: 80
diff changeset
   278
479
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   279
!UIBuilder methodsFor:'initialization'!
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   280
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   281
setupWindowFor:aView
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   282
    |ext|
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   283
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   284
    window notNil ifTrue:[
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   285
        ext := window extent.
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   286
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   287
        ((window isMemberOf:View)
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   288
        or:[window isMemberOf:SimpleView]) ifTrue:[
607
054b3195f908 added message to debugHalt
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   289
479
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   290
windowView ~~ window ifTrue:[
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   291
    windowView isNil ifTrue:[
607
054b3195f908 added message to debugHalt
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   292
        self halt:'debug halt - should not happen'
479
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   293
    ]
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   294
].
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   295
            aView addSubView:window.
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   296
        ].
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   297
    ].
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   298
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   299
    window := aView.
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   300
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   301
    aView container isNil ifTrue:[
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   302
        spec notNil ifTrue:[
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   303
            spec window setupView:window for:self
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   304
        ]
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   305
    ].
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   306
607
054b3195f908 added message to debugHalt
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   307
    "Modified: 17.6.1997 / 18:03:54 / cg"
479
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   308
! !
8058c8296148 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   309
503
23faf6064747 implementing:
ca
parents: 497
diff changeset
   310
!UIBuilder methodsFor:'misc'!
23faf6064747 implementing:
ca
parents: 497
diff changeset
   311
23faf6064747 implementing:
ca
parents: 497
diff changeset
   312
newSubBuilder
23faf6064747 implementing:
ca
parents: 497
diff changeset
   313
    |builder|
23faf6064747 implementing:
ca
parents: 497
diff changeset
   314
23faf6064747 implementing:
ca
parents: 497
diff changeset
   315
    builder := UIBuilder new.
23faf6064747 implementing:
ca
parents: 497
diff changeset
   316
    builder bindings:(self bindings).
23faf6064747 implementing:
ca
parents: 497
diff changeset
   317
    builder application:(self application).
23faf6064747 implementing:
ca
parents: 497
diff changeset
   318
    ^ builder
23faf6064747 implementing:
ca
parents: 497
diff changeset
   319
! !
23faf6064747 implementing:
ca
parents: 497
diff changeset
   320
132
0a8fe342ed91 version method at the end
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   321
!UIBuilder class methodsFor:'documentation'!
0a8fe342ed91 version method at the end
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   322
0a8fe342ed91 version method at the end
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   323
version
721
1889d708a951 provide a handle to the applications menuBar
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
   324
    ^ '$Header: /cvs/stx/stx/libview2/UIBuilder.st,v 1.28 1997-10-28 19:14:37 cg Exp $'
132
0a8fe342ed91 version method at the end
Claus Gittinger <cg@exept.de>
parents: 125
diff changeset
   325
! !
100
claus
parents: 96
diff changeset
   326
UIBuilder initialize!