5464
|
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 |
"
|
5433
|
12 |
"{ Package: 'stx:libview' }"
|
|
13 |
|
|
14 |
AbstractBorder subclass:#RoundButtonBorder
|
|
15 |
instanceVariableNames:'color'
|
|
16 |
classVariableNames:''
|
|
17 |
poolDictionaries:''
|
|
18 |
category:'Graphics-Support'
|
|
19 |
!
|
|
20 |
|
|
21 |
!RoundButtonBorder class methodsFor:'documentation'!
|
|
22 |
|
5464
|
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 |
|
5433
|
37 |
documentation
|
|
38 |
"
|
|
39 |
experimental
|
|
40 |
|
|
41 |
[author:]
|
|
42 |
Claus Gittinger
|
|
43 |
"
|
|
44 |
! !
|
|
45 |
|
|
46 |
!RoundButtonBorder methodsFor:'accessing'!
|
|
47 |
|
|
48 |
color
|
|
49 |
"the color of the border"
|
|
50 |
|
|
51 |
^ color
|
|
52 |
!
|
|
53 |
|
|
54 |
color:aColor
|
|
55 |
"set the color of the border"
|
|
56 |
|
|
57 |
width ~~ 0 ifTrue:[
|
|
58 |
self assert:aColor notNil.
|
|
59 |
].
|
|
60 |
color := aColor
|
|
61 |
!
|
|
62 |
|
|
63 |
width
|
|
64 |
^ 2
|
|
65 |
! !
|
|
66 |
|
|
67 |
!RoundButtonBorder methodsFor:'displaying'!
|
|
68 |
|
|
69 |
displayOn:aGC forDisplayBox:aRectangle
|
|
70 |
|oldPaint left top w h|
|
|
71 |
|
|
72 |
color isNil ifTrue:[ ^ self].
|
|
73 |
|
|
74 |
oldPaint := aGC paint.
|
|
75 |
aGC paint:color.
|
|
76 |
left := aRectangle left.
|
|
77 |
top := aRectangle top.
|
|
78 |
w := aRectangle width.
|
|
79 |
h := aRectangle height.
|
|
80 |
|
|
81 |
aGC displayRectangleX:left y:top width:w height:h.
|
|
82 |
|
|
83 |
aGC paint:color slightlyLightened.
|
|
84 |
aGC displayPointX:left+2 y:top.
|
|
85 |
aGC displayPointX:left+1 y:top+1.
|
|
86 |
aGC displayPointX:left y:top+2.
|
|
87 |
|
|
88 |
aGC displayPointX:left+2 y:top+h-1.
|
|
89 |
aGC displayPointX:left+1 y:top+h-2.
|
|
90 |
aGC displayPointX:left y:top+h-3.
|
|
91 |
|
|
92 |
aGC displayPointX:left+w-3 y:top.
|
|
93 |
aGC displayPointX:left+w-2 y:top+1.
|
|
94 |
aGC displayPointX:left+w-1 y:top+2.
|
|
95 |
|
|
96 |
aGC displayPointX:left+w-3 y:top+h-1.
|
|
97 |
aGC displayPointX:left+w-2 y:top+h-2.
|
|
98 |
aGC displayPointX:left+w-1 y:top+h-3.
|
|
99 |
|
|
100 |
aGC paint:color lightened.
|
|
101 |
aGC displayPointX:left+1 y:top.
|
|
102 |
aGC displayPointX:left y:top+1.
|
|
103 |
|
|
104 |
aGC displayPointX:left+1 y:top+h-1.
|
|
105 |
aGC displayPointX:left y:top+h-2.
|
|
106 |
|
|
107 |
aGC displayPointX:left+w-2 y:top.
|
|
108 |
aGC displayPointX:left+w-1 y:top+1.
|
|
109 |
|
|
110 |
aGC displayPointX:left+w-2 y:top+h-1.
|
|
111 |
aGC displayPointX:left+w-1 y:top+h-2.
|
|
112 |
|
|
113 |
aGC paint:(aGC container ? aGC) viewBackground.
|
|
114 |
aGC displayPointX:left y:top.
|
|
115 |
aGC displayPointX:left+w-1 y:top.
|
|
116 |
|
|
117 |
aGC displayPointX:left y:top+h-1.
|
|
118 |
aGC displayPointX:left+w-1 y:top+h-1.
|
|
119 |
|
|
120 |
aGC paint:oldPaint.
|
|
121 |
|
|
122 |
"
|
|
123 |
|v b|
|
|
124 |
|
|
125 |
v := View new openAndWait.
|
|
126 |
b := RoundButtonBorder width:2 color:Color grey.
|
|
127 |
b displayOn:v forDisplayBox:(0@0 corner:v extent).
|
|
128 |
"
|
|
129 |
! !
|
|
130 |
|
|
131 |
!RoundButtonBorder class methodsFor:'documentation'!
|
|
132 |
|
|
133 |
version_CVS
|
5464
|
134 |
^ '$Header: /cvs/stx/stx/libview/RoundButtonBorder.st,v 1.3 2009-11-04 14:32:11 cg Exp $'
|
5433
|
135 |
! !
|