
===================== CGA-example version 1.1 ===================== ===================== Overview :: This is an example of a low-level binding to a c++ GUI library and a mid-level CGA abstraction over it. This was created primarily to spark discussion in the gui@haskell.org mailing list and secondarily to provide a simple example that can be compiled using ghc without any language extensions. I encourage those who code, to implement their ideas for the Common GUI API using this simple framework. This would allow all reviewers to understand exactly what you are talking about by running your examples. Fltk was chosen for its simplicity and portability. I didn't use an existing library because I wanted a short example where the source code is easy to comprehend at all levels. ===================== Changes :: v1.1 -- Using Heiarchy extention for module naming. Completed CGA version of Box, Button, Window, and Widget. Now using the agreed callback format. Initial child handeling support. Using class-per-function naming. Using MVar's in example CGA application for simplicity. ===================== Questions :: 1) How does the interface look in Test_midlevel.hs? Is there any critiques in regard to using this style in CGA (Common GUI API)? 2) Haskell has one namespace, the global one. Since there would be a lot of function names and attributes in CGA, their names should be well thought out. Is there any ideas on how to handle this? 3) How should children be handled? I used both an attribute and a seperate function in this implementation. 4) What do you think is important to have in the next version of CGA-example? ===================== Running :: To run the examples, one needs a standard Haskell compiler with ffi (ghc) and fltk installed (http://www.fltk.org). run make. If necessary, change the makefile to modify for your configuration. Fl-stubs/* -- These are the stubs that are used to bind the c++ library to c functions. This is required because the Haskell ffi standard does not specify any conventions for C++. Fl.hs Fl/* -- These contain the bindings to the stub files. They also provide a low-level interface for the fltk GUI toolkit. Test_lowlevel.hs -- This is a simple program demonstrating use of the low-level binding. Attributes.hs -- This code was taken from the htoolkit cvs server. Simple modifications were made to suit our purposes. CGA.hs CGA/* -- This is the Midlevel, CGA code wrapping the low-level Fl interface. CGA/CommonAttributes.hs CGA/CommonMembers.hs CGA/CommonSignals.hs -- these are the support files for the one-class-per-function style as proposed on gui@haskell.org. Test_midlevel.hs -- This is the same simple program as Test_lowlevel.hs except it uses CGA instead of Fl. ===================== Cheers, David J. Sankel