home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / programming / desklib / examples / DeskLib / Examples / !IncDec / c / !RunImage next >
Encoding:
Text File  |  1994-10-12  |  2.6 KB  |  69 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    IncDec.c
  12.     Author:  Copyright © 1994 Lee Atkinson
  13.     Version: 1.00 (12 Oct 1993)
  14.     Purpose: Demonstrate Icon's Increment and Decrement handlers
  15.  
  16. */
  17.  
  18. #include "DeskLib:Core.h"
  19. #include "DeskLib:Window.h"            /* Window handling automation      */
  20. #include "DeskLib:Error.h"             /* Error despatcher                */
  21. #include "DeskLib:Event.h"             /* Event despatcher                */
  22. #include "DeskLib:EventMsg.h"          /* Wimp Message event dispatcher   */
  23. #include "DeskLib:Handler.h"           /* Default/example event handlers  */
  24. #include "DeskLib:Icon.h"              /* Icon handling automation        */
  25. #include "DeskLib:Resource.h"          /* Handles finding resource files  */
  26. #include "DeskLib:Screen.h"            /* Getting screen size info, etc   */
  27. #include "DeskLib:Template.h"          /* Template loading and caching    */
  28.  
  29. #define TOPTEXT    0
  30. #define TOPINC     1
  31. #define TOPDEC     2
  32. #define BOTTOMTEXT 3
  33. #define BOTTOMINC  5
  34. #define BOTTOMDEC  4
  35.  
  36. static BOOL quit=       FALSE;
  37. static window_handle    window;
  38. static icon_incdecblock *incdec1;
  39. static icon_incdecblock *incdec2;
  40.  
  41. static BOOL ByeBye(event_pollblock *event,void *ref)
  42. {
  43.  Icon_ReleaseIncDecHandler(incdec1);
  44.  Icon_ReleaseIncDecHandler(incdec2);
  45.  Window_Delete(window);
  46.  quit=TRUE;
  47.  return TRUE;
  48. }
  49.  
  50. int main(void)
  51. {
  52.  Resource_InitialisePath("IncDec");
  53.  Event_Initialise("Inc/Decrement Test");
  54.  EventMsg_Initialise();
  55.  Screen_CacheModeInfo();
  56.  EventMsg_Claim(message_MODECHANGE,event_ANY,Handler_ModeChange,NULL);
  57.  Template_Initialise();
  58.  Template_LoadFile("Templates");
  59.  window=Window_Create("main",0);
  60.  Event_Claim(event_CLOSE,window,event_ANY,ByeBye,            NULL);
  61.  Event_Claim(event_OPEN, window,event_ANY,Handler_OpenWindow,NULL);
  62.  incdec1=Icon_InitIncDecHandler(window,TOPTEXT,TOPINC,TOPDEC,TRUE,5,10,100,10);
  63.  incdec2=Icon_InitIncDecHandler(window,BOTTOMTEXT,BOTTOMINC,BOTTOMDEC,FALSE,1,
  64.                                                                   -100,-50,-50);
  65.  Window_Show(window,open_CENTERED);
  66.  while (!quit) Event_Poll();
  67.  return FALSE;
  68. }
  69.