// Borland C++ Builder
// Copyright (c) 1995, 2005 by Borland Software Corporation
// All rights reserved

// (DO NOT EDIT: machine generated header) 'Dbadvgrd.pas' rev: 10.00

#ifndef DbadvgrdHPP
#define DbadvgrdHPP

#pragma delphiheader begin
#pragma option push
#pragma option -w-      // All warnings off
#pragma option -Vx      // Zero-length empty class member functions
#pragma pack(push,8)
#include <System.hpp>	// Pascal unit
#include <Sysinit.hpp>	// Pascal unit
#include <Windows.hpp>	// Pascal unit
#include <Sysutils.hpp>	// Pascal unit
#include <Messages.hpp>	// Pascal unit
#include <Classes.hpp>	// Pascal unit
#include <Controls.hpp>	// Pascal unit
#include <Grids.hpp>	// Pascal unit
#include <Db.hpp>	// Pascal unit
#include <Graphics.hpp>	// Pascal unit
#include <Basegrid.hpp>	// Pascal unit
#include <Advgrid.hpp>	// Pascal unit
#include <Advobj.hpp>	// Pascal unit
#include <Dialogs.hpp>	// Pascal unit
#include <Dbconsts.hpp>	// Pascal unit
#include <Dbctrls.hpp>	// Pascal unit

//-- user supplied -----------------------------------------------------------

namespace Dbadvgrd
{
//-- type declarations -------------------------------------------------------
class DELPHICLASS EDBAdvGridError;
class PASCALIMPLEMENTATION EDBAdvGridError : public Sysutils::Exception 
{
	typedef Sysutils::Exception inherited;
	
public:
	#pragma option push -w-inl
	/* Exception.Create */ inline __fastcall EDBAdvGridError(const AnsiString Msg) : Sysutils::Exception(Msg) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateFmt */ inline __fastcall EDBAdvGridError(const AnsiString Msg, System::TVarRec const * Args, const int Args_Size) : Sysutils::Exception(Msg, Args, Args_Size) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateRes */ inline __fastcall EDBAdvGridError(int Ident)/* overload */ : Sysutils::Exception(Ident) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateResFmt */ inline __fastcall EDBAdvGridError(int Ident, System::TVarRec const * Args, const int Args_Size)/* overload */ : Sysutils::Exception(Ident, Args, Args_Size) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateHelp */ inline __fastcall EDBAdvGridError(const AnsiString Msg, int AHelpContext) : Sysutils::Exception(Msg, AHelpContext) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateFmtHelp */ inline __fastcall EDBAdvGridError(const AnsiString Msg, System::TVarRec const * Args, const int Args_Size, int AHelpContext) : Sysutils::Exception(Msg, Args, Args_Size, AHelpContext) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateResHelp */ inline __fastcall EDBAdvGridError(int Ident, int AHelpContext)/* overload */ : Sysutils::Exception(Ident, AHelpContext) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateResFmtHelp */ inline __fastcall EDBAdvGridError(System::PResStringRec ResStringRec, System::TVarRec const * Args, const int Args_Size, int AHelpContext)/* overload */ : Sysutils::Exception(ResStringRec, Args, Args_Size, AHelpContext) { }
	#pragma option pop
	
public:
	#pragma option push -w-inl
	/* TObject.Destroy */ inline __fastcall virtual ~EDBAdvGridError(void) { }
	#pragma option pop
	
};


class DELPHICLASS TStringGridField;
class PASCALIMPLEMENTATION TStringGridField : public Classes::TCollectionItem 
{
	typedef Classes::TCollectionItem inherited;
	
private:
	AnsiString FFieldName;
	AnsiString FTitle;
	Graphics::TColor FColor;
	Graphics::TFont* FFont;
	bool FReadOnly;
	Classes::TAlignment FAlignment;
	bool FShowBands;
	Basegrid::TEditorType FEditor;
	AnsiString FEditMask;
	int FTag;
	Classes::TStringList* FComboItems;
	int FSpinMax;
	int FSpinStep;
	int FSpinMin;
	Advgrid::TEditLink* FEditLink;
	void __fastcall SetFieldName(const AnsiString value);
	void __fastcall SetTitle(const AnsiString value);
	HIDESBASE void __fastcall Changed(void);
	void __fastcall SetColor(const Graphics::TColor Value);
	void __fastcall SetFont(const Graphics::TFont* Value);
	void __fastcall FontChanged(System::TObject* Sender);
	void __fastcall SetAlignment(const Classes::TAlignment Value);
	void __fastcall SetShowBands(const bool Value);
	void __fastcall SetComboItems(const Classes::TStringList* Value);
	
protected:
	virtual AnsiString __fastcall GetDisplayName();
	
public:
	__fastcall virtual TStringGridField(Classes::TCollection* Collection);
	__fastcall virtual ~TStringGridField(void);
	virtual void __fastcall Assign(Classes::TPersistent* Source);
	
__published:
	__property Classes::TAlignment Alignment = {read=FAlignment, write=SetAlignment, nodefault};
	__property Graphics::TColor Color = {read=FColor, write=SetColor, nodefault};
	__property Classes::TStringList* ComboItems = {read=FComboItems, write=SetComboItems};
	__property Advgrid::TEditLink* EditLink = {read=FEditLink, write=FEditLink};
	__property AnsiString EditMask = {read=FEditMask, write=FEditMask};
	__property Basegrid::TEditorType Editor = {read=FEditor, write=FEditor, nodefault};
	__property AnsiString FieldName = {read=FFieldName, write=SetFieldName};
	__property Graphics::TFont* Font = {read=FFont, write=SetFont};
	__property AnsiString Title = {read=FTitle, write=SetTitle};
	__property bool ReadOnly = {read=FReadOnly, write=FReadOnly, nodefault};
	__property bool ShowBands = {read=FShowBands, write=SetShowBands, nodefault};
	__property int SpinMin = {read=FSpinMin, write=FSpinMin, nodefault};
	__property int SpinMax = {read=FSpinMax, write=FSpinMax, nodefault};
	__property int SpinStep = {read=FSpinStep, write=FSpinStep, nodefault};
	__property int Tag = {read=FTag, write=FTag, nodefault};
};


class DELPHICLASS TStringGridFields;
class DELPHICLASS TDBAdvStringGrid;
class DELPHICLASS TAdvGridDataLink;
class PASCALIMPLEMENTATION TAdvGridDataLink : public Db::TDataLink 
{
	typedef Db::TDataLink inherited;
	
private:
	TDBAdvStringGrid* FGrid;
	
protected:
	virtual void __fastcall ActiveChanged(void);
	virtual void __fastcall DataSetChanged(void);
	virtual void __fastcall LayoutChanged(void);
	virtual void __fastcall DataSetScrolled(int distance);
	virtual void __fastcall RecordChanged(Db::TField* Field);
	
public:
	__fastcall TAdvGridDataLink(TDBAdvStringGrid* AGrid);
	__fastcall virtual ~TAdvGridDataLink(void);
};


#pragma option push -b-
enum TDataMapMode { dmRow, dmCell };
#pragma option pop

class PASCALIMPLEMENTATION TDBAdvStringGrid : public Advgrid::TAdvStringGrid 
{
	typedef Advgrid::TAdvStringGrid inherited;
	
private:
	int FMapping[256];
	TAdvGridDataLink* FDataLink;
	Db::TDataSetState FOldState;
	Advgrid::TCellGraphic* FCellGraphic;
	TStringGridFields* FStringGridFields;
	bool FCloseWhenLoaded;
	bool FLoaded;
	bool FSelectScroll;
	bool FDataScroll;
	bool FKeepLinked;
	bool FPageMode;
	Classes::TStringList* FHTMLTemplate;
	TDataMapMode FDataMapMode;
	int FMaxRows;
	int FLastRow;
	int FLastCol;
	Advobj::TIntList* FWidths;
	int FFixedColumns;
	bool FShowPictureFields;
	bool FShowMemoFields;
	bool FShowBooleanFields;
	bool FShowIndicator;
	Graphics::TPicture* FPicture;
	bool FDetailGrid;
	AnsiString FCurrCell;
	bool FInsLastRow;
	bool FFieldColMoving;
	Classes::TNotifyEvent FDataLoaded;
	Db::TDataSource* __fastcall GetDataSource(void);
	void __fastcall SetDatasource(Db::TDataSource* Value);
	void __fastcall SetCloseWhenLoaded(bool Value);
	void __fastcall SetStringGridFields(TStringGridFields* value);
	bool __fastcall CheckDataSet(void);
	bool __fastcall CheckDataSetRW(void);
	int __fastcall MaxVisibleRows(void);
	int __fastcall MaxRowsInDataset(void);
	void __fastcall SetBufferCount(void);
	bool __fastcall InitMapping(void);
	void __fastcall SetPageMode(const bool Value);
	void __fastcall SetHTMLTemplate(const Classes::TStringList* Value);
	HIDESBASE MESSAGE void __fastcall WMKeyDown(Messages::TWMKey &Msg);
	HIDESBASE MESSAGE void __fastcall WMVScroll(Messages::TWMScroll &WMScroll);
	HIDESBASE MESSAGE void __fastcall WMSize(Messages::TWMSize &Msg);
	void __fastcall StoreColWidths(void);
	void __fastcall ReStoreColWidths(void);
	void __fastcall SetShowIndicator(const bool Value);
	HIDESBASE int __fastcall GetFixedColsEx(void);
	HIDESBASE void __fastcall SetFixedColsEx(const int Value);
	void __fastcall SetShowBooleanFields(const bool Value);
	void __fastcall SetShowMemoFields(const bool Value);
	void __fastcall SetShowPictureFields(const bool Value);
	MESSAGE void __fastcall CMGetDataLink(Messages::TMessage &Message);
	
protected:
	void __fastcall ClearAll(void);
	virtual void __fastcall UpdateEditingCell(int ACol, int ARow, AnsiString Value);
	virtual void __fastcall PasteInCell(int ACol, int ARow, AnsiString Value);
	virtual AnsiString __fastcall GetCurrentCell();
	virtual void __fastcall SetCurrentCell(const AnsiString AValue);
	virtual bool __fastcall ToggleCheck(int ACol, int ARow, bool FromEdit);
	virtual void __fastcall Loaded(void);
	virtual bool __fastcall SelectCell(int ACol, int ARow);
	virtual void __fastcall RestoreCache(void);
	DYNAMIC void __fastcall KeyUp(Word &Key, Classes::TShiftState Shift);
	void __fastcall SetActive(bool Active);
	void __fastcall ShowFields(void);
	virtual void __fastcall GetCellAlign(int ACol, int ARow, Classes::TAlignment &HAlign, Basegrid::TVAlignment &VAlign);
	DYNAMIC void __fastcall ColumnMoved(int FromIndex, int ToIndex);
	bool __fastcall UpdateDataRow(int ARow);
	bool __fastcall UpdateDataCell(int ACol, int ARow);
	void __fastcall UpdateVisibleCells(void);
	void __fastcall UpdateCursorPos(void);
	void __fastcall UpdateRowCount(void);
	void __fastcall TemplateChanged(System::TObject* Sender);
	virtual void __fastcall DrawCell(int ACol, int ARow, const Types::TRect &ARect, Grids::TGridDrawState AState);
	virtual void __fastcall Notification(Classes::TComponent* AComponent, Classes::TOperation Operation);
	virtual void __fastcall DoInsertRow(int ARow);
	virtual void __fastcall DoDeleteRow(int ARow);
	virtual void __fastcall GetDisplText(int c, int r, AnsiString &Value);
	virtual Advgrid::TCellType __fastcall GetCellType(int ACol, int ARow);
	virtual Advgrid::TCellGraphic* __fastcall GetCellGraphic(int ACol, int ARow);
	virtual void __fastcall GetCellColor(int ACol, int ARow, Grids::TGridDrawState AState, Graphics::TBrush* ABrush, Graphics::TFont* AFont);
	virtual void __fastcall GetCellPrintColor(int ACol, int ARow, Grids::TGridDrawState AState, Graphics::TBrush* ABrush, Graphics::TFont* AFont);
	virtual void __fastcall GetCellEditor(int ACol, int ARow, Basegrid::TEditorType &AEditor);
	DYNAMIC AnsiString __fastcall GetEditMask(int ACol, int ARow);
	Db::TField* __fastcall ColumnField(int Col);
	int __fastcall VisibleFieldCount(void);
	int __fastcall VisibleFieldIndex(int i);
	AnsiString __fastcall GetHTMLTemplate();
	virtual void __fastcall QueryAddRow(bool &AllowAdd);
	virtual void __fastcall QueryInsertRow(int ARow, bool &AllowInsert);
	DYNAMIC AnsiString __fastcall GetEditText(int ACol, int ARow);
	DYNAMIC void __fastcall SetEditText(int ACol, int ARow, const AnsiString Value);
	virtual bool __fastcall CanEditShow(void);
	
public:
	virtual bool __fastcall ValidateCell(const AnsiString NewValue);
	__fastcall virtual TDBAdvStringGrid(Classes::TComponent* AOwner);
	__fastcall virtual ~TDBAdvStringGrid(void);
	virtual int __fastcall GetVersionNr(void);
	virtual AnsiString __fastcall GetVersionString();
	void __fastcall LoadFromDataSource(void);
	virtual void __fastcall CalcFooter(int ACol);
	DYNAMIC bool __fastcall ExecuteAction(Classes::TBasicAction* Action);
	DYNAMIC bool __fastcall UpdateAction(Classes::TBasicAction* Action);
	
__published:
	__property bool CloseWhenLoaded = {read=FCloseWhenLoaded, write=SetCloseWhenLoaded, nodefault};
	__property bool KeepLinked = {read=FKeepLinked, write=FKeepLinked, nodefault};
	__property TDataMapMode DataMapMode = {read=FDataMapMode, write=FDataMapMode, nodefault};
	__property Db::TDataSource* DataSource = {read=GetDataSource, write=SetDatasource};
	__property bool DetailGrid = {read=FDetailGrid, write=FDetailGrid, nodefault};
	__property TStringGridFields* Fields = {read=FStringGridFields, write=SetStringGridFields};
	__property int FixedCols = {read=GetFixedColsEx, write=SetFixedColsEx, nodefault};
	__property bool PageMode = {read=FPageMode, write=SetPageMode, nodefault};
	__property Classes::TStringList* HTMLTemplate = {read=FHTMLTemplate, write=SetHTMLTemplate};
	__property bool ShowMemoFields = {read=FShowMemoFields, write=SetShowMemoFields, nodefault};
	__property bool ShowPictureFields = {read=FShowPictureFields, write=SetShowPictureFields, nodefault};
	__property bool ShowBooleanFields = {read=FShowBooleanFields, write=SetShowBooleanFields, nodefault};
	__property bool ShowIndicator = {read=FShowIndicator, write=SetShowIndicator, nodefault};
	__property Classes::TNotifyEvent OnDataLoaded = {read=FDataLoaded, write=FDataLoaded};
public:
	#pragma option push -w-inl
	/* TWinControl.CreateParented */ inline __fastcall TDBAdvStringGrid(HWND ParentWindow) : Advgrid::TAdvStringGrid(ParentWindow) { }
	#pragma option pop
	
};


class PASCALIMPLEMENTATION TStringGridFields : public Classes::TCollection 
{
	typedef Classes::TCollection inherited;
	
public:
	TStringGridField* operator[](int Index) { return Items[Index]; }
	
private:
	TDBAdvStringGrid* FOwner;
	HIDESBASE TStringGridField* __fastcall GetItem(int Index);
	HIDESBASE void __fastcall SetItem(int Index, const TStringGridField* Value);
	
public:
	__fastcall TStringGridFields(TDBAdvStringGrid* aOwner);
	
protected:
	virtual void __fastcall Update(Classes::TCollectionItem* Item);
	
public:
	HIDESBASE TStringGridField* __fastcall Add(void);
	HIDESBASE TStringGridField* __fastcall Insert(int index);
	__property TStringGridField* Items[int Index] = {read=GetItem, write=SetItem/*, default*/};
	DYNAMIC Classes::TPersistent* __fastcall GetOwner(void);
	TStringGridField* __fastcall FindField(const AnsiString FieldName);
public:
	#pragma option push -w-inl
	/* TCollection.Destroy */ inline __fastcall virtual ~TStringGridFields(void) { }
	#pragma option pop
	
};


//-- var, const, procedure ---------------------------------------------------
static const Byte MAX_FIELDS = 0xff;
static const Shortint MAJ_VER = 0x1;
static const Shortint MIN_VER = 0x7;
static const Shortint REL_VER = 0x0;
static const Shortint BLD_VER = 0xe;
#define DATE_VER "October, 2004"

}	/* namespace Dbadvgrd */
using namespace Dbadvgrd;
#pragma pack(pop)
#pragma option pop

#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif	// Dbadvgrd
