ViewStyle.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Sat, 26 Nov 2016 21:09:32 +0000
branchjv
changeset 7719 c2f802dd340a
parent 7716 3dba89415c91
child 7723 620e91f9b082
permissions -rw-r--r--
XFT: Forbid XFT rendering on bitmaps (depth-1 pixmaps) In theory it could work if XFT would just turn gray into either black or white. But XFT doesn't do it and simply draw nothing without failing in any way. To prevent this silent failures, forbid drawing XFT onto bitmaps (depth-1 pixmaps). After all, the while point of XFT is to use anti-aliased fonts.
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
7179
cedcbd5de0a9 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6924
diff changeset
   104
msWindows8
cedcbd5de0a9 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6924
diff changeset
   105
    ^ #mswindows8
cedcbd5de0a9 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6924
diff changeset
   106
!
cedcbd5de0a9 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6924
diff changeset
   107
5952
5a8e9468117a class: ViewStyle
Claus Gittinger <cg@exept.de>
parents: 5531
diff changeset
   108
msWindowsVista
5a8e9468117a class: ViewStyle
Claus Gittinger <cg@exept.de>
parents: 5531
diff changeset
   109
    ^ #mswindowsVista
5a8e9468117a class: ViewStyle
Claus Gittinger <cg@exept.de>
parents: 5531
diff changeset
   110
!
5a8e9468117a class: ViewStyle
Claus Gittinger <cg@exept.de>
parents: 5531
diff changeset
   111
5a8e9468117a class: ViewStyle
Claus Gittinger <cg@exept.de>
parents: 5531
diff changeset
   112
msWindowsXP
5a8e9468117a class: ViewStyle
Claus Gittinger <cg@exept.de>
parents: 5531
diff changeset
   113
    ^ #mswindowsXP
5a8e9468117a class: ViewStyle
Claus Gittinger <cg@exept.de>
parents: 5531
diff changeset
   114
!
5a8e9468117a class: ViewStyle
Claus Gittinger <cg@exept.de>
parents: 5531
diff changeset
   115
5a8e9468117a class: ViewStyle
Claus Gittinger <cg@exept.de>
parents: 5531
diff changeset
   116
normal
5a8e9468117a class: ViewStyle
Claus Gittinger <cg@exept.de>
parents: 5531
diff changeset
   117
    ^ #normal
5a8e9468117a class: ViewStyle
Claus Gittinger <cg@exept.de>
parents: 5531
diff changeset
   118
! !
5a8e9468117a class: ViewStyle
Claus Gittinger <cg@exept.de>
parents: 5531
diff changeset
   119
53
6b9a04aede51 Initial revision
claus
parents:
diff changeset
   120
!ViewStyle methodsFor:'accessing'!
6b9a04aede51 Initial revision
claus
parents:
diff changeset
   121
7540
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   122
at:key
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   123
    ^ 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
   124
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   125
    "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
   126
    "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
   127
!
243
8cffacfcdb93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 228
diff changeset
   128
7540
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   129
at:key default:default
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   130
    ^ self at: key default: default for: thisContext sender receiver
243
8cffacfcdb93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 228
diff changeset
   131
7540
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   132
    "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
   133
    "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
   134
    "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
   135
!
8cffacfcdb93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 228
diff changeset
   136
7540
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   137
at:key default:default for: class
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   138
    "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
   139
     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
   140
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   141
     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
   142
     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
   143
     as follows:
1925
e4d67cc4f082 support new viewStyle resource name format
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   144
7540
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   145
     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
   146
        then its value is returned.
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   147
     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
   148
        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
   149
     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
   150
        then its value is returned
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   151
     4. `default` value 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
    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
   154
    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
   155
    All that while being backward compatible.
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   156
    "
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   157
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   158
    | i key1 key2 key3 |
1925
e4d67cc4f082 support new viewStyle resource name format
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   159
7540
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   160
    i := key indexOf: $..
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   161
    i ~~ 0 ifTrue:[ 
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   162
        key3 := (key copyFrom: i + 1).
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   163
        key2 := key.
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   164
    ] ifFalse:[ 
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   165
        key3 := key.
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   166
        key2 := nil.
2347
c276691fdd72 allow for blocks in styleSheets
Claus Gittinger <cg@exept.de>
parents: 2304
diff changeset
   167
    ].
7540
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   168
    key1 := class class theNonMetaclass name , '.' , key3.
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
    (self includesKey:key1) ifTrue:[
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   171
        ^ (super at:key1 ifAbsent:default) value
1925
e4d67cc4f082 support new viewStyle resource name format
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   172
    ].
7540
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   173
    (key2 notNil and:[self includesKey:key2]) ifTrue:[
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   174
        ^ (super at:key2 ifAbsent:default) value
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   175
    ].
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   176
    (self includesKey:key3) ifTrue:[
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   177
        ^ (super at:key3 ifAbsent:default) value
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   178
    ].
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   179
    ^ default value.
1925
e4d67cc4f082 support new viewStyle resource name format
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   180
7540
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   181
    "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
   182
!
e4d67cc4f082 support new viewStyle resource name format
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   183
7540
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   184
colorAt: key
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   185
    ^ 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
   186
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   187
    "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
   188
!
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
colorAt:key default:default
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   191
    ^ 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
   192
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   193
    "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
   194
!
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   195
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   196
colorAt:key default:default for:class
7402
0ade34042e78 #OTHER by mawalch
mawalch
parents: 7179
diff changeset
   197
    "retrieve a color resource - also acquire a device color
243
8cffacfcdb93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 228
diff changeset
   198
     to avoid repeated color allocations later"
8cffacfcdb93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 228
diff changeset
   199
6920
cbe27edb6e72 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
   200
    |value device deviceColor|
cbe27edb6e72 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
   201
cbe27edb6e72 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
   202
    device := Display.
cbe27edb6e72 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
   203
7540
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   204
    value := self at:key default:default for: class.
6920
cbe27edb6e72 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
   205
    value isInteger ifTrue:[
cbe27edb6e72 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
   206
        value := Color rgbValue:value
cbe27edb6e72 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
   207
    ].
cbe27edb6e72 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
   208
    (value notNil and:[device notNil]) ifTrue:[
cbe27edb6e72 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
   209
        deviceColor := value onDevice:device.
cbe27edb6e72 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
   210
        deviceColor notNil ifTrue:[^ deviceColor].
cbe27edb6e72 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
   211
    ].
cbe27edb6e72 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
   212
    ^ value
243
8cffacfcdb93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 228
diff changeset
   213
7540
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   214
    "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
   215
    "Modified: / 19-07-2016 / 22:40:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
78
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   216
!
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   217
243
8cffacfcdb93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 228
diff changeset
   218
doesNotUnderstand:aMessage
8cffacfcdb93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 228
diff changeset
   219
    ^ self at:(aMessage selector) default:nil
78
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   220
!
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   221
7540
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   222
fontAt:key
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   223
   ^ 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
   224
!
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   225
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   226
fontAt:key default:default
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   227
    ^ 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
   228
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   229
    "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
   230
!
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   231
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   232
fontAt:key default:default for: class
7402
0ade34042e78 #OTHER by mawalch
mawalch
parents: 7179
diff changeset
   233
    "retrieve a font resource - also acquire a device font
243
8cffacfcdb93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 228
diff changeset
   234
     to avoid repeated font allocations later"
78
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
    ^ self deviceResourceAt:key default:default for: class
78
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   237
7540
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   238
    "Created: / 19-07-2016 / 22:42:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
78
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   239
!
1c9c22df3251 *** empty log message ***
claus
parents: 72
diff changeset
   240
72
3e84121988c3 *** empty log message ***
claus
parents: 53
diff changeset
   241
is3D
3e84121988c3 *** empty log message ***
claus
parents: 53
diff changeset
   242
    is3D isNil ifTrue:[
3e84121988c3 *** empty log message ***
claus
parents: 53
diff changeset
   243
	is3D := self at:#is3D default:false.
53
6b9a04aede51 Initial revision
claus
parents:
diff changeset
   244
    ].
72
3e84121988c3 *** empty log message ***
claus
parents: 53
diff changeset
   245
    ^ is3D
53
6b9a04aede51 Initial revision
claus
parents:
diff changeset
   246
!
6b9a04aede51 Initial revision
claus
parents:
diff changeset
   247
72
3e84121988c3 *** empty log message ***
claus
parents: 53
diff changeset
   248
name
3e84121988c3 *** empty log message ***
claus
parents: 53
diff changeset
   249
    name isNil ifTrue:[
3e84121988c3 *** empty log message ***
claus
parents: 53
diff changeset
   250
	name := self at:#name default:'noname'.
53
6b9a04aede51 Initial revision
claus
parents:
diff changeset
   251
    ].
72
3e84121988c3 *** empty log message ***
claus
parents: 53
diff changeset
   252
    ^ name
2775
319d0a97eeac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   253
!
319d0a97eeac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   254
319d0a97eeac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   255
viewGrey
319d0a97eeac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   256
    viewGrey isNil ifTrue:[
319d0a97eeac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   257
        viewGrey := self at:#viewGrey default:nil.
319d0a97eeac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   258
    ].
319d0a97eeac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   259
    ^ viewGrey
243
8cffacfcdb93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 228
diff changeset
   260
! !
53
6b9a04aede51 Initial revision
claus
parents:
diff changeset
   261
1894
9982e96dff75 better behavior if no stylesheet is present.
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   262
!ViewStyle methodsFor:'error handling'!
9982e96dff75 better behavior if no stylesheet is present.
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   263
9982e96dff75 better behavior if no stylesheet is present.
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   264
nonexistingFileRead
9982e96dff75 better behavior if no stylesheet is present.
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   265
    "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
   266
9982e96dff75 better behavior if no stylesheet is present.
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   267
    fileReadFailed := true.
9982e96dff75 better behavior if no stylesheet is present.
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   268
    ^ self
9982e96dff75 better behavior if no stylesheet is present.
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   269
9982e96dff75 better behavior if no stylesheet is present.
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   270
    "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
   271
! !
9982e96dff75 better behavior if no stylesheet is present.
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   272
7540
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   273
!ViewStyle methodsFor:'private'!
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   274
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   275
deviceResourceAt:key default:default for: class
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   276
    "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
   277
     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
   278
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   279
    |aResource deviceResource device|
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   280
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   281
    device := Display.
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   282
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   283
    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
   284
    (aResource notNil and:[device notNil]) ifTrue:[
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   285
        deviceResource := aResource onDevice:device.
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   286
        deviceResource notNil ifTrue:[^ deviceResource].
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   287
    ].
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   288
    ^ aResource
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   289
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   290
    "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
   291
! !
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   292
3678
d180d63dc7ca #fromFile: - accept a Filename
Stefan Vogel <sv@exept.de>
parents: 3118
diff changeset
   293
!ViewStyle methodsFor:'queries'!
d180d63dc7ca #fromFile: - accept a Filename
Stefan Vogel <sv@exept.de>
parents: 3118
diff changeset
   294
d180d63dc7ca #fromFile: - accept a Filename
Stefan Vogel <sv@exept.de>
parents: 3118
diff changeset
   295
isWindowsStyle
d180d63dc7ca #fromFile: - accept a Filename
Stefan Vogel <sv@exept.de>
parents: 3118
diff changeset
   296
    "answer true if this is a MS-Windows style.
d180d63dc7ca #fromFile: - accept a Filename
Stefan Vogel <sv@exept.de>
parents: 3118
diff changeset
   297
     XXX Currently we simply check the name"
d180d63dc7ca #fromFile: - accept a Filename
Stefan Vogel <sv@exept.de>
parents: 3118
diff changeset
   298
5054
a0837866ad8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
   299
    |nm|
a0837866ad8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
   300
a0837866ad8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
   301
    nm := name ? self name.
3678
d180d63dc7ca #fromFile: - accept a Filename
Stefan Vogel <sv@exept.de>
parents: 3118
diff changeset
   302
5054
a0837866ad8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
   303
    ^ nm == #win95 
a0837866ad8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
   304
    or:[nm == #win98
a0837866ad8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
   305
    or:[nm == #winXP
a0837866ad8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
   306
    or:[nm == #winVista ]]]
4730
49f5f50eea5a added #isWindowsXPStyle
Claus Gittinger <cg@exept.de>
parents: 4681
diff changeset
   307
!
49f5f50eea5a added #isWindowsXPStyle
Claus Gittinger <cg@exept.de>
parents: 4681
diff changeset
   308
5052
23a19186c25d changed #isWindowsVistaStyle
Claus Gittinger <cg@exept.de>
parents: 4730
diff changeset
   309
isWindowsVistaStyle
7686
6397f8316375 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
   310
    ^ (name ? self name) == #winVista
5052
23a19186c25d changed #isWindowsVistaStyle
Claus Gittinger <cg@exept.de>
parents: 4730
diff changeset
   311
7686
6397f8316375 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
   312
    "Modified (format): / 19-11-2016 / 15:49:48 / cg"
5052
23a19186c25d changed #isWindowsVistaStyle
Claus Gittinger <cg@exept.de>
parents: 4730
diff changeset
   313
!
23a19186c25d changed #isWindowsVistaStyle
Claus Gittinger <cg@exept.de>
parents: 4730
diff changeset
   314
4730
49f5f50eea5a added #isWindowsXPStyle
Claus Gittinger <cg@exept.de>
parents: 4681
diff changeset
   315
isWindowsXPStyle
49f5f50eea5a added #isWindowsXPStyle
Claus Gittinger <cg@exept.de>
parents: 4681
diff changeset
   316
    "answer true if this is a MS-Windows-XP (or later) style.
49f5f50eea5a added #isWindowsXPStyle
Claus Gittinger <cg@exept.de>
parents: 4681
diff changeset
   317
     XXX Currently we simply check the name"
49f5f50eea5a added #isWindowsXPStyle
Claus Gittinger <cg@exept.de>
parents: 4681
diff changeset
   318
5054
a0837866ad8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
   319
    |nm|
4730
49f5f50eea5a added #isWindowsXPStyle
Claus Gittinger <cg@exept.de>
parents: 4681
diff changeset
   320
5054
a0837866ad8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
   321
    nm := name ? self name.
a0837866ad8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
   322
a0837866ad8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
   323
    ^ nm == #winXP 
a0837866ad8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5053
diff changeset
   324
    or:[nm == #winVista]
3678
d180d63dc7ca #fromFile: - accept a Filename
Stefan Vogel <sv@exept.de>
parents: 3118
diff changeset
   325
! !
d180d63dc7ca #fromFile: - accept a Filename
Stefan Vogel <sv@exept.de>
parents: 3118
diff changeset
   326
3069
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   327
!ViewStyle methodsFor:'special'!
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   328
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   329
newDerivedStyle
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   330
    "create and return a new style, which inherits from
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   331
     the receiver, but possibly overrides individual entries.
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   332
     This may be useful to give a single button some different
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   333
     look (in the future - read the comment in SimpleView>>viewStyle:)"
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   334
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   335
    ^ self class new
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   336
        superPack:self; 
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   337
        at:#is3D put:(self is3D);
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   338
        at:viewGrey put:(self viewGrey);
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   339
        yourself
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
    "
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   342
     |panel b1 b2 newStyle|
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   343
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   344
     panel := HorizontalPanelView new.
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   345
     panel add:(b1 := Button label:'oldStyle').
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   346
     panel add:(b2 := Button label:'newStyle').
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   347
     newStyle := b1 styleSheet newDerivedStyle.
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   348
     newStyle at:'button.activeBackgroundColor' put:Color blue.
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   349
     b2 styleSheet:newStyle.        
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   350
0dc010683048 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3057
diff changeset
   351
     panel open
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
253
1471b41ac9e5 version at the end
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   355
!ViewStyle class methodsFor:'documentation'!
1471b41ac9e5 version at the end
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   356
1471b41ac9e5 version at the end
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   357
version
6920
cbe27edb6e72 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
   358
    ^ '$Header$'
5531
188f76d043b5 changed: #fromFile:
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   359
!
188f76d043b5 changed: #fromFile:
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   360
188f76d043b5 changed: #fromFile:
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   361
version_CVS
6920
cbe27edb6e72 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
   362
    ^ '$Header$'
7540
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   363
!
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   364
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   365
version_HG
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   366
69b0ea8c4b30 ViewStyle: unified style resource lookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7402
diff changeset
   367
    ^ '$Changeset: <not expanded> $'
253
1471b41ac9e5 version at the end
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   368
! !
6920
cbe27edb6e72 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
   369