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