// Borland C++ Builder
// Copyright (c) 1995, 1999 by Borland International
// All rights reserved

// (DO NOT EDIT: machine generated header) 'dbadvgrd.pas' rev: 5.00

#ifndef dbadvgrdHPP
#define dbadvgrdHPP

#pragma delphiheader begin
#pragma option push -w-
#pragma option push -Vx
#include <Dialogs.hpp>	// Pascal unit
#include <AdvObj.hpp>	// Pascal unit
#include <AdvGrid.hpp>	// Pascal unit
#include <BaseGrid.hpp>	// Pascal unit
#include <Graphics.hpp>	// Pascal unit
#include <Db.hpp>	// Pascal unit
#include <Grids.hpp>	// Pascal unit
#include <Controls.hpp>	// Pascal unit
#include <Classes.hpp>	// Pascal unit
#include <Messages.hpp>	// Pascal unit
#include <SysUtils.hpp>	// Pascal unit
#include <Windows.hpp>	// Pascal unit
#include <SysInit.hpp>	// Pascal unit
#include <System.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, const System::TVarRec 
		* 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, const System::TVarRec * 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, const System::TVarRec 
		* 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
		, const System::TVarRec * 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;
	void __fastcall SetFieldName(const AnsiString value);
	void __fastcall SetTitle(const AnsiString value);
	HIDESBASE void __fastcall Changed(void);
	
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 AnsiString FieldName = {read=FFieldName, write=SetFieldName};
	__property AnsiString Title = {read=FTitle, write=SetTitle};
};


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 DataSetScrolled(int distance);
	virtual void __fastcall RecordChanged(Db::TField* Field);
	void __fastcall BeforeRecordDeleted(Db::TDataSet* DataSet);
	void __fastcall AfterRecordDeleted(Db::TDataSet* DataSet);
	
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;
	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;
	bool FDeleting;
	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);
	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::TWMKey &Msg);
	void __fastcall StoreColWidths(void);
	void __fastcall ReStoreColWidths(void);
	void __fastcall SetShowIndicator(const bool Value);
	
protected:
	void __fastcall ClearAll(void);
	virtual void __fastcall Loaded(void);
	virtual bool __fastcall SelectCell(int ACol, int ARow);
	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 Windows::TRect &ARect, Grids::TGridDrawState 
		AState);
	virtual void __fastcall Notification(Classes::TComponent* AComponent, Classes::TOperation Operation
		);
	
public:
	__fastcall virtual TDBAdvStringGrid(Classes::TComponent* AOwner);
	__fastcall virtual ~TDBAdvStringGrid(void);
	virtual int __fastcall GetVersionNr(void);
	virtual AnsiString __fastcall GetVersionString();
	void __fastcall LoadFromDataSource(void);
	
__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 TStringGridFields* Fields = {read=FStringGridFields, write=SetStringGridFields};
	__property bool PageMode = {read=FPageMode, write=SetPageMode, nodefault};
	__property Classes::TStringList* HTMLTemplate = {read=FHTMLTemplate, write=SetHTMLTemplate};
	__property bool ShowMemoFields = {read=FShowMemoFields, write=FShowMemoFields, nodefault};
	__property bool ShowPictureFields = {read=FShowPictureFields, write=FShowPictureFields, nodefault};
		
	__property bool ShowBooleanFields = {read=FShowBooleanFields, write=FShowBooleanFields, nodefault};
		
	__property bool ShowIndicator = {read=FShowIndicator, write=SetShowIndicator, nodefault};
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;
	
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};
	DYNAMIC Classes::TPersistent* __fastcall GetOwner(void);
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;

}	/* namespace Dbadvgrd */
#if !defined(NO_IMPLICIT_NAMESPACE_USE)
using namespace Dbadvgrd;
#endif
#pragma option pop	// -w-
#pragma option pop	// -Vx

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