;; -*- mode: Scheme; tab-width: 2; -*- ;;

(require-library
  lolevel data-structures extras srfi-1 srfi-13 srfi-42 irregex posix)

(module iup-base
	(ihandle->pointer pointer->ihandle ihandle-list->pointer-vector ihandle?
	 istatus->integer integer->istatus
	 iname->string string->iname
	 thread-watchdog iup-version load/led
	 attribute attribute-set! attribute-reset!
	 handle-name handle-name-set! handle-ref
	 main-loop main-loop-step main-loop-level main-loop-exit main-loop-flush
	 callback callback-set!
	 make-constructor-procedure optional-args
	 create destroy! map-peer! unmap-peer!
	 class-name class-type save-attributes!
	 parent parent-dialog sibling
	 child-add! child-remove! child-move!
	 child-ref child-pos child-count
	 :children children
	 refresh redraw
	 child-x/y->pos
	 show hide
	 dialog
	 fill hbox vbox zbox cbox sbox
	 radio normalizer split
	 image/palette image/rgb image/rgba image/file image-save
	 current-focus focus-next focus-previous
	 menu menu-item menu-separator
	 clipboard timer send-url)
	(import
		scheme chicken foreign
		lolevel data-structures extras srfi-1 srfi-13 srfi-42 irregex
		(only posix setenv))
	(include "iup-base.scm"))

(module iup-controls
	(canvas
	 frame tabs
	 label button toggle
	 spin spinbox valuator
	 textbox listbox treebox
	 progress-bar
	 matrix cells
	 color-bar color-browser
	 dial)
	(import
		scheme chicken foreign
		iup-base)
	(include "iup-controls.scm"))

(module iup-dialogs
	(file-dialog message-dialog color-dialog font-dialog
   layout-dialog element-properties-dialog)
	(import
		scheme chicken foreign
		iup-base)
	(include "iup-dialogs.scm"))

(cond-expand
 [disable-iup-glcanvas]
 [else
	(module iup-glcanvas
		(glcanvas
		 call-with-glcanvas glcanvas-is-current?
		 glcanvas-palette-set! glcanvas-font-set!)
		(import
		  scheme chicken foreign
			iup-base)
		(include "iup-glcanvas.scm"))])

(cond-expand
 [disable-iup-pplot]
 [else
	(module iup-pplot
		(pplot
		 call-with-pplot pplot-add!
		 pplot-x/y->pixel-x/y
		 pplot-paint-to)
		(import
		  scheme chicken foreign
			iup-base)
		(include "iup-pplot.scm"))])

(cond-expand
 [disable-iup-web]
 [else
	(module iup-web
		(web-browser)
		(import
		  scheme chicken foreign
			iup-base)
		(include "iup-web.scm"))])

(module iup
	()
	(import scheme chicken)
	(reexport
		(except iup-base
			ihandle->pointer pointer->ihandle ihandle-list->pointer-vector
			istatus->integer integer->istatus
			iname->string string->iname
			make-constructor-procedure optional-args)
		iup-controls
		iup-dialogs))
