home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 October / Chip_1997-10_cd.bin / tema / sybase / powerj / hpp.z / wgrid.hpp < prev    next >
C/C++ Source or Header  |  1997-01-21  |  18KB  |  528 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.         // UseArray
  121.         //
  122.         //  Note: Changing this property deletes existing data
  123.  
  124.         WBool GetUseArray() const;
  125.         WBool SetUseArray( WBool useArray );
  126.  
  127.         // ColumnCount
  128.  
  129.         WULong GetColumnCount() const;
  130.         WBool SetColumnCount( WULong columnCount=0xFFFFFFFFL );
  131.  
  132.         // DataColumns
  133.  
  134.         WString GetDataColumns() const;
  135.         WBool SetDataColumns( const WString & columns );
  136.  
  137.         // DataGuardRows
  138.  
  139.         WLong GetDataGuardRows() const;
  140.         WBool SetDataGuardRows( WLong guardRows );
  141.  
  142.         // DataKeptRows
  143.  
  144.         WLong GetDataKeptRows() const;
  145.         WBool SetDataKeptRows( WLong keptRows );
  146.  
  147.         // DataSource
  148.  
  149.         WDataSource * GetDataSource() const;
  150.         WBool SetDataSource( WDataSource * source );
  151.  
  152.         // DefaultColumnWidth
  153.  
  154.         WInt GetDefaultColumnWidth() const;
  155.         WBool SetDefaultColumnWidth( WInt defaultColumnWidth,
  156.                                      WBool repaint=TRUE );
  157.  
  158.         // DefaultRowHeight
  159.  
  160.         WInt GetDefaultRowHeight() const;
  161.         WBool SetDefaultRowHeight( WInt defaultRowHeight,
  162.                                    WBool repaint=TRUE );
  163.  
  164.         // Editor
  165.  
  166.         WWindow * GetEditor() const;
  167.         WBool SetEditor( WWindow * editor, WBool deleteOld=TRUE );
  168.  
  169.         // FullRowSelection
  170.  
  171.         WBool GetFullRowSelection() const;
  172.         WBool SetFullRowSelection( WBool fullRowSelection );
  173.  
  174.         // HorizontalHeaderHeight
  175.  
  176.         WBool SetHorizontalHeaderHeight( WShort headerHeight );
  177.         WShort GetHorizontalHeaderHeight() const;
  178.  
  179.         // LeftColumnNumber
  180.  
  181.         WULong GetLeftColumnNumber() const;
  182.         WBool SetLeftColumnNumber( WULong columnNumber );
  183.  
  184.         // LiveEditMode
  185.  
  186.         WBool GetLiveEditMode() const;
  187.         WBool SetLiveEditMode( WBool liveEditMode=TRUE );
  188.  
  189.         // LiveScrollMode
  190.  
  191.         WBool GetLiveScrollMode() const;
  192.         WBool SetLiveScrollMode( WBool liveScrollMode=TRUE );
  193.  
  194.         // MultipleSelection
  195.  
  196.         WBool SetMultipleSelection( WBool multipleSelection );
  197.         WBool GetMultipleSelection() const;
  198.  
  199.         // ReadOnly
  200.  
  201.         WBool GetReadOnly() const;
  202.         WBool SetReadOnly( WBool readOnly );
  203.  
  204.         // ResizableColumns
  205.  
  206.         WBool SetResizableColumns( WBool resizableColumns );
  207.         WBool GetResizableColumns() const;
  208.  
  209.         // ResizableRows
  210.  
  211.         WBool SetResizableRows( WBool resizableRows );
  212.         WBool GetResizableRows() const;
  213.  
  214.         // RowCount
  215.  
  216.         WULong GetRowCount() const;
  217.         WBool SetRowCount( WULong rowCount=0xFFFFFFFFL );
  218.  
  219.         // SelectedColumnNumber
  220.  
  221.         WULong GetSelectedColumnNumber() const;
  222.         WBool SetSelectedColumnNumber( WULong columnNumber,
  223.                                        WBool repaint=TRUE,
  224.                                        WBool scrollIntoView=TRUE );
  225.  
  226.         // SelectedEndColumnNumber
  227.  
  228.         WULong GetSelectedEndColumnNumber() const;
  229.         WBool SetSelectedEndColumnNumber( WULong columnNumber,
  230.                                           WBool repaint=TRUE );
  231.  
  232.         // SelectedEndRowNumber
  233.  
  234.         WULong GetSelectedEndRowNumber() const;
  235.         WBool SetSelectedEndRowNumber( WULong rowNumber, WBool repaint=TRUE );
  236.  
  237.         // SelectedRowNumber
  238.  
  239.         WULong GetSelectedRowNumber() const;
  240.         WBool SetSelectedRowNumber( WULong rowNumber, WBool repaint=TRUE,
  241.                                     WBool scrollIntoView=TRUE );
  242.  
  243.         // ShowColumnLines
  244.  
  245.         WBool SetShowColumnLines( WBool showColumnLines=TRUE );
  246.         WBool GetShowColumnLines() const;
  247.  
  248.         // ShowRowLines
  249.  
  250.         WBool SetShowRowLines( WBool showRowLines=TRUE );
  251.         WBool GetShowRowLines() const;
  252.  
  253.         // ShowHorizontalHeader
  254.  
  255.         WBool GetShowHorizontalHeader() const;
  256.         WBool SetShowHorizontalHeader( WBool showHorizontalHeader,
  257.                                        WBool repaint=TRUE );
  258.  
  259.         // ShowVerticalHeader
  260.  
  261.         WBool GetShowVerticalHeader() const;
  262.         WBool SetShowVerticalHeader( WBool showVerticalHeader,
  263.                                      WBool repaint=TRUE );
  264.  
  265.         // TopRowNumber
  266.  
  267.         WULong GetTopRowNumber() const;
  268.         WBool SetTopRowNumber( WULong rowNumber );
  269.  
  270.         // UseTabs
  271.  
  272.         WBool SetUseTabs( WBool useTabs );
  273.         WBool GetUseTabs() const;
  274.  
  275.         // VerticalHeaderWidth
  276.  
  277.         WBool SetVerticalHeaderWidth( WShort headerWidth );
  278.         WShort GetVerticalHeaderWidth() const;
  279.  
  280.         // VisibleColumnCount
  281.  
  282.         WULong GetVisibleColumnCount() const;
  283.  
  284.         // VisibleRowCount
  285.  
  286.         WULong GetVisibleRowCount() const;
  287.  
  288.         // DataTrackRow
  289.  
  290.         WBool GetDataTrackRow() const;
  291.         WBool SetDataTrackRow( WBool trackRow );
  292.  
  293.         /**************************************************************
  294.          * Item Properties
  295.          **************************************************************/
  296.  
  297.         // ColumnTitle
  298.  
  299.         WBool SetColumnTitle( WULong columnNumber,
  300.                               const WString & columnTitle,
  301.                               WBool repaint=FALSE );
  302.         WString GetColumnTitle( WULong columnNumber ) const;
  303.  
  304.         // ColumnWidth
  305.  
  306.         WBool SetColumnWidth( WULong columnNumber, WInt columnWidth );
  307.         WInt GetColumnWidth( WULong columnNumber ) const;
  308.  
  309.         // ReadOnly
  310.  
  311.         WBool SetReadOnly( WULong rowNumber, WULong columnNumber,
  312.                            WBool readOnly );
  313.         WBool SetReadOnly( WULong columnNumber, WBool readOnly );
  314.         WBool GetReadOnly( WULong rowNumber, WULong columnNumber ) const;
  315.         WBool GetReadOnly( WULong columnNumber ) const;
  316.  
  317.         // Rectangle
  318.  
  319.         WRect GetRectangle( WULong rowNumber, WULong columnNumber );
  320.  
  321.         // RowTitle
  322.  
  323.         WBool SetRowTitle( WULong rowNumber, const WString & rowTitle,
  324.                            WBool repaint=FALSE );
  325.         WString GetRowTitle( WULong rowNumber ) const;
  326.  
  327.         // RowHeight
  328.  
  329.         WBool SetRowHeight( WULong rowNumber, WInt rowHeight );
  330.         WInt GetRowHeight( WULong rowNumber ) const;
  331.  
  332.         // Text
  333.  
  334.         WBool SetText( WULong rowNumber, WULong columnNumber,
  335.                        const WString & text, WBool createIfDoesntExist=TRUE,
  336.                        WBool repaint=TRUE );
  337.         WString GetText( WULong rowNumber, WULong columnNumber ) const;
  338.  
  339.         // UserData
  340.  
  341.         WBool SetUserData( WULong rowNumber, WULong columnNumber,
  342.                            void * userData );
  343.         void * GetUserData( WULong rowNumber, WULong columnNumber ) const;
  344.  
  345.         /**************************************************************
  346.          * Methods
  347.          **************************************************************/
  348.  
  349.         // AddRow
  350.  
  351.         WBool AddRow( WULong rowNumber=0xFFFFFFFFL );
  352.  
  353.         // CreateComboBoxEditor
  354.  
  355.         WGridComboBox * CreateComboBoxEditor( WBool set=TRUE );
  356.  
  357.         // CreateMaskedTextBoxEditor
  358.  
  359.         WGridMaskedTextBox * CreateMaskedTextBoxEditor( WBool set=TRUE );
  360.  
  361.         // CreateTextBoxEditor
  362.  
  363.         WGridTextBox * CreateTextBoxEditor( WBool set=TRUE );
  364.  
  365.         // DeleteAllRows
  366.  
  367.         WBool DeleteAllRows();
  368.  
  369.         // DeleteRow
  370.  
  371.         WBool DeleteRow( WULong rowNumber );
  372.  
  373.         // EnsureRowIsVisible
  374.  
  375.         WBool EnsureRowIsVisible( WULong rowNumber );
  376.  
  377.         // Retrieve
  378.  
  379.         WBool Retrieve( const WPoint & point, WULong & rowNumber,
  380.                         WULong & columnNumber );
  381.  
  382.         /**************************************************************
  383.          * Overrides
  384.          **************************************************************/
  385.  
  386.         virtual WString GetText() const;
  387.  
  388.         virtual WBool SetText( const WString & text );
  389.  
  390.         virtual WStyle GetDefaultStyle() const;
  391.  
  392.         virtual WULong GetDialogCode( WUInt wParam = 0, WLong lParam = 0 );
  393.  
  394.         virtual WRect GetRectangle( WBool absolute=FALSE ) const;
  395.  
  396.         virtual WBool MakeWindow( WWindow * parent, WUInt id,
  397.                                   const WChar *className, const WChar *title,
  398.                                   const WRect & r, WStyle wstyle,
  399.                                   WStyle exStyle, void * data=NULL );
  400.  
  401.         virtual WBool LoadWindow( WWindow * parent, const WResourceID & id,
  402.                                   WModuleHandle module=_ApplicationModule );
  403.         
  404.         virtual WBool CloneWindow( WStyle newStyle, WStyle newExStyle,
  405.                                    void * data=NULL );
  406.  
  407.         /**************************************************************
  408.          * Event Handlers
  409.          **************************************************************/
  410.     
  411.         WBool DataAvailableHandler( WGrid * source, WDataAvailableEventData * ev );
  412.         WBool DataCloseHandler( WGrid * source, WDataCloseEventData * event );
  413.         WBool DataGuardRowHandler( WGrid * source, WDataGuardRowEventData * ev );
  414.         WBool DataOpenHandler( WGrid * source, WDataOpenEventData * event );
  415.         WBool DataRequestHandler( WGrid * source, WDataRequestEventData * );
  416.         WBool EraseBackgroundEvent( WGrid * source, WPaintEventData * event );
  417.         WBool GetCursorEvent( WGrid * source, WGetCursorEventData * event );
  418.         WBool KeyDownEvent( WGrid * source, WKeyPressEventData * event );
  419.         WBool LeftButtonDownEvent( WGrid * source, WMouseEventData * event );
  420.         WBool LeftButtonUpEvent( WGrid * source, WMouseEventData * event );
  421.         WBool MouseMoveEvent( WGrid * source, WMouseEventData * event );
  422.         WBool PaintEvent( WGrid * source, WPaintEventData * event );
  423.         WBool ResizeEvent( WGrid * source, WResizeEventData * event );
  424.         WBool ScrollEvent( WGrid * source, WScrollBarEventData * event );
  425.         WBool TextBoxCharacterPressEvent( WWindow * source, WCharacterPressEventData * event );
  426.         WBool TextBoxKeyDownEvent( WWindow * source, WKeyPressEventData * event );
  427.         WBool TextBoxLeftButtonUpEvent( WGrid * source, WMouseEventData * event );
  428.         WBool LeftButtonDoubleEvent( WGrid * source, WMouseEventData * event );
  429.  
  430.         /**************************************************************
  431.          * Others
  432.          **************************************************************/
  433.     
  434.         WBool ChangeVerticalHeaderSize( WULong oldSize, WULong newSize,
  435.                                         WULong columnNumber );
  436.         WBool ChangeHorizontalHeaderSize( WULong oldSize, WULong newSize,
  437.                                           WULong rowNumber );
  438.         WBool SetSelected( WULong rowNumber, WULong columnNumber,
  439.                            WBool repaint=TRUE, WBool scrollIntoView=TRUE );
  440.     private:
  441.         WBool ShowTextBox();
  442.         WBool HideTextBox();
  443.         WBool HandleRefreshRow( WLong reason, WLong currentRow,
  444.                                 WULong count );
  445.         WBool AddDataRow( WULong row, WULong rowNumber=0xFFFFFFFFL );
  446.         void RenumberDataRows();
  447.         WULong FindDataRow( WULong dbrow, WLong itemCount=0xFFFFFFFFL );
  448.         WBool IndirectUserData( WBool indirect );
  449.         void * GetRealUserData( WULong rowNumber, WULong columnNumber ) const;
  450.         WBool SetRealUserData( WULong rowNumber, WULong columnNumber,
  451.                                void * userData );
  452.         WBool GetNonEmptyRowRange( WULong & startRowNumber,
  453.                                    WULong & endRowNumber ) const;
  454.         WULong GetNonEmptyRowCount() const;
  455.         WBool ResetColumnGap();
  456.         WBool ResetRowGap();
  457.         WBool IsSizing( const WPoint & point, WBool * vertical );
  458.         WBool DrawSizingLine( WBool vertical, WULong rowNumber,
  459.                               WULong columnNumber, WPoint * currPoint=NULL,
  460.                               WBool eraseOnly=FALSE );
  461.         WBool SelectiveInvalidate( WULong oldTopRowNum, WULong oldLeftColNum,
  462.                                    WULong oldSelEndRowNum,
  463.                                    WULong oldSelEndColNum );
  464.         WBool AllocDTTable();
  465.         void UpdateExtents( WInt count );
  466.         WBool UpdateHorizontalScrollbars();
  467.         WBool UpdateVerticalScrollbars();
  468.  
  469.     protected:
  470.         WBool doDataTargetScroll();
  471.  
  472.         /**************************************************************
  473.          * Data Members
  474.          **************************************************************/
  475.  
  476.     private:
  477.         WGridData                 _data;
  478.         WWindow *                 _editor;
  479.         WShort                    _headerHeight;
  480.         WShort                    _headerWidth;
  481.         WULong                    _selectedRowNum;
  482.         WULong                    _selectedColNum;
  483.         WRect                     _sizingRect;
  484.         WULong                    _sizingNumber;
  485.         WPoint                    _sizingPos;
  486.         WULong                    _rowCount;
  487.         WULong                    _colCount;
  488.         WULong                    _selectedEndRowNum;
  489.         WULong                    _selectedEndColNum;
  490.         WULong                    _rowGap;
  491.         WULong                    _colGap;
  492.         WDataTargetTable *        _dataTargetTable;
  493.         WLong                     _addRow;
  494.         WLong                     _lastScrollPos;
  495.         WLong                     _scrollUp;
  496.         WLong                     _scrollDown;
  497.         // TODO: Put these into flags
  498.         WBool                     _liveEditMode;
  499.         WBool                     _editting;
  500.         WBool                     _showVertHeader;
  501.         WBool                     _showHorzHeader;
  502.         WBool                     _readOnly;
  503.         WBool                     _headerSizing;
  504.         WBool                     _verticalSizing;
  505.         WBool                     _horizontalSizing;
  506.         WBool                     _selecting;
  507.         WBool                     _allowVertSizing;
  508.         WBool                     _allowHorzSizing;
  509.         WBool                     _fullRowSelect;
  510.         WBool                     _rowLines;
  511.         WBool                     _colLines;
  512.         WBool                     _useTabs;
  513.         WBool                     _multiSelect;
  514.         WBool                     _dataFilling;
  515.         WBool                     _wasPainting;
  516.         WBool                     _ignoreItemChanged;
  517.         WBool                     _indirectUserData;
  518.         WBool                     _ignoreDataAvailableMove;
  519.         WBool                     _scrolling;
  520.         WLong                     _dataGuardRowOffset;
  521.         WBool                     _liveScrollMode;
  522.         WBool                     _buttonDown;
  523. };
  524.  
  525. #pragma warning 849 1
  526.  
  527. #endif
  528.