home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 10 / ioProg_10.iso / soft / optima / hpp.z / WDATANAV.HPP < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-06  |  7.6 KB  |  275 lines

  1. /*************************************************************************
  2.  *
  3.  * WDataNavigator 
  4.  *
  5.  *   Events:
  6.  *
  7.  *       DataAvailable --
  8.  *
  9.  *       DataClose --
  10.  *
  11.  *       DataOpen --
  12.  *
  13.  *       DataRequest --
  14.  *
  15.  *************************************************************************/
  16.  
  17. #ifndef _WDATANAV_HPP_INCLUDED
  18. #define _WDATANAV_HPP_INCLUDED
  19.  
  20. #ifndef _WNO_PRAGMA_PUSH
  21. #pragma pack(push,4);
  22. #pragma enum int;
  23. #endif
  24.  
  25. #ifndef _WWINDOW_HPP_INCLUDED
  26. #  include "wwindow.hpp"
  27. #endif
  28. #ifndef _WCONTROL_HPP_INCLUDED
  29. #  include "wcontrol.hpp"
  30. #endif
  31. #ifndef _WDATATRG_HPP_INCLUDED
  32. #  include "wdatatrg.hpp"
  33. #endif
  34. #ifndef _WDATASRC_HPP_INCLUDED
  35. #  include "wdatasrc.hpp"
  36. #endif
  37.  
  38. enum WDNAction {
  39.     WDNActionNone,
  40.     WDNActionMoveFirst,
  41.     WDNActionMoveLast
  42. };
  43.  
  44. //
  45. // DataNavigator styles
  46. //
  47.  
  48. #define WDNSDefault             ((WStyle)0x50000000L) // WS_VISIBLE|WS_CHILD
  49.  
  50. class WCMCLASS WDataNavigator : public WControl {
  51.     WDeclareSubclass( WDataNavigator, WControl );
  52.  
  53.     public:
  54.     
  55.         /***************************************************************
  56.          * Constructors and Destructors
  57.          ***************************************************************/
  58.  
  59.         WDataNavigator();
  60.     
  61.         ~WDataNavigator();
  62.  
  63.         /***************************************************************
  64.          * Properties
  65.          ***************************************************************/
  66.  
  67.         // BOFAction
  68.         //
  69.         //    Determines what to do when the cursor is moved to the
  70.         //    beginning of the query.
  71.  
  72.         WDNAction GetBOFAction() const;
  73.         WBool     SetBOFAction( WDNAction action );
  74.  
  75.         // DataSource
  76.         //
  77.         //    The data source to track.
  78.  
  79.         WDataSource *GetDataSource() const;
  80.         WBool        SetDataSource( WDataSource *source );
  81.  
  82.         // EOFAction
  83.         //
  84.         //    Determines what to do when the cursor is moved to the
  85.         //    end of the query.
  86.  
  87.         WDNAction GetEOFAction() const;
  88.         WBool     SetEOFAction( WDNAction action );
  89.  
  90.         // KeepFocus
  91.         //
  92.         //    If TRUE, the focus stays on a button when the user
  93.         //    clicks on it, otherwise it returns to where it came
  94.         //    from.
  95.  
  96.         WBool GetKeepFocus() const;
  97.         WBool SetKeepFocus( WBool keep );
  98.  
  99.         // ShowAdd
  100.         //
  101.         //    Show the Add button.
  102.  
  103.         WBool GetShowAdd() const;
  104.         WBool SetShowAdd( WBool show );
  105.  
  106.         // ShowCancel
  107.         //
  108.         //    Show the cancel button.
  109.  
  110.         WBool GetShowCancel() const;
  111.         WBool SetShowCancel( WBool show );
  112.  
  113.         // ShowDelete
  114.         //
  115.         //    Show the delete button.
  116.  
  117.         WBool GetShowDelete() const;
  118.         WBool SetShowDelete( WBool show );
  119.  
  120.         // ShowEdit
  121.         //
  122.         //    Show the edit button.
  123.  
  124.         WBool GetShowEdit() const;
  125.         WBool SetShowEdit( WBool show );
  126.  
  127.         // ShowMoveFirst
  128.         //
  129.         //    Show the movefirst button.
  130.  
  131.         WBool GetShowMoveFirst() const;
  132.         WBool SetShowMoveFirst( WBool show );
  133.  
  134.         // ShowMoveLast
  135.         //
  136.         //    Show the movelast button.
  137.  
  138.         WBool GetShowMoveLast() const;
  139.         WBool SetShowMoveLast( WBool show );
  140.  
  141.         // ShowMoveNext
  142.         //
  143.         //    Show the movenext button.
  144.  
  145.         WBool GetShowMoveNext() const;
  146.         WBool SetShowMoveNext( WBool show );
  147.  
  148.         // ShowMovePrevious
  149.         //
  150.         //   Show the moveprevious button.
  151.  
  152.         WBool GetShowMovePrevious() const;
  153.         WBool SetShowMovePrevious( WBool show );
  154.  
  155.         // ShowRefresh
  156.         //
  157.         //   Show the refresh button.
  158.  
  159.         WBool GetShowRefresh() const;
  160.         WBool SetShowRefresh( WBool show );
  161.  
  162.         // ShowTooltips
  163.         //
  164.         //   Show the tooltips.
  165.  
  166.         WBool GetShowTooltips() const;
  167.         WBool SetShowTooltips( WBool show );
  168.  
  169.         // ShowUpdate
  170.         //
  171.         //   Show the update button.
  172.  
  173.         WBool GetShowUpdate() const;
  174.         WBool SetShowUpdate( WBool show );
  175.  
  176.         /***************************************************************
  177.          * Methods
  178.          ***************************************************************/
  179.  
  180.         /***************************************************************
  181.          * Overrides
  182.          ***************************************************************/
  183.  
  184.         virtual WStyle GetDefaultStyle() const;
  185.         virtual WStyle GetDefaultExtendedStyle() const;
  186.         virtual const WChar * InitializeClass();
  187.         virtual WBool CloneWindow( WStyle newStyle, WStyle newExStyle,
  188.                                    void *data );
  189.  
  190.         WBool GetShowState( int ) const;
  191.         WBool SetShowState( int, WBool );
  192.  
  193.         /***************************************************************
  194.          * Event Handlers
  195.          ***************************************************************/
  196.  
  197.     protected:
  198.         WLong WhichButton( const WPoint & pt, WRect *r=NULL );
  199.  
  200.         WBool SizeChangingHandler( WDataNavigator *, WResizeEventData * );
  201.         WBool ResizeHandler( WDataNavigator *, WResizeEventData * );
  202.         WBool EraseBackgroundHandler( WDataNavigator *, WEventData * );
  203.         WBool PaintHandler( WDataNavigator *, WPaintEventData * );
  204.         WBool LeftButtonDownHandler( WDataNavigator * window,
  205.                                      WMouseEventData * event );
  206.         WBool LeftButtonUpHandler( WDataNavigator * window,
  207.                                      WMouseEventData * event );
  208.         WBool MouseMoveHandler( WDataNavigator *, WMouseEventData *event );
  209.  
  210.         WBool DataOpenHandler( WDataNavigator *, WDataOpenEventData *ev );
  211.         WBool DataCloseHandler( WDataNavigator *, WDataCloseEventData *ev );
  212.         WBool DataAvailableHandler( WDataNavigator *, WDataAvailableEventData *ev );
  213.  
  214.         WBool AdjustCursorHandler( WDataNavigator *, WAdjustCursorEventData * );
  215.         WBool DestroyEventHandler( WDataNavigator *, WEventData * );
  216.  
  217.         /***************************************************************
  218.          * Internal
  219.          ***************************************************************/
  220.  
  221.     public:
  222.  
  223.         enum WDNButton {
  224.             WDNButtonMoveFirst,
  225.             WDNButtonMovePrevious,
  226.             WDNButtonMoveNext,
  227.             WDNButtonMoveLast,
  228.             WDNButtonAdd,
  229.             WDNButtonDelete,
  230.             WDNButtonEdit,
  231.             WDNButtonUpdate,
  232.             WDNButtonCancel,
  233.             WDNButtonRefresh,
  234.         
  235.             WDNButtonLastPlusOne
  236.         };
  237.         
  238.     protected:
  239.  
  240.         struct ButtonInfo {
  241.             WBool    visible;
  242.             WBool    enabled;
  243.             WBool    selected;
  244.             WShort   horizID;
  245.             WShort   vertID;
  246.             WString *tooltip;
  247.         };
  248.  
  249.         void DrawButton( ButtonInfo & b, WRect rcItem, WDisplayCanvas *canvas );
  250.         void RedrawButton( WLong which );
  251.         void UpdateButtons( WULong ev );
  252.         void DeleteToolTip();
  253.  
  254.         ButtonInfo   _buttons[ WDNButtonLastPlusOne ];
  255.         WUShort      _numVisible;
  256.         WBitmap      _bitmap;
  257.         WDataTarget *_dataTarget;
  258.         WBool        _keepFocus;
  259.         WBool        _vertical;
  260.         WDNAction    _bofAction;
  261.         WDNAction    _eofAction;
  262.         WBool        _redo;
  263.         WLong        _which;
  264.         WShort       _lastX;
  265.         WShort       _lastY;
  266.         WBool        _showTooltips;
  267. };
  268.  
  269. #ifndef _WNO_PRAGMA_PUSH
  270. #pragma enum pop;
  271. #pragma pack(pop);
  272. #endif
  273.  
  274. #endif // _WDATANAV_HPP_INCLUDED
  275.