home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / powergui / toolbar / animated / animated.cpp next >
Encoding:
C/C++ Source or Header  |  1996-10-29  |  1.9 KB  |  67 lines

  1. //************************************************************
  2. // Tool Bars  - Animated Button Example
  3. //
  4. // Copyright (C) 1994, Law, Leong, Love, Olson, Tsuji.
  5. // Copyright (c) 1997 John Wiley & Sons, Inc. 
  6. // All Rights Reserved.
  7. //************************************************************
  8. #include <iframe.hpp>
  9. #include <ianimbut.hpp>
  10. #include <isetcv.hpp>
  11. #include <iapp.hpp>
  12. #include <icconst.h>
  13. #include "animated.h"
  14.  
  15. void main()
  16. {
  17. IFrameWindow
  18.   frame ("Animated Button Example");
  19.  
  20. // Create a set canvas for the client window.
  21. ISetCanvas
  22.   client(IC_FRAME_CLIENT_ID, &frame, &frame);
  23.  
  24. // Create the circular button as a latchable button
  25. // and the various IOC-supplied buttons as nonlatchable.
  26. //
  27. IAnimatedButton
  28.   circleButton(11, &client, &client, IRectangle(),
  29.                IAnimatedButton::classDefaultStyle |
  30.                IAnimatedButton::latchable),
  31.   playButton(12, &client, &client),
  32.   scanForwardButton(13, &client, &client),
  33.   scanBackwardButton(14, &client, &client);
  34.  
  35. // Add the circle bitmaps to the circle button by indicating
  36. // the resource identifier of the first bitmap and the number
  37. // of bitmaps in the set.  Set the animation rate to .1 seconds
  38. // and indicate that the button is animate when latched.
  39. circleButton
  40.   .setBitmaps (ID_CIRCLE1, 4)
  41.   .setAnimationRate (100)
  42.   .enableAnimateWhenLatched();
  43.  
  44. // Add the IOC-provided bitmaps to their respective buttons.
  45. playButton
  46.   .setBitmaps (IAnimatedButton::play)
  47.   .setAnimationRate (500)
  48.   .startAnimation();
  49. scanForwardButton
  50.   .setBitmaps (IAnimatedButton::scanForward)
  51.   .setAnimationRate (500)
  52.   .startAnimation();
  53. scanBackwardButton
  54.   .setBitmaps (IAnimatedButton::scanBackward)
  55.   .setAnimationRate (500)
  56.   .startAnimation();
  57.  
  58.  
  59. // Put the canvas in the client area and show the application.
  60. frame
  61.   .setClient(&client)
  62.   .setFocus()
  63.   .show();
  64. IApplication::current().run();
  65.  
  66. }
  67.