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