home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / programming / setupapp_1 / !SetUpApp / Resources / mainwind_c < prev    next >
Text File  |  1995-03-30  |  2KB  |  74 lines

  1. static wimp_w        main_window_w;
  2. static wimp_wind    *main_window_wind;
  3. static BOOL        main_window_is_open = FALSE;
  4.  
  5. void main_window_open(wimp_openstr *o)
  6. {
  7.     if(o==NULL)
  8.     {
  9.     wimp_wstate ws;
  10.         wimpt_complain( wimp_get_wind_state(main_window_w, &ws));
  11.         wimpt_complain( wimp_open_wind(&ws.o));
  12.     }
  13.     else
  14.         wimpt_complain( wimp_open_wind(o));
  15.     main_window_is_open = TRUE;
  16. }
  17.  
  18. static void main_window_close(void)
  19. {
  20.     wimpt_complain( wimp_close_wind(main_window_w));
  21.     main_window_is_open = FALSE;
  22. }
  23.  
  24. static void main_window_display(void)
  25. {
  26. wimp_wstate ws;
  27. int x,y;
  28.     wimpt_complain( wimp_get_wind_state(main_window_w, &ws));
  29.     x = ws.o.box.x0;    /* top left corner */
  30.     y = ws.o.box.y1;
  31.     /* do your wonderful window redraw stuff here */
  32. }
  33.  
  34. void main_window_redraw(void)
  35. {
  36. BOOL more;
  37. wimp_redrawstr r;
  38.     r.w = main_window_w;
  39.     wimpt_complain( wimp_redraw_wind(&r, &more));
  40.     while(more)
  41.     {
  42.         main_window_display();
  43.         wimpt_complain( wimp_get_rectangle(&r, &more));
  44.     }
  45. }
  46.  
  47. static void main_window_butclick(wimp_mousestr ms)
  48. {
  49.     switch(ms.i)
  50.     {
  51.     case -1:        /* Click on Window Background */
  52.         {
  53.         int x,y;
  54.         wimp_wstate ws;
  55.             wimp_get_wind_state(ms.w,&ws);
  56.             x = ms.x - ws.o.box.x0 + ws.o.x;
  57.             y = ms.y - ws.o.box.y1 + ws.o.y;
  58.             werr(FALSE,"Work Area Click @ %i,%i (internal)",x,y);
  59.         }
  60.         break;
  61.     /* enter your favourite icons here */
  62.     case 0:
  63.         break;
  64.     }
  65. }
  66.  
  67. static void main_window_handler(wimp_eventstr *e, void *h)
  68. {
  69.     switch( e->e )
  70.     {
  71.     case wimp_EOPEN:    main_window_open(&e->data.o);            break;
  72.     case wimp_ECLOSE:    main_window_close();                    break;
  73.     case wimp_EREDRAW:    main_window_redraw();                    break;
  74.     case wimp_EBUT:        main_window_butclick(e->data.but.m);    break;