home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ool_main.zip / ool / source / xspinbtn.cpp < prev    next >
C/C++ Source or Header  |  1998-04-05  |  3KB  |  132 lines

  1. #include "xspinbtn.h"
  2.  
  3. /*@
  4. @class XSpinButton
  5. @parent XControl
  6. @type overview
  7. @symbol _
  8. */
  9.  
  10. /*@ XSpinButton :: XSpinButton(const XWindow * owner, const XRect& rec, const USHORT id, const ULONG style, const char *string, const char *font)
  11. @group constructors/destructors
  12. @remarks Constructs a XSpinButton
  13. @parameters <t '°' c=2>
  14.             °XWindow * owner      °the owner of the XSlider
  15.             °XRect& rect         °the rectangle
  16.             °USHORT id            °id of the window
  17.             °ULONG style          °style, valid values are:
  18. <BR>
  19. SP_LEFT
  20. <BR>
  21. SP_RIGHT
  22. <BR>
  23. SP_CENTER
  24. <BR>
  25. SP_NOBORDER
  26. <BR>
  27. SP_FAST
  28. <BR>
  29. SP_MASTER
  30. <BR>
  31. SP_SERVANT
  32. <BR>
  33. SP_READONLY
  34. <BR>
  35. SP_NUMERIC
  36. <BR>
  37. SP_CHAR
  38. <BR>
  39. SP_FILLZERO
  40. <BR>
  41.                                 (can be or-ed)
  42.             °char * font            °font to use, e.g. "8.Helv"
  43.             </t>
  44. */
  45. XSpinButton :: XSpinButton(const XWindow * owner, const XRect& rec, const USHORT id, const ULONG style, const char *string, const char *font):XControl(&rec, style, owner, string, WC_SPINBUTTON, id, font)
  46. {
  47. }
  48.  
  49.  
  50. /*@ XSpinButton::SpinDown(const LONG units)
  51. @group misc
  52. @remarks Spin down window-content
  53. @parameters LONG units to spin down
  54. */
  55. void XSpinButton::SpinDown(const LONG units) const
  56. {
  57.    WinSendMsg(winhandle, SPBM_SPINDOWN, (MPARAM) units, 0);
  58. }
  59.  
  60.  
  61. /*@ XSpinButton::SpinUp(const LONG units)
  62. @group misc
  63. @remarks Spin up window-content
  64. @parameters LONG units to spin up
  65. */
  66. void XSpinButton::SpinUp(const LONG units) const
  67. {
  68.    WinSendMsg(winhandle, SPBM_SPINUP, (MPARAM) units, 0);
  69. }
  70.  
  71.  
  72. /*@ XSpinButton::SetTextLimit(const SHORT limit)
  73. @group misc
  74. @remarks Set maximum textlength
  75. @parameters SHORT maximum length
  76. */
  77. void XSpinButton::SetTextLimit(const SHORT limit) const
  78. {
  79.    WinSendMsg(winhandle, SPBM_SPINDOWN, MPFROMSHORT(limit), 0);
  80. }
  81.  
  82.  
  83. /*@ XSpinButton::SetMaster(const XWindow * master)
  84. @group misc
  85. @remarks
  86. @parameters XWindow* master
  87. @returns BOOL result
  88. */
  89. BOOL XSpinButton::SetMaster(const XWindow * master) const
  90. {
  91.    return (BOOL) WinSendMsg(winhandle, SPBM_SETMASTER, (MPARAM) master->GetHandle(), 0);
  92. }
  93.  
  94.  
  95. /*@ XSpinButton::GetValue(void)
  96. @group set/query values
  97. @remarks Returns the current value of the spinbutton
  98. */
  99. LONG XSpinButton::GetValue(void) const
  100. {
  101.    LONG l;
  102.  
  103.    WinSendMsg(winhandle, SPBM_QUERYVALUE, MPFROMP((VOID *) & l), 0);
  104.    return l;
  105. }
  106.  
  107.  
  108. /*@ XSpinButton::SetLimits(const LONG lowerLimit, const LONG upperLimit)
  109. @group limits
  110. @remarks Set limits of the spinbutton
  111. @parameters
  112. <t '°' c=2>
  113. °LONG °the lower limit
  114. °LONG °the upper limit
  115. </t>
  116. */
  117. void XSpinButton::SetLimits(const LONG lowerLimit, const LONG upperLimit) const
  118. {
  119.    WinSendMsg(winhandle, SPBM_SETLIMITS, (MPARAM) upperLimit, (MPARAM) lowerLimit);
  120. }
  121.  
  122.  
  123. /*@ XSpinButton::SetValue(const LONG val)
  124. @group set/query values
  125. @remarks Set the value of the spinbutton
  126. @parameters LONG the new value
  127. */
  128. void XSpinButton::SetValue(const LONG val) const
  129. {
  130.    WinSendMsg(winhandle, SPBM_SETCURRENTVALUE, (MPARAM) val, 0);
  131. }
  132.