home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cset21v5.zip / TOOLKT21 / CPLUS / SAMPLES / WPCAR / BRAKE.CPP next >
C/C++ Source or Header  |  1993-04-30  |  3KB  |  129 lines

  1. /******************************************************************************
  2. *
  3. *  Module Name: BRAKE.CPP
  4. *
  5. *  OS/2 Work Place Shell Sample Program
  6. *
  7. *  Copyright (C) 1992 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.   depressed = DEFAULT_BRAKEFLAG;
  45. }
  46.  
  47. /*
  48.  * Method: Brake::Set
  49.  *
  50.  * Description:
  51.  *
  52.  *    Sets the brake.
  53.  */
  54. VOID Brake::Set(VOID)    
  55. {
  56.   depressed = TRUE;
  57. }
  58.  
  59. /*
  60.  * Method: Brake::Release
  61.  *
  62.  * Description:
  63.  *
  64.  *    Releases the brake.
  65.  */
  66. VOID Brake::Release(VOID) 
  67. {
  68.   depressed = FALSE;
  69. }
  70.  
  71. /*
  72.  * Method: Brake::IsSet
  73.  *
  74.  * Description:
  75.  *
  76.  *    Determines whether or not the brake is set.  A value of TRUE is returned
  77.  *     if the brake is set, otherwise, FALSE is returned.
  78.  */
  79. BOOL Brake::IsSet(VOID) 
  80. {
  81.   if (depressed)
  82.     return TRUE;
  83.   else
  84.     return FALSE;
  85. }
  86.  
  87. /*
  88.  * Method: Brake::SetToDefault
  89.  *
  90.  * Description:
  91.  *
  92.  *    Sets the default state of the object.
  93.  */
  94. VOID Brake::SetToDefault(VOID)   
  95. {
  96.   depressed = DEFAULT_BRAKEFLAG;
  97. }
  98.  
  99. /*
  100.  * Method: Brake::SaveState
  101.  *
  102.  * Description:
  103.  *
  104.  *    Saves the state of the current object in the OS2.INI file.  The input
  105.  *     arguments consist of a pointer to a Carpp object as well as a pointer 
  106.  *     to a string.  These two items are required so that the data associated 
  107.  *     with the object being saved can be stored in the OS2.INI file.
  108.  */
  109. VOID Brake::SaveState(Carpp *clientObject, PSZ szCarClassTitle)   
  110. {
  111.   clientObject->wpSaveLong( szCarClassTitle, IDKEY_BRAKEFLAG, depressed);
  112. }
  113.  
  114. /*
  115.  * Method: Brake::RestoreState
  116.  *
  117.  * Description:
  118.  *
  119.  *    Restores the object's saved state from the OS2.INI file.  The input
  120.  *     arguments consist of a pointer to a Carpp object as well as a pointer 
  121.  *     to a string.  These two items are required so that the data associated
  122.  *     with the object being restored can be retrieved from the OS2.INI file.
  123.  */
  124. VOID Brake::RestoreState(Carpp *clientObject, PSZ szCarClassTitle)
  125. {
  126.   clientObject->wpRestoreLong(szCarClassTitle, IDKEY_BRAKEFLAG, &depressed);
  127. }
  128.