#include once "crt/stdio.bi"
#include once "inc/iup.bi"
#include once "inc/iupim.bi"

' Initializes IUP
sub _init_ constructor
  IupOpen(0,0)
end sub
' Finishes IUP 
sub _exit_ destructor
  IupClose()
end sub

chdir exepath

#define DIMIUP dim as IHandle ptr 

#macro CreateFrameWithLabelFromImageFile(ext)
DIMIUP Image##ext = IupLoadImage("./media/renata." & #ext) : IupSetHandle(#ext, Image##ext)
DIMIUP Frame##ext = IupSetAttributes(IUPFrame(IupSetAttributes(IUpLabel(#ext),!"IMAGE=" & #ext)),!"TITLE=renata." & #ext)
#endmacro

CreateFrameWithLabelFromImageFile(bmp)
CreateFrameWithLabelFromImageFile(gif)
CreateFrameWithLabelFromImageFile(png)
CreateFrameWithLabelFromImageFile(pcx)
CreateFrameWithLabelFromImageFile(tga)
CreateFrameWithLabelFromImageFile(tiff)
CreateFrameWithLabelFromImageFile(jpg)

DIMIUP HBoxT = IupHBox(Framebmp,Iupfill(),Framegif,Iupfill(),Framepng,Iupfill(),Framepcx,NULL)
DIMIUP HBoxB = IupHBox(Frametga,Iupfill(),Frametiff,Iupfill(),Framejpg,NULL)
DIMIUP Dialog = IupDialog(IupVBox(HBoxT,Iupfill(),HBoxB,NULL))
IupSetAttributes(Dialog, !"TITLE=\"IupLoadImage Example" )
IupShowXY ( Dialog, IUP_CENTER, IUP_CENTER )
IupMainLoop()




