home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional Developers Kit 1992 November / Disc01 / Disc01.mdf / cppbeta / ibmcli / ispinbt.hp_ / ISPINBT.HPP
Encoding:
C/C++ Source or Header  |  1992-10-26  |  6.6 KB  |  139 lines

  1. #ifndef _ISPINBUTTON_
  2.   #define _ISPINBUTTON_
  3. /*******************************************************************************
  4. * FILE NAME: ispinbt.hpp                                                       *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the class(es):                                              *
  8. *     Ispinbt  - This class creates and manages the spin button control window.*
  9. *                                                                              *
  10. * COPYRIGHT:                                                                   *
  11. *   Licensed Materials - Property of IBM                                       *
  12. *   (C) Copyright IBM Corporation 1992, 1993                                   *
  13. *   All Rights Reserved                                                        *
  14. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  15. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  16. *                                                                              *
  17. * $Log:   R:/IBMCLASS/IBASECTL/VCS/ISPINBT.HPV  $
  18. //
  19. //   Rev 1.4   25 Oct 1992 17:06:12   nunn
  20. //changed library name to ICLUI
  21. //
  22. //   Rev 1.3   25 Oct 1992 10:57:40   boezeman
  23. //Add documentation and converted file to skeleton.hpp format.
  24.  
  25.  
  26.       Rev 1.2   18 Sep 1992 20:55:52   Martin D Vo
  27.    Convert to 930 driver
  28.  
  29.       Rev 1.1   28 Oct 1991 19:02:08   Tim Hertz
  30.    Initial Development
  31. *******************************************************************************/
  32. #ifndef _ICONTROL_
  33.   #include "icontrol.hpp"
  34. #endif
  35.  
  36. // Forward declarations for other classes:
  37. class ISpinButton;      /* spb */
  38. class IRectangle;
  39.  
  40. class ISpinButton : public IControl {
  41. /*******************************************************************************
  42. * This class creates and manages the spin button control window.               *
  43. *                                                                              *
  44. * To use this class, create an instance of this class as follows:              *
  45. *   ISpinButton* pSpinBtn = new ISpinButton(id,                                *
  46. *                                       pMyAppWin,                             *
  47. *                                       IRectangle(                            *
  48. *                                       IPoint(10,100),                        *
  49. *                                       ISize(200,20));                        *
  50. *   pSpinBtn->setLimits(0,59);                                                 *
  51. *   ...                                                                        *
  52. *   ULONG Number = pSpinBtn->value();                                          *
  53. *                                                                              *
  54. * EXAMPLE:                                                                     *
  55. *   <sample code>                                                              *
  56. *******************************************************************************/
  57. typedef IControl
  58.   Inherited;
  59. public :
  60. INESTEDBITFLAGCLASSDEF2(Style, ISpinButton, IWindow, IControl);
  61.  
  62. static const Style
  63.   master,
  64.   slave,
  65.   allChar,
  66.   leftAlign,
  67.   centerAlign,
  68.   rightAlign,
  69.   defaultStyle;
  70.  
  71.  
  72. /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
  73. | There are 3 ways to construct instances of this class:                       |
  74. |   1. default                                                                 |
  75. |   2. From a Dialog Template                                                  |
  76. |   3. From a Window                                                           |
  77. ------------------------------------------------------------------------------*/
  78.   ISpinButton  (unsigned long id,
  79.                 const IWindow* parent,
  80.                 const IWindow* owner,
  81.                 const IRectangle& initial,
  82.                 Style style = defaultStyle);
  83.  
  84.   ISpinButton  (unsigned long id,
  85.                 const IWindow* parentDialog);
  86.  
  87.   ISpinButton  (IWindowHandle handle);
  88.  
  89. /*------------------------ GENERAL OPERATIONS ----------------------------------
  90. | setMaster     - This call sets the master.                                   |
  91. | setTextLimit  - Set the number of characters allowed in the spin button.     |
  92. | spinDown      - Spin the button down the specified number of times.          |
  93. | spinUp        - Spin the button up the specified number of times.            |
  94. ------------------------------------------------------------------------------*/
  95. void
  96.   setMaster(const ISpinButton* spnb),
  97.   setTextLimit(unsigned long limit),
  98.   spinDown(unsigned long numToSpin = 1),
  99.   spinUp(unsigned long numToSpin = 1);
  100.  
  101. /*------------------------ NUMERICAL SPIN BUTTON OPERATIONS --------------------
  102. | setLimits     - Set the limits of the spin button and change the entry if    |
  103. |                 it is outside the new limits.                                |
  104. | overrideLimits- Set the limits of the spin button and do not change the entry|
  105. |                 if it is outside the new limits.                             |
  106. | upperLimit    - Get the upper limit of the spin button range.                |
  107. | lowerLimit    - Get the lower limit of the spin button range.                |
  108. | value         - Get the value in the spin button entry field.                |
  109. | setValue      - Set the value in the spin button entry field.                |
  110. ------------------------------------------------------------------------------*/
  111. void
  112.   setLimits(long lowLimit, long highLimit),
  113.   overrideLimits(long lowLimit, long highLimit),
  114.   setValue(long value);
  115. long
  116.   upperLimit() const,
  117.   lowerLimit() const,
  118.   value() const;
  119.  
  120. /*------------------------ ALPHANUMERICAL SPIN BUTTON OPERATIONS ---------------
  121. | text     - Returns the text in the spin button.                              |
  122. |                 it is outside the new limits.                                |
  123. | setIndex - Sets the spin button to the indexed item of the array. The items  |
  124. |            are zero-based                                                    |
  125. | setArray - Set an array of character strings as items in the spin button     |
  126. ------------------------------------------------------------------------------*/
  127. enum Attribute { validate, noUpdate, always };
  128. IString
  129.   text(Attribute attribute ) const;
  130. void
  131.   setIndex(unsigned long index),
  132.   setArray(char** array, unsigned long count);
  133.  
  134. };
  135.  
  136. INESTEDBITFLAGCLASSFUNCS( Style, ISpinButton);
  137.  
  138. #endif
  139.