home *** CD-ROM | disk | FTP | other *** search
- static wimp_w main_window_w;
- static wimp_wind *main_window_wind;
- static BOOL main_window_is_open = FALSE;
-
- void main_window_open(wimp_openstr *o)
- {
- if(o==NULL)
- {
- wimp_wstate ws;
- wimpt_complain( wimp_get_wind_state(main_window_w, &ws));
- wimpt_complain( wimp_open_wind(&ws.o));
- }
- else
- wimpt_complain( wimp_open_wind(o));
- main_window_is_open = TRUE;
- }
-
- static void main_window_close(void)
- {
- wimpt_complain( wimp_close_wind(main_window_w));
- main_window_is_open = FALSE;
- }
-
- static void main_window_display(void)
- {
- wimp_wstate ws;
- int x,y;
- wimpt_complain( wimp_get_wind_state(main_window_w, &ws));
- x = ws.o.box.x0; /* top left corner */
- y = ws.o.box.y1;
- /* do your wonderful window redraw stuff here */
- }
-
- void main_window_redraw(void)
- {
- BOOL more;
- wimp_redrawstr r;
- r.w = main_window_w;
- wimpt_complain( wimp_redraw_wind(&r, &more));
- while(more)
- {
- main_window_display();
- wimpt_complain( wimp_get_rectangle(&r, &more));
- }
- }
-
- static void main_window_butclick(wimp_mousestr ms)
- {
- switch(ms.i)
- {
- case -1: /* Click on Window Background */
- {
- int x,y;
- wimp_wstate ws;
- wimp_get_wind_state(ms.w,&ws);
- x = ms.x - ws.o.box.x0 + ws.o.x;
- y = ms.y - ws.o.box.y1 + ws.o.y;
- werr(FALSE,"Work Area Click @ %i,%i (internal)",x,y);
- }
- break;
- /* enter your favourite icons here */
- case 0:
- break;
- }
- }
-
- static void main_window_handler(wimp_eventstr *e, void *h)
- {
- switch( e->e )
- {
- case wimp_EOPEN: main_window_open(&e->data.o); break;
- case wimp_ECLOSE: main_window_close(); break;
- case wimp_EREDRAW: main_window_redraw(); break;
- case wimp_EBUT: main_window_butclick(e->data.but.m); break;