author | Claus Gittinger <cg@exept.de> |
Mon, 22 Jul 2019 13:56:47 +0200 | |
changeset 8744 | d9c17cf6f9dd |
parent 7940 | 8a46a8c0dd58 |
permissions | -rw-r--r-- |
5375 | 1 |
" |
7940 | 2 |
COPYRIGHT (c) 1997 by Claus Gittinger |
5375 | 3 |
COPYRIGHT (c) 2009 by eXept Software AG |
7940 | 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 |
||
6715 | 15 |
"{ NameSpace: Smalltalk }" |
16 |
||
5375 | 17 |
AbstractBorder subclass:#SimpleBorder |
5410 | 18 |
instanceVariableNames:'color' |
5375 | 19 |
classVariableNames:'' |
20 |
poolDictionaries:'' |
|
5393 | 21 |
category:'Graphics-Support' |
5375 | 22 |
! |
23 |
||
24 |
!SimpleBorder class methodsFor:'documentation'! |
|
25 |
||
26 |
copyright |
|
27 |
" |
|
7940 | 28 |
COPYRIGHT (c) 1997 by Claus Gittinger |
5375 | 29 |
COPYRIGHT (c) 2009 by eXept Software AG |
7940 | 30 |
All Rights Reserved |
5375 | 31 |
|
32 |
This software is furnished under a license and may be used |
|
33 |
only in accordance with the terms of that license and with the |
|
34 |
inclusion of the above copyright notice. This software may not |
|
35 |
be provided or otherwise made available to, or used by, any |
|
36 |
other person. No title to or ownership of the software is |
|
37 |
hereby transferred. |
|
38 |
" |
|
39 |
! |
|
40 |
||
41 |
documentation |
|
42 |
" |
|
5410 | 43 |
a simple border, where all four sides are drawn in the same solid color |
5375 | 44 |
|
45 |
[author:] |
|
46 |
Claus Gittinger |
|
47 |
" |
|
6715 | 48 |
! |
49 |
||
50 |
examples |
|
51 |
" |
|
52 |
[exBegin] |
|
53 |
|v1 v2 b| |
|
54 |
||
55 |
v1 := View new extent:100@100. |
|
56 |
v2 := View origin:10@10 corner:90@20 in:v2. |
|
57 |
v2 border:(SimpleBorder new color:Color red). |
|
58 |
v1 openAndWait. |
|
59 |
[exEnd] |
|
60 |
" |
|
5375 | 61 |
! ! |
62 |
||
63 |
!SimpleBorder methodsFor:'accessing'! |
|
64 |
||
5410 | 65 |
color |
5432 | 66 |
"the color of the border" |
67 |
||
5375 | 68 |
^ color |
69 |
! |
|
70 |
||
5410 | 71 |
color:aColor |
5432 | 72 |
"set the color of the border" |
5375 | 73 |
|
5417 | 74 |
width ~~ 0 ifTrue:[ |
75 |
self assert:aColor notNil. |
|
76 |
]. |
|
5410 | 77 |
color := aColor |
5375 | 78 |
! ! |
79 |
||
5410 | 80 |
!SimpleBorder methodsFor:'displaying'! |
81 |
||
82 |
displayOn:aGC forDisplayBox:aRectangle |
|
5437
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
83 |
|oldPaint boxLeft boxTop boxWidth boxHeight| |
5375 | 84 |
|
5417 | 85 |
color isNil ifTrue:[ ^ self]. |
5410 | 86 |
|
87 |
oldPaint := aGC paint. |
|
88 |
aGC paint:color. |
|
5437
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
89 |
width == 1 ifTrue:[ |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
90 |
aGC displayRectangle:aRectangle. |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
91 |
] ifFalse:[ |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
92 |
boxLeft := aRectangle left. |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
93 |
boxTop := aRectangle top. |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
94 |
boxWidth := aRectangle width. |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
95 |
boxHeight := aRectangle height. |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
96 |
aGC fillRectangleX:boxLeft y:boxTop width:boxWidth height:width. |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
97 |
aGC fillRectangleX:boxLeft y:boxTop+boxHeight-width width:boxWidth height:width. |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
98 |
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
|
99 |
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
|
100 |
]. |
5410 | 101 |
aGC paint:oldPaint. |
5437
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
102 |
|
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
103 |
" |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
104 |
View new |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
105 |
border:(SimpleBorder width:2 color:Color red); |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
106 |
open. |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
107 |
" |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
108 |
" |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
109 |
View new |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
110 |
border:(SimpleBorder width:4 color:Color red); |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
111 |
open. |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
112 |
" |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
113 |
|
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
114 |
" |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
115 |
StandardSystemView new |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
116 |
extent:200@200; |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
117 |
add:(View new |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
118 |
origin:(10@10) corner:0.9@0.9; |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
119 |
border:(SimpleBorder width:4 color:Color red)); |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
120 |
open. |
75f2638be06f
changed: #displayOn:forDisplayBox:
Claus Gittinger <cg@exept.de>
parents:
5432
diff
changeset
|
121 |
" |
5375 | 122 |
! ! |
123 |
||
124 |
!SimpleBorder class methodsFor:'documentation'! |
|
125 |
||
126 |
version_CVS |
|
7940 | 127 |
^ '$Header$' |
5375 | 128 |
! ! |
6715 | 129 |