home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / hpp.z / WCHECKBX.HPP < prev    next >
C/C++ Source or Header  |  1996-12-03  |  5KB  |  156 lines

  1. /*************************************************************************
  2.  *
  3.  * WCheckBox -- Wrapper for the check box control.
  4.  *
  5.  *   Events:
  6.  *
  7.  *       DataAvailable --
  8.  *
  9.  *       DataClose --
  10.  *
  11.  *       DataOpen --
  12.  *
  13.  *       DataRequest --
  14.  *
  15.  *************************************************************************/
  16.  
  17. #ifndef _WCHECKBX_HPP_INCLUDED
  18. #define _WCHECKBX_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 WCheckBox : public WButton {
  35.     WDeclareSubclass( WCheckBox, WButton );
  36.     
  37.     public:
  38.  
  39.         /******************************************************
  40.          * Constructors and Destructors
  41.          ******************************************************/
  42.  
  43.         WCheckBox();
  44.     
  45.         ~WCheckBox();
  46.  
  47.         /******************************************************
  48.          * Properties
  49.          ******************************************************/
  50.  
  51.         // Checked
  52.         //
  53.         //     Set/get whether the check box is checked or not.
  54.         //     TRUE means its state is WBStateChecked, FALSE
  55.         //     means it is WBStateNotChecked (or possibly
  56.         //     WBStateIndeterminate for 3-state boxes).  Setting
  57.         //     to FALSE always sets it to WBStateNotChecked.
  58.  
  59.         WBool  GetChecked() const;
  60.         WBool  SetChecked( WBool checked );
  61.  
  62.         // DataColumns
  63.  
  64.         WString GetDataColumns() const;
  65.         WBool   SetDataColumns( const WString & cols );
  66.  
  67.         // DataSource
  68.  
  69.         WDataSource *GetDataSource() const;
  70.         WBool        SetDataSource( WDataSource *source );
  71.  
  72.         // DataValueChecked
  73.  
  74.         WString GetDataValueChecked() const;
  75.         WBool   SetDataValueChecked( const WString & val );
  76.  
  77.         // DataValueUnchecked
  78.  
  79.         WString GetDataValueUnchecked() const;
  80.         WBool   SetDataValueUnchecked( const WString & val );
  81.  
  82.         // FDXDataSource
  83.  
  84.         WBool SetFDXDataSource( WULong * fdxDataSource );
  85.         WBool SetFDXDataSource( WBool * fdxDataSource );
  86.  
  87.         // State
  88.         //
  89.         //     Set/get the check state. 
  90.  
  91.         WButtonState GetState( WBool getAllStates=FALSE ) const;
  92.         WBool        SetState( WButtonState state );
  93.  
  94.         /******************************************************
  95.          * Methods
  96.          ******************************************************/
  97.  
  98.         // Toggle
  99.         //
  100.         //     Toggles the state, returning the new state.  If
  101.         //     a 2-state checkbox, toggles between checked & unchecked.
  102.         //     Otherwise goes unchecked->checked->indeterminate->unchecked.
  103.  
  104.         WButtonState Toggle();
  105.  
  106.         /******************************************************
  107.          * Overrides
  108.          ******************************************************/
  109.  
  110.         virtual WColor GetBackColor( WBool getResultingColor=TRUE ) const;
  111.  
  112.         virtual WBool AutoSize();
  113.  
  114.         virtual WBool CloneWindow( WStyle newStyle, WStyle newExStyle,
  115.                                    void * data=NULL );
  116.     
  117.         virtual const WChar * InitializeClass();
  118.  
  119.         virtual WStyle       GetDefaultStyle() const;
  120.  
  121.         virtual WBool FDXIn();
  122.  
  123.         virtual WBool FDXOut();
  124.  
  125.         virtual WBool ProcessCommand( WUInt id, WNotify code,
  126.                                       WNotifyInfo info, WLong & returns );
  127.  
  128.         WBool DataOpenHandler( WCheckBox *, WDataOpenEventData *ev );
  129.         WBool DataCloseHandler( WCheckBox *, WDataCloseEventData *ev );
  130.         WBool DataAvailableHandler( WCheckBox *, WDataAvailableEventData *ev );
  131.         WBool DataRequestHandler( WCheckBox *, WDataRequestEventData *ev );
  132.  
  133.     protected:
  134.  
  135.         WBool AllocDTCell();
  136.  
  137.         /**************************************************************
  138.          * Data members
  139.          **************************************************************/
  140.  
  141.     private:
  142.  
  143.         WULong *                _fdxDataSource;
  144.         WBool *                 _fdxDataSourceBool;
  145.         WDataTargetBoolCell *   _dataTarget;
  146.         WButtonState            _initial;
  147.         WBool                   _wasEnabled;
  148. };
  149.  
  150. #ifndef _WNO_PRAGMA_PUSH
  151. #pragma enum pop;
  152. #pragma pack(pop);
  153. #endif
  154.  
  155. #endif // _WCHECKBX_HPP_INCLUDED
  156.