home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / dho.zip / DHO / SRC / RADIOBTN.CC < prev    next >
C/C++ Source or Header  |  1995-08-27  |  5KB  |  197 lines

  1. /****************************************/
  2. /*    Developer Helper Object Set       */
  3. /*  (C) 1994-95 Thomas E. Bednarz, Jr.  */
  4. /*     All rights reserved              */
  5. /***************************************/
  6.  
  7. /* $Id: radiobtn.cc 1.2 1995/08/13 03:21:12 teb Exp $ */
  8.  
  9.  
  10. #include"radiobtn.h"
  11.  
  12.  
  13. //-------------------------------------------------------------------
  14. //   TBaseButton
  15. TBaseButton::TBaseButton(TWinBase *parent, ULONG resource):
  16.    TControl(parent, resource)
  17. {
  18.  
  19. }
  20.  
  21.  
  22. //-------------------------------------------------------------------
  23. //   TBaseButton
  24. TBaseButton::TBaseButton(TWinBase *parent, groupType gt, char *text, ULONG cmdId,
  25.                               ULONG x, ULONG y, ULONG cx, ULONG cy):
  26.    TControl(parent)
  27. {
  28.  
  29. }
  30.  
  31.  
  32. //-------------------------------------------------------------------
  33. //   ~TBaseButton
  34. TBaseButton::~TBaseButton()
  35. {
  36.  
  37. }
  38.  
  39.  
  40.  
  41. //-------------------------------------------------------------------
  42. //   clickButton
  43. void TBaseButton::clickButton()
  44. {
  45.    SendMessage(BM_CLICK, (MPARAM)NULL, (MPARAM) NULL);
  46. }
  47.  
  48.  
  49.  
  50. //-------------------------------------------------------------------
  51. //   getClickState
  52. LONG TBaseButton::getClickState()
  53. {
  54.    return (LONG)SendMessage(BM_QUERYHILITE, NULL, NULL);
  55. }
  56.  
  57.  
  58.  
  59. //-------------------------------------------------------------------
  60. //   setClickState
  61. void TBaseButton::setClickState(BOOL state)
  62. {
  63.     SendMessage(BM_SETHILITE, MPARAM(state), MPARAM(NULL));
  64. }
  65.  
  66.  
  67. //-------------------------------------------------------------------
  68. //   getGroupSelection
  69. LONG TBaseButton::getGroupSelection()
  70. {
  71.    return (LONG)SendMessage(BM_QUERYCHECKINDEX, MPARAM(NULL), MPARAM(NULL));
  72. }
  73.  
  74.  
  75.  
  76. //-------------------------------------------------------------------
  77. //   TRadioButton
  78. TRadioButton::TRadioButton(TWinBase *parent, ULONG resource):
  79.    TBaseButton(parent, resource)
  80. {
  81.  
  82. }
  83.  
  84.  
  85.  
  86. //-------------------------------------------------------------------
  87. //   TRadioButton
  88. TRadioButton::TRadioButton(TWinBase *parent, groupType gt, char *text, ULONG cmdId,
  89.                               ULONG x, ULONG y, ULONG cx, ULONG cy):
  90.    TBaseButton(parent, gt, text, cmdId, x,  y, cx, cy)
  91. {
  92.    Style = BS_AUTORADIOBUTTON | WS_VISIBLE ;
  93.    if ((gt == groupStart) || (gt == standAlone))
  94.       Style |= WS_GROUP;
  95.  
  96.    hwndControl = WinCreateWindow(
  97.                       fParent->getHWND(),
  98.                       WC_BUTTON,
  99.                       (PSZ)text,
  100.                       Style,
  101.                       x, y,cx,cy,
  102.                       fParent->getHWND(),
  103.                       HWND_TOP,
  104.                       cmdId, (PVOID)NULL, (PVOID)NULL);
  105.  
  106. }
  107.  
  108.  
  109. //-------------------------------------------------------------------
  110. //   ~TRadioButton
  111. TRadioButton::~TRadioButton()
  112. {
  113.  
  114. }
  115.  
  116.  
  117. //-------------------------------------------------------------------
  118. //   TCheckBox
  119. TCheckBox::TCheckBox(TWinBase *parent, ULONG resource):
  120.    TBaseButton(parent, resource)
  121. {
  122.  
  123. }
  124.  
  125.  
  126.  
  127. //-------------------------------------------------------------------
  128. //   TCheckBox
  129. TCheckBox::TCheckBox(TWinBase *parent, groupType gt, char *text, ULONG cmdId,
  130.                               ULONG x, ULONG y, ULONG cx, ULONG cy):
  131.    TBaseButton(parent, gt, text, cmdId, x,  y, cx, cy)
  132. {
  133.    Style = BS_CHECKBOX | WS_VISIBLE ;
  134.  //  if ((gt == groupStart) || (gt == standAlone))
  135.  //     Style |= WS_GROUP;
  136.  
  137.    hwndControl = WinCreateWindow(
  138.                       fParent->getHWND(),
  139.                       WC_BUTTON,
  140.                       (PSZ)text,
  141.                       Style,
  142.                       x, y,cx,cy,
  143.                       fParent->getHWND(),
  144.                       HWND_TOP,
  145.                       cmdId, (PVOID)NULL, (PVOID)NULL);
  146.  
  147. }
  148.  
  149.  
  150. //-------------------------------------------------------------------
  151. //   ~TCheckBox
  152. TCheckBox::~TCheckBox()
  153. {
  154.  
  155. }
  156.  
  157.  
  158.  
  159. //-------------------------------------------------------------------
  160. //   T3StateButton
  161. T3StateButton::T3StateButton(TWinBase *parent, ULONG resource):
  162.    TBaseButton(parent, resource)
  163. {
  164.  
  165. }
  166.  
  167. //-------------------------------------------------------------------
  168. //   T3StateButton
  169. T3StateButton::T3StateButton(TWinBase *parent, groupType gt,
  170.                      char *text, ULONG cmdId,
  171.                      ULONG x, ULONG y, ULONG cx, ULONG cy):
  172.    TBaseButton(parent, gt, text, cmdId, x,  y, cx, cy)
  173. {    
  174.    Style = BS_AUTO3STATE | WS_VISIBLE ;
  175.    if ((gt == groupStart) || (gt == standAlone))
  176.       Style |= WS_GROUP;
  177.  
  178.    hwndControl = WinCreateWindow(
  179.                       fParent->getHWND(),
  180.                       WC_BUTTON,
  181.                       (PSZ)text,
  182.                       Style,
  183.                       x, y,cx,cy,
  184.                       fParent->getHWND(),
  185.                       HWND_TOP,
  186.                       cmdId, (PVOID)NULL, (PVOID)NULL);
  187.  
  188. }
  189.  
  190.  
  191. //-------------------------------------------------------------------
  192. //   ~T3StateButton
  193. T3StateButton::~T3StateButton()
  194. {
  195.  
  196. }
  197.