.
"
COPYRIGHT (c) 1994 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
"
ResourcePack subclass:#ViewStyle
instanceVariableNames:'name is3D'
classVariableNames:''
poolDictionaries:''
category:'Views-Support'
!
ViewStyle comment:'
COPYRIGHT (c) 1994 by Claus Gittinger
All Rights Reserved
$Header: /cvs/stx/stx/libview/ViewStyle.st,v 1.4 1995-06-27 02:20:33 claus Exp $
'!
!ViewStyle class methodsFor:'documentation'!
copyright
"
COPYRIGHT (c) 1993 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
"
!
version
"
$Header: /cvs/stx/stx/libview/ViewStyle.st,v 1.4 1995-06-27 02:20:33 claus Exp $
"
!
documentation
"
instances of this class keep all view-style specific information.
The current viewStyle is kept in Views-classvariable called 'StyleSheet'
and is instantiated with 'View defaultStyle:aStyleSymbol', which reads
a stylesheet from a file '<aStyleSymbol>.style' (usually in the 'resources'
directory.
"
! !
!ViewStyle class methodsFor:'instance creation'!
fromFile:aFileName
"get the preferences definitions from a file"
|prefs failed nm|
prefs := self new.
(aFileName endsWith:'.style') ifTrue:[
nm := aFileName copyWithoutLast:6
] ifFalse:[
nm := aFileName
].
prefs at:#name put:nm.
failed := (prefs readFromFile:aFileName directory:'resources') isNil.
prefs at:#fileReadFailed put:failed.
^ prefs
"
ViewStyle fromFile:'motif.style'
ViewStyle fromFile:'normal.style'
ViewStyle fromFile:'iris.style'
"
! !
!ViewStyle methodsFor:'accessing'!
deviceResourceAt:aKey default:default
"retrieve a resource - also aquire a device version
to avoid repeated allocations later"
|aResource|
aResource := self at:aKey default:default.
aResource notNil ifTrue:[
^ aResource on:Screen current
].
^ nil
!
colorAt:aKey default:default
"retrieve a color resource - also aquire a device color
to avoid repeated color allocations later"
^ self deviceResourceAt:aKey default:default
!
colorAt:aKey
"retrieve a color resource - also aquire a device color
to avoid repeated color allocations later"
^ self deviceResourceAt:aKey default:nil
!
fontAt:aKey default:default
"retrieve a font resource - also aquire a device font
to avoid repeated font allocations later"
^ self deviceResourceAt:aKey default:default
!
fontAt:aKey
"retrieve a font resource - also aquire a device font
to avoid repeated font allocations later"
^ self deviceResourceAt:aKey default:nil
!
at:aKey
^ self at:aKey default:nil
!
is3D
is3D isNil ifTrue:[
is3D := self at:#is3D default:false.
].
^ is3D
!
name
name isNil ifTrue:[
name := self at:#name default:'noname'.
].
^ name
!
doesNotUnderstand:aMessage
^ self at:(aMessage selector) default:nil
! !