author | Claus Gittinger <cg@exept.de> |
Thu, 03 Mar 2011 19:17:42 +0100 | |
changeset 5719 | 014212ef8765 |
parent 5437 | 75f2638be06f |
child 6715 | c02e6d42e2cb |
permissions | -rw-r--r-- |
5375 | 1 |
" |
2 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
3 |
COPYRIGHT (c) 2009 by eXept Software AG |
|
5410 | 4 |
All Rights Reserved |
5375 | 5 |
|
6 |
This software is furnished under a license and may be used |
|
7 |
only in accordance with the terms of that license and with the |
|
8 |
inclusion of the above copyright notice. This software may not |
|
9 |
be provided or otherwise made available to, or used by, any |
|
10 |
other person. No title to or ownership of the software is |
|
11 |
hereby transferred. |
|
12 |
" |
|
13 |
"{ Package: 'stx:libview' }" |
|
14 |
||
15 |
AbstractBorder subclass:#SimpleBorder |
|
5410 | 16 |
instanceVariableNames:'color' |
5375 | 17 |
classVariableNames:'' |
18 |
poolDictionaries:'' |
|
5393 | 19 |
category:'Graphics-Support' |
5375 | 20 |
! |
21 |
||
22 |
!SimpleBorder class methodsFor:'documentation'! |
|
23 |
||
24 |
copyright |
|
25 |
" |
|
26 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
27 |
COPYRIGHT (c) 2009 by eXept Software AG |
|
5410 | 28 |
All Rights Reserved |
5375 | 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 |
||
39 |
documentation |
|
40 |
" |
|
5410 | 41 |
a simple border, where all four sides are drawn in the same solid color |
5375 | 42 |
|
43 |
[author:] |
|
44 |
Claus Gittinger |
|
45 |
" |
|
46 |
! ! |
|
47 |
||
48 |
!SimpleBorder methodsFor:'accessing'! |
|
49 |
||
5410 | 50 |
color |
5432 | 51 |
"the color of the border" |
52 |
||
5375 | 53 |
^ color |
54 |
! |
|
55 |
||
5410 | 56 |
color:aColor |
5432 | 57 |
"set the color of the border" |
5375 | 58 |
|
5417 | 59 |
width ~~ 0 ifTrue:[ |
60 |
self assert:aColor notNil. |
|
61 |
]. |
|
5410 | 62 |
color := aColor |
5375 | 63 |
! ! |
64 |
||
5410 | 65 |
!SimpleBorder methodsFor:'displaying'! |
66 |
||
67 |
displayOn:aGC forDisplayBox:aRectangle |
|
5437
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
68 |
|oldPaint boxLeft boxTop boxWidth boxHeight| |
5375 | 69 |
|
5417 | 70 |
color isNil ifTrue:[ ^ self]. |
5410 | 71 |
|
72 |
oldPaint := aGC paint. |
|
73 |
aGC paint:color. |
|
5437
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
74 |
width == 1 ifTrue:[ |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
75 |
aGC displayRectangle:aRectangle. |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
76 |
] ifFalse:[ |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
77 |
boxLeft := aRectangle left. |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
78 |
boxTop := aRectangle top. |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
79 |
boxWidth := aRectangle width. |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
80 |
boxHeight := aRectangle height. |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
81 |
aGC fillRectangleX:boxLeft y:boxTop width:boxWidth height:width. |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
82 |
aGC fillRectangleX:boxLeft y:boxTop+boxHeight-width width:boxWidth height:width. |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
83 |
aGC fillRectangleX:boxLeft y:boxTop+width width:width height:boxHeight-width-width. |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
84 |
aGC fillRectangleX:boxLeft+boxWidth-width y:boxTop+width width:width height:boxHeight-width-width. |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
85 |
]. |
5410 | 86 |
aGC paint:oldPaint. |
5437
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
87 |
|
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
88 |
" |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
89 |
View new |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
90 |
border:(SimpleBorder width:2 color:Color red); |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
91 |
open. |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
92 |
" |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
93 |
" |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
94 |
View new |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
95 |
border:(SimpleBorder width:4 color:Color red); |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
96 |
open. |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
97 |
" |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
98 |
|
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
99 |
" |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
100 |
StandardSystemView new |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
101 |
extent:200@200; |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
102 |
add:(View new |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
103 |
origin:(10@10) corner:0.9@0.9; |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
104 |
border:(SimpleBorder width:4 color:Color red)); |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
105 |
open. |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
106 |
" |
5375 | 107 |
! ! |
108 |
||
109 |
!SimpleBorder class methodsFor:'documentation'! |
|
110 |
||
111 |
version_CVS |
|
5437
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
112 |
^ '$Header: /cvs/stx/stx/libview/SimpleBorder.st,v 1.6 2009-10-29 15:59:43 cg Exp $' |
5375 | 113 |
! ! |