WindowBuilder.st
author Claus Gittinger <cg@exept.de>
Thu, 23 Nov 1995 11:43:41 +0100
changeset 125 fa5b5e4336bf
parent 114 e577a2f332d0
child 132 0a8fe342ed91
permissions -rw-r--r--
checkin from browser
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
89
claus
parents: 86
diff changeset
     1
"
claus
parents: 86
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger
99
claus
parents: 89
diff changeset
     3
	      All Rights Reserved
89
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: 99
diff changeset
    13
Object subclass:#WindowBuilder
75
claus
parents: 69
diff changeset
    14
	 instanceVariableNames:'topView application bindings aspects focusSequence'
66
claus
parents:
diff changeset
    15
	 classVariableNames:''
claus
parents:
diff changeset
    16
	 poolDictionaries:''
80
claus
parents: 75
diff changeset
    17
	 category:'Interface-Support-UI'
66
claus
parents:
diff changeset
    18
!
claus
parents:
diff changeset
    19
claus
parents:
diff changeset
    20
!WindowBuilder class methodsFor:'documentation'!
claus
parents:
diff changeset
    21
89
claus
parents: 86
diff changeset
    22
copyright
claus
parents: 86
diff changeset
    23
"
claus
parents: 86
diff changeset
    24
 COPYRIGHT (c) 1995 by Claus Gittinger
99
claus
parents: 89
diff changeset
    25
	      All Rights Reserved
89
claus
parents: 86
diff changeset
    26
claus
parents: 86
diff changeset
    27
 This software is furnished under a license and may be used
claus
parents: 86
diff changeset
    28
 only in accordance with the terms of that license and with the
claus
parents: 86
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
claus
parents: 86
diff changeset
    30
 be provided or otherwise made available to, or used by, any
claus
parents: 86
diff changeset
    31
 other person.  No title to or ownership of the software is
claus
parents: 86
diff changeset
    32
 hereby transferred.
claus
parents: 86
diff changeset
    33
"
claus
parents: 86
diff changeset
    34
!
claus
parents: 86
diff changeset
    35
66
claus
parents:
diff changeset
    36
documentation
claus
parents:
diff changeset
    37
"
69
claus
parents: 66
diff changeset
    38
    a no-op class, for systems which do not use the UIBuilder.
66
claus
parents:
diff changeset
    39
    Concrete subclasses know how to create a view (with components) from
claus
parents:
diff changeset
    40
    some interface spec. Currently, an experimantal version of UIBuilder exists,
claus
parents:
diff changeset
    41
    and more may be added in the future (for example, to parse different UI
claus
parents:
diff changeset
    42
    specs - thinking of motifs UIL specs etc).
claus
parents:
diff changeset
    43
"
125
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    44
!
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    45
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    46
version
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    47
    ^ '$Header: /cvs/stx/stx/libview2/WindowBuilder.st,v 1.10 1995-11-23 10:43:41 cg Exp $'
66
claus
parents:
diff changeset
    48
! !
claus
parents:
diff changeset
    49
claus
parents:
diff changeset
    50
!WindowBuilder methodsFor:'accessing'!
claus
parents:
diff changeset
    51
100
claus
parents: 99
diff changeset
    52
application
claus
parents: 99
diff changeset
    53
    ^ application
66
claus
parents:
diff changeset
    54
!
claus
parents:
diff changeset
    55
125
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    56
application:anApplicationModel
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    57
    application := anApplicationModel
66
claus
parents:
diff changeset
    58
!
claus
parents:
diff changeset
    59
claus
parents:
diff changeset
    60
aspectAt:aSymbol
claus
parents:
diff changeset
    61
    aspects isNil ifTrue:[^ nil].
claus
parents:
diff changeset
    62
    ^ aspects at:aSymbol ifAbsent:nil
claus
parents:
diff changeset
    63
!
claus
parents:
diff changeset
    64
125
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    65
aspectAt:aSymbol put:aModel
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    66
    aspects isNil ifTrue:[
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    67
	aspects := IdentityDictionary new
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    68
    ].
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    69
    ^ aspects at:aSymbol put:aModel
100
claus
parents: 99
diff changeset
    70
!
claus
parents: 99
diff changeset
    71
claus
parents: 99
diff changeset
    72
bindings
claus
parents: 99
diff changeset
    73
    ^ bindings
claus
parents: 99
diff changeset
    74
!
claus
parents: 99
diff changeset
    75
claus
parents: 99
diff changeset
    76
bindings:aDictionary
claus
parents: 99
diff changeset
    77
    bindings := aDictionary
claus
parents: 99
diff changeset
    78
!
claus
parents: 99
diff changeset
    79
125
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    80
componentAt:name
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    81
    bindings isNil ifTrue:[^ nil].
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    82
    ^ bindings at:name ifAbsent:nil
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    83
!
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    84
100
claus
parents: 99
diff changeset
    85
componentAt:name put:aComponent
claus
parents: 99
diff changeset
    86
    bindings isNil ifTrue:[
claus
parents: 99
diff changeset
    87
	bindings := IdentityDictionary new.
claus
parents: 99
diff changeset
    88
    ].
claus
parents: 99
diff changeset
    89
    bindings at:name put:aComponent
claus
parents: 99
diff changeset
    90
!
claus
parents: 99
diff changeset
    91
125
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    92
focusSequence 
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    93
    ^ focusSequence
66
claus
parents:
diff changeset
    94
!
claus
parents:
diff changeset
    95
86
claus
parents: 80
diff changeset
    96
namedComponents
claus
parents: 80
diff changeset
    97
    ^ bindings
claus
parents: 80
diff changeset
    98
!
claus
parents: 80
diff changeset
    99
125
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   100
source:anApplicationModel
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   101
    application := anApplicationModel
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   102
!
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   103
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   104
window
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   105
    ^ topView
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   106
!
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   107
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   108
window:aView
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   109
    topView := aView
66
claus
parents:
diff changeset
   110
!
claus
parents:
diff changeset
   111
claus
parents:
diff changeset
   112
windowGroup
claus
parents:
diff changeset
   113
    ^ topView windowGroup
claus
parents:
diff changeset
   114
! !
claus
parents:
diff changeset
   115
claus
parents:
diff changeset
   116
!WindowBuilder methodsFor:'operation'!
claus
parents:
diff changeset
   117
125
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   118
buildFromSpec:aSpec
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   119
    self subclassResponsibility
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   120
!
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   121
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   122
closeRequest
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   123
    topView destroy
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   124
!
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   125
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   126
open
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   127
    "open my topView, as previously created"
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   128
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   129
    self openWithExtent:nil andType:#normal 
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   130
!
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   131
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   132
openDialog
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   133
    "open my topView, as previously created as a modal view,
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   134
     blocking interaction to the currently active view."
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   135
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   136
    self openWithExtent:nil andType:#dialog
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   137
!
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   138
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   139
openDialogWithExtent:ext
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   140
    "open my topView, as previously created as a modal view,
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   141
     blocking interaction to the currently active view."
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   142
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   143
    self openWithExtent:ext andType:#dialog
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   144
!
fa5b5e4336bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   145
80
claus
parents: 75
diff changeset
   146
openWithExtent:aPoint
claus
parents: 75
diff changeset
   147
    "open my topView, as previously created, but override
claus
parents: 75
diff changeset
   148
     the extent."
claus
parents: 75
diff changeset
   149
claus
parents: 75
diff changeset
   150
    self openWithExtent:aPoint andType:#normal 
claus
parents: 75
diff changeset
   151
!
claus
parents: 75
diff changeset
   152
66
claus
parents:
diff changeset
   153
openWithExtent:ext andType:type
80
claus
parents: 75
diff changeset
   154
    "open my topView, as previously created. The type argument
claus
parents: 75
diff changeset
   155
     may be #dialog or #normal, and specifies if the view should
claus
parents: 75
diff changeset
   156
     be opened as a modal view, blocking interaction to the currently 
claus
parents: 75
diff changeset
   157
     active view, or as a normal view."
claus
parents: 75
diff changeset
   158
66
claus
parents:
diff changeset
   159
    ext notNil ifTrue:[
claus
parents:
diff changeset
   160
	topView extent:ext
claus
parents:
diff changeset
   161
    ].
claus
parents:
diff changeset
   162
    type == #dialog ifTrue:[
claus
parents:
diff changeset
   163
	topView openModal.
claus
parents:
diff changeset
   164
	^ self
claus
parents:
diff changeset
   165
    ].
claus
parents:
diff changeset
   166
claus
parents:
diff changeset
   167
    type == #normal ifTrue:[
claus
parents:
diff changeset
   168
	topView open.
claus
parents:
diff changeset
   169
	^ self
claus
parents:
diff changeset
   170
    ].
80
claus
parents: 75
diff changeset
   171
    "
claus
parents: 75
diff changeset
   172
     if ST-80 supports more types - these may be added later
claus
parents: 75
diff changeset
   173
    "
66
claus
parents:
diff changeset
   174
    self halt:'unimplemented'
claus
parents:
diff changeset
   175
! !
100
claus
parents: 99
diff changeset
   176
claus
parents: 99
diff changeset
   177
!WindowBuilder methodsFor:'spec creation callbacks'!
claus
parents: 99
diff changeset
   178
claus
parents: 99
diff changeset
   179
createdComponent:aView forSpec:spec
claus
parents: 99
diff changeset
   180
claus
parents: 99
diff changeset
   181
    "Modified: 5.9.1995 / 21:42:54 / claus"
claus
parents: 99
diff changeset
   182
! !
claus
parents: 99
diff changeset
   183