home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 May / Pcwk5b98.iso / Borland / Cplus45 / BC45 / OWL1.PAK / RADIOBUT.CPP < prev    next >
Text File  |  1995-08-29  |  1KB  |  41 lines

  1. // ObjectWindows - (C) Copyright 1992 by Borland International
  2.  
  3. /* --------------------------------------------------------
  4.   RADIOBUT.CPP
  5.   Defines type TRadioButton.  This defines the basic behavior
  6.   for all radio buttons.
  7.   -------------------------------------------------------- */
  8.  
  9. #include "radiobut.h"
  10. #include "groupbox.h"
  11.  
  12. /* Constructor for a TRadioButton object.  Initializes its data fields
  13.   using passed parameters and default values. */
  14. TRadioButton::TRadioButton(PTWindowsObject AParent, int AnId, LPSTR
  15.                            ATitle, int X, int Y, int W, int H,
  16.                            PTGroupBox AGroup, PTModule AModule)
  17.              : TCheckBox(AParent, AnId, ATitle, X, Y, W, H, AGroup, AModule)
  18. {
  19.   Attr.Style = WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON;
  20. }
  21.  
  22. /* Responds to an incoming BN_CLICKED message. Need to see if it's
  23.    checked because Windows generates two BN_CLICKED messages on
  24.    keyboard input such as up arrow (but only one on mouse input),
  25.    and we should only handle the one after it's checked. */
  26. void TRadioButton::BNClicked(TMessage& Msg)
  27. {
  28.   if ( GetCheck() )
  29.     TCheckBox::BNClicked(Msg);
  30.   else
  31.     DefNotificationProc(Msg);    
  32. }
  33.  
  34. TStreamable *TRadioButton::build()
  35. {
  36.   return new TRadioButton(streamableInit);
  37. }
  38.  
  39. TStreamableClass RegRadioButton("TRadioButton", TRadioButton::build,
  40.                               __DELTA(TRadioButton));
  41.