--- a/ApplicationModel.st Tue May 02 01:06:45 1995 +0200
+++ b/ApplicationModel.st Wed May 03 02:01:17 1995 +0200
@@ -39,7 +39,7 @@
version
"
-$Header: /cvs/stx/stx/libview2/ApplicationModel.st,v 1.4 1995-04-11 15:54:20 claus Exp $
+$Header: /cvs/stx/stx/libview2/ApplicationModel.st,v 1.5 1995-05-03 00:01:12 claus Exp $
"
!
@@ -48,7 +48,8 @@
Since many ST-80 classes are subclasses of ApplicationModel, this class
is provided here to allow easier porting of ST-80 code.
- It does not (currently) provide much functionality; therefore, manual
+ It does not (currently) provide much functionality and is NOT
+ compatible to the corresponding ST80 class; therefore, manual
changes have to be made to get those applications to run under ST/X.
(but at least, this enables you to fileIn that code and have a superclass
for them)
@@ -81,17 +82,21 @@
!ApplicationModel class methodsFor:'instance creation'!
new
- ^ super new initialize
+ ^ super new basicInitialize initialize
! !
!ApplicationModel class methodsFor:'startup'!
open
- self subclassResponsibility
+ self new open
+
+ "
+ self open
+ "
!
-openOn:aModel
- self new openOn:aModel
+openOn:anApplicationModel
+ anApplicationModel open
! !
!ApplicationModel class methodsFor:'change & update'!
@@ -103,6 +108,12 @@
]
! !
+!ApplicationModel class methodsFor:'queries'!
+
+interfaceSpecFor:aSelector
+ ^ self perform:aSelector
+! !
+
!ApplicationModel class methodsFor:'resources'!
classResources
@@ -137,41 +148,136 @@
Needed whenever a resource file / language setting has changed"
ClassResources := nil.
+!
+
+updateClassResources
+ "update my classResources"
+
+ ClassResources := nil.
+ self classResources
! !
!ApplicationModel methodsFor:'initialization'!
-initialize
+basicInitialize
super initialize.
+ "
+ Create a windowBuilder to have someone around which
+ understands the builder protocol. Since UIBuilder is not present
+ in all systems, this allows operation without one (unless a spec
+ is read later ...)
+ "
+ builder := WindowBuilder new.
+ builder application:self.
resources := self class classResources.
+!
+
+initialize
+!
+
+addTopViewsToCurrentProject
+ "add all of my topViews to the current projects list of views.
+ This allows hiding views on a per-project basis."
+
+ self windowGroup topViews do:[:aView |
+ aView addToCurrentProject
+ ]
! !
!ApplicationModel methodsFor:'startup'!
-openInterface
- "mhmh - what does this do ?"
+allButOpenFrom:aSpec
+ self preBuildWith:builder.
+ builder buildFromSpec:aSpec.
+ self postBuildWith:builder.
+!
- UIPainter new openOnClass:self class andSelector:#windowSpec.
-
-"/ self subclassResponsibility
+openInterface
+ self openInterface:#windowSpec
!
-openOn:aModel
- UIPainter new openOn:aModel.
+openInterface:aSymbol
+ |spec realBuilder|
+
+ spec := self class interfaceSpecFor:aSymbol.
+ "
+ here, we kludge a bit: up to now, the builder was an
+ instance of the no-op WindowBuilder. Now, it becomes
+ a UIBuilder ....
+ This allows for ApplicationModels without a UIBuilder
+ if not needed.
+ "
+ realBuilder := UIBuilder new.
+ realBuilder application:self.
+ realBuilder bindings:builder bindings.
+ builder := realBuilder.
+
+ self allButOpenFrom:spec.
+ builder window model:self.
+ builder window application:self.
+ builder openWithExtent:nil.
+ self postOpenWith:builder.
+ ^ builder
+!
+
+open
+ self openInterface.
+!
+
+closeDownViews
+ "close down the application"
+
+ |wg views|
+
+ (wg := self windowGroup) notNil ifTrue:[
+ views := wg topViews.
+ views notNil ifTrue:[
+ views do:[:aView |
+ aView destroy
+ ]
+ ]
+ ]
+!
+
+close
+ "this is sent by my topView when about to be closed by the
+ windowmanager. What should this do ?"
+
+ self closeDownViews
+!
+
+opened
+ "this is sent by my topView when its finally open"
+
+ self addTopViewsToCurrentProject.
+ self postOpenWith:builder
!
closeRequest
- "mhmh - what does this do ?"
+ "this is sent by my topView when about to be closed by the
+ windowmanager. What should this do ?"
+
+ self closeDownViews
+!
- builder notNil ifTrue:[
- builder closeRequest
- ].
+saveAndTerminateRequest
+ "some windowManagers send this to shut down an application
+ and have it save its state for restart.
+ Can be redefined in subclasses"
+
+ self closeRequest
+!
+
+preBuildWith:aBuilder
+ "mhmh - what does this do ?"
!
postBuildWith:aBuilder
"mhmh - what does this do ?"
+!
- builder := aBuilder
+postOpenWith:aBuilder
+ "mhmh - what does this do ?"
! !
!ApplicationModel methodsFor:'accessing'!
@@ -180,11 +286,18 @@
^ resources
!
+windowGroup
+ ^ builder window windowGroup
+!
+
builder
^ builder
!
builder:aBuilder
builder := aBuilder
+!
+
+focusSequence
+ ^ builder focusSequence
! !
-