summaryrefslogtreecommitdiff
path: root/objectio/tut6_4_4.icl
blob: 1e7f4d8b5b53c306f3192ba7611db80ebe29ce13 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
module tut6_4_4

// ********************************************************************************
// Clean tutorial example program.
//
// This program creates a window that displays a user selected bitmap.
// Make sure that this application has sufficient heap or extra memory.
// ********************************************************************************

import StdIO, StdEnv

Start :: *World -> *World
Start world
    # (maybeFile,world) = selectInputFile world
    | isNothing maybeFile
        = world
    # bitmapfile = fromJust maybeFile
    # (maybeBitmap,world) = openBitmap bitmapfile world
    | isNothing maybeBitmap
        = world
    | otherwise
        # bitmap = fromJust maybeBitmap
          bitmapsize = getBitmapSize bitmap
          window = Window "Bitmap" NilLS
            [ WindowViewSize bitmapsize
            , WindowLook True (\_ _->drawAt zero bitmap)
            , WindowClose (noLS closeProcess)
            ]
        = startIO SDI
            Void
            (snd o openWindow Void window)
            [ProcessClose closeProcess]
            world