Cairo__TextExampleView.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 24 Dec 2014 14:15:10 +0100
changeset 23 38ee47dbd976
parent 18 fae6edf1bdbd
child 24 6c74dd51bff4
permissions -rw-r--r--
Added version_HG to make Mercurial happy

"{ Package: 'stx:goodies/libcairo' }"

"{ NameSpace: Cairo }"

SimpleView subclass:#TextExampleView
	instanceVariableNames:'cr updater'
	classVariableNames:''
	poolDictionaries:''
	category:'Cairo-Examples'
!


!TextExampleView class methodsFor:'instance creation'!

new
    "return an initialized instance"

    ^ self basicNew initialize.
! !

!TextExampleView methodsFor:'accessing-dimensions'!

preferredExtent

    ^400 @ 400

    "Created: / 17-06-2012 / 22:37:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!TextExampleView methodsFor:'redrawing'!

redraw

    |  |

    self clippingRectangle: 
        (Smalltalk::Rectangle left:1 top:1 width:self width height:self height).
    cr isNil ifTrue:[
        cr := self cairo.
    ].

    self font: (Font family: 'Helvetica' face: 'medium' style: 'italic' size: 32).
    self displayString: 'Hello world!!' x: 10 y: 40.

    cr fontFaceFamily: 'Helvetice' slant: Cairo::FontSlant FONT_SLANT_ITALIC weight: Cairo::FontWeight FONT_WEIGHT_NORMAL. 
    cr fontSize: 42.

    cr moveToX: 10 y: 82.
    cr showText: 'Hello World!!'

    "Created: / 16-06-2012 / 23:25:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

redrawX: x y: y width: w height: h

    self redraw

    "Created: / 17-06-2012 / 21:33:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!TextExampleView class methodsFor:'documentation'!

version_HG
    ^ '$Changeset: <not expanded> $'
! !