18
|
1 |
"{ Package: 'stx:goodies/libcairo' }"
|
|
2 |
|
|
3 |
"{ NameSpace: Cairo }"
|
|
4 |
|
|
5 |
SimpleView subclass:#TextExampleView
|
|
6 |
instanceVariableNames:'cr updater'
|
|
7 |
classVariableNames:''
|
|
8 |
poolDictionaries:''
|
|
9 |
category:'Cairo-Examples'
|
|
10 |
!
|
|
11 |
|
|
12 |
|
|
13 |
!TextExampleView class methodsFor:'instance creation'!
|
|
14 |
|
|
15 |
new
|
|
16 |
"return an initialized instance"
|
|
17 |
|
|
18 |
^ self basicNew initialize.
|
|
19 |
! !
|
|
20 |
|
|
21 |
!TextExampleView methodsFor:'accessing-dimensions'!
|
|
22 |
|
|
23 |
preferredExtent
|
|
24 |
|
|
25 |
^400 @ 400
|
|
26 |
|
|
27 |
"Created: / 17-06-2012 / 22:37:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
28 |
! !
|
|
29 |
|
|
30 |
!TextExampleView methodsFor:'redrawing'!
|
|
31 |
|
|
32 |
redraw
|
|
33 |
|
|
34 |
| |
|
|
35 |
|
|
36 |
self clippingRectangle:
|
|
37 |
(Smalltalk::Rectangle left:1 top:1 width:self width height:self height).
|
|
38 |
cr isNil ifTrue:[
|
|
39 |
cr := self cairo.
|
|
40 |
].
|
|
41 |
|
|
42 |
self font: (Font family: 'Helvetica' face: 'medium' style: 'italic' size: 32).
|
|
43 |
self displayString: 'Hello world!!' x: 10 y: 40.
|
|
44 |
|
|
45 |
cr fontFaceFamily: 'Helvetice' slant: Cairo::FontSlant FONT_SLANT_ITALIC weight: Cairo::FontWeight FONT_WEIGHT_NORMAL.
|
|
46 |
cr fontSize: 42.
|
|
47 |
|
|
48 |
cr moveToX: 10 y: 82.
|
|
49 |
cr showText: 'Hello World!!'
|
|
50 |
|
|
51 |
"Created: / 16-06-2012 / 23:25:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
52 |
!
|
|
53 |
|
|
54 |
redrawX: x y: y width: w height: h
|
|
55 |
|
|
56 |
self redraw
|
|
57 |
|
|
58 |
"Created: / 17-06-2012 / 21:33:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
59 |
! !
|
|
60 |
|
|
61 |
!TextExampleView class methodsFor:'documentation'!
|
|
62 |
|
|
63 |
version_SVN
|
|
64 |
^ '$Id:: $'
|
|
65 |
! !
|