home *** CD-ROM | disk | FTP | other *** search
- /*************************************************************************
- *
- * WCheckBox -- Wrapper for the check box control.
- *
- * Events:
- *
- * DataAvailable --
- *
- * DataClose --
- *
- * DataOpen --
- *
- * DataRequest --
- *
- *************************************************************************/
-
- #ifndef _WCHECKBX_HPP_INCLUDED
- #define _WCHECKBX_HPP_INCLUDED
-
- #ifndef _WNO_PRAGMA_PUSH
- #pragma pack(push,8);
- #pragma enum int;
- #endif
-
- #ifndef _WBUTTON_HPP_INCLUDED
- # include "wbutton.hpp"
- #endif
- #ifndef _WDATATRG_HPP_INCLUDED
- # include "wdatatrg.hpp"
- #endif
-
- class WDataSource;
-
- class WCMCLASS WCheckBox : public WButton {
- WDeclareSubclass( WCheckBox, WButton );
-
- public:
-
- /******************************************************
- * Constructors and Destructors
- ******************************************************/
-
- WCheckBox();
-
- ~WCheckBox();
-
- /******************************************************
- * Properties
- ******************************************************/
-
- // Checked
- //
- // Set/get whether the check box is checked or not.
- // TRUE means its state is WBStateChecked, FALSE
- // means it is WBStateNotChecked (or possibly
- // WBStateIndeterminate for 3-state boxes). Setting
- // to FALSE always sets it to WBStateNotChecked.
-
- WBool GetChecked() const;
- WBool SetChecked( WBool checked );
-
- // DataColumns
-
- WString GetDataColumns() const;
- WBool SetDataColumns( const WString & cols );
-
- // DataSource
-
- WDataSource *GetDataSource() const;
- WBool SetDataSource( WDataSource *source );
-
- // DataValueChecked
-
- WString GetDataValueChecked() const;
- WBool SetDataValueChecked( const WString & val );
-
- // DataValueUnchecked
-
- WString GetDataValueUnchecked() const;
- WBool SetDataValueUnchecked( const WString & val );
-
- // FDXDataSource
-
- WBool SetFDXDataSource( WULong * fdxDataSource );
- WBool SetFDXDataSource( WBool * fdxDataSource );
-
- // State
- //
- // Set/get the check state.
-
- WButtonState GetState( WBool getAllStates=FALSE ) const;
- WBool SetState( WButtonState state );
-
- /******************************************************
- * Methods
- ******************************************************/
-
- // Toggle
- //
- // Toggles the state, returning the new state. If
- // a 2-state checkbox, toggles between checked & unchecked.
- // Otherwise goes unchecked->checked->indeterminate->unchecked.
-
- WButtonState Toggle();
-
- /******************************************************
- * Overrides
- ******************************************************/
-
- virtual WColor GetBackColor( WBool getResultingColor=TRUE ) const;
-
- virtual WBool AutoSize();
-
- virtual WBool CloneWindow( WStyle newStyle, WStyle newExStyle,
- void * data=NULL );
-
- virtual const WChar * InitializeClass();
-
- virtual WStyle GetDefaultStyle() const;
-
- virtual WBool FDXIn();
-
- virtual WBool FDXOut();
-
- virtual WBool ProcessCommand( WUInt id, WNotify code,
- WNotifyInfo info, WLong & returns );
-
- WBool DataOpenHandler( WCheckBox *, WDataOpenEventData *ev );
- WBool DataCloseHandler( WCheckBox *, WDataCloseEventData *ev );
- WBool DataAvailableHandler( WCheckBox *, WDataAvailableEventData *ev );
- WBool DataRequestHandler( WCheckBox *, WDataRequestEventData *ev );
-
- protected:
-
- WBool AllocDTCell();
-
- /**************************************************************
- * Data members
- **************************************************************/
-
- private:
-
- WULong * _fdxDataSource;
- WBool * _fdxDataSourceBool;
- WDataTargetBoolCell * _dataTarget;
- WButtonState _initial;
- WBool _wasEnabled;
- };
-
- #ifndef _WNO_PRAGMA_PUSH
- #pragma enum pop;
- #pragma pack(pop);
- #endif
-
- #endif // _WCHECKBX_HPP_INCLUDED
-