5433
|
1 |
"{ Package: 'stx:libview' }"
|
|
2 |
|
|
3 |
AbstractBorder subclass:#RoundButtonBorder
|
|
4 |
instanceVariableNames:'color'
|
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'Graphics-Support'
|
|
8 |
!
|
|
9 |
|
|
10 |
!RoundButtonBorder class methodsFor:'documentation'!
|
|
11 |
|
|
12 |
documentation
|
|
13 |
"
|
|
14 |
experimental
|
|
15 |
|
|
16 |
[author:]
|
|
17 |
Claus Gittinger
|
|
18 |
"
|
|
19 |
! !
|
|
20 |
|
|
21 |
!RoundButtonBorder methodsFor:'accessing'!
|
|
22 |
|
|
23 |
color
|
|
24 |
"the color of the border"
|
|
25 |
|
|
26 |
^ color
|
|
27 |
!
|
|
28 |
|
|
29 |
color:aColor
|
|
30 |
"set the color of the border"
|
|
31 |
|
|
32 |
width ~~ 0 ifTrue:[
|
|
33 |
self assert:aColor notNil.
|
|
34 |
].
|
|
35 |
color := aColor
|
|
36 |
!
|
|
37 |
|
|
38 |
width
|
|
39 |
^ 2
|
|
40 |
! !
|
|
41 |
|
|
42 |
!RoundButtonBorder methodsFor:'displaying'!
|
|
43 |
|
|
44 |
displayOn:aGC forDisplayBox:aRectangle
|
|
45 |
|oldPaint left top w h|
|
|
46 |
|
|
47 |
color isNil ifTrue:[ ^ self].
|
|
48 |
|
|
49 |
oldPaint := aGC paint.
|
|
50 |
aGC paint:color.
|
|
51 |
left := aRectangle left.
|
|
52 |
top := aRectangle top.
|
|
53 |
w := aRectangle width.
|
|
54 |
h := aRectangle height.
|
|
55 |
|
|
56 |
aGC displayRectangleX:left y:top width:w height:h.
|
|
57 |
|
|
58 |
aGC paint:color slightlyLightened.
|
|
59 |
aGC displayPointX:left+2 y:top.
|
|
60 |
aGC displayPointX:left+1 y:top+1.
|
|
61 |
aGC displayPointX:left y:top+2.
|
|
62 |
|
|
63 |
aGC displayPointX:left+2 y:top+h-1.
|
|
64 |
aGC displayPointX:left+1 y:top+h-2.
|
|
65 |
aGC displayPointX:left y:top+h-3.
|
|
66 |
|
|
67 |
aGC displayPointX:left+w-3 y:top.
|
|
68 |
aGC displayPointX:left+w-2 y:top+1.
|
|
69 |
aGC displayPointX:left+w-1 y:top+2.
|
|
70 |
|
|
71 |
aGC displayPointX:left+w-3 y:top+h-1.
|
|
72 |
aGC displayPointX:left+w-2 y:top+h-2.
|
|
73 |
aGC displayPointX:left+w-1 y:top+h-3.
|
|
74 |
|
|
75 |
aGC paint:color lightened.
|
|
76 |
aGC displayPointX:left+1 y:top.
|
|
77 |
aGC displayPointX:left y:top+1.
|
|
78 |
|
|
79 |
aGC displayPointX:left+1 y:top+h-1.
|
|
80 |
aGC displayPointX:left y:top+h-2.
|
|
81 |
|
|
82 |
aGC displayPointX:left+w-2 y:top.
|
|
83 |
aGC displayPointX:left+w-1 y:top+1.
|
|
84 |
|
|
85 |
aGC displayPointX:left+w-2 y:top+h-1.
|
|
86 |
aGC displayPointX:left+w-1 y:top+h-2.
|
|
87 |
|
|
88 |
aGC paint:(aGC container ? aGC) viewBackground.
|
|
89 |
aGC displayPointX:left y:top.
|
|
90 |
aGC displayPointX:left+w-1 y:top.
|
|
91 |
|
|
92 |
aGC displayPointX:left y:top+h-1.
|
|
93 |
aGC displayPointX:left+w-1 y:top+h-1.
|
|
94 |
|
|
95 |
aGC paint:oldPaint.
|
|
96 |
|
|
97 |
"
|
|
98 |
|v b|
|
|
99 |
|
|
100 |
v := View new openAndWait.
|
|
101 |
b := RoundButtonBorder width:2 color:Color grey.
|
|
102 |
b displayOn:v forDisplayBox:(0@0 corner:v extent).
|
|
103 |
"
|
|
104 |
! !
|
|
105 |
|
|
106 |
!RoundButtonBorder class methodsFor:'documentation'!
|
|
107 |
|
|
108 |
version_CVS
|
|
109 |
^ '$Header: /cvs/stx/stx/libview/RoundButtonBorder.st,v 1.1 2009-10-29 15:14:19 cg Exp $'
|
|
110 |
! !
|