home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 9 / CDACTUAL9.iso / progs / CB / DATA.Z / GRIDS.HPP < prev    next >
Encoding:
C/C++ Source or Header  |  1996-11-06  |  27.3 KB  |  644 lines

  1. //----------------------------------------------------------------------------
  2. // Grids.hpp - dcc32 generated hdr (DO NOT EDIT) rev: -2
  3. // From: Grids.pas
  4. //----------------------------------------------------------------------------
  5. #ifndef GridsHPP
  6. #define GridsHPP
  7. //----------------------------------------------------------------------------
  8. #ifndef MaskHPP
  9. #include <Mask.hpp>
  10. #endif
  11.  
  12. #ifndef StdCtrlsHPP
  13. #include <StdCtrls.hpp>
  14. #endif
  15.  
  16. #ifndef FormsHPP
  17. #include <Forms.hpp>
  18. #endif
  19.  
  20. #ifndef ControlsHPP
  21. #include <Controls.hpp>
  22. #endif
  23.  
  24. #ifndef MenusHPP
  25. #include <Menus.hpp>
  26. #endif
  27.  
  28. #ifndef GraphicsHPP
  29. #include <Graphics.hpp>
  30. #endif
  31.  
  32. #ifndef ClassesHPP
  33. #include <Classes.hpp>
  34. #endif
  35.  
  36. #ifndef WindowsHPP
  37. #include <Windows.hpp>
  38. #endif
  39.  
  40. #ifndef MessagesHPP
  41. #include <Messages.hpp>
  42. #endif
  43.  
  44. #ifndef SysUtilsHPP
  45. #include <SysUtils.hpp>
  46. #endif
  47.  
  48. #ifndef SystemHPP
  49. #include <System.hpp>
  50. #endif
  51.  
  52. namespace Grids
  53. {
  54. //-- type declarations -------------------------------------------------------
  55. class __declspec(delphiclass) EInvalidGridOperation;
  56. class __declspec(pascalimplementation) EInvalidGridOperation : public Sysutils::Exception
  57. {
  58.     typedef EInvalidGridOperation ThisClass;
  59.     typedef Sysutils::Exception inherited;
  60.     
  61. public:
  62.     /* !! Exception.Create */ __fastcall EInvalidGridOperation(const System::AnsiString Msg) : Sysutils::Exception(
  63.         Msg) { }
  64.     /* !! Exception.CreateFmt */ __fastcall EInvalidGridOperation(const System::AnsiString Msg, const TVarRec 
  65.         *Args, const System::Integer Args_Size) : Sysutils::Exception(Msg, Args, Args_Size) { }
  66.     /* !! Exception.CreateRes */ __fastcall EInvalidGridOperation(System::Integer Ident) : Sysutils::Exception(
  67.         Ident) { }
  68.     /* !! Exception.CreateResFmt */ __fastcall EInvalidGridOperation(System::Integer Ident, const TVarRec 
  69.         *Args, const System::Integer Args_Size) : Sysutils::Exception(Ident, Args, Args_Size) { }
  70.     /* !! Exception.CreateHelp */ __fastcall EInvalidGridOperation(const System::AnsiString Msg, System::Integer 
  71.         AHelpContext) : Sysutils::Exception(Msg, AHelpContext) { }
  72.     /* !! Exception.CreateFmtHelp */ __fastcall EInvalidGridOperation(const System::AnsiString Msg, const 
  73.         TVarRec *Args, const System::Integer Args_Size, System::Integer AHelpContext) : Sysutils::Exception(
  74.         Msg, Args, Args_Size, AHelpContext) { }
  75.     /* !! Exception.CreateResHelp */ __fastcall EInvalidGridOperation(System::Integer Ident, System::Integer 
  76.         AHelpContext) : Sysutils::Exception(Ident, AHelpContext) { }
  77.     /* !! Exception.CreateResFmtHelp */ __fastcall EInvalidGridOperation(System::Integer Ident, const TVarRec 
  78.         *Args, const System::Integer Args_Size, System::Integer AHelpContext) : Sysutils::Exception(Ident, 
  79.         Args, Args_Size, AHelpContext) { }
  80.     
  81. public:
  82.     /* !! TObject.Destroy */ __fastcall virtual ~EInvalidGridOperation(void) { }
  83.     
  84. };
  85.  
  86. typedef System::Integer __fastcall (__closure *TGetExtentsFunc)(System::Longint Index);
  87.  
  88. struct TGridAxisDrawInfo
  89. {
  90.     System::Integer EffectiveLineWidth;
  91.     System::Integer FixedBoundary;
  92.     System::Integer GridBoundary;
  93.     System::Integer GridExtent;
  94.     System::Longint LastFullVisibleCell;
  95.     System::Integer FullVisBoundary;
  96.     System::Integer FixedCellCount;
  97.     System::Integer FirstGridCell;
  98.     System::Integer GridCellCount;
  99.     TGetExtentsFunc GetExtent;
  100. } ;
  101.  
  102. struct TGridDrawInfo
  103. {
  104.     TGridAxisDrawInfo Horz;
  105.     TGridAxisDrawInfo Vert;
  106. } ;
  107.  
  108. enum TGridState { gsNormal, gsSelecting, gsRowSizing, gsColSizing, gsRowMoving, gsColMoving };
  109.  
  110. class __declspec(delphiclass) TInplaceEdit;
  111. class __declspec(delphiclass) TCustomGrid;
  112. struct TGridCoord
  113. {
  114.     System::Longint X;
  115.     System::Longint Y;
  116. } ;
  117.  
  118. enum TGridOption { goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goDrawFocusSelected, 
  119.     goRowSizing, goColSizing, goRowMoving, goColMoving, goEditing, goTabs, goRowSelect, goAlwaysShowEditor, 
  120.     goThumbTracking };
  121.  
  122. typedef Set<TGridOption, goFixedVertLine, goThumbTracking>  TGridOptions;
  123.  
  124. struct TGridRect;
  125. enum Grids_3 { gdSelected, gdFocused, gdFixed };
  126.  
  127. typedef Set<Grids_3, gdSelected, gdFixed>  TGridDrawState;
  128.  
  129. enum Grids_4 { sdLeft, sdRight, sdUp, sdDown };
  130.  
  131. typedef Set<Grids_4, sdLeft, sdDown>  TGridScrollDirection;
  132.  
  133. class __declspec(pascalimplementation) TCustomGrid : public Controls::TCustomControl
  134. {
  135.     typedef TCustomGrid ThisClass;
  136.     typedef Controls::TCustomControl inherited;
  137.     
  138. private:
  139.     TGridCoord FAnchor;
  140.     TFormBorderStyle FBorderStyle;
  141.     System::Boolean FCanEditModify;
  142.     System::Longint FColCount;
  143.     void *FColWidths;
  144.     void *FTabStops;
  145.     TGridCoord FCurrent;
  146.     System::Integer FDefaultColWidth;
  147.     System::Integer FDefaultRowHeight;
  148.     System::Integer FFixedCols;
  149.     System::Integer FFixedRows;
  150.     Graphics::TColor FFixedColor;
  151.     System::Integer FGridLineWidth;
  152.     TGridOptions FOptions;
  153.     System::Longint FRowCount;
  154.     void *FRowHeights;
  155.     TScrollStyle FScrollBars;
  156.     TGridCoord FTopLeft;
  157.     System::Longint FSizingIndex;
  158.     System::Integer FSizingPos;
  159.     System::Integer FSizingOfs;
  160.     System::Longint FMoveIndex;
  161.     System::Longint FMovePos;
  162.     Windows::TPoint FHitTest;
  163.     TInplaceEdit *FInplaceEdit;
  164.     System::Longint FInplaceCol;
  165.     System::Longint FInplaceRow;
  166.     System::Boolean FDefaultDrawing;
  167.     System::Boolean FEditorMode;
  168.     System::Integer FColOffset;
  169.     TGridCoord __fastcall CalcCoordFromPoint(System::Integer X, System::Integer Y, const TGridDrawInfo 
  170.         &DrawInfo);
  171.     void __fastcall CalcDrawInfo(TGridDrawInfo &DrawInfo);
  172.     void __fastcall CalcDrawInfoXY(TGridDrawInfo &DrawInfo, System::Integer UseWidth, System::Integer UseHeight
  173.         );
  174.     void __fastcall CalcFixedInfo(TGridDrawInfo &DrawInfo);
  175.     TGridCoord __fastcall CalcMaxTopLeft(const TGridCoord &Coord, const TGridDrawInfo &DrawInfo);
  176.     void __fastcall CalcSizingState(System::Integer X, System::Integer Y, TGridState &State, System::Longint 
  177.         &Index, System::Integer &SizingPos, System::Integer &SizingOfs, TGridDrawInfo &FixedInfo);
  178.     void __fastcall ChangeSize(System::Longint NewColCount, System::Longint NewRowCount);
  179.     void __fastcall ClampInView(const TGridCoord &Coord);
  180.     void __fastcall DrawSizingLine(const TGridDrawInfo &DrawInfo);
  181.     void __fastcall DrawMove(void);
  182.     void __fastcall FocusCell(System::Longint ACol, System::Longint ARow, System::Boolean MoveAnchor);
  183.     void __fastcall GridRectToScreenRect(const TGridRect &GridRect, Windows::TRect &ScreenRect, System::Boolean 
  184.         IncludeLine);
  185.     void __fastcall HideEdit(void);
  186.     void __fastcall Initialize(void);
  187.     void __fastcall InvalidateGrid(void);
  188.     void __fastcall InvalidateRect(const TGridRect &ARect);
  189.     void __fastcall InvertRect(const Windows::TRect &Rect);
  190.     void __fastcall ModifyScrollBar(System::Cardinal ScrollBar, System::Cardinal ScrollCode, System::Cardinal 
  191.         Pos);
  192.     void __fastcall MoveAdjust(System::Longint &CellPos, System::Longint FromIndex, System::Longint ToIndex
  193.         );
  194.     void __fastcall MoveAnchor(const TGridCoord &NewAnchor);
  195.     void __fastcall MoveAndScroll(System::Integer Mouse, System::Integer CellHit, TGridDrawInfo &DrawInfo
  196.         , TGridAxisDrawInfo &Axis, System::Integer Scrollbar);
  197.     void __fastcall MoveCurrent(System::Longint ACol, System::Longint ARow, System::Boolean MoveAnchor, 
  198.         System::Boolean Show);
  199.     void __fastcall MoveTopLeft(System::Longint ALeft, System::Longint ATop);
  200.     void __fastcall ResizeCol(System::Longint Index, System::Integer OldSize, System::Integer NewSize);
  201.         
  202.     void __fastcall ResizeRow(System::Longint Index, System::Integer OldSize, System::Integer NewSize);
  203.         
  204.     void __fastcall SelectionMoved(const TGridRect &OldSel);
  205.     void __fastcall ScrollDataInfo(System::Integer DX, System::Integer DY, TGridDrawInfo &DrawInfo);
  206.     void __fastcall TopLeftMoved(const TGridCoord &OldTopLeft);
  207.     void __fastcall UpdateScrollPos(void);
  208.     void __fastcall UpdateScrollRange(void);
  209.     System::Integer __fastcall GetColWidths(System::Longint Index);
  210.     System::Integer __fastcall GetRowHeights(System::Longint Index);
  211.     TGridRect __fastcall GetSelection(void);
  212.     System::Boolean __fastcall GetTabStops(System::Longint Index);
  213.     System::Integer __fastcall GetVisibleColCount(void);
  214.     System::Integer __fastcall GetVisibleRowCount(void);
  215.     void __fastcall ReadColWidths(Classes::TReader *Reader);
  216.     void __fastcall ReadRowHeights(Classes::TReader *Reader);
  217.     void __fastcall SetBorderStyle(Forms::TBorderStyle Value);
  218.     void __fastcall SetCol(System::Longint Value);
  219.     void __fastcall SetColCount(System::Longint Value);
  220.     void __fastcall SetColWidths(System::Longint Index, System::Integer Value);
  221.     void __fastcall SetDefaultColWidth(System::Integer Value);
  222.     void __fastcall SetDefaultRowHeight(System::Integer Value);
  223.     void __fastcall SetEditorMode(System::Boolean Value);
  224.     void __fastcall SetFixedColor(Graphics::TColor Value);
  225.     void __fastcall SetFixedCols(System::Integer Value);
  226.     void __fastcall SetFixedRows(System::Integer Value);
  227.     void __fastcall SetGridLineWidth(System::Integer Value);
  228.     void __fastcall SetLeftCol(System::Longint Value);
  229.     void __fastcall SetOptions( TGridOptions Value);
  230.     void __fastcall SetRow(System::Longint Value);
  231.     void __fastcall SetRowCount(System::Longint Value);
  232.     void __fastcall SetRowHeights(System::Longint Index, System::Integer Value);
  233.     void __fastcall SetScrollBars(Stdctrls::TScrollStyle Value);
  234.     void __fastcall SetSelection(const TGridRect &Value);
  235.     void __fastcall SetTabStops(System::Longint Index, System::Boolean Value);
  236.     void __fastcall SetTopRow(System::Longint Value);
  237.     void __fastcall UpdateEdit(void);
  238.     void __fastcall UpdateText(void);
  239.     void __fastcall WriteColWidths(Classes::TWriter *Writer);
  240.     void __fastcall WriteRowHeights(Classes::TWriter *Writer);
  241.     MESSAGE void __fastcall CMCancelMode(Messages::TMessage &Msg);
  242.     MESSAGE void __fastcall CMFontChanged(Messages::TMessage &Message);
  243.     MESSAGE void __fastcall CMCtl3DChanged(Messages::TMessage &Message);
  244.     MESSAGE void __fastcall CMDesignHitTest(Messages::TWMMouse &Msg);
  245.     MESSAGE void __fastcall CMWantSpecialKey(Messages::TWMKey &Msg);
  246.     MESSAGE void __fastcall WMChar(Messages::TWMKey &Msg);
  247.     MESSAGE void __fastcall WMCommand(Messages::TWMCommand &Message);
  248.     MESSAGE void __fastcall WMGetDlgCode(Messages::TWMNoParams &Msg);
  249.     MESSAGE void __fastcall WMHScroll(Messages::TWMScroll &Msg);
  250.     MESSAGE void __fastcall WMKillFocus(Messages::TWMKillFocus &Msg);
  251.     MESSAGE void __fastcall WMLButtonDown(Messages::TMessage &Message);
  252.     MESSAGE void __fastcall WMNCHitTest(Messages::TWMNCHitTest &Msg);
  253.     MESSAGE void __fastcall WMSetCursor(Messages::TWMSetCursor &Msg);
  254.     MESSAGE void __fastcall WMSetFocus(Messages::TWMSetFocus &Msg);
  255.     MESSAGE void __fastcall WMSize(Messages::TWMSize &Msg);
  256.     MESSAGE void __fastcall WMTimer(Messages::TWMTimer &Msg);
  257.     MESSAGE void __fastcall WMVScroll(Messages::TWMScroll &Msg);
  258.     
  259. protected:
  260.     TGridState FGridState;
  261.     System::Boolean FSaveCellExtents;
  262.     virtual TInplaceEdit *__fastcall CreateEditor(void);
  263.     virtual void __fastcall CreateParams(Controls::TCreateParams &Params);
  264.     virtual void __fastcall KeyDown(System::Word &Key,  Classes::TShiftState Shift);
  265.     virtual void __fastcall KeyPress(System::Char &Key);
  266.     virtual void __fastcall MouseDown(Controls::TMouseButton Button,  Classes::TShiftState Shift, System::Integer 
  267.         X, System::Integer Y);
  268.     virtual void __fastcall MouseMove( Classes::TShiftState Shift, System::Integer X, System::Integer Y
  269.         );
  270.     virtual void __fastcall MouseUp(Controls::TMouseButton Button,  Classes::TShiftState Shift, System::Integer 
  271.         X, System::Integer Y);
  272.     virtual void __fastcall AdjustSize(System::Longint Index, System::Longint Amount, System::Boolean Rows
  273.         );
  274.     Windows::TRect __fastcall BoxRect(System::Longint ALeft, System::Longint ATop, System::Longint ARight
  275.         , System::Longint ABottom);
  276.     virtual void __fastcall DoExit(void);
  277.     Windows::TRect __fastcall CellRect(System::Longint ACol, System::Longint ARow);
  278.     virtual System::Boolean __fastcall CanEditAcceptKey(System::Char Key);
  279.     virtual System::Boolean __fastcall CanGridAcceptKey(System::Word Key,  Classes::TShiftState Shift);
  280.         
  281.     virtual System::Boolean __fastcall CanEditModify(void);
  282.     virtual System::Boolean __fastcall CanEditShow(void);
  283.     virtual System::AnsiString __fastcall GetEditText(System::Longint ACol, System::Longint ARow);
  284.     virtual void __fastcall SetEditText(System::Longint ACol, System::Longint ARow, const System::AnsiString 
  285.         Value);
  286.     virtual System::AnsiString __fastcall GetEditMask(System::Longint ACol, System::Longint ARow);
  287.     virtual System::Integer __fastcall GetEditLimit(void);
  288.     System::Integer __fastcall GetGridWidth(void);
  289.     System::Integer __fastcall GetGridHeight(void);
  290.     void __fastcall HideEditor(void);
  291.     void __fastcall ShowEditor(void);
  292.     void __fastcall ShowEditorChar(System::Char Ch);
  293.     void __fastcall InvalidateEditor(void);
  294.     void __fastcall MoveColumn(System::Longint FromIndex, System::Longint ToIndex);
  295.     virtual void __fastcall ColumnMoved(System::Longint FromIndex, System::Longint ToIndex);
  296.     void __fastcall MoveRow(System::Longint FromIndex, System::Longint ToIndex);
  297.     virtual void __fastcall RowMoved(System::Longint FromIndex, System::Longint ToIndex);
  298.     virtual void __fastcall DrawCell(System::Longint ACol, System::Longint ARow, const Windows::TRect &ARect
  299.         ,  TGridDrawState AState) = 0;
  300.     virtual void __fastcall DefineProperties(Classes::TFiler *Filer);
  301.     TGridCoord __fastcall MouseCoord(System::Integer X, System::Integer Y);
  302.     void __fastcall MoveColRow(System::Longint ACol, System::Longint ARow, System::Boolean MoveAnchor, 
  303.         System::Boolean Show);
  304.     virtual System::Boolean __fastcall SelectCell(System::Longint ACol, System::Longint ARow);
  305.     virtual void __fastcall SizeChanged(System::Longint OldColCount, System::Longint OldRowCount);
  306.     System::Boolean __fastcall Sizing(System::Integer X, System::Integer Y);
  307.     void __fastcall ScrollData(System::Integer DX, System::Integer DY);
  308.     void __fastcall InvalidateCell(System::Longint ACol, System::Longint ARow);
  309.     void __fastcall InvalidateCol(System::Longint ACol);
  310.     void __fastcall InvalidateRow(System::Longint ARow);
  311.     virtual void __fastcall TopLeftChanged(void);
  312.     virtual void __fastcall TimedScroll( TGridScrollDirection Direction);
  313.     virtual void __fastcall Paint(void);
  314.     virtual void __fastcall ColWidthsChanged(void);
  315.     virtual void __fastcall RowHeightsChanged(void);
  316.     void __fastcall DeleteColumn(System::Longint ACol);
  317.     void __fastcall DeleteRow(System::Longint ARow);
  318.     void __fastcall UpdateDesigner(void);
  319.     __property Forms::TBorderStyle BorderStyle = {read=FBorderStyle, write=SetBorderStyle, default=1};
  320.     __property System::Longint Col = {read=FCurrent.X, write=SetCol, nodefault};
  321.     __property Color ;
  322.     __property System::Longint ColCount = {read=FColCount, write=SetColCount, default=5};
  323.     __property System::Integer ColWidths[System::Longint Index] = {read=GetColWidths, write=SetColWidths
  324.         };
  325.     __property System::Integer DefaultColWidth = {read=FDefaultColWidth, write=SetDefaultColWidth, default=64
  326.         };
  327.     __property System::Boolean DefaultDrawing = {read=FDefaultDrawing, write=FDefaultDrawing, default=1
  328.         };
  329.     __property System::Integer DefaultRowHeight = {read=FDefaultRowHeight, write=SetDefaultRowHeight, default=24
  330.         };
  331.     __property System::Boolean EditorMode = {read=FEditorMode, write=SetEditorMode, nodefault};
  332.     __property Graphics::TColor FixedColor = {read=FFixedColor, write=SetFixedColor, default=-2147483633
  333.         };
  334.     __property System::Integer FixedCols = {read=FFixedCols, write=SetFixedCols, default=1};
  335.     __property System::Integer FixedRows = {read=FFixedRows, write=SetFixedRows, default=1};
  336.     __property System::Integer GridHeight = {read=GetGridHeight, nodefault};
  337.     __property System::Integer GridLineWidth = {read=FGridLineWidth, write=SetGridLineWidth, default=1}
  338.         ;
  339.     __property System::Integer GridWidth = {read=GetGridWidth, nodefault};
  340.     __property TInplaceEdit * InplaceEditor = {read=FInplaceEdit, nodefault};
  341.     __property System::Longint LeftCol = {read=FTopLeft.X, write=SetLeftCol, nodefault};
  342.     __property TGridOptions Options = {read=FOptions, write=SetOptions, default=31};
  343.     __property ParentColor ;
  344.     __property System::Longint Row = {read=FCurrent.Y, write=SetRow, nodefault};
  345.     __property System::Longint RowCount = {read=FRowCount, write=SetRowCount, default=5};
  346.     __property System::Integer RowHeights[System::Longint Index] = {read=GetRowHeights, write=SetRowHeights
  347.         };
  348.     __property Stdctrls::TScrollStyle ScrollBars = {read=FScrollBars, write=SetScrollBars, default=3};
  349.     __property TGridRect Selection = {read=GetSelection, write=SetSelection};
  350.     __property System::Boolean TabStops[System::Longint Index] = {read=GetTabStops, write=SetTabStops};
  351.         
  352.     __property System::Longint TopRow = {read=FTopLeft.Y, write=SetTopRow, nodefault};
  353.     __property System::Integer VisibleColCount = {read=GetVisibleColCount, nodefault};
  354.     __property System::Integer VisibleRowCount = {read=GetVisibleRowCount, nodefault};
  355.     
  356. public:
  357.     __fastcall virtual TCustomGrid(Classes::TComponent *AOwner);
  358.     __fastcall virtual ~TCustomGrid(void);
  359.     
  360. __published:
  361.     __property TabStop ;
  362. };
  363.  
  364. class __declspec(pascalimplementation) TInplaceEdit : public Mask::TCustomMaskEdit
  365. {
  366.     typedef TInplaceEdit ThisClass;
  367.     typedef Mask::TCustomMaskEdit inherited;
  368.     
  369. private:
  370.     TCustomGrid *FGrid;
  371.     System::Longint FClickTime;
  372.     void __fastcall InternalMove(const Windows::TRect &Loc, System::Boolean Redraw);
  373.     void __fastcall SetGrid(TCustomGrid *Value);
  374.     MESSAGE void __fastcall CMShowingChanged(Messages::TMessage &Message);
  375.     MESSAGE void __fastcall WMGetDlgCode(Messages::TWMNoParams &Message);
  376.     MESSAGE void __fastcall WMPaste(void *Message);
  377.     MESSAGE void __fastcall WMCut(void *Message);
  378.     MESSAGE void __fastcall WMClear(void *Message);
  379.     
  380. protected:
  381.     virtual void __fastcall CreateParams(Controls::TCreateParams &Params);
  382.     virtual void __fastcall DblClick(void);
  383.     virtual System::Boolean __fastcall EditCanModify(void);
  384.     virtual void __fastcall KeyDown(System::Word &Key,  Classes::TShiftState Shift);
  385.     virtual void __fastcall KeyPress(System::Char &Key);
  386.     virtual void __fastcall KeyUp(System::Word &Key,  Classes::TShiftState Shift);
  387.     virtual void __fastcall BoundsChanged(void);
  388.     virtual void __fastcall UpdateContents(void);
  389.     virtual void __fastcall WndProc(Messages::TMessage &Message);
  390.     __property TCustomGrid * Grid = {read=FGrid, nodefault};
  391.     
  392. public:
  393.     __fastcall virtual TInplaceEdit(Classes::TComponent *AOwner);
  394.     void __fastcall Deselect(void);
  395.     void __fastcall Hide(void);
  396.     void __fastcall Invalidate(void);
  397.     void __fastcall Move(const Windows::TRect &Loc);
  398.     System::Boolean __fastcall PosEqual(const Windows::TRect &Rect);
  399.     void __fastcall SetFocus(void);
  400.     void __fastcall UpdateLoc(const Windows::TRect &Loc);
  401.     System::Boolean __fastcall Visible(void);
  402. public:
  403.     /* !! TWinControl.Destroy */ __fastcall virtual ~TInplaceEdit(void) { }
  404.     
  405. };
  406.  
  407. struct TGridRect
  408. {
  409.     
  410.     union
  411.     {
  412.         struct 
  413.         {
  414.             TGridCoord TopLeft;
  415.             TGridCoord BottomRight;
  416.             
  417.         };
  418.         struct 
  419.         {
  420.             System::Longint Left;
  421.             System::Longint Top;
  422.             System::Longint Right;
  423.             System::Longint Bottom;
  424.             
  425.         };
  426.         
  427.     };
  428. } ;
  429.  
  430. typedef void __fastcall (__closure *TSelectCellEvent)(System::TObject *Sender, System::Longint Col, 
  431.     System::Longint Row, System::Boolean &CanSelect);
  432.  
  433. typedef void __fastcall (__closure *TDrawCellEvent)(System::TObject *Sender, System::Longint Col, System::Longint 
  434.     Row, const Windows::TRect &Rect,  TGridDrawState State);
  435.  
  436. typedef void __fastcall (__closure *TGetEditEvent)(System::TObject *Sender, System::Longint ACol, System::Longint 
  437.     ARow,  System::AnsiString &Value);
  438.  
  439. typedef void __fastcall (__closure *TSetEditEvent)(System::TObject *Sender, System::Longint ACol, System::Longint 
  440.     ARow, const System::AnsiString Value);
  441.  
  442. typedef void __fastcall (__closure *TMovedEvent)(System::TObject *Sender, System::Longint FromIndex, 
  443.     System::Longint ToIndex);
  444.  
  445. class __declspec(delphiclass) TDrawGrid;
  446. class __declspec(pascalimplementation) TDrawGrid : public TCustomGrid
  447. {
  448.     typedef TDrawGrid ThisClass;
  449.     typedef TCustomGrid inherited;
  450.     
  451. private:
  452.     TMovedEvent FOnColumnMoved;
  453.     TDrawCellEvent FOnDrawCell;
  454.     TGetEditEvent FOnGetEditMask;
  455.     TGetEditEvent FOnGetEditText;
  456.     TMovedEvent FOnRowMoved;
  457.     TSelectCellEvent FOnSelectCell;
  458.     TSetEditEvent FOnSetEditText;
  459.     Classes::TNotifyEvent FOnTopLeftChanged;
  460.     
  461. protected:
  462.     virtual void __fastcall ColumnMoved(System::Longint FromIndex, System::Longint ToIndex);
  463.     virtual void __fastcall DrawCell(System::Longint ACol, System::Longint ARow, const Windows::TRect &ARect
  464.         ,  TGridDrawState AState);
  465.     virtual System::AnsiString __fastcall GetEditMask(System::Longint ACol, System::Longint ARow);
  466.     virtual System::AnsiString __fastcall GetEditText(System::Longint ACol, System::Longint ARow);
  467.     virtual void __fastcall RowMoved(System::Longint FromIndex, System::Longint ToIndex);
  468.     virtual System::Boolean __fastcall SelectCell(System::Longint ACol, System::Longint ARow);
  469.     virtual void __fastcall SetEditText(System::Longint ACol, System::Longint ARow, const System::AnsiString 
  470.         Value);
  471.     virtual void __fastcall TopLeftChanged(void);
  472.     
  473. public:
  474.     Windows::TRect __fastcall CellRect(System::Longint ACol, System::Longint ARow);
  475.     void __fastcall MouseToCell(System::Integer X, System::Integer Y, System::Longint &ACol, System::Longint 
  476.         &ARow);
  477.     __property Canvas ;
  478.     __property Col ;
  479.     __property ColWidths ;
  480.     __property EditorMode ;
  481.     __property GridHeight ;
  482.     __property GridWidth ;
  483.     __property LeftCol ;
  484.     __property Selection ;
  485.     __property Row ;
  486.     __property RowHeights ;
  487.     __property TabStops ;
  488.     __property TopRow ;
  489.     
  490. __published:
  491.     __property Align ;
  492.     __property BorderStyle ;
  493.     __property Color ;
  494.     __property ColCount ;
  495.     __property Ctl3D ;
  496.     __property DefaultColWidth ;
  497.     __property DefaultRowHeight ;
  498.     __property DefaultDrawing ;
  499.     __property DragCursor ;
  500.     __property DragMode ;
  501.     __property Enabled ;
  502.     __property FixedColor ;
  503.     __property FixedCols ;
  504.     __property RowCount ;
  505.     __property FixedRows ;
  506.     __property Font ;
  507.     __property GridLineWidth ;
  508.     __property Options ;
  509.     __property ParentColor ;
  510.     __property ParentCtl3D ;
  511.     __property ParentFont ;
  512.     __property ParentShowHint ;
  513.     __property PopupMenu ;
  514.     __property ScrollBars ;
  515.     __property ShowHint ;
  516.     __property TabOrder ;
  517.     __property TabStop ;
  518.     __property Visible ;
  519.     __property VisibleColCount ;
  520.     __property VisibleRowCount ;
  521.     __property OnClick ;
  522.     __property TMovedEvent OnColumnMoved = {read=FOnColumnMoved, write=FOnColumnMoved};
  523.     __property OnDblClick ;
  524.     __property OnDragDrop ;
  525.     __property OnDragOver ;
  526.     __property TDrawCellEvent OnDrawCell = {read=FOnDrawCell, write=FOnDrawCell};
  527.     __property OnEndDrag ;
  528.     __property OnEnter ;
  529.     __property OnExit ;
  530.     __property TGetEditEvent OnGetEditMask = {read=FOnGetEditMask, write=FOnGetEditMask};
  531.     __property TGetEditEvent OnGetEditText = {read=FOnGetEditText, write=FOnGetEditText};
  532.     __property OnKeyDown ;
  533.     __property OnKeyPress ;
  534.     __property OnKeyUp ;
  535.     __property OnMouseDown ;
  536.     __property OnMouseMove ;
  537.     __property OnMouseUp ;
  538.     __property TMovedEvent OnRowMoved = {read=FOnRowMoved, write=FOnRowMoved};
  539.     __property TSelectCellEvent OnSelectCell = {read=FOnSelectCell, write=FOnSelectCell};
  540.     __property TSetEditEvent OnSetEditText = {read=FOnSetEditText, write=FOnSetEditText};
  541.     __property OnStartDrag ;
  542.     __property Classes::TNotifyEvent OnTopLeftChanged = {read=FOnTopLeftChanged, write=FOnTopLeftChanged
  543.         };
  544. public:
  545.     /* !! TCustomGrid.Create */ __fastcall virtual TDrawGrid(Classes::TComponent *AOwner) : Grids::TCustomGrid(
  546.         AOwner) { }
  547.     /* !! TCustomGrid.Destroy */ __fastcall virtual ~TDrawGrid(void) { }
  548.     
  549. };
  550.  
  551. class __declspec(delphiclass) TStringGridStrings;
  552. class __declspec(delphiclass) TStringGrid;
  553. class __declspec(pascalimplementation) TStringGrid : public TDrawGrid
  554. {
  555.     typedef TStringGrid ThisClass;
  556.     typedef TDrawGrid inherited;
  557.     
  558. private:
  559.     void *FData;
  560.     void *FRows;
  561.     void *FCols;
  562.     System::Boolean FUpdating;
  563.     System::Boolean FNeedsUpdating;
  564.     System::Integer FEditUpdate;
  565.     void __fastcall DisableEditUpdate(void);
  566.     void __fastcall EnableEditUpdate(void);
  567.     void __fastcall Initialize(void);
  568.     void __fastcall Update(System::Integer ACol, System::Integer ARow);
  569.     void __fastcall SetUpdateState(System::Boolean Updating);
  570.     System::AnsiString __fastcall GetCells(System::Integer ACol, System::Integer ARow);
  571.     Classes::TStrings *__fastcall GetCols(System::Integer Index);
  572.     System::TObject *__fastcall GetObjects(System::Integer ACol, System::Integer ARow);
  573.     Classes::TStrings *__fastcall GetRows(System::Integer Index);
  574.     void __fastcall SetCells(System::Integer ACol, System::Integer ARow, const System::AnsiString Value
  575.         );
  576.     void __fastcall SetCols(System::Integer Index, Classes::TStrings *Value);
  577.     void __fastcall SetObjects(System::Integer ACol, System::Integer ARow, System::TObject *Value);
  578.     void __fastcall SetRows(System::Integer Index, Classes::TStrings *Value);
  579.     TStringGridStrings *__fastcall EnsureColRow(System::Integer Index, System::Boolean IsCol);
  580.     System::Pointer __fastcall EnsureDataRow(System::Integer ARow);
  581.     
  582. protected:
  583.     virtual void __fastcall ColumnMoved(System::Longint FromIndex, System::Longint ToIndex);
  584.     virtual void __fastcall DrawCell(System::Longint ACol, System::Longint ARow, const Windows::TRect &ARect
  585.         ,  TGridDrawState AState);
  586.     virtual System::AnsiString __fastcall GetEditText(System::Longint ACol, System::Longint ARow);
  587.     virtual void __fastcall SetEditText(System::Longint ACol, System::Longint ARow, const System::AnsiString 
  588.         Value);
  589.     virtual void __fastcall RowMoved(System::Longint FromIndex, System::Longint ToIndex);
  590.     
  591. public:
  592.     __fastcall virtual TStringGrid(Classes::TComponent *AOwner);
  593.     __fastcall virtual ~TStringGrid(void);
  594.     __property System::AnsiString Cells[System::Integer ACol][System::Integer ARow] = {read=GetCells, write=
  595.         SetCells};
  596.     __property Classes::TStrings * Cols[System::Integer Index] = {read=GetCols, write=SetCols};
  597.     __property System::TObject * Objects[System::Integer ACol][System::Integer ARow] = {read=GetObjects
  598.         , write=SetObjects};
  599.     __property Classes::TStrings * Rows[System::Integer Index] = {read=GetRows, write=SetRows};
  600. };
  601.  
  602. class __declspec(pascalimplementation) TStringGridStrings : public Classes::TStrings
  603. {
  604.     typedef TStringGridStrings ThisClass;
  605.     typedef Classes::TStrings inherited;
  606.     
  607. private:
  608.     TStringGrid *FGrid;
  609.     System::Integer FIndex;
  610.     void __fastcall CalcXY(System::Integer Index, System::Integer &X, System::Integer &Y);
  611.     
  612. protected:
  613.     virtual void __fastcall Clear(void);
  614.     virtual System::Integer __fastcall Add(const System::AnsiString S);
  615.     virtual System::AnsiString __fastcall Get(System::Integer Index);
  616.     virtual System::Integer __fastcall GetCount(void);
  617.     virtual System::TObject *__fastcall GetObject(System::Integer Index);
  618.     virtual void __fastcall Put(System::Integer Index, const System::AnsiString S);
  619.     virtual void __fastcall PutObject(System::Integer Index, System::TObject *AObject);
  620.     virtual void __fastcall SetUpdateState(System::Boolean Updating);
  621.     
  622. public:
  623.     __fastcall TStringGridStrings(TStringGrid *AGrid, System::Longint AIndex);
  624.     virtual void __fastcall Assign(Classes::TPersistent *Source);
  625. public:
  626.     /* !! TObject.Destroy */ __fastcall virtual ~TStringGridStrings(void) { }
  627.     
  628. };
  629.  
  630. //-- var, const, procedure ---------------------------------------------------
  631. #define MaxCustomExtents System::Integer(134217727)
  632. #define MaxShortInt System::Shortint(127)
  633. //-- template instantiations -------------------------------------------------
  634. template class TGridScrollDirection ;
  635. template class TGridDrawState ;
  636. template class TGridOptions ;
  637.  
  638. }    /* namespace Grids */
  639. #if !defined(NO_IMPLICIT_NAMESPACE_USE)
  640. using namespace Grids;
  641. #endif
  642. //-- end unit ----------------------------------------------------------------
  643. #endif    // Grids
  644.