home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1997 October
/
Chip_1997-10_cd.bin
/
tema
/
sybase
/
powerj
/
hpp.z
/
WDATANAV.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1997-01-23
|
8KB
|
283 lines
/*************************************************************************
*
* WDataNavigator
*
* Events:
*
* DataAvailable --
*
* DataClose --
*
* DataOpen --
*
* DataRequest --
*
*************************************************************************/
#ifndef _WDATANAV_HPP_INCLUDED
#define _WDATANAV_HPP_INCLUDED
#ifndef _WNO_PRAGMA_PUSH
#pragma pack(push,8);
#pragma enum int;
#endif
#ifndef _WWINDOW_HPP_INCLUDED
# include "wwindow.hpp"
#endif
#ifndef _WCONTROL_HPP_INCLUDED
# include "wcontrol.hpp"
#endif
#ifndef _WDATATRG_HPP_INCLUDED
# include "wdatatrg.hpp"
#endif
#ifndef _WDATASRC_HPP_INCLUDED
# include "wdatasrc.hpp"
#endif
enum WDNAction {
WDNActionNone,
WDNActionMoveFirst,
WDNActionMoveLast
};
//
// DataNavigator styles
//
#define WDNSDefault ((WStyle)0x50000000L) // WS_VISIBLE|WS_CHILD
class WCMCLASS WDataNavigator : public WControl {
WDeclareSubclass( WDataNavigator, WControl );
public:
/***************************************************************
* Constructors and Destructors
***************************************************************/
WDataNavigator();
~WDataNavigator();
/***************************************************************
* Properties
***************************************************************/
// BOFAction
//
// Determines what to do when the cursor is moved to the
// beginning of the query.
WDNAction GetBOFAction() const;
WBool SetBOFAction( WDNAction action );
// DataSource
//
// The data source to track.
WDataSource *GetDataSource() const;
WBool SetDataSource( WDataSource *source );
// EOFAction
//
// Determines what to do when the cursor is moved to the
// end of the query.
WDNAction GetEOFAction() const;
WBool SetEOFAction( WDNAction action );
// KeepFocus
//
// If TRUE, the focus stays on a button when the user
// clicks on it, otherwise it returns to where it came
// from.
WBool GetKeepFocus() const;
WBool SetKeepFocus( WBool keep );
// ShowAdd
//
// Show the Add button.
WBool GetShowAdd() const;
WBool SetShowAdd( WBool show );
// ShowCancel
//
// Show the cancel button.
WBool GetShowCancel() const;
WBool SetShowCancel( WBool show );
// ShowDelete
//
// Show the delete button.
WBool GetShowDelete() const;
WBool SetShowDelete( WBool show );
// ShowEdit
//
// Show the edit button.
WBool GetShowEdit() const;
WBool SetShowEdit( WBool show );
// ShowMoveFirst
//
// Show the movefirst button.
WBool GetShowMoveFirst() const;
WBool SetShowMoveFirst( WBool show );
// ShowMoveLast
//
// Show the movelast button.
WBool GetShowMoveLast() const;
WBool SetShowMoveLast( WBool show );
// ShowMoveNext
//
// Show the movenext button.
WBool GetShowMoveNext() const;
WBool SetShowMoveNext( WBool show );
// ShowMovePrevious
//
// Show the moveprevious button.
WBool GetShowMovePrevious() const;
WBool SetShowMovePrevious( WBool show );
// ShowRefresh
//
// Show the refresh button.
WBool GetShowRefresh() const;
WBool SetShowRefresh( WBool show );
// ShowSearch
//
// Show the search button.
WBool GetShowSearch() const;
WBool SetShowSearch( WBool show );
// ShowTooltips
//
// Show the tooltips.
WBool GetShowTooltips() const;
WBool SetShowTooltips( WBool show );
// ShowUpdate
//
// Show the update button.
WBool GetShowUpdate() const;
WBool SetShowUpdate( WBool show );
/***************************************************************
* Methods
***************************************************************/
/***************************************************************
* Overrides
***************************************************************/
virtual WStyle GetDefaultStyle() const;
virtual WStyle GetDefaultExtendedStyle() const;
virtual const WChar * InitializeClass();
virtual WBool CloneWindow( WStyle newStyle, WStyle newExStyle,
void *data );
WBool GetShowState( int ) const;
WBool SetShowState( int, WBool );
/***************************************************************
* Event Handlers
***************************************************************/
protected:
WLong WhichButton( const WPoint & pt, WRect *r=NULL );
WBool SizeChangingHandler( WDataNavigator *, WResizeEventData * );
WBool ResizeHandler( WDataNavigator *, WResizeEventData * );
WBool EraseBackgroundHandler( WDataNavigator *, WEventData * );
WBool PaintHandler( WDataNavigator *, WPaintEventData * );
WBool LeftButtonDownHandler( WDataNavigator * window,
WMouseEventData * event );
WBool LeftButtonUpHandler( WDataNavigator * window,
WMouseEventData * event );
WBool MouseMoveHandler( WDataNavigator *, WMouseEventData *event );
WBool DataOpenHandler( WDataNavigator *, WDataOpenEventData *ev );
WBool DataCloseHandler( WDataNavigator *, WDataCloseEventData *ev );
WBool DataAvailableHandler( WDataNavigator *, WDataAvailableEventData *ev );
WBool AdjustCursorHandler( WDataNavigator *, WAdjustCursorEventData * );
WBool DestroyEventHandler( WDataNavigator *, WEventData * );
/***************************************************************
* Internal
***************************************************************/
public:
enum WDNButton {
WDNButtonMoveFirst,
WDNButtonMovePrevious,
WDNButtonMoveNext,
WDNButtonMoveLast,
WDNButtonAdd,
WDNButtonDelete,
WDNButtonEdit,
WDNButtonUpdate,
WDNButtonCancel,
WDNButtonRefresh,
WDNButtonSearch,
WDNButtonLastPlusOne
};
protected:
struct ButtonInfo {
WBool visible;
WBool enabled;
WBool selected;
WShort horizID;
WShort vertID;
WString *tooltip;
};
void DrawButton( ButtonInfo & b, WRect rcItem, WDisplayCanvas *canvas );
void RedrawButton( WLong which );
void UpdateButtons( WULong ev );
void DeleteToolTip();
ButtonInfo _buttons[ WDNButtonLastPlusOne ];
WUShort _numVisible;
WBitmap _bitmap;
WDataTarget *_dataTarget;
WBool _keepFocus;
WBool _vertical;
WDNAction _bofAction;
WDNAction _eofAction;
WBool _redo;
WLong _which;
WShort _lastX;
WShort _lastY;
WBool _showTooltips;
};
#ifndef _WNO_PRAGMA_PUSH
#pragma enum pop;
#pragma pack(pop);
#endif
#endif // _WDATANAV_HPP_INCLUDED