home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 October / Chip_1997-10_cd.bin / tema / sybase / powerj / hpp.z / WOPTBTTN.HPP < prev    next >
C/C++ Source or Header  |  1996-12-03  |  5KB  |  175 lines

  1. /*************************************************************************
  2.  *
  3.  * WOptionButton -- Wrapper for the option button control.
  4.  *
  5.  *   Events:
  6.  *
  7.  *       DataAvailable --
  8.  *
  9.  *       DataClose --
  10.  *
  11.  *       DataOpen --
  12.  *
  13.  *       DataRequest --
  14.  *
  15.  *************************************************************************/
  16.  
  17. #ifndef _WOPTBTTN_HPP_INCLUDED
  18. #define _WOPTBTTN_HPP_INCLUDED
  19.  
  20. #ifndef _WNO_PRAGMA_PUSH
  21. #pragma pack(push,8);
  22. #pragma enum int;
  23. #endif
  24.  
  25. #ifndef _WBUTTON_HPP_INCLUDED
  26. #  include "wbutton.hpp"
  27. #endif
  28. #ifndef _WDATATRG_HPP_INCLUDED
  29. #  include "wdatatrg.hpp"
  30. #endif
  31.  
  32. class WDataSource;
  33.  
  34. class WCMCLASS WOptionButton : public WButton {
  35.  
  36.     WDeclareSubclass( WOptionButton, WButton )
  37.  
  38.     public:
  39.  
  40.         /******************************************************
  41.          * Constructors and Destructors
  42.          ******************************************************/
  43.  
  44.         WOptionButton();
  45.  
  46.         ~WOptionButton();
  47.  
  48.         /******************************************************
  49.          * Properties
  50.          ******************************************************/
  51.  
  52.         // Checked
  53.         //
  54.         //     Set/get whether the option button is checked or not.
  55.         //     TRUE means its state is WBStateChecked, FALSE
  56.         //     means it is WBStateNotChecked.
  57.         //     If toggleOthersInGroup is TRUE and checked is TRUE,
  58.         //     will set the state of all other option buttons in
  59.         //     the group to WBStateNotChecked.
  60.  
  61.         WBool  GetChecked() const;
  62.         WBool  SetChecked( WBool checked, WBool toggleOthersInGroup=TRUE );
  63.  
  64.         // DataColumns
  65.  
  66.         WString GetDataColumns() const;
  67.         WBool   SetDataColumns( const WString & cols );
  68.  
  69.         // DataSource
  70.  
  71.         WDataSource *GetDataSource() const;
  72.         WBool        SetDataSource( WDataSource *source );
  73.  
  74.         // DataValueChecked
  75.  
  76.         WString GetDataValueChecked() const;
  77.         WBool   SetDataValueChecked( const WString & val );
  78.  
  79.         // FDXDataSource
  80.  
  81.         WBool SetFDXDataSource( WULong * fdxDataSource,
  82.                                 WULong fdxOnValue=TRUE );
  83.  
  84.         // State
  85.         //
  86.         //     Set/get the state.
  87.  
  88.         WButtonState GetState( WBool getAllStates=FALSE ) const;
  89.         WBool        SetState( WButtonState state );
  90.  
  91.         /******************************************************
  92.          * Methods
  93.          ******************************************************/
  94.  
  95.         // CheckGroup
  96.         //
  97.         //     Specify the window ID of the first and last option button that
  98.         //     the current option button is a member of.  The function then
  99.         //     checks the current option button and ensures that all other
  100.         //     option buttons in that group are unchecked.
  101.  
  102.         WBool CheckGroup( WUInt firstWindowID, WUInt lastWindowID );
  103.  
  104.         // Toggle
  105.         //
  106.         //     Toggles the state, returning the new state (notset or set).
  107.  
  108.         WButtonState Toggle();
  109.  
  110.         // WhichChecked
  111.         //
  112.         //     Returns a pointer to the option button in the group that
  113.         //     is checked, if any.
  114.  
  115.         WOptionButton *WhichChecked() const;
  116.  
  117.         // WhichCheckedID
  118.         //
  119.         //     Like WhichChecked, but instead returns the ID of the
  120.         //     button that was checked.  Returns 0 if no button was
  121.         //     checked.
  122.  
  123.         WInt WhichCheckedID() const;
  124.  
  125.         /******************************************************
  126.          * Overrides
  127.          ******************************************************/
  128.  
  129.         virtual WColor GetBackColor( WBool getResultingColor=TRUE ) const;
  130.  
  131.         virtual WBool AutoSize();
  132.     
  133.         virtual WBool CloneWindow( WStyle newStyle, WStyle newExStyle,
  134.                                    void * data=NULL );
  135.  
  136.         virtual const WChar * InitializeClass();
  137.  
  138.         virtual WStyle GetDefaultStyle() const;
  139.  
  140.         virtual WBool FDXIn();
  141.  
  142.         virtual WBool FDXOut();
  143.  
  144.         virtual WBool ProcessCommand( WUInt id, WNotify code,
  145.                                       WNotifyInfo info, WLong & returns );
  146.     
  147.         WBool DataOpenHandler( WOptionButton *, WDataOpenEventData *ev );
  148.         WBool DataCloseHandler( WOptionButton *, WDataCloseEventData *ev );
  149.         WBool DataAvailableHandler( WOptionButton *, WDataAvailableEventData *ev );
  150.         WBool DataRequestHandler( WOptionButton *, WDataRequestEventData *ev );
  151.  
  152.     protected:
  153.  
  154.         WBool AllocDTCell();
  155.  
  156.         /******************************************************
  157.          * Data members
  158.          ******************************************************/
  159.  
  160.     private:
  161.  
  162.         WULong              *_fdxDataSource;
  163.         WULong               _fdxOnValue;
  164.         WDataTargetBoolCell *_dataTarget;
  165.         WBool                _initial;
  166.         WBool                _wasEnabled;
  167. };
  168.  
  169. #ifndef _WNO_PRAGMA_PUSH
  170. #pragma enum pop;
  171. #pragma pack(pop);
  172. #endif
  173.  
  174. #endif // _WOPTBTTN_HPP_INCLUDED
  175.