home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / samples / visbuild / rapsheet / msnmspnh.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-08  |  4.3 KB  |  87 lines

  1. /******************************************************************************
  2. * .FILE:        msnmspnh.cpp                                                  *
  3. *                                                                             *
  4. * .DESCRIPTION: Handler that automatically spins the specified servant        *
  5. *               numeric spin button when the specified master numeric         *
  6. *               spin button reaches its upper and lower bounds.               *
  7. *                                                                             *
  8. * .CLASSES:     MasterServantNumSpinHandler                                   *
  9. *                                                                             *
  10. * .COPYRIGHT:                                                                 *
  11. *    Licensed Material - Program-Property of IBM                              *
  12. *    (C) Copyright IBM Corp. 1992, 1996 - All Rights Reserved                 *
  13. *                                                                             *
  14. * .DISCLAIMER:                                                                *
  15. *   The following [enclosed] code is sample code created by IBM               *
  16. *   Corporation.  This sample code is not part of any standard IBM product    *
  17. *   and is provided to you solely for the purpose of assisting you in the     *
  18. *   development of your applications.  The code is provided 'AS IS',          *
  19. *   without warranty of any kind.  IBM shall not be liable for any damages    *
  20. *   arising out of your use of the sample code, even if they have been        *
  21. *   advised of the possibility of such damages.                               *
  22. *                                                                             *
  23. * .NOTE: WE RECOMMEND USING A FIXED SPACE FONT TO LOOK AT THE SOURCE          *
  24. *                                                                             *
  25. ******************************************************************************/
  26. #include <itrace.hpp>
  27. #include <ispinnum.hpp>
  28. #include "msnmspnh.hpp"            //MasterServantNumSpinHandler
  29.  
  30. //***************************************************************************
  31. // Class:   MasterServantNumSpinHandler
  32. //
  33. // Purpose: Supports the master and servant spin buttons used to represent
  34. //          the feet and inch fields.
  35. //
  36. //***************************************************************************
  37.  
  38. //***************************************************************************
  39. // Constructor
  40. //***************************************************************************
  41. MasterServantNumSpinHandler :: MasterServantNumSpinHandler(
  42.    INumericSpinButton * master,
  43.    INumericSpinButton * servant) : ISpinHandler()
  44. {
  45.    imaster = master;
  46.    iservant = servant;
  47. }
  48.  
  49. //***************************************************************************
  50. // Destructor
  51. //***************************************************************************
  52. MasterServantNumSpinHandler :: ~MasterServantNumSpinHandler()
  53. {
  54. }
  55.  
  56. //***************************************************************************
  57. // arrowUp
  58. //***************************************************************************
  59. Boolean MasterServantNumSpinHandler::arrowUp(IControlEvent& controlEvent)
  60. {
  61.      IFUNCTRACE_DEVELOP();
  62.  
  63.      /***********************************************************************
  64.       * NOTE: master->value() is already changed before the handler is called
  65.       ***********************************************************************/
  66.      if (imaster->value() == imaster->range().lowerBound())
  67.         iservant->spinUp();
  68.  
  69.      return false;  //allow any other handlers to be called
  70. }
  71.  
  72. //***************************************************************************
  73. // arrowDown
  74. //***************************************************************************
  75. Boolean MasterServantNumSpinHandler::arrowDown(IControlEvent& controlEvent)
  76. {
  77.      IFUNCTRACE_DEVELOP();
  78.  
  79.      /***********************************************************************
  80.       * NOTE: master->value() is already changed before the handler is called
  81.       ***********************************************************************/
  82.      if (imaster->value() == imaster->range().upperBound())
  83.         iservant->spinDown();
  84.  
  85.      return false;  //allow any other handlers to be called
  86. }
  87.