home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / developer-tools / c-tools / c_examples / imagebutton / imagebutton_example.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-19  |  1.5 KB  |  62 lines

  1. //////////////////////////////////////////////////////////////////////////////
  2. // Button Example
  3. // 5.18.96 Deryk Robosson
  4.  
  5. //////////////////////////////////////////////////////////////////////////////
  6. // Includes
  7. #include "aframe:include/amigaapp.hpp"
  8. #include "aframe:include/window.hpp"
  9. #include "aframe:include/rect.hpp"
  10. #include "aframe:include/imagebutton.hpp"
  11. #include "aframe:include/reqtools.hpp"
  12. #include "resources/brushes_select.res"
  13. #include "resources/brushes_render.res"
  14.  
  15. //////////////////////////////////////////////////////////////////////////////
  16. // ControlWindow Class Definition
  17.  
  18. class ControlWindow : public AFWindow
  19.  
  20. {
  21. public:
  22.     virtual void OnGadgetUp(LPIntuiMessage imess);
  23.  
  24.     AFImageButton button;
  25.     AFReqTools rt;
  26. };
  27.  
  28. //////////////////////////////////////////////////////////////////////////////
  29. // ControlWindow Implementation routines
  30.  
  31. void ControlWindow::OnGadgetUp(LPIntuiMessage imess)
  32. {
  33.   switch(((struct Gadget*)imess->IAddress)->GadgetID) {
  34.  
  35.   case 100:     // Test button
  36.     rt.EZRequest("ImageButton selected!","Ok");
  37.     break;
  38.   default:
  39.     AFWindow::OnGadgetUp(imess);
  40.     break;
  41.   }
  42. }
  43.  
  44. //////////////////////////////////////////////////////////////////////////////
  45. // MAIN
  46.  
  47. void main()
  48. {
  49.     AFAmigaApp theApp;
  50.     ControlWindow win;
  51.     AFRect rect(10,10,410,310);
  52.  
  53.     win.Create(&theApp,&rect,"AFrame ImageButton Example");
  54.  
  55.     rect.SetRect(10,10,50,50);
  56.     win.button.Create(&win,&rect,100, &about_render_image, &about_select_image);
  57.  
  58.     win.RefreshGadgets();
  59.  
  60.     theApp.RunApp();
  61. }
  62.