home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tolkit45.zip / os2tk45 / samples / wps / carpp / brake.cpp next >
C/C++ Source or Header  |  1999-05-11  |  3KB  |  130 lines

  1. /******************************************************************************
  2. *
  3. *  Module Name: BRAKE.CPP
  4. *
  5. *  OS/2 WorkPlace Shell Sample Program - SOM 2.0 / IDL Version
  6. *
  7. *  Copyright (C) 1992-1995 IBM Corporation
  8. *
  9. *      DISCLAIMER OF WARRANTIES.  The following [enclosed] code is
  10. *      sample code created by IBM Corporation. This sample code is not
  11. *      part of any standard or IBM product and is provided to you solely
  12. *      for  the purpose of assisting you in the development of your
  13. *      applications.  The code is provided "AS IS", without
  14. *      warranty of any kind.  IBM shall not be liable for any damages
  15. *      arising out of your use of the sample code, even if they have been
  16. *      advised of the possibility of such damages.                                                    *
  17. *
  18. *  Entry Points:
  19. *
  20. *     Class Methods:
  21. *
  22. *        Set
  23. *        Release
  24. *        IsSet
  25. *        SetToDefault
  26. *        SaveState
  27. *        RestoreState
  28. *
  29. *  Description:
  30. *
  31. *      This file contains the member functions of class Brake.
  32. ******************************************************************************/
  33. #include "Carpp.xih"
  34.  
  35. /*
  36.  * Method: Brake::Brake
  37.  *
  38.  * Description:
  39.  *
  40.  *    This is the constructor for class Brake which initializes
  41.  *     the state data for an object of type Brake.
  42.  */
  43. Brake::Brake(VOID)
  44. {
  45.   depressed = DEFAULT_BRAKEFLAG;
  46. }
  47.  
  48. /*
  49.  * Method: Brake::Set
  50.  *
  51.  * Description:
  52.  *
  53.  *    Sets the brake.
  54.  */
  55. VOID Brake::Set(VOID)
  56. {
  57.   depressed = TRUE;
  58. }
  59.  
  60. /*
  61.  * Method: Brake::Release
  62.  *
  63.  * Description:
  64.  *
  65.  *    Releases the brake.
  66.  */
  67. VOID Brake::Release(VOID)
  68. {
  69.   depressed = FALSE;
  70. }
  71.  
  72. /*
  73.  * Method: Brake::IsSet
  74.  *
  75.  * Description:
  76.  *
  77.  *    Determines whether or not the brake is set.  A value of TRUE is returned
  78.  *     if the brake is set, otherwise, FALSE is returned.
  79.  */
  80. BOOL Brake::IsSet(VOID)
  81. {
  82.   if (depressed)
  83.     return TRUE;
  84.   else
  85.     return FALSE;
  86. }
  87.  
  88. /*
  89.  * Method: Brake::SetToDefault
  90.  *
  91.  * Description:
  92.  *
  93.  *    Sets the default state of the object.
  94.  */
  95. VOID Brake::SetToDefault(VOID)
  96. {
  97.   depressed = DEFAULT_BRAKEFLAG;
  98. }
  99.  
  100. /*
  101.  * Method: Brake::SaveState
  102.  *
  103.  * Description:
  104.  *
  105.  *    Saves the state of the current object in the OS2.INI file.  The input
  106.  *     arguments consist of a pointer to a Carpp object as well as a pointer
  107.  *     to a string.  These two items are required so that the data associated
  108.  *     with the object being saved can be stored in the OS2.INI file.
  109.  */
  110. VOID Brake::SaveState(Carpp *clientObject, PSZ szCarClassTitle)
  111. {
  112.   clientObject->wpSaveLong( szCarClassTitle, IDKEY_BRAKEFLAG, depressed);
  113. }
  114.  
  115. /*
  116.  * Method: Brake::RestoreState
  117.  *
  118.  * Description:
  119.  *
  120.  *    Restores the object's saved state from the OS2.INI file.  The input
  121.  *     arguments consist of a pointer to a Carpp object as well as a pointer
  122.  *     to a string.  These two items are required so that the data associated
  123.  *     with the object being restored can be retrieved from the OS2.INI file.
  124.  */
  125. VOID Brake::RestoreState(Carpp *clientObject, PSZ szCarClassTitle)
  126. {
  127.   clientObject->wpRestoreLong(szCarClassTitle, IDKEY_BRAKEFLAG, &depressed);
  128. }
  129. /********************************  END brake.cpp  ********************************/
  130.