CharacterSetView.st
author Claus Gittinger <cg@exept.de>
Mon, 09 Feb 2004 15:06:44 +0100
changeset 2620 6eb751261f2b
child 2622 c24fdc09ab2b
permissions -rw-r--r--
initial checkin

"{ Package: 'stx:goodies' }"

View subclass:#CharacterSetView
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Collections-Text-Encodings'
!


!CharacterSetView class methodsFor:'startup'!

openOn:aFont
    |top v|

    top := StandardSystemView new.
    top label:(aFont printString).
    v := self origin:0.0@0.0 corner:1.0@1.0 in:top.
    v font:aFont.
    top open.

    "
     self openOn:(View defaultFont).
    "
! !

!CharacterSetView methodsFor:'drawing'!

redraw
    |wCol hRow|

    wCol := width / 16.
    hRow := height / 16.

    0 to:16 do:[:col |
        |x|

        x := (col * wCol) rounded asInteger.
        self displayLineFromX:x y:0 toX:x y:height-1.
    ].

    0 to:15 do:[:row |
        |y|

        y := (row * hRow) rounded asInteger.
        self displayLineFromX:0 y:y toX:width y:y.
    ].


    0 to:15 do:[:row |
        |y rowBase|

        rowBase := row * 16r10.
        y := row * hRow.
        y := y + (hRow / 2).
        y := y rounded asInteger.
        0 to:15 do:[:col |
            |x codePoint s|

            codePoint := rowBase + col.
            s := (Character value:codePoint) asString.

            x := (col * wCol) rounded asInteger.
            x := x + (wCol / 2).
            x := x - ((font widthOf:s) / 2).
            x := x rounded asInteger.
            self displayString:s x:x y:y.
        ].
    ].

    "
     (self extent:300@600) open
    "
!

sizeChanged:how
    self clear.
    self redraw.
! !

!CharacterSetView class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libwidg2/CharacterSetView.st,v 1.1 2004-02-09 14:06:44 cg Exp $'
! !