author | Jan Vrany <jan.vrany@labware.com> |
Mon, 15 Jun 2020 15:14:31 +0100 | |
changeset 89 | 2a1c3c0439ea |
parent 88 | 9d51db2ba641 |
permissions | -rw-r--r-- |
88 | 1 |
" |
2 |
stx:goodies/libcairo - Cairo graphics bindings for Smalltalk/X |
|
3 |
||
4 |
Copyright (C) 2008-2019 Jan Vrany |
|
5 |
||
6 |
This code is licensed under Creative Commons Attribution-NonCommercial License. |
|
7 |
For full text of the license, see file LICENSE.txt |
|
8 |
" |
|
18 | 9 |
"{ Package: 'stx:goodies/libcairo' }" |
10 |
||
11 |
"{ NameSpace: Cairo }" |
|
12 |
||
13 |
SimpleView subclass:#TextExampleView |
|
28
1bd3d147cd77
Added utility methods to SimpleView...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
24
diff
changeset
|
14 |
instanceVariableNames:'' |
18 | 15 |
classVariableNames:'' |
16 |
poolDictionaries:'' |
|
17 |
category:'Cairo-Examples' |
|
18 |
! |
|
19 |
||
88 | 20 |
!TextExampleView class methodsFor:'documentation'! |
21 |
||
22 |
copyright |
|
23 |
" |
|
24 |
stx:goodies/libcairo - Cairo graphics bindings for Smalltalk/X |
|
25 |
||
26 |
Copyright (C) 2008-2019 Jan Vrany |
|
27 |
||
28 |
This code is licensed under Creative Commons Attribution-NonCommercial License. |
|
29 |
For full text of the license, see file LICENSE.txt |
|
30 |
" |
|
31 |
! ! |
|
18 | 32 |
|
33 |
!TextExampleView methodsFor:'accessing-dimensions'! |
|
34 |
||
35 |
preferredExtent |
|
36 |
||
37 |
^400 @ 400 |
|
38 |
||
39 |
"Created: / 17-06-2012 / 22:37:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
40 |
! ! |
|
41 |
||
42 |
!TextExampleView methodsFor:'redrawing'! |
|
43 |
||
44 |
redraw |
|
45 |
||
28
1bd3d147cd77
Added utility methods to SimpleView...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
24
diff
changeset
|
46 |
self font: (Font family: 'Helvetica' face: 'medium' style: 'italic' size: 32). |
1bd3d147cd77
Added utility methods to SimpleView...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
24
diff
changeset
|
47 |
self displayString: 'Hello world!!' x: 10 y: 40. |
1bd3d147cd77
Added utility methods to SimpleView...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
24
diff
changeset
|
48 |
|
1bd3d147cd77
Added utility methods to SimpleView...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
24
diff
changeset
|
49 |
self redrawWithCairo |
18 | 50 |
|
28
1bd3d147cd77
Added utility methods to SimpleView...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
24
diff
changeset
|
51 |
"Created: / 16-06-2012 / 23:25:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1bd3d147cd77
Added utility methods to SimpleView...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
24
diff
changeset
|
52 |
"Modified: / 27-12-2014 / 00:37:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1bd3d147cd77
Added utility methods to SimpleView...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
24
diff
changeset
|
53 |
! |
1bd3d147cd77
Added utility methods to SimpleView...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
24
diff
changeset
|
54 |
|
1bd3d147cd77
Added utility methods to SimpleView...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
24
diff
changeset
|
55 |
redrawWithCairo: cr |
1bd3d147cd77
Added utility methods to SimpleView...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
24
diff
changeset
|
56 |
|
1bd3d147cd77
Added utility methods to SimpleView...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
24
diff
changeset
|
57 |
self clippingBounds: nil. |
1bd3d147cd77
Added utility methods to SimpleView...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
24
diff
changeset
|
58 |
|
18 | 59 |
|
60 |
self font: (Font family: 'Helvetica' face: 'medium' style: 'italic' size: 32). |
|
61 |
self displayString: 'Hello world!!' x: 10 y: 40. |
|
62 |
||
29
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
63 |
cr fontFaceFamily: 'Helvetice' slant: Cairo::FontSlant CAIRO_FONT_SLANT_ITALIC weight: Cairo::FontWeight CAIRO_FONT_WEIGHT_NORMAL. |
18 | 64 |
cr fontSize: 42. |
65 |
||
66 |
cr moveToX: 10 y: 82. |
|
67 |
cr showText: 'Hello World!!' |
|
68 |
||
28
1bd3d147cd77
Added utility methods to SimpleView...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
24
diff
changeset
|
69 |
"Created: / 27-12-2014 / 00:36:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
29
6ba06265e543
Bindinge updated to recent Cairo version.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
70 |
"Modified: / 28-12-2014 / 22:13:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
18 | 71 |
! |
72 |
||
73 |
redrawX: x y: y width: w height: h |
|
74 |
self redraw |
|
75 |
||
76 |
"Created: / 17-06-2012 / 21:33:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
28
1bd3d147cd77
Added utility methods to SimpleView...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
24
diff
changeset
|
77 |
"Modified: / 27-12-2014 / 00:37:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
18 | 78 |
! ! |
79 |
||
80 |
!TextExampleView class methodsFor:'documentation'! |
|
81 |
||
23
38ee47dbd976
Added version_HG to make Mercurial happy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18
diff
changeset
|
82 |
version_HG |
38ee47dbd976
Added version_HG to make Mercurial happy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18
diff
changeset
|
83 |
^ '$Changeset: <not expanded> $' |
18 | 84 |
! ! |
28
1bd3d147cd77
Added utility methods to SimpleView...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
24
diff
changeset
|
85 |