
------------------------------------------------------------------------
--# GTK can display a variety of image types
------------------------------------------------------------------------

include GtkEngine.e

constant docs = 
---------------------------------------------------------------------
`<u><b>GtkImages</b></u> are <i>very</i> easy to use! 
<small>
Formats which can be displayed without conversion include:
gif, jpg, png, bmp, svg, tif, tga, ico, pbm, pgm, pcx, xpm, etc...
</small>
`
----------------------------------------------------------------------

sequence path = "thumbnails/" -- where to find 'em

sequence images = { -- note the various image types being used;
    "DISKS04.ICO",
    "cal.png",
    "BabyTux.bmp",
    "giraffe.xpm",
    "dino_mite.gif",
    "bug-buddy.png",
    $
    }
    
-- Next we replace each filename in the images sequence 
-- with a pointer created by loading that file,
-- thus saving space by re-using the same variable.

for i = 1 to length(images) do 
    images[i] = create(GtkImage,path & images[i]) 
end for

constant win = create(GtkWindow,"title=Images,border=10,position=1,$destroy=Quit")

constant panel = create(GtkBox,VERTICAL,10) -- spacing between images = 10px
    add(win,panel)

constant lbl = create(GtkLabel,{
    {"line wrap",TRUE},
    {"markup",docs}})
    add(panel,lbl)

-- Below, we create two boxes, stacked, to hold the images.
-- A GtkGrid would also work.

constant top = create(GtkBox,"orientation=HORIZONTAL,spacing=10") -- (params, newer style)
    pack(top,images[1..3],TRUE,TRUE,10)
    
constant bot = create(GtkBox,HORIZONTAL,10) -- (same params as box above, different style)
    pack(bot,images[4..$],TRUE,TRUE,10)
    add(panel,{top,bot})

constant box = pack_end(panel,create(GtkButtonBox))
    add(box,create(GtkButton,"gtk-quit","Quit"))

show_all(win)
main()

