5464
|
1 |
"
|
7944
|
2 |
COPYRIGHT (c) 2009 by Claus Gittinger / eXept Software AG
|
5464
|
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 |
"
|
5433
|
12 |
"{ Package: 'stx:libview' }"
|
|
13 |
|
7944
|
14 |
"{ NameSpace: Smalltalk }"
|
|
15 |
|
5433
|
16 |
AbstractBorder subclass:#RoundButtonBorder
|
|
17 |
instanceVariableNames:'color'
|
|
18 |
classVariableNames:''
|
|
19 |
poolDictionaries:''
|
|
20 |
category:'Graphics-Support'
|
|
21 |
!
|
|
22 |
|
|
23 |
!RoundButtonBorder class methodsFor:'documentation'!
|
|
24 |
|
5464
|
25 |
copyright
|
|
26 |
"
|
7944
|
27 |
COPYRIGHT (c) 2009 by Claus Gittinger / eXept Software AG
|
5464
|
28 |
All Rights Reserved
|
|
29 |
|
|
30 |
This software is furnished under a license and may be used
|
|
31 |
only in accordance with the terms of that license and with the
|
|
32 |
inclusion of the above copyright notice. This software may not
|
|
33 |
be provided or otherwise made available to, or used by, any
|
|
34 |
other person. No title to or ownership of the software is
|
|
35 |
hereby transferred.
|
|
36 |
"
|
|
37 |
!
|
|
38 |
|
5433
|
39 |
documentation
|
|
40 |
"
|
|
41 |
experimental
|
|
42 |
|
5468
|
43 |
|v b|
|
|
44 |
|
|
45 |
v := View new extent:100@100; openAndWait.
|
|
46 |
b := RoundButtonBorder new.
|
|
47 |
b width:1 color:(Color rgbValue:16r707070).
|
|
48 |
b displayOn:v forDisplayBox:((0@0 corner:v extent) insetBy:10).
|
|
49 |
Delay waitForSeconds:3.
|
|
50 |
|
|
51 |
b width:1 color:(Color rgbValue:16r2C628B).
|
|
52 |
b displayOn:v forDisplayBox:((0@0 corner:v extent) insetBy:10).
|
|
53 |
Delay waitForSeconds:3.
|
|
54 |
|
|
55 |
b width:1 color:(Color rgbValue:16r3C7FB1).
|
|
56 |
b displayOn:v forDisplayBox:((0@0 corner:v extent) insetBy:10).
|
|
57 |
|
5433
|
58 |
[author:]
|
|
59 |
Claus Gittinger
|
|
60 |
"
|
|
61 |
! !
|
|
62 |
|
|
63 |
!RoundButtonBorder methodsFor:'accessing'!
|
|
64 |
|
|
65 |
color
|
|
66 |
"the color of the border"
|
|
67 |
|
|
68 |
^ color
|
|
69 |
!
|
|
70 |
|
|
71 |
color:aColor
|
|
72 |
"set the color of the border"
|
|
73 |
|
|
74 |
width ~~ 0 ifTrue:[
|
|
75 |
self assert:aColor notNil.
|
|
76 |
].
|
|
77 |
color := aColor
|
|
78 |
!
|
|
79 |
|
|
80 |
width
|
|
81 |
^ 2
|
|
82 |
! !
|
|
83 |
|
|
84 |
!RoundButtonBorder methodsFor:'displaying'!
|
|
85 |
|
|
86 |
displayOn:aGC forDisplayBox:aRectangle
|
|
87 |
|oldPaint left top w h|
|
|
88 |
|
|
89 |
color isNil ifTrue:[ ^ self].
|
|
90 |
|
|
91 |
oldPaint := aGC paint.
|
|
92 |
aGC paint:color.
|
|
93 |
left := aRectangle left.
|
|
94 |
top := aRectangle top.
|
|
95 |
w := aRectangle width.
|
|
96 |
h := aRectangle height.
|
|
97 |
|
|
98 |
aGC displayRectangleX:left y:top width:w height:h.
|
|
99 |
|
|
100 |
aGC paint:color slightlyLightened.
|
|
101 |
aGC displayPointX:left+2 y:top.
|
|
102 |
aGC displayPointX:left+1 y:top+1.
|
|
103 |
aGC displayPointX:left y:top+2.
|
|
104 |
|
|
105 |
aGC displayPointX:left+2 y:top+h-1.
|
|
106 |
aGC displayPointX:left+1 y:top+h-2.
|
|
107 |
aGC displayPointX:left y:top+h-3.
|
|
108 |
|
|
109 |
aGC displayPointX:left+w-3 y:top.
|
|
110 |
aGC displayPointX:left+w-2 y:top+1.
|
|
111 |
aGC displayPointX:left+w-1 y:top+2.
|
|
112 |
|
|
113 |
aGC displayPointX:left+w-3 y:top+h-1.
|
|
114 |
aGC displayPointX:left+w-2 y:top+h-2.
|
|
115 |
aGC displayPointX:left+w-1 y:top+h-3.
|
|
116 |
|
|
117 |
aGC paint:color lightened.
|
|
118 |
aGC displayPointX:left+1 y:top.
|
|
119 |
aGC displayPointX:left y:top+1.
|
|
120 |
|
|
121 |
aGC displayPointX:left+1 y:top+h-1.
|
|
122 |
aGC displayPointX:left y:top+h-2.
|
|
123 |
|
|
124 |
aGC displayPointX:left+w-2 y:top.
|
|
125 |
aGC displayPointX:left+w-1 y:top+1.
|
|
126 |
|
|
127 |
aGC displayPointX:left+w-2 y:top+h-1.
|
|
128 |
aGC displayPointX:left+w-1 y:top+h-2.
|
|
129 |
|
|
130 |
aGC paint:(aGC container ? aGC) viewBackground.
|
|
131 |
aGC displayPointX:left y:top.
|
|
132 |
aGC displayPointX:left+w-1 y:top.
|
|
133 |
|
|
134 |
aGC displayPointX:left y:top+h-1.
|
|
135 |
aGC displayPointX:left+w-1 y:top+h-1.
|
|
136 |
|
|
137 |
aGC paint:oldPaint.
|
|
138 |
|
|
139 |
"
|
|
140 |
|v b|
|
|
141 |
|
|
142 |
v := View new openAndWait.
|
|
143 |
b := RoundButtonBorder width:2 color:Color grey.
|
|
144 |
b displayOn:v forDisplayBox:(0@0 corner:v extent).
|
|
145 |
"
|
|
146 |
! !
|
|
147 |
|
|
148 |
!RoundButtonBorder class methodsFor:'documentation'!
|
|
149 |
|
|
150 |
version_CVS
|
7944
|
151 |
^ '$Header$'
|
5433
|
152 |
! !
|
7944
|
153 |
|