53
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1994 by Claus Gittinger
|
72
|
3 |
All Rights Reserved
|
53
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
ResourcePack subclass:#ViewStyle
|
72
|
14 |
instanceVariableNames:'name is3D'
|
|
15 |
classVariableNames:''
|
|
16 |
poolDictionaries:''
|
|
17 |
category:'Views-Support'
|
53
|
18 |
!
|
|
19 |
|
|
20 |
ViewStyle comment:'
|
|
21 |
COPYRIGHT (c) 1994 by Claus Gittinger
|
72
|
22 |
All Rights Reserved
|
53
|
23 |
|
72
|
24 |
$Header: /cvs/stx/stx/libview/ViewStyle.st,v 1.2 1994-10-10 02:33:46 claus Exp $
|
53
|
25 |
'!
|
|
26 |
|
|
27 |
!ViewStyle class methodsFor:'documentation'!
|
|
28 |
|
|
29 |
copyright
|
|
30 |
"
|
|
31 |
COPYRIGHT (c) 1993 by Claus Gittinger
|
72
|
32 |
All Rights Reserved
|
53
|
33 |
|
|
34 |
This software is furnished under a license and may be used
|
|
35 |
only in accordance with the terms of that license and with the
|
|
36 |
inclusion of the above copyright notice. This software may not
|
|
37 |
be provided or otherwise made available to, or used by, any
|
|
38 |
other person. No title to or ownership of the software is
|
|
39 |
hereby transferred.
|
|
40 |
"
|
|
41 |
!
|
|
42 |
|
|
43 |
version
|
|
44 |
"
|
72
|
45 |
$Header: /cvs/stx/stx/libview/ViewStyle.st,v 1.2 1994-10-10 02:33:46 claus Exp $
|
53
|
46 |
"
|
|
47 |
!
|
|
48 |
|
|
49 |
documentation
|
|
50 |
"
|
|
51 |
instances of this class keep all view-style specific information.
|
72
|
52 |
The current viewStyle is kept in Views-classvariable called 'StyleSheet'
|
|
53 |
and is instantiated with 'View defaultStyle:aStyleSymbol', which reads
|
|
54 |
a stylesheet from a file '<aStyleSymbol>.style' (usually in the 'resources'
|
|
55 |
directory.
|
53
|
56 |
"
|
|
57 |
! !
|
|
58 |
|
|
59 |
!ViewStyle class methodsFor:'instance creation'!
|
|
60 |
|
|
61 |
fromFile:aFileName
|
|
62 |
"get the preferences definitions from a file"
|
|
63 |
|
|
64 |
|prefs|
|
|
65 |
|
72
|
66 |
prefs := self new.
|
|
67 |
(aFileName endsWith:'.style') ifTrue:[
|
|
68 |
prefs at:#name put:(aFileName copyTo:aFileName size - 6)
|
|
69 |
] ifFalse:[
|
|
70 |
prefs at:#name put:aFileName
|
|
71 |
].
|
|
72 |
(prefs readFromFile:aFileName directory:'resources') isNil ifTrue:[
|
|
73 |
prefs at:#fileReadFailed put:true
|
|
74 |
] ifFalse:[
|
|
75 |
prefs at:#fileReadFailed put:false
|
|
76 |
].
|
53
|
77 |
^ prefs
|
|
78 |
|
72
|
79 |
"
|
|
80 |
ViewStyle fromFile:'motif.style'
|
|
81 |
ViewStyle fromFile:'normal.style'
|
|
82 |
ViewStyle fromFile:'iris.style'
|
|
83 |
"
|
53
|
84 |
! !
|
|
85 |
|
|
86 |
!ViewStyle methodsFor:'accessing'!
|
|
87 |
|
72
|
88 |
at:aKey
|
|
89 |
^ self at:aKey default:nil
|
53
|
90 |
!
|
|
91 |
|
72
|
92 |
is3D
|
|
93 |
is3D isNil ifTrue:[
|
|
94 |
is3D := self at:#is3D default:false.
|
53
|
95 |
].
|
72
|
96 |
^ is3D
|
53
|
97 |
!
|
|
98 |
|
72
|
99 |
name
|
|
100 |
name isNil ifTrue:[
|
|
101 |
name := self at:#name default:'noname'.
|
53
|
102 |
].
|
72
|
103 |
^ name
|
53
|
104 |
!
|
|
105 |
|
|
106 |
doesNotUnderstand:aMessage
|
72
|
107 |
^ self at:(aMessage selector) default:nil
|
53
|
108 |
! !
|