author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Wed, 30 May 2018 09:37:07 +0100 | |
branch | jv |
changeset 4132 | 7e5528572373 |
parent 3855 | 1db7742d33ad |
permissions | -rw-r--r-- |
3855
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1683
diff
changeset
|
1 |
" |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1683
diff
changeset
|
2 |
COPYRIGHT (c) Claus Gittinger / 2006 by eXept Software AG |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1683
diff
changeset
|
3 |
All Rights Reserved |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1683
diff
changeset
|
4 |
|
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1683
diff
changeset
|
5 |
This software is furnished under a license and may be used |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1683
diff
changeset
|
6 |
only in accordance with the terms of that license and with the |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1683
diff
changeset
|
7 |
inclusion of the above copyright notice. This software may not |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1683
diff
changeset
|
8 |
be provided or otherwise made available to, or used by, any |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1683
diff
changeset
|
9 |
other person. No title to or ownership of the software is |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1683
diff
changeset
|
10 |
hereby transferred. |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1683
diff
changeset
|
11 |
" |
1682 | 12 |
"{ Package: 'stx:libview2' }" |
13 |
||
3855
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1683
diff
changeset
|
14 |
"{ NameSpace: Smalltalk }" |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1683
diff
changeset
|
15 |
|
1682 | 16 |
View subclass:#PluggableView |
17 |
instanceVariableNames:'redrawAction buttonPressAction keyPressAction' |
|
18 |
classVariableNames:'' |
|
19 |
poolDictionaries:'' |
|
20 |
category:'Views-Basic' |
|
21 |
! |
|
22 |
||
23 |
!PluggableView class methodsFor:'documentation'! |
|
24 |
||
3855
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1683
diff
changeset
|
25 |
copyright |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1683
diff
changeset
|
26 |
" |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1683
diff
changeset
|
27 |
COPYRIGHT (c) Claus Gittinger / 2006 by eXept Software AG |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1683
diff
changeset
|
28 |
All Rights Reserved |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1683
diff
changeset
|
29 |
|
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1683
diff
changeset
|
30 |
This software is furnished under a license and may be used |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1683
diff
changeset
|
31 |
only in accordance with the terms of that license and with the |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1683
diff
changeset
|
32 |
inclusion of the above copyright notice. This software may not |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1683
diff
changeset
|
33 |
be provided or otherwise made available to, or used by, any |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1683
diff
changeset
|
34 |
other person. No title to or ownership of the software is |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1683
diff
changeset
|
35 |
hereby transferred. |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1683
diff
changeset
|
36 |
" |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1683
diff
changeset
|
37 |
! |
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1683
diff
changeset
|
38 |
|
1682 | 39 |
documentation |
40 |
" |
|
41 |
a view for which the redraw, button and key-actions can be plugged as |
|
42 |
blocks. |
|
43 |
Mostly useful for little examples (where we dont want to add a full-blown class |
|
44 |
for. |
|
45 |
||
46 |
[author:] |
|
47 |
Claus Gittinger (cg@alan) |
|
48 |
||
49 |
[instance variables:] |
|
50 |
||
51 |
[class variables:] |
|
52 |
||
53 |
[see also:] |
|
54 |
||
55 |
" |
|
56 |
! |
|
57 |
||
58 |
examples |
|
59 |
" |
|
60 |
||
61 |
a simple lissajous figure |
|
62 |
[exBegin] |
|
63 |
|v| |
|
64 |
||
1683 | 65 |
v := PluggableView new. |
66 |
v viewBackground:Color black. |
|
1682 | 67 |
v redrawAction:[ |
68 |
|offsX offsY scaleX scaleY| |
|
69 |
||
1683 | 70 |
scaleX := v width - 10 // 2. |
71 |
scaleY := v height - 10 // 2. |
|
72 |
offsX := v width // 2. |
|
73 |
offsY := v height // 2. |
|
1682 | 74 |
|
75 |
0 to:360 do:[:degrees | |
|
76 |
|radians x y| |
|
77 |
||
78 |
radians := degrees degreesToRadians. |
|
79 |
x := (radians * 3 ) cos. |
|
80 |
y := (radians * 5 ) sin. |
|
81 |
||
82 |
x := x * scaleX + offsX. |
|
83 |
y := y * scaleY + offsY. |
|
84 |
v atX:x y:y put:Color red. |
|
85 |
]. |
|
86 |
]. |
|
1683 | 87 |
v open. |
1682 | 88 |
[exEnd] |
89 |
" |
|
90 |
! ! |
|
91 |
||
92 |
!PluggableView methodsFor:'accessing'! |
|
93 |
||
94 |
buttonPressAction:something |
|
95 |
"set the value of the instance variable 'buttonPressAction' (automatically generated)" |
|
96 |
||
97 |
buttonPressAction := something. |
|
98 |
! |
|
99 |
||
100 |
keyPressAction:something |
|
101 |
"set the value of the instance variable 'keyPressAction' (automatically generated)" |
|
102 |
||
103 |
keyPressAction := something. |
|
104 |
! |
|
105 |
||
106 |
redrawAction:something |
|
107 |
"set the value of the instance variable 'redrawAction' (automatically generated)" |
|
108 |
||
109 |
redrawAction := something. |
|
110 |
! ! |
|
111 |
||
112 |
!PluggableView methodsFor:'events'! |
|
113 |
||
114 |
buttonPress:button x:x y:y |
|
115 |
buttonPressAction notNil ifTrue:[ |
|
116 |
buttonPressAction value:button value:(x @ y) |
|
117 |
] |
|
118 |
! |
|
119 |
||
120 |
keyPress:key x:x y:y |
|
121 |
keyPressAction notNil ifTrue:[ |
|
122 |
keyPressAction value:key value:(x @ y) |
|
123 |
] |
|
124 |
! |
|
125 |
||
126 |
redraw |
|
127 |
super redraw. |
|
128 |
redrawAction notNil ifTrue:[ |
|
129 |
redrawAction value |
|
130 |
] |
|
1683 | 131 |
! |
132 |
||
133 |
sizeChanged:how |
|
134 |
super sizeChanged:how. |
|
135 |
self clear. |
|
136 |
self redraw. |
|
1682 | 137 |
! ! |
138 |
||
139 |
!PluggableView class methodsFor:'documentation'! |
|
140 |
||
141 |
version |
|
1683 | 142 |
^ '$Header: /cvs/stx/stx/libview2/PluggableView.st,v 1.2 2003-01-09 16:58:22 cg Exp $' |
1682 | 143 |
! ! |
3855
1db7742d33ad
Win32: Build libjpeg in its own directory, out-of-source-tree.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1683
diff
changeset
|
144 |