home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 10 / ioProg_10.iso / soft / optima / hpp.z / WCHECKBX.HPP < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-19  |  4.3 KB  |  154 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,4);
  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 WBool AutoSize();
  111.  
  112.         virtual WBool CloneWindow( WStyle newStyle, WStyle newExStyle,
  113.                                    void * data=NULL );
  114.     
  115.         virtual const WChar * InitializeClass();
  116.  
  117.         virtual WStyle       GetDefaultStyle() const;
  118.  
  119.         virtual WBool FDXIn();
  120.  
  121.         virtual WBool FDXOut();
  122.  
  123.         virtual WBool ProcessCommand( WUInt id, WNotify code,
  124.                                       WNotifyInfo info, WLong & returns );
  125.  
  126.         WBool DataOpenHandler( WCheckBox *, WDataOpenEventData *ev );
  127.         WBool DataCloseHandler( WCheckBox *, WDataCloseEventData *ev );
  128.         WBool DataAvailableHandler( WCheckBox *, WDataAvailableEventData *ev );
  129.         WBool DataRequestHandler( WCheckBox *, WDataRequestEventData *ev );
  130.  
  131.     protected:
  132.  
  133.         WBool AllocDTCell();
  134.  
  135.         /**************************************************************
  136.          * Data members
  137.          **************************************************************/
  138.  
  139.     private:
  140.  
  141.         WULong *                _fdxDataSource;
  142.         WBool *                 _fdxDataSourceBool;
  143.         WDataTargetBoolCell *   _dataTarget;
  144.         WButtonState            _initial;
  145.         WBool                   _wasEnabled;
  146. };
  147.  
  148. #ifndef _WNO_PRAGMA_PUSH
  149. #pragma enum pop;
  150. #pragma pack(pop);
  151. #endif
  152.  
  153. #endif // _WCHECKBX_HPP_INCLUDED
  154.