5470
|
1 |
"
|
|
2 |
COPYRIGHT (c) 2009 by eXept Software AG
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
"{ Package: 'stx:libview' }"
|
|
13 |
|
|
14 |
ButtonRenderer subclass:#WinVistaButtonRenderer
|
|
15 |
instanceVariableNames:''
|
|
16 |
classVariableNames:''
|
|
17 |
poolDictionaries:''
|
|
18 |
category:'Graphics-Rendering'
|
|
19 |
!
|
|
20 |
|
|
21 |
!WinVistaButtonRenderer class methodsFor:'documentation'!
|
|
22 |
|
|
23 |
copyright
|
|
24 |
"
|
|
25 |
COPYRIGHT (c) 2009 by eXept Software AG
|
|
26 |
All Rights Reserved
|
|
27 |
|
|
28 |
This software is furnished under a license and may be used
|
|
29 |
only in accordance with the terms of that license and with the
|
|
30 |
inclusion of the above copyright notice. This software may not
|
|
31 |
be provided or otherwise made available to, or used by, any
|
|
32 |
other person. No title to or ownership of the software is
|
|
33 |
hereby transferred.
|
|
34 |
"
|
|
35 |
!
|
|
36 |
|
|
37 |
documentation
|
|
38 |
"
|
|
39 |
experimental work in progress - unfinished; do not use
|
|
40 |
|
|
41 |
|v b r|
|
|
42 |
|
|
43 |
v := View new extent:100@100; openAndWait.
|
|
44 |
b := Button new.
|
|
45 |
b extent:100@20.
|
|
46 |
|
|
47 |
r := WinVistaButtonRenderer new.
|
|
48 |
r render:b on:v forDisplayBox:((0@0 corner:b extent)).
|
|
49 |
"
|
|
50 |
! !
|
|
51 |
|
|
52 |
!WinVistaButtonRenderer methodsFor:'rendering'!
|
|
53 |
|
|
54 |
render:aWidget on:aGC forDisplayBox:aRectangle
|
|
55 |
|sav border bdClr bgClr step1 step2 h1 h2 y|
|
|
56 |
|
|
57 |
sav := aGC paint.
|
|
58 |
|
|
59 |
aWidget controller active ifTrue:[
|
|
60 |
bdClr := (Color rgbValue:16r2C628B)
|
|
61 |
] ifFalse:[
|
|
62 |
aWidget controller entered ifTrue:[
|
|
63 |
bdClr := (Color rgbValue:16r3C7FB1)
|
|
64 |
] ifFalse:[
|
|
65 |
bdClr := (Color rgbValue:16r707070).
|
|
66 |
].
|
|
67 |
].
|
|
68 |
|
|
69 |
border := RoundButtonBorder new.
|
|
70 |
border width:1 color:bdClr.
|
|
71 |
|
|
72 |
border displayOn:aGC forDisplayBox:aRectangle.
|
|
73 |
|
|
74 |
"/ blend 1/10 to 1/5 with color white...
|
|
75 |
h1 := ((aWidget height - 4) // 2).
|
|
76 |
step1 := ((1/5) - (1/10)) / h1.
|
|
77 |
y := 2.
|
|
78 |
(1/10) to:(1/5) by:step1 do:[:m |
|
|
79 |
bgClr := bdClr mixed:m with:Color white.
|
|
80 |
aGC paint:bgClr.
|
|
81 |
aGC displayLineFromX:2 y:y toX:aWidget width-2 y:y.
|
|
82 |
y := y + 1.
|
|
83 |
].
|
|
84 |
|
|
85 |
"/ blend 1/3 to 1/2 with color white...
|
|
86 |
h2 := aWidget height - 4 - h1.
|
|
87 |
step2 := ((1/2) - (1/3)) / h2.
|
|
88 |
(1/3) to:(1/2) by:step1 do:[:m |
|
|
89 |
bgClr := bdClr mixed:m with:Color white.
|
|
90 |
aGC paint:bgClr.
|
|
91 |
aGC displayLineFromX:2 y:y toX:aWidget width-2 y:y.
|
|
92 |
y := y + 1.
|
|
93 |
].
|
|
94 |
|
|
95 |
aGC paint:sav.
|
|
96 |
! !
|
|
97 |
|
|
98 |
!WinVistaButtonRenderer class methodsFor:'documentation'!
|
|
99 |
|
|
100 |
version_CVS
|
|
101 |
^ '$Header: /cvs/stx/stx/libview/WinVistaButtonRenderer.st,v 1.1 2009-11-05 14:01:24 cg Exp $'
|
|
102 |
! !
|