ViewStyle.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 06 Sep 2017 10:04:18 +0200
branchjv
changeset 8180 25149dfd68e0
parent 7723 620e91f9b082
child 8420 76e39223f5ab
permissions -rw-r--r--
Build files: removed a bunch of make rules for long-dead unsupported systems ...in order to unify and simplify the build. If a need to support this ancient systems arose, these hacks may ni longer be needed (due to new versions of tools) or the hacks would have to be written again (better) or retrieved from SCM (worse). Time will show.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
53
6b9a04aede51 Initial revision
claus
parents:
diff changeset
     1
"
243
8cffacfcdb93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 228
diff changeset
     2
 COPYRIGHT (c) 1993 by Claus Gittinger
72
3e84121988c3 *** empty log message ***
claus
parents: 53
diff changeset
     3
	      All Rights Reserved
53
6b9a04aede51 Initial revision
claus
parents:
diff changeset
     4
6b9a04aede51 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
6b9a04aede51 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
6b9a04aede51 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
6b9a04aede51 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
6b9a04aede51 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
6b9a04aede51 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
6b9a04aede51 Initial revision
claus
parents:
diff changeset
    11
"
3678
d180d63dc7ca #fromFile: - accept a Filename
Stefan Vogel <sv@exept.de>
parents: 3118
diff changeset
    12
"{ Package: 'stx:libview' }"
d180d63dc7ca #fromFile: - accept a Filename
Stefan Vogel <sv@exept.de>
parents: 3118
diff changeset
    13
6920
cbe27edb6e72 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
    14
"{ NameSpace: Smalltalk }"
cbe27edb6e72 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
    15
243
8cffacfcdb93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 228
diff changeset
    16
ResourcePack subclass:#ViewStyle
2775
319d0a97eeac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
    17
	instanceVariableNames:'name is3D viewGrey'
617
74941f143cf1 documentation
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    18
	classVariableNames:''
74941f143cf1 documentation
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    19
	poolDictionaries:''
74941f143cf1 documentation
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    20
	category:'Views-Support'
53
6b9a04aede51 Initial revision
claus
parents:
diff changeset
    21
!
6b9a04aede51 Initial revision
claus
parents:
diff changeset
    22
6b9a04aede51 Initial revision
claus
parents:
diff changeset
    23
!ViewStyle class methodsFor:'documentation'!
6b9a04aede51 Initial revision
claus
parents:
diff changeset
    24
6b9a04aede51 Initial revision
claus
parents:
diff changeset
    25
copyright
6b9a04aede51 Initial revision
claus
parents:
diff changeset
    26
"
6b9a04aede51 Initial revision
claus
parents:
diff changeset
    27
 COPYRIGHT (c) 1993 by Claus Gittinger
72
3e84121988c3 *** empty log message ***
claus
parents: 53
diff changeset
    28
	      All Rights Reserved
53
6b9a04aede51 Initial revision
claus
parents:
diff changeset
    29
6b9a04aede51 Initial revision
claus
parents:
diff changeset
    30
 This software is furnished under a license and may be used
6b9a04aede51 Initial revision
claus
parents:
diff changeset
    31
 only in accordance with the terms of that license and with the
6b9a04aede51 Initial revision
claus
parents:
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
6b9a04aede51 Initial revision
claus
parents:
diff changeset
    33
 be provided or otherwise made available to, or used by, any
6b9a04aede51 Initial revision
claus
parents:
diff changeset
    34
 other person.  No title to or ownership of the software is
6b9a04aede51 Initial revision
claus
parents:
diff changeset
    35
 hereby transferred.
6b9a04aede51 Initial revision
claus
parents:
diff changeset
    36
"
6b9a04aede51 Initial revision
claus
parents:
diff changeset
    37
!
6b9a04aede51 Initial revision
claus
parents:
diff changeset
    38
6b9a04aede51 Initial revision
claus
parents:
diff changeset
    39
documentation
6b9a04aede51 Initial revision
claus
parents:
diff changeset
    40
"
6b9a04aede51 Initial revision
claus
parents:
diff changeset
    41
    instances of this class keep all view-style specific information.
72
3e84121988c3 *** empty log message ***
claus
parents: 53
diff changeset
    42
    The current viewStyle is kept in Views-classvariable called 'StyleSheet'
3e84121988c3 *** empty log message ***
claus
parents: 53
diff changeset
    43
    and is instantiated with 'View defaultStyle:aStyleSymbol', which reads
3e84121988c3 *** empty log message ***
claus
parents: 53
diff changeset
    44
    a stylesheet from a file '<aStyleSymbol>.style' (usually in the 'resources'
3e84121988c3 *** empty log message ***
claus
parents: 53
diff changeset
    45
    directory.
617
74941f143cf1 documentation
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    46
74941f143cf1 documentation
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    47
    [see also:]
2304
cbf9bb6fb83e use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1925
diff changeset
    48
	View
cbf9bb6fb83e use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1925
diff changeset
    49
	( Configuration & Customization :html: custom/TOP.html#VIEWSTYLE )
617
74941f143cf1 documentation
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    50
74941f143cf1 documentation
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    51
    [author:]
2304
cbf9bb6fb83e use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1925
diff changeset
    52
	Claus Gittinger
53
6b9a04aede51 Initial revision
claus
parents:
diff changeset
    53
"
6b9a04aede51 Initial revision
claus
parents:
diff changeset
    54
! !
6b9a04aede51 Initial revision
claus
parents:
diff changeset
    55
6b9a04aede51 Initial revision
claus
parents:
diff changeset
    56
!ViewStyle class methodsFor:'instance creation'!
6b9a04aede51 Initial revision
claus
parents:
diff changeset
    57
3678
d180d63dc7ca #fromFile: - accept a Filename
Stefan Vogel <sv@exept.de>
parents: 3118
diff changeset
    58
fromFile:aFileNameArg
53
6b9a04aede51 Initial revision
claus
parents:
diff changeset
    59
    "get the preferences definitions from a file"
6b9a04aede51 Initial revision
claus
parents:
diff changeset
    60
5531
188f76d043b5 changed: #fromFile:
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
    61
    |aFileName prefs failed nm nmInStyles dir path baseName|
53
6b9a04aede51 Initial revision
claus
parents:
diff changeset
    62
3678
d180d63dc7ca #fromFile: - accept a Filename
Stefan Vogel <sv@exept.de>
parents: 3118
diff changeset
    63
    aFileName := aFileNameArg asFilename.
d180d63dc7ca #fromFile: - accept a Filename
Stefan Vogel <sv@exept.de>
parents: 3118
diff changeset
    64
    (aFileName hasSuffix:'style') ifTrue:[
4681
3cd2041ea16d #fromFile: - use (only) #getResorceFileName:forPackage
Stefan Vogel <sv@exept.de>
parents: 4289
diff changeset
    65
        baseName := aFileName withoutSuffix baseName.
3cd2041ea16d #fromFile: - use (only) #getResorceFileName:forPackage
Stefan Vogel <sv@exept.de>
parents: 4289
diff changeset
    66
        nm := aFileName.
72
3e84121988c3 *** empty log message ***
claus
parents: 53
diff changeset
    67
    ] ifFalse:[
4681
3cd2041ea16d #fromFile: - use (only) #getResorceFileName:forPackage
Stefan Vogel <sv@exept.de>
parents: 4289
diff changeset
    68
        baseName := aFileName baseName.
3cd2041ea16d #fromFile: - use (only) #getResorceFileName:forPackage
Stefan Vogel <sv@exept.de>
parents: 4289
diff changeset
    69
        nm := aFileName withSuffix:'style'.
72
3e84121988c3 *** empty log message ***
claus
parents: 53
diff changeset
    70
    ].
5531
188f76d043b5 changed: #fromFile:
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
    71
    nm isAbsolute ifFalse:[
188f76d043b5 changed: #fromFile:
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
    72
        nmInStyles := 'styles' asFilename / nm
188f76d043b5 changed: #fromFile:
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
    73
    ].
188f76d043b5 changed: #fromFile:
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
    74
3678
d180d63dc7ca #fromFile: - accept a Filename
Stefan Vogel <sv@exept.de>
parents: 3118
diff changeset
    75
    prefs := self new.
4681
3cd2041ea16d #fromFile: - use (only) #getResorceFileName:forPackage
Stefan Vogel <sv@exept.de>
parents: 4289
diff changeset
    76
    prefs at:#name put:baseName. 
153
claus
parents: 78
diff changeset
    77
5531
188f76d043b5 changed: #fromFile:
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
    78
    nmInStyles notNil ifTrue:[
188f76d043b5 changed: #fromFile:
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
    79
        path := Smalltalk getResourceFileName:nmInStyles forPackage:'stx:libview'.
188f76d043b5 changed: #fromFile:
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
    80
    ].
188f76d043b5 changed: #fromFile:
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
    81
    path isNil ifTrue:[
188f76d043b5 changed: #fromFile:
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
    82
        path := Smalltalk getResourceFileName:nm forPackage:'stx:libview'.
188f76d043b5 changed: #fromFile:
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
    83
    ].
3057
5d7383ca3aef oops - local style file (in resources) must still be found
Claus Gittinger <cg@exept.de>
parents: 3053
diff changeset
    84
    path notNil ifTrue:[
4681
3cd2041ea16d #fromFile: - use (only) #getResorceFileName:forPackage
Stefan Vogel <sv@exept.de>
parents: 4289
diff changeset
    85
        dir := path asFilename directory pathName.
3048
df43567e46cd look for styles in the libview package-dir as well
Claus Gittinger <cg@exept.de>
parents: 2775
diff changeset
    86
    ].
4681
3cd2041ea16d #fromFile: - use (only) #getResorceFileName:forPackage
Stefan Vogel <sv@exept.de>
parents: 4289
diff changeset
    87
    failed := (prefs readFromFile:nm directory:dir) isNil.
153
claus
parents: 78
diff changeset
    88
    prefs at:#fileReadFailed put:failed. 
53
6b9a04aede51 Initial revision
claus
parents:
diff changeset
    89
    ^ prefs
6b9a04aede51 Initial revision
claus
parents:
diff changeset
    90
72
3e84121988c3 *** empty log message ***
claus
parents: 53
diff changeset
    91
    "
4681
3cd2041ea16d #fromFile: - use (only) #getResorceFileName:forPackage
Stefan Vogel <sv@exept.de>
parents: 4289
diff changeset
    92
     ViewStyle fromFile:'motif'  
3112
94968bec00b0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3084
diff changeset
    93
     ViewStyle fromFile:'motif.style'  
94968bec00b0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3084
diff changeset
    94
     ViewStyle fromFile:'normal.style' 
72
3e84121988c3 *** empty log message ***
claus
parents: 53
diff changeset
    95
     ViewStyle fromFile:'iris.style'
3678
d180d63dc7ca #fromFile: - accept a Filename
Stefan Vogel <sv@exept.de>
parents: 3118
diff changeset
    96
     ViewStyle fromFile:'iris.style' asFilename
72
3e84121988c3 *** empty log message ***
claus
parents: 53
diff changeset
    97
    "
3052
89e30d1da2d7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3051
diff changeset
    98
3112
94968bec00b0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3084
diff changeset
    99
    "Modified: / 10.12.1999 / 16:05:30 / cg"
53
6b9a04aede51 Initial revision
claus
parents:
diff changeset
   100
! !
6b9a04aede51 Initial revision
claus
parents:
diff changeset
   101
5952
5a8e9468117a class: ViewStyle
Claus Gittinger <cg@exept.de>
parents: 5531
diff changeset
   102
!ViewStyle class methodsFor:'constants'!
5a8e9468117a class: ViewStyle
Claus Gittinger <cg@exept.de>
parents: 5531
diff changeset
   103
7711
11ee38c0349c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7686
diff changeset
   104
adwaita
11ee38c0349c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7686
diff changeset
   105
    ^ #Adwaita
11ee38c0349c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7686
diff changeset
   106
11ee38c0349c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7686
diff changeset
   107
    "Created: / 24-11-2016 / 17:54:58 / cg"
11ee38c0349c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7686
diff changeset
   108
!
11ee38c0349c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7686
diff changeset
   109
11ee38c0349c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7686
diff changeset
   110
macosx_yosemite
11ee38c0349c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7686
diff changeset
   111
    ^ #'macosx_yosemite'
11ee38c0349c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7686
diff changeset
   112
11ee38c0349c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7686
diff changeset
   113
    "Created: / 24-11-2016 / 17:55:46 / cg"
11ee38c0349c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7686
diff changeset
   114
!
11ee38c0349c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7686
diff changeset
   115
7179
cedcbd5de0a9 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6924
diff changeset
   116
msWindows8
cedcbd5de0a9 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6924
diff changeset
   117
    ^ #mswindows8
cedcbd5de0a9 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6924
diff changeset
   118
!
cedcbd5de0a9 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6924
diff changeset
   119
5952
5a8e9468117a class: ViewStyle
Claus Gittinger <cg@exept.de>
parents: 5531
diff changeset
   120
msWindowsVista
5a8e9468117a class: ViewStyle
Claus Gittinger <cg@exept.de>
parents: 5531
diff changeset
   121
    ^ #mswindowsVista
5a8e9468117a class: ViewStyle
Claus Gittinger <cg@exept.de>
parents: 5531
diff changeset
   122
!
5a8e9468117a class: ViewStyle
Claus Gittinger <cg@exept.de>
parents: 5531
diff changeset
   123
5a8e9468117a class: ViewStyle
Claus Gittinger <cg@exept.de>
parents: 5531
diff changeset
   124
msWindowsXP
5a8e9468117a class: ViewStyle
Claus Gittinger <cg@exept.de>
parents: 5531
diff changeset
   125
    ^ #mswindowsXP
5a8e9468117a class: ViewStyle
Claus Gittinger <cg@exept.de>
parents: 5531
diff changeset
   126
!
5a8e9468117a class: ViewStyle
Claus Gittinger <cg@exept.de>
parents: 5531
diff changeset
   127
5a8e9468117a class: ViewStyle
Claus Gittinger <cg@exept.de>
parents: 5531
diff changeset
   128
normal
5a8e9468117a class: ViewStyle
Claus Gittinger <cg@exept.de>
parents: 5531
diff changeset
   129
    ^ #normal
5a8e9468117a class: ViewStyle
Claus Gittinger <cg@exept.de>
parents: 5531
diff changeset
   130
! !
5a8e9468117a class: ViewStyle
Claus Gittinger <cg@exept.de>
parents: 5531
diff changeset
   131
53
6b9a04aede51 Initial revision
claus
parents:
diff changeset
   132
!ViewStyle methodsFor:'accessing'!
6b9a04aede51 Initial revision
claus
parents:
diff changeset
   133
7540
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   134
at:key
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   135
    ^ self at: key default: nil for: thisContext sender receiver
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   136
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   137
    "Modified: / 10-09-1995 / 10:59:38 / claus"
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   138
    "Modified: / 19-07-2016 / 21:41:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   139
!
243
8cffacfcdb93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 228
diff changeset
   140
7540
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   141
at:key default:default
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   142
    ^ self at: key default: default for: thisContext sender receiver
243
8cffacfcdb93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 228
diff changeset
   143
7540
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   144
    "Created: / 14-10-1997 / 00:21:15 / cg"
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   145
    "Modified: / 15-09-1998 / 21:47:13 / cg"
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   146
    "Modified: / 19-07-2016 / 21:41:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
243
8cffacfcdb93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 228
diff changeset
   147
!
8cffacfcdb93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 228
diff changeset
   148
7540
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   149
at:key default:default for: class
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   150
    "Retrieve a style resource (color, image, string...) for given key and
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   151
     view `class`. If not found, `default` is returned.
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   152
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   153
     Resource `key` is either a simple key (for example 'foo') or
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   154
     compound key (for example 'bar.foo'). Resource is looked up
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   155
     as follows:
1925
e4d67cc4f082 support new viewStyle resource name format
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   156
7540
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   157
     1. key '<class name>.foo' is looked up, if it exists
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   158
        then its value is returned.
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   159
     2. key 'bar.foo' is looked up, if it exists then
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   160
        then its value is returned (only if key is compound)
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   161
     3. key 'foo' is looked up,  if it exists then
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   162
        then its value is returned
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   163
     4. `default` value is returned.
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   164
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   165
    This has been added to support fine-grained resource (mainly color) specification
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   166
    allowing (easy) customization per widget class (in a somewhat predictable) way.
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   167
    All that while being backward compatible.
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   168
    "
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   169
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   170
    | i key1 key2 key3 |
1925
e4d67cc4f082 support new viewStyle resource name format
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   171
7540
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   172
    i := key indexOf: $..
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   173
    i ~~ 0 ifTrue:[ 
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   174
        key3 := (key copyFrom: i + 1).
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   175
        key2 := key.
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   176
    ] ifFalse:[ 
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   177
        key3 := key.
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   178
        key2 := nil.
2347
c276691fdd72 allow for blocks in styleSheets
Claus Gittinger <cg@exept.de>
parents: 2304
diff changeset
   179
    ].
7540
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   180
    key1 := class class theNonMetaclass name , '.' , key3.
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   181
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   182
    (self includesKey:key1) ifTrue:[
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   183
        ^ (super at:key1 ifAbsent:default) value
1925
e4d67cc4f082 support new viewStyle resource name format
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   184
    ].
7540
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   185
    (key2 notNil and:[self includesKey:key2]) ifTrue:[
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   186
        ^ (super at:key2 ifAbsent:default) value
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   187
    ].
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   188
    (self includesKey:key3) ifTrue:[
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   189
        ^ (super at:key3 ifAbsent:default) value
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   190
    ].
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   191
    ^ default value.
1925
e4d67cc4f082 support new viewStyle resource name format
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   192
7540
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   193
    "Created: / 19-07-2016 / 22:21:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1925
e4d67cc4f082 support new viewStyle resource name format
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   194
!
e4d67cc4f082 support new viewStyle resource name format
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   195
7540
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   196
colorAt: key
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   197
    ^ self colorAt: key default: nil for: thisContext sender receiver
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   198
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   199
    "Modified: / 19-07-2016 / 21:32:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   200
!
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   201
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   202
colorAt:key default:default
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   203
    ^ self colorAt:key default:default for: thisContext sender receiver
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   204
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   205
    "Modified (format): / 19-07-2016 / 21:36:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   206
!
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   207
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   208
colorAt:key default:default for:class
7402
0ade34042e78 #OTHER by mawalch
mawalch
parents: 7179
diff changeset
   209
    "retrieve a color resource - also acquire a device color
243
8cffacfcdb93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 228
diff changeset
   210
     to avoid repeated color allocations later"
8cffacfcdb93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 228
diff changeset
   211
6920
cbe27edb6e72 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
   212
    |value device deviceColor|
cbe27edb6e72 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
   213
cbe27edb6e72 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
   214
    device := Display.
cbe27edb6e72 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
   215
7540
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   216
    value := self at:key default:default for: class.
6920
cbe27edb6e72 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
   217
    value isInteger ifTrue:[
cbe27edb6e72 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
   218
        value := Color rgbValue:value
cbe27edb6e72 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
   219
    ].
cbe27edb6e72 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
   220
    (value notNil and:[device notNil]) ifTrue:[
cbe27edb6e72 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
   221
        deviceColor := value onDevice:device.
cbe27edb6e72 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
   222
        deviceColor notNil ifTrue:[^ deviceColor].
cbe27edb6e72 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
   223
    ].
cbe27edb6e72 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
   224
    ^ value
243
8cffacfcdb93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 228
diff changeset
   225
7540
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   226
    "Created: / 19-07-2016 / 21:32:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   227
    "Modified: / 19-07-2016 / 22:40:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
78
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   228
!
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   229
243
8cffacfcdb93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 228
diff changeset
   230
doesNotUnderstand:aMessage
8cffacfcdb93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 228
diff changeset
   231
    ^ self at:(aMessage selector) default:nil
78
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   232
!
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   233
7540
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   234
fontAt:key
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   235
   ^ self fontAt: key default: nil for: thisContext sender receiver.
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   236
!
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   237
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   238
fontAt:key default:default
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   239
    ^ self fontAt:key default:default for: thisContext sender receiver
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   240
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   241
    "Modified: / 19-07-2016 / 22:42:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   242
!
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   243
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   244
fontAt:key default:default for: class
7402
0ade34042e78 #OTHER by mawalch
mawalch
parents: 7179
diff changeset
   245
    "retrieve a font resource - also acquire a device font
243
8cffacfcdb93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 228
diff changeset
   246
     to avoid repeated font allocations later"
78
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   247
7540
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   248
    ^ self deviceResourceAt:key default:default for: class
78
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   249
7540
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   250
    "Created: / 19-07-2016 / 22:42:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
78
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   251
!
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   252
72
3e84121988c3 *** empty log message ***
claus
parents: 53
diff changeset
   253
is3D
3e84121988c3 *** empty log message ***
claus
parents: 53
diff changeset
   254
    is3D isNil ifTrue:[
3e84121988c3 *** empty log message ***
claus
parents: 53
diff changeset
   255
	is3D := self at:#is3D default:false.
53
6b9a04aede51 Initial revision
claus
parents:
diff changeset
   256
    ].
72
3e84121988c3 *** empty log message ***
claus
parents: 53
diff changeset
   257
    ^ is3D
53
6b9a04aede51 Initial revision
claus
parents:
diff changeset
   258
!
6b9a04aede51 Initial revision
claus
parents:
diff changeset
   259
72
3e84121988c3 *** empty log message ***
claus
parents: 53
diff changeset
   260
name
3e84121988c3 *** empty log message ***
claus
parents: 53
diff changeset
   261
    name isNil ifTrue:[
3e84121988c3 *** empty log message ***
claus
parents: 53
diff changeset
   262
	name := self at:#name default:'noname'.
53
6b9a04aede51 Initial revision
claus
parents:
diff changeset
   263
    ].
72
3e84121988c3 *** empty log message ***
claus
parents: 53
diff changeset
   264
    ^ name
2775
319d0a97eeac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   265
!
319d0a97eeac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   266
319d0a97eeac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   267
viewGrey
319d0a97eeac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   268
    viewGrey isNil ifTrue:[
319d0a97eeac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   269
        viewGrey := self at:#viewGrey default:nil.
319d0a97eeac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   270
    ].
319d0a97eeac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   271
    ^ viewGrey
243
8cffacfcdb93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 228
diff changeset
   272
! !
53
6b9a04aede51 Initial revision
claus
parents:
diff changeset
   273
1894
9982e96dff75 better behavior if no stylesheet is present.
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   274
!ViewStyle methodsFor:'error handling'!
9982e96dff75 better behavior if no stylesheet is present.
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   275
9982e96dff75 better behavior if no stylesheet is present.
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   276
nonexistingFileRead
9982e96dff75 better behavior if no stylesheet is present.
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   277
    "here, a non-existing stylesheet is treated as an error"
9982e96dff75 better behavior if no stylesheet is present.
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   278
9982e96dff75 better behavior if no stylesheet is present.
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   279
    fileReadFailed := true.
9982e96dff75 better behavior if no stylesheet is present.
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   280
    ^ self
9982e96dff75 better behavior if no stylesheet is present.
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   281
9982e96dff75 better behavior if no stylesheet is present.
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   282
    "Created: 6.9.1997 / 11:40:16 / cg"
9982e96dff75 better behavior if no stylesheet is present.
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   283
! !
9982e96dff75 better behavior if no stylesheet is present.
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   284
7540
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   285
!ViewStyle methodsFor:'private'!
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   286
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   287
deviceResourceAt:key default:default for: class
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   288
    "retrieve a resource - also acquire a device version
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   289
     for the default display, to avoid repeated allocations later"
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   290
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   291
    |aResource deviceResource device|
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   292
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   293
    device := Display.
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   294
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   295
    aResource := self at:key default:default for: class.
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   296
    (aResource notNil and:[device notNil]) ifTrue:[
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   297
        deviceResource := aResource onDevice:device.
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   298
        deviceResource notNil ifTrue:[^ deviceResource].
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   299
    ].
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   300
    ^ aResource
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   301
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   302
    "Created: / 19-07-2016 / 22:41:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   303
! !
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   304
3678
d180d63dc7ca #fromFile: - accept a Filename
Stefan Vogel <sv@exept.de>
parents: 3118
diff changeset
   305
!ViewStyle methodsFor:'queries'!
d180d63dc7ca #fromFile: - accept a Filename
Stefan Vogel <sv@exept.de>
parents: 3118
diff changeset
   306
d180d63dc7ca #fromFile: - accept a Filename
Stefan Vogel <sv@exept.de>
parents: 3118
diff changeset
   307
isWindowsStyle
d180d63dc7ca #fromFile: - accept a Filename
Stefan Vogel <sv@exept.de>
parents: 3118
diff changeset
   308
    "answer true if this is a MS-Windows style.
d180d63dc7ca #fromFile: - accept a Filename
Stefan Vogel <sv@exept.de>
parents: 3118
diff changeset
   309
     XXX Currently we simply check the name"
d180d63dc7ca #fromFile: - accept a Filename
Stefan Vogel <sv@exept.de>
parents: 3118
diff changeset
   310
5054
a0837866ad8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
   311
    |nm|
a0837866ad8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
   312
a0837866ad8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
   313
    nm := name ? self name.
3678
d180d63dc7ca #fromFile: - accept a Filename
Stefan Vogel <sv@exept.de>
parents: 3118
diff changeset
   314
5054
a0837866ad8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
   315
    ^ nm == #win95 
a0837866ad8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
   316
    or:[nm == #win98
a0837866ad8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
   317
    or:[nm == #winXP
a0837866ad8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
   318
    or:[nm == #winVista ]]]
4730
49f5f50eea5a added #isWindowsXPStyle
Claus Gittinger <cg@exept.de>
parents: 4681
diff changeset
   319
!
49f5f50eea5a added #isWindowsXPStyle
Claus Gittinger <cg@exept.de>
parents: 4681
diff changeset
   320
5052
23a19186c25d changed #isWindowsVistaStyle
Claus Gittinger <cg@exept.de>
parents: 4730
diff changeset
   321
isWindowsVistaStyle
7686
6397f8316375 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
   322
    ^ (name ? self name) == #winVista
5052
23a19186c25d changed #isWindowsVistaStyle
Claus Gittinger <cg@exept.de>
parents: 4730
diff changeset
   323
7686
6397f8316375 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
   324
    "Modified (format): / 19-11-2016 / 15:49:48 / cg"
5052
23a19186c25d changed #isWindowsVistaStyle
Claus Gittinger <cg@exept.de>
parents: 4730
diff changeset
   325
!
23a19186c25d changed #isWindowsVistaStyle
Claus Gittinger <cg@exept.de>
parents: 4730
diff changeset
   326
4730
49f5f50eea5a added #isWindowsXPStyle
Claus Gittinger <cg@exept.de>
parents: 4681
diff changeset
   327
isWindowsXPStyle
49f5f50eea5a added #isWindowsXPStyle
Claus Gittinger <cg@exept.de>
parents: 4681
diff changeset
   328
    "answer true if this is a MS-Windows-XP (or later) style.
49f5f50eea5a added #isWindowsXPStyle
Claus Gittinger <cg@exept.de>
parents: 4681
diff changeset
   329
     XXX Currently we simply check the name"
49f5f50eea5a added #isWindowsXPStyle
Claus Gittinger <cg@exept.de>
parents: 4681
diff changeset
   330
5054
a0837866ad8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
   331
    |nm|
4730
49f5f50eea5a added #isWindowsXPStyle
Claus Gittinger <cg@exept.de>
parents: 4681
diff changeset
   332
5054
a0837866ad8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
   333
    nm := name ? self name.
a0837866ad8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
   334
a0837866ad8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
   335
    ^ nm == #winXP 
a0837866ad8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
   336
    or:[nm == #winVista]
3678
d180d63dc7ca #fromFile: - accept a Filename
Stefan Vogel <sv@exept.de>
parents: 3118
diff changeset
   337
! !
d180d63dc7ca #fromFile: - accept a Filename
Stefan Vogel <sv@exept.de>
parents: 3118
diff changeset
   338
3069
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   339
!ViewStyle methodsFor:'special'!
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   340
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   341
newDerivedStyle
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   342
    "create and return a new style, which inherits from
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   343
     the receiver, but possibly overrides individual entries.
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   344
     This may be useful to give a single button some different
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   345
     look (in the future - read the comment in SimpleView>>viewStyle:)"
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   346
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   347
    ^ self class new
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   348
        superPack:self; 
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   349
        at:#is3D put:(self is3D);
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   350
        at:viewGrey put:(self viewGrey);
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   351
        yourself
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   352
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   353
    "
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   354
     |panel b1 b2 newStyle|
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   355
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   356
     panel := HorizontalPanelView new.
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   357
     panel add:(b1 := Button label:'oldStyle').
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   358
     panel add:(b2 := Button label:'newStyle').
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   359
     newStyle := b1 styleSheet newDerivedStyle.
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   360
     newStyle at:'button.activeBackgroundColor' put:Color blue.
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   361
     b2 styleSheet:newStyle.        
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   362
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   363
     panel open
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   364
    "
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   365
! !
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   366
253
1471b41ac9e5 version at the end
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   367
!ViewStyle class methodsFor:'documentation'!
1471b41ac9e5 version at the end
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   368
1471b41ac9e5 version at the end
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   369
version
6920
cbe27edb6e72 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
   370
    ^ '$Header$'
5531
188f76d043b5 changed: #fromFile:
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   371
!
188f76d043b5 changed: #fromFile:
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   372
188f76d043b5 changed: #fromFile:
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   373
version_CVS
6920
cbe27edb6e72 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
   374
    ^ '$Header$'
7540
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   375
!
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   376
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   377
version_HG
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   378
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   379
    ^ '$Changeset: <not expanded> $'
253
1471b41ac9e5 version at the end
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   380
! !
6920
cbe27edb6e72 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
   381