home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / hpp.z / wgrid.hpp < prev    next >
C/C++ Source or Header  |  1996-10-29  |  17KB  |  514 lines

  1. /*
  2.     WGrid.hpp
  3.  
  4.     NOTE: This file is a generated file.
  5.           Do not modify it by hand!
  6. */
  7.  
  8. #ifndef _WGRID_HPP_INCLUDED
  9. #define _WGRID_HPP_INCLUDED
  10.  
  11.  
  12. // Declarations added here will be included at the top of the .HPP file
  13.  
  14. #include "WGridD.hpp"
  15.  
  16. #ifndef _WTEXTBOX_HPP_INCLUDED
  17. #  include "wtextbox.hpp"
  18. #endif
  19. #ifndef _WCOMBOX_HPP_INCLUDED
  20. #  include "wcombox.hpp"
  21. #endif
  22. #ifndef _WMASKTB_HPP_INCLUDED
  23. #  include "wmasktb.hpp"
  24. #endif
  25.  
  26. /*************************************************************************
  27.  *
  28.  * WGrid -- Base Grid class
  29.  *
  30.  *
  31.  *   Events:
  32.  *
  33.  *       BeginLabelEdit --
  34.  *
  35.  *       Click --
  36.  *
  37.  *       DoubleClick --
  38.  *
  39.  *       EndLabelEdit --
  40.  *
  41.  *       InsertItem -- Called immediately after an item is added.
  42.  *
  43.  *       Select -- Called immediately after an item is selected.
  44.  *
  45.  ************************************************************************/
  46.  
  47. struct WGridEventData : public WEventData {
  48.     WULong      rowNumber;
  49.     WULong      columnNumber;
  50.     WString     text;
  51. };
  52.  
  53. struct WGridUserData {
  54.     WLong           row;
  55.     void *          userData;
  56. };
  57.  
  58. #pragma warning 849 9
  59.  
  60. class WGrid;
  61.  
  62. class WCMCLASS WGridComboBox : public WComboBox
  63. {
  64.     public:
  65.         WGridComboBox( WGrid * grid=NULL ) { _grid = grid; };
  66.         ~WGridComboBox() {};
  67.         
  68.     public:
  69.         virtual WULong GetDialogCode( WUInt wParam = 0, WLong lParam = 0 );
  70.         virtual WBool Move( const WRect & rectangle, WBool update=TRUE );
  71.         virtual WBool Move( const WRect & rectangle, WDeferMoveHandle & dwp );
  72.         virtual WBool Move( const WPoint & point, WBool update=TRUE );
  73.         virtual WBool Move( const WPoint & point, WDeferMoveHandle & dwp );
  74.  
  75.     private:
  76.         WGrid *         _grid;
  77. };
  78.  
  79. class WCMCLASS WGridMaskedTextBox : public WMaskedTextBox
  80. {
  81.     public:
  82.         WGridMaskedTextBox( WGrid * grid=NULL ) { _grid = grid; };
  83.         ~WGridMaskedTextBox() {};
  84.         
  85.     public:
  86.         virtual WULong GetDialogCode( WUInt wParam = 0, WLong lParam = 0 );
  87.  
  88.     private:
  89.         WGrid *         _grid;
  90. };
  91.  
  92. class WCMCLASS WGridTextBox : public WTextBox
  93. {
  94.     public:
  95.         WGridTextBox( WGrid * grid=NULL ) { _grid = grid; };
  96.         ~WGridTextBox() {};
  97.         
  98.     public:
  99.         virtual WULong GetDialogCode( WUInt wParam = 0, WLong lParam = 0 );
  100.  
  101.     private:
  102.         WGrid *         _grid;
  103. };
  104.  
  105. class WCMCLASS WGrid : public WControl
  106. {
  107.         /**************************************************************
  108.          * Constructors and destructors
  109.          **************************************************************/
  110.     public:
  111.  
  112.         WGrid();
  113.  
  114.         ~WGrid();
  115.  
  116.         /**************************************************************
  117.          * Properties
  118.          **************************************************************/
  119.  
  120.         // ColumnCount
  121.  
  122.         WULong GetColumnCount() const;
  123.         WBool SetColumnCount( WULong columnCount=0xFFFFFFFFL );
  124.  
  125.         // DataColumns
  126.  
  127.         WString GetDataColumns() const;
  128.         WBool SetDataColumns( const WString & columns );
  129.  
  130.         // DataGuardRows
  131.  
  132.         WLong GetDataGuardRows() const;
  133.         WBool SetDataGuardRows( WLong guardRows );
  134.  
  135.         // DataKeptRows
  136.  
  137.         WLong GetDataKeptRows() const;
  138.         WBool SetDataKeptRows( WLong keptRows );
  139.  
  140.         // DataSource
  141.  
  142.         WDataSource * GetDataSource() const;
  143.         WBool SetDataSource( WDataSource * source );
  144.  
  145.         // DefaultColumnWidth
  146.  
  147.         WInt GetDefaultColumnWidth() const;
  148.         WBool SetDefaultColumnWidth( WInt defaultColumnWidth,
  149.                                      WBool repaint=TRUE );
  150.  
  151.         // DefaultRowHeight
  152.  
  153.         WInt GetDefaultRowHeight() const;
  154.         WBool SetDefaultRowHeight( WInt defaultRowHeight,
  155.                                    WBool repaint=TRUE );
  156.  
  157.         // Editor
  158.  
  159.         WWindow * GetEditor() const;
  160.         WBool SetEditor( WWindow * editor, WBool deleteOld=TRUE );
  161.  
  162.         // FullRowSelection
  163.  
  164.         WBool GetFullRowSelection() const;
  165.         WBool SetFullRowSelection( WBool fullRowSelection );
  166.  
  167.         // HorizontalHeaderHeight
  168.  
  169.         WBool SetHorizontalHeaderHeight( WShort headerHeight );
  170.         WShort GetHorizontalHeaderHeight() const;
  171.  
  172.         // LeftColumnNumber
  173.  
  174.         WULong GetLeftColumnNumber() const;
  175.         WBool SetLeftColumnNumber( WULong columnNumber );
  176.  
  177.         // LiveEditMode
  178.  
  179.         WBool GetLiveEditMode() const;
  180.         WBool SetLiveEditMode( WBool liveEditMode=TRUE );
  181.  
  182.         // MultipleSelection
  183.  
  184.         WBool SetMultipleSelection( WBool multipleSelection );
  185.         WBool GetMultipleSelection() const;
  186.  
  187.         // ReadOnly
  188.  
  189.         WBool GetReadOnly() const;
  190.         WBool SetReadOnly( WBool readOnly );
  191.  
  192.         // ResizableColumns
  193.  
  194.         WBool SetResizableColumns( WBool resizableColumns );
  195.         WBool GetResizableColumns() const;
  196.  
  197.         // ResizableRows
  198.  
  199.         WBool SetResizableRows( WBool resizableRows );
  200.         WBool GetResizableRows() const;
  201.  
  202.         // RowCount
  203.  
  204.         WULong GetRowCount() const;
  205.         WBool SetRowCount( WULong rowCount=0xFFFFFFFFL );
  206.  
  207.         // SelectedColumnNumber
  208.  
  209.         WULong GetSelectedColumnNumber() const;
  210.         WBool SetSelectedColumnNumber( WULong columnNumber,
  211.                                        WBool repaint=TRUE,
  212.                                        WBool scrollIntoView=TRUE );
  213.  
  214.         // SelectedEndColumnNumber
  215.  
  216.         WULong GetSelectedEndColumnNumber() const;
  217.         WBool SetSelectedEndColumnNumber( WULong columnNumber,
  218.                                           WBool repaint=TRUE );
  219.  
  220.         // SelectedEndRowNumber
  221.  
  222.         WULong GetSelectedEndRowNumber() const;
  223.         WBool SetSelectedEndRowNumber( WULong rowNumber, WBool repaint=TRUE );
  224.  
  225.         // SelectedRowNumber
  226.  
  227.         WULong GetSelectedRowNumber() const;
  228.         WBool SetSelectedRowNumber( WULong rowNumber, WBool repaint=TRUE,
  229.                                     WBool scrollIntoView=TRUE );
  230.  
  231.         // ShowColumnLines
  232.  
  233.         WBool SetShowColumnLines( WBool showColumnLines=TRUE );
  234.         WBool GetShowColumnLines() const;
  235.  
  236.         // ShowRowLines
  237.  
  238.         WBool SetShowRowLines( WBool showRowLines=TRUE );
  239.         WBool GetShowRowLines() const;
  240.  
  241.         // ShowHorizontalHeader
  242.  
  243.         WBool GetShowHorizontalHeader() const;
  244.         WBool SetShowHorizontalHeader( WBool showHorizontalHeader,
  245.                                        WBool repaint=TRUE );
  246.  
  247.         // ShowVerticalHeader
  248.  
  249.         WBool GetShowVerticalHeader() const;
  250.         WBool SetShowVerticalHeader( WBool showVerticalHeader,
  251.                                      WBool repaint=TRUE );
  252.  
  253.         // TopRowNumber
  254.  
  255.         WULong GetTopRowNumber() const;
  256.         WBool SetTopRowNumber( WULong rowNumber );
  257.  
  258.         // UseTabs
  259.  
  260.         WBool SetUseTabs( WBool useTabs );
  261.         WBool GetUseTabs() const;
  262.  
  263.         // VerticalHeaderWidth
  264.  
  265.         WBool SetVerticalHeaderWidth( WShort headerWidth );
  266.         WShort GetVerticalHeaderWidth() const;
  267.  
  268.         // VisibleColumnCount
  269.  
  270.         WULong GetVisibleColumnCount() const;
  271.  
  272.         // VisibleRowCount
  273.  
  274.         WULong GetVisibleRowCount() const;
  275.  
  276.         // DataTrackRow
  277.  
  278.         WBool GetDataTrackRow() const;
  279.         WBool SetDataTrackRow( WBool trackRow );
  280.  
  281.         /**************************************************************
  282.          * Item Properties
  283.          **************************************************************/
  284.  
  285.         // ColumnTitle
  286.  
  287.         WBool SetColumnTitle( WULong columnNumber,
  288.                               const WString & columnTitle,
  289.                               WBool repaint=FALSE );
  290.         WString GetColumnTitle( WULong columnNumber ) const;
  291.  
  292.         // ColumnWidth
  293.  
  294.         WBool SetColumnWidth( WULong columnNumber, WInt columnWidth );
  295.         WInt GetColumnWidth( WULong columnNumber ) const;
  296.  
  297.         // ReadOnly
  298.  
  299.         WBool SetReadOnly( WULong rowNumber, WULong columnNumber,
  300.                            WBool readOnly );
  301.         WBool SetReadOnly( WULong columnNumber, WBool readOnly );
  302.         WBool GetReadOnly( WULong rowNumber, WULong columnNumber ) const;
  303.         WBool GetReadOnly( WULong columnNumber ) const;
  304.  
  305.         // Rectangle
  306.  
  307.         WRect GetRectangle( WULong rowNumber, WULong columnNumber );
  308.  
  309.         // RowTitle
  310.  
  311.         WBool SetRowTitle( WULong rowNumber, const WString & rowTitle,
  312.                            WBool repaint=FALSE );
  313.         WString GetRowTitle( WULong rowNumber ) const;
  314.  
  315.         // RowHeight
  316.  
  317.         WBool SetRowHeight( WULong rowNumber, WInt rowHeight );
  318.         WInt GetRowHeight( WULong rowNumber ) const;
  319.  
  320.         // Text
  321.  
  322.         WBool SetText( WULong rowNumber, WULong columnNumber,
  323.                        const WString & text, WBool createIfDoesntExist=TRUE,
  324.                        WBool repaint=TRUE );
  325.         WString GetText( WULong rowNumber, WULong columnNumber ) const;
  326.  
  327.         // UserData
  328.  
  329.         WBool SetUserData( WULong rowNumber, WULong columnNumber,
  330.                            void * userData );
  331.         void * GetUserData( WULong rowNumber, WULong columnNumber ) const;
  332.  
  333.         /**************************************************************
  334.          * Methods
  335.          **************************************************************/
  336.  
  337.         // AddRow
  338.  
  339.         WBool AddRow( WULong rowNumber=0xFFFFFFFFL );
  340.  
  341.         // CreateComboBoxEditor
  342.  
  343.         WGridComboBox * CreateComboBoxEditor( WBool set=TRUE );
  344.  
  345.         // CreateMaskedTextBoxEditor
  346.  
  347.         WGridMaskedTextBox * CreateMaskedTextBoxEditor( WBool set=TRUE );
  348.  
  349.         // CreateTextBoxEditor
  350.  
  351.         WGridTextBox * CreateTextBoxEditor( WBool set=TRUE );
  352.  
  353.         // DeleteAllRows
  354.  
  355.         WBool DeleteAllRows();
  356.  
  357.         // DeleteRow
  358.  
  359.         WBool DeleteRow( WULong rowNumber );
  360.  
  361.         // EnsureRowIsVisible
  362.  
  363.         WBool EnsureRowIsVisible( WULong rowNumber );
  364.  
  365.         // Retrieve
  366.  
  367.         WBool Retrieve( const WPoint & point, WULong & rowNumber,
  368.                         WULong & columnNumber );
  369.  
  370.         /**************************************************************
  371.          * Overrides
  372.          **************************************************************/
  373.  
  374.         virtual WString GetText() const;
  375.  
  376.         virtual WBool SetText( const WString & text );
  377.  
  378.         virtual WStyle GetDefaultStyle() const;
  379.  
  380.         virtual WULong GetDialogCode( WUInt wParam = 0, WLong lParam = 0 );
  381.  
  382.         virtual WRect GetRectangle( WBool absolute=FALSE ) const;
  383.  
  384.         virtual WBool MakeWindow( WWindow * parent, WUInt id,
  385.                                   const WChar *className, const WChar *title,
  386.                                   const WRect & r, WStyle wstyle,
  387.                                   WStyle exStyle, void * data=NULL );
  388.  
  389.         virtual WBool LoadWindow( WWindow * parent, const WResourceID & id,
  390.                                   WModuleHandle module=_ApplicationModule );
  391.         
  392.         virtual WBool CloneWindow( WStyle newStyle, WStyle newExStyle,
  393.                                    void * data=NULL );
  394.  
  395.         /**************************************************************
  396.          * Event Handlers
  397.          **************************************************************/
  398.     
  399.         WBool DataAvailableHandler( WGrid * source, WDataAvailableEventData * ev );
  400.         WBool DataCloseHandler( WGrid * source, WDataCloseEventData * event );
  401.         WBool DataGuardRowHandler( WGrid * source, WDataGuardRowEventData * ev );
  402.         WBool DataOpenHandler( WGrid * source, WDataOpenEventData * event );
  403.         WBool DataRequestHandler( WGrid * source, WDataRequestEventData * );
  404.         WBool EraseBackgroundEvent( WGrid * source, WPaintEventData * event );
  405.         WBool GetCursorEvent( WGrid * source, WGetCursorEventData * event );
  406.         WBool KeyDownEvent( WGrid * source, WKeyPressEventData * event );
  407.         WBool LeftButtonDownEvent( WGrid * source, WMouseEventData * event );
  408.         WBool LeftButtonUpEvent( WGrid * source, WMouseEventData * event );
  409.         WBool MouseMoveEvent( WGrid * source, WMouseEventData * event );
  410.         WBool PaintEvent( WGrid * source, WPaintEventData * event );
  411.         WBool ResizeEvent( WGrid * source, WResizeEventData * event );
  412.         WBool ScrollEvent( WGrid * source, WScrollBarEventData * event );
  413.         WBool TextBoxCharacterPressEvent( WWindow * source, WCharacterPressEventData * event );
  414.         WBool TextBoxKeyDownEvent( WWindow * source, WKeyPressEventData * event );
  415.         WBool TextBoxLeftButtonUpEvent( WGrid * source, WMouseEventData * event );
  416.         WBool LeftButtonDoubleEvent( WGrid * source, WMouseEventData * event );
  417.  
  418.         /**************************************************************
  419.          * Others
  420.          **************************************************************/
  421.     
  422.         WBool ChangeVerticalHeaderSize( WULong oldSize, WULong newSize,
  423.                                         WULong columnNumber );
  424.         WBool ChangeHorizontalHeaderSize( WULong oldSize, WULong newSize,
  425.                                           WULong rowNumber );
  426.         WBool SetSelected( WULong rowNumber, WULong columnNumber,
  427.                            WBool repaint=TRUE, WBool scrollIntoView=TRUE );
  428.     private:
  429.         WBool ShowTextBox();
  430.         WBool HideTextBox();
  431.         WBool HandleRefreshRow( WLong reason, WLong currentRow,
  432.                                 WULong count );
  433.         WBool AddDataRow( WULong row, WULong rowNumber=0xFFFFFFFFL );
  434.         void RenumberDataRows();
  435.         WULong FindDataRow( WULong dbrow, WLong itemCount=0xFFFFFFFFL );
  436.         WBool IndirectUserData( WBool indirect );
  437.         void * GetRealUserData( WULong rowNumber, WULong columnNumber ) const;
  438.         WBool SetRealUserData( WULong rowNumber, WULong columnNumber,
  439.                                void * userData );
  440.         WBool GetNonEmptyRowRange( WULong & startRowNumber,
  441.                                    WULong & endRowNumber ) const;
  442.         WULong GetNonEmptyRowCount() const;
  443.         WBool ResetColumnGap();
  444.         WBool ResetRowGap();
  445.         WBool IsSizing( const WPoint & point, WBool * vertical );
  446.         WBool DrawSizingLine( WBool vertical, WULong rowNumber,
  447.                               WULong columnNumber, WPoint * currPoint=NULL,
  448.                               WBool eraseOnly=FALSE );
  449.         WBool SelectiveInvalidate( WULong oldTopRowNum, WULong oldLeftColNum,
  450.                                    WULong oldSelEndRowNum,
  451.                                    WULong oldSelEndColNum );
  452.         WBool AllocDTTable();
  453.         void UpdateExtents( WInt count );
  454.         WBool UpdateHorizontalScrollbars();
  455.         WBool UpdateVerticalScrollbars();
  456.  
  457.     protected:
  458.         WBool doDataTargetScroll();
  459.  
  460.         /**************************************************************
  461.          * Data Members
  462.          **************************************************************/
  463.  
  464.     private:
  465.         WGridData                 _data;
  466.         WWindow *                 _editor;
  467.         WShort                    _headerHeight;
  468.         WShort                    _headerWidth;
  469.         WULong                    _selectedRowNum;
  470.         WULong                    _selectedColNum;
  471.         WRect                     _sizingRect;
  472.         WULong                    _sizingNumber;
  473.         WPoint                    _sizingPos;
  474.         WULong                    _rowCount;
  475.         WULong                    _colCount;
  476.         WULong                    _selectedEndRowNum;
  477.         WULong                    _selectedEndColNum;
  478.         WULong                    _rowGap;
  479.         WULong                    _colGap;
  480.         WDataTargetTable *        _dataTargetTable;
  481.         WLong                     _addRow;
  482.         WLong                     _lastScrollPos;
  483.         WLong                     _scrollUp;
  484.         WLong                     _scrollDown;
  485.         // TODO: Put these into flags
  486.         WBool                     _liveEditMode;
  487.         WBool                     _editting;
  488.         WBool                     _showVertHeader;
  489.         WBool                     _showHorzHeader;
  490.         WBool                     _readOnly;
  491.         WBool                     _headerSizing;
  492.         WBool                     _verticalSizing;
  493.         WBool                     _horizontalSizing;
  494.         WBool                     _selecting;
  495.         WBool                     _allowVertSizing;
  496.         WBool                     _allowHorzSizing;
  497.         WBool                     _fullRowSelect;
  498.         WBool                     _rowLines;
  499.         WBool                     _colLines;
  500.         WBool                     _useTabs;
  501.         WBool                     _multiSelect;
  502.         WBool                     _dataFilling;
  503.         WBool                     _wasPainting;
  504.         WBool                     _ignoreItemChanged;
  505.         WBool                     _indirectUserData;
  506.         WBool                     _ignoreDataAvailableMove;
  507.         WBool                     _scrolling;
  508.         WLong                     _dataGuardRowOffset;
  509. };
  510.  
  511. #pragma warning 849 1
  512.  
  513. #endif
  514.