I looked at the GUI framework page :
http://www.geocities.com/SiliconValley/ ... itool.html
again and saw
GraphAPP
that seems to have a straightforward C interface
see
http://enchantia.com/software/graphapp/
which continues under active development, latest release:
GraphApp.3.tar.gz - Version 3 source code, portable fonts and extras.
1.6M Tar Gzip File, Latest Update 2004/05/08
This version of GraphApp will work on Linux, Unix or MS-Windows systems. Try the demo programs, imagine (image viewer), tester (event displayer), viewutf8 (show utf8 files), and blend (alpha-blending and image drawing). Many extras are included in this release, such as libPNG, libJPEG, libGIF, zLib and the GNU Unicode portable font. New versions of this file will be uploaded regularly.
An example C program looks straight forward:
/*
* clock.c
* -------
* Digital clock program written using GraphApp.
*
* This is a complex example which demonstrates the use of
* timer functions, fonts, and windows. It also uses some
* standard C time functions.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <graphapp.h>
App *app;
Window *the_window;
Font *the_font;
int state = 0; /* 0 = show the time, 1 = show the date */
int hour = -1, minute = -1;
int day = -1, month = -1;
char *month_name[] = {
"", "January", "February", "March",
"April", "May", "June",
"July", "August", "September",
"October", "November", "December"
};
void draw_clock(Window *w, Graphics *g)
{
int width, height;
char the_string[80];
Rect r = get_window_area(w);
if (state == 0)
sprintf(the_string, "%d:%2.2d", hour, minute);
else
sprintf(the_string, "%d %3.3s", day, month_name[month]);
set_font(g, the_font);
width = font_width(the_font, the_string, strlen(the_string));
height = font_height(the_font);
draw_utf8(g, pt((r.width-width)/2, (r.height-height)/2),
the_string, strlen(the_string));
}
void update_clock(Timer *unused)
{
struct tm *the_time;
time_t seconds;
int newhour, newminute, newday, newmonth;
tzset();
time(&seconds);
the_time = localtime(&seconds);
newhour = the_time->tm_hour;
if (newhour > 12)
newhour -= 12;
newminute = the_time->tm_min;
newday = the_time->tm_mday;
newmonth = the_time->tm_mon + 1;
if ((hour != newhour) || (minute != newminute)
|| (day != newday) || (month != newmonth))
{
hour = newhour;
minute = newminute;
day = newday;
month = newmonth;
redraw_window(the_window);
}
}
void handle_mouse(Window *w, int buttons, Point xy)
{
if (buttons && !state) {
state = 1;
redraw_window(the_window);
}
else if (!buttons && state) {
state = 0;
redraw_window(the_window);
}
}
void handle_key(Window *w, unsigned long key)
{
if ((key == ESC)
|| (key == 'q')
|| (key == 'Q')
|| (key == 17)) /* ctrl-q */
exit(0);
}
int main(int argc, char *argv[])
{
app = new_app(argc, argv);
the_font = new_font(app, "unifont", BOLD, 16);
the_window = new_window(app,
rect(3,3,font_width(the_font,"HH:MM.",6),18),
"Clock", FLOATING);
on_window_redraw(the_window, draw_clock);
set_window_background(the_window, rgb(0x66,0x99,0xCC));
on_window_key_down(the_window, handle_key);
on_window_mouse_up(the_window, handle_mouse);
on_window_mouse_down(the_window, handle_mouse);
update_clock(NULL);
show_window(the_window);
new_timer(app, update_clock, 15000); /* 15 second timer */
main_loop(app);
return 0;
}
I'll try to line by line convert it to newlisp over the next week as a try out (like txt2pdf which is a line by line port) - if I can automate interface generation to allow it to compile into newlisp and expose itself!! ??SWIG or a server/shared lib
Regards
Nigel