home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1999 March
/
Chip_1999-03_cd.bin
/
zkuste
/
delphi
/
D12
/
MRO.ZIP
/
TADBMRO.INT
< prev
next >
Wrap
Text File
|
1996-05-06
|
11KB
|
294 lines
{$I TADBMRO.INC}
{*********************************************************}
{* TADBMRO.PAS 2.00 *}
{* Copyright (c) Tamarack Associates 1995, 1996. *}
{* All rights reserved. *}
{*********************************************************}
UNIT taDBMRO;
INTERFACE
USES
{$IFDEF WIN32}
Windows,
{$ELSE}
WinTypes, WinProcs,
{$ENDIF}
SysUtils, Messages, Classes, Graphics, Controls, Buttons,
Forms, Dialogs, DBConsts, DBTables, DB, Grids, DBGrids,
{$IFDEF UseInfoPower}
wwDBigrd, wwDBGrid, wwTable, wwDatSrc,
{$ENDIF}
{$IFDEF UseTwwDBLookupCombo}
wwDBLook,
{$ENDIF}
{$IFDEF UseTwwDBLookupComboDlg}
wwDBDlg,
{$ENDIF}
{$IFDEF UseOrpheus}
OvcBase, OvcEF, OvcMisc,
{$ENDIF}
{$IFDEF UseTOvcDBSimpleField}
OvcSF, OvcDbSf,
{$ENDIF}
{$IFDEF UseTOvcDBPictureField}
OvcPB, OvcPF, OvcDbPf,
{$ENDIF}
{$IFDEF UseTOvcDBNumericField}
OvcNF, OvcDbNf,
{$ENDIF}
{$IFDEF UseTDBComboBoxPlus}
DBLUP1B,
{$ENDIF}
{$IFDEF UseTDBLookupComboPlus}
DBLUP2,
{$ENDIF}
{$IFDEF UseDBLookup}
DBLookup,
{$ENDIF}
StdCtrls, Mask, DBCtrls, ExtCtrls;
TYPE
TMROFlag = (mroAutoCursor,mroMouseClick,mroBtnWidth);
TMROFlags = SET OF TMROFlag;
TMRODrawEvent = PROCEDURE (Sender : TObject ; Control : TControl ;
CONST CellRect : TRect) OF OBJECT;
TMROPrepareEvent = PROCEDURE (Sender : TObject ; Control : TControl ;
VAR S : STRING) OF OBJECT;
{$IFDEF UseInfoPower}
TtaDBMRO = CLASS(TwwDBGrid)
{$ELSE}
TtaDBMRO = CLASS(TDBGrid)
{$ENDIF}
PRIVATE
FAutoHeight : BOOLEAN;
FAutoTitleHeight : BOOLEAN;
FAutoWidth : BOOLEAN;
FBackgroundColor : TColor;
FBorderWidth : INTEGER;
FBrush95 : TBitmap;
FBtnWidth : INTEGER;
FChangeLock : WORD;
FCheckBox : TBitmap;
FCheckBox3D : TBitmap;
FFontList : TList;
FDither95 : BOOLEAN;
FFlags : TMROFlags;
FHHeight : INTEGER;
FHWidth : INTEGER;
FIgnoreFocusChange : BOOLEAN;
{$IFDEF WIN32}
FMouseAlreadyUp : BOOLEAN;
{$ENDIF}
FMouseHandle : THandle;
FMousePending : BOOLEAN;
FMousePoint : TPoint;
FOffsetList : TList;
FOnDrawControl : TMRODrawEvent;
FOnDrawBackground : TMRODrawEvent;
FOnPrepareLookup : TMROPrepareEvent;
FRecordPanel : TPanel;
FSaveIdle : TIdleEvent;
FTitlePanel : TPanel;
FUseColor : BOOLEAN;
FUseFont : BOOLEAN;
FVisibleField : INTEGER;
FVHeight : INTEGER;
FVWidth : INTEGER;
FWin95 : INTEGER;
FWin95SB : INTEGER;
PROCEDURE CheckFieldVisibility;
PROCEDURE CMColorChanged(VAR Msg : TMessage) ; MESSAGE CM_COLORCHANGED;
PROCEDURE CMFontChanged(VAR Msg : TMessage); MESSAGE CM_FONTCHANGED;
PROCEDURE CMSysColorChange(VAR Msg : TMessage); MESSAGE CM_SYSCOLORCHANGE;
PROCEDURE CMWinIniChange(VAR Msg : TMessage); MESSAGE CM_WININICHANGE;
FUNCTION GetCheckBoxBitmap(Ctl3D : BOOLEAN) : TBitmap;
FUNCTION IndicatorWidth : INTEGER;
FUNCTION IsPanelChild(Control : TControl) : BOOLEAN;
PROCEDURE SetAutoHeight(Value : BOOLEAN);
PROCEDURE SetAutoWidth(Value : BOOLEAN);
PROCEDURE SetBackgroundColor(Value : TColor);
PROCEDURE SetBorderStyle(Value : TBorderStyle);
FUNCTION GetBorderStyle : TBorderStyle;
{$IFDEF UseInfoPower}
PROCEDURE SetDataSource(Value : TwwDataSource);
FUNCTION GetDataSource : TwwDataSource;
PROCEDURE SetOptions(Value : TwwDBGridOptions);
FUNCTION GetOptions : TwwDBGridOptions;
{$ELSE}
PROCEDURE SetDataSource(Value : TDataSource);
FUNCTION GetDataSource : TDataSource;
PROCEDURE SetOptions(Value : TDBGridOptions);
FUNCTION GetOptions : TDBGridOptions;
{$ENDIF}
PROCEDURE SetRecordPanel(Value : TPanel);
PROCEDURE SetTitlePanel(Value : TPanel);
PROCEDURE SetUseColor(Value : BOOLEAN);
PROCEDURE SetUseFont(Value : BOOLEAN);
PROCEDURE WMPaint(VAR Msg : TWMPaint) ; MESSAGE WM_PAINT;
PROCEDURE WMSize(VAR Msg : TMessage) ; MESSAGE WM_SIZE;
PROTECTED
{$IFDEF UseInfoPower}
PROCEDURE CalcRowHeight ; OVERRIDE;
{$ELSE}
{$IFDEF WIN32}
PROCEDURE SetColumnAttributes ; OVERRIDE;
{$ELSE}
PROCEDURE DefineFieldMap ; OVERRIDE;
{$ENDIF}
{$ENDIF}
PROCEDURE MouseDown(Button : TMouseButton ; Shift : TShiftState ;
X, Y: Integer) ; OVERRIDE;
PROCEDURE MouseMove(Shift : TShiftState ;
X, Y: Integer) ; OVERRIDE;
PROCEDURE MouseUp(Button : TMouseButton ; Shift : TShiftState ;
X, Y: Integer) ; OVERRIDE;
PROCEDURE MemPaintHandler(VAR Msg : TWMPaint);
PUBLIC
CONSTRUCTOR Create(AOwner : TComponent) ; OVERRIDE;
DESTRUCTOR Destroy ; OVERRIDE;
PROCEDURE ApplicationIdle(Sender : TObject ; VAR Done : BOOLEAN);
PROCEDURE DrawBorder(Style : TBorderStyle ; Ctl3D,TwoTone : BOOLEAN ;
FieldRect : TRect); VIRTUAL;
PROCEDURE DrawControl(Control : TControl ; CONST CellRect : TRect); VIRTUAL;
PROCEDURE DrawDataCell(CONST Rect : TRect ; Field : TField;
State : TGridDrawState); OVERRIDE;
PROCEDURE DrawDropDownArrow(R : TRect ; BtnWidth : INTEGER ;
DeepShadow,IsComboBox,Enabled,UseDots,DnArrow : BOOLEAN ;
BorderStyle : TBorderStyle);
PROCEDURE DrawString(Alignment : TAlignment ; Color : TColor ; Enabled : BOOLEAN ;
Font : TFont ; OffsetX,OffsetY : INTEGER ; Rect : TRect ;
CONST S : STRING); VIRTUAL;
PROCEDURE DrawScrollBar(R : TRect ; ScrollStyle : TScrollStyle ;
XPos,XVis,YPos,YVis : DOUBLE);
{* These procs providing drawing support for their respective controls *}
PROCEDURE DrawBevel(Control : TBevel ;
CONST CellRect : TRect) ; VIRTUAL;
PROCEDURE DrawGroupBox(Control : TGroupBox ;
CONST CellRect : TRect) ; VIRTUAL;
PROCEDURE DrawLabel(Control : TLabel ;
CONST CellRect : TRect) ; VIRTUAL;
PROCEDURE DrawPanel(Control : TPanel ;
CONST CellRect : TRect) ; VIRTUAL;
PROCEDURE DrawRadioButton(Control : TRadioButton ; CONST CellRect : TRect ;
IsChecked : BOOLEAN) ; VIRTUAL;
PROCEDURE DrawDBCheckBox(Control : TDBCheckBox ;
CONST CellRect : TRect) ; VIRTUAL;
PROCEDURE DrawDBComboBox(Control : TDBComboBox ;
CONST CellRect : TRect) ; VIRTUAL;
PROCEDURE DrawDBEdit(Control : TDBEdit ;
CONST CellRect : TRect) ; VIRTUAL;
PROCEDURE DrawDBImage(Control : TDBImage ;
CONST CellRect : TRect) ; VIRTUAL;
PROCEDURE DrawDBListBox(Control : TDBListBox ;
CONST CellRect : TRect) ; VIRTUAL;
{$IFDEF UseTDBLookupComboBox}
PROCEDURE DrawDBLookupComboBox(Control : TDBLookupComboBox ;
CONST CellRect : TRect) ; VIRTUAL;
{$ENDIF}
{$IFDEF UseTDBLookupListBox}
PROCEDURE DrawDBLookupListBox(Control : TDBLookupListBox ;
CONST CellRect : TRect) ; VIRTUAL;
{$ENDIF}
{$IFDEF UseDBLookup}
PROCEDURE DrawDBLookupList(Control : TDBLookupList ;
CONST CellRect : TRect) ; VIRTUAL;
PROCEDURE DrawDBLookupCombo(Control : TDBLookupCombo ;
CONST CellRect : TRect) ; VIRTUAL;
{$ENDIF}
PROCEDURE DrawDBMemo(Control : TDBMemo ;
CONST CellRect : TRect) ; VIRTUAL;
PROCEDURE DrawDBRadioGroup(Control : TDBRadioGroup ;
CONST CellRect : TRect) ; VIRTUAL;
{$IFDEF UseTDBComboBoxPlus}
PROCEDURE DrawDBComboBoxPlus(Control : TDBComboBoxPlus ;
CONST CellRect : TRect) ; VIRTUAL;
{$ENDIF}
{$IFDEF UseTDBLookupComboPlus}
PROCEDURE DrawDBLookupComboPlus(Control : TDBLookupComboPlus ;
CONST CellRect : TRect) ; VIRTUAL;
{$ENDIF}
{$IFDEF UseOrpheus}
PROCEDURE DrawOrpheusText(BorderStyle : TBorderStyle ; Color : TColor ;
Font : TFont ; MaxLength : INTEGER ; Rect : TRect ;
Ctl3D,Enabled,Numeric : BOOLEAN ; Alignment : TAlignment ;
VAR S : STRING) ; VIRTUAL;
{$ENDIF}
{$IFDEF UseTOvcDBNumericField}
PROCEDURE DrawOvcDBNumericField(Control : TOvcDBNumericField ;
CONST CellRect : TRect) ; VIRTUAL;
{$ENDIF}
{$IFDEF UseTOvcDBPictureField}
PROCEDURE DrawOvcDBPictureField(Control : TOvcDBPictureField ;
CONST CellRect : TRect) ; VIRTUAL;
{$ENDIF}
{$IFDEF UseTOvcDBSimpleField}
PROCEDURE DrawOvcDBSimpleField(Control : TOvcDBSimpleField ;
CONST CellRect : TRect) ; VIRTUAL;
{$ENDIF}
PROCEDURE DrawDBText(Control : TDBText ;
CONST CellRect : TRect) ; VIRTUAL;
{$IFDEF UseTwwDBLookupCombo}
PROCEDURE DrawwwDBCustomLookupCombo(Control : TwwDBCustomLookupCombo ;
CONST CellRect : TRect) ; VIRTUAL;
{$ENDIF}
FUNCTION FetchColor(Value : TColor) : TColor;
FUNCTION FetchFont(Value : TFont) : TFont;
FUNCTION GetFontOffset(AFont : TFont) : INTEGER;
PROCEDURE FieldOnExit(ActiveControl,TestControl,GotoControl : TWinControl;
GotoNext : BOOLEAN);
PROCEDURE FormKeyDown(Sender : TObject ; VAR Key : Word ; Shift : TShiftState);
PROCEDURE FormKeyDownExt(Sender : TObject ; VAR Key : Word ; Shift : TShiftState);
PROCEDURE Housekeeping;
PROCEDURE MonitorFocus(WinMsg : WORD);
PROCEDURE Notification(AComponent : TComponent ;
Operation : TOperation) ; OVERRIDE;
PUBLISHED
PROPERTY AutoHeight : BOOLEAN READ FAutoHeight WRITE SetAutoHeight DEFAULT TRUE;
PROPERTY AutoWidth : BOOLEAN READ FAutoWidth WRITE SetAutoWidth DEFAULT TRUE;
PROPERTY AutoTitleHeight : BOOLEAN
READ FAutoTitleHeight WRITE FAutoTitleHeight DEFAULT TRUE;
PROPERTY BackgroundColor : TColor
READ FBackgroundColor WRITE SetBackgroundColor DEFAULT clBtnFace;
PROPERTY BorderStyle : TBorderStyle
READ GetBorderStyle WRITE SetBorderStyle DEFAULT bsSingle;
{$IFDEF UseInfoPower}
PROPERTY DataSource : TwwDataSource READ GetDataSource WRITE SetDataSource;
{$ELSE}
PROPERTY DataSource : TDataSource READ GetDataSource WRITE SetDataSource;
{$ENDIF}
PROPERTY DefaultDrawing DEFAULT FALSE;
PROPERTY Flags : TMROFlags READ FFlags WRITE FFlags
DEFAULT [mroAutoCursor,mroMouseClick,mroBtnWidth];
PROPERTY OnDrawControl : TMRODrawEvent READ FOnDrawControl WRITE FOnDrawControl;
PROPERTY OnDrawBackground : TMRODrawEvent
READ FOnDrawBackground WRITE FOnDrawBackground;
PROPERTY OnPrepareLookup : TMROPrepareEvent
READ FOnPrepareLookup WRITE FOnPrepareLookup;
{$IFDEF UseInfoPower}
PROPERTY Options : TwwDBGridOptions
{$ELSE}
PROPERTY Options : TDBGridOptions
{$ENDIF}
READ GetOptions WRITE SetOptions
DEFAULT [dgEditing,dgConfirmDelete,dgCancelOnExit];
PROPERTY RecordPanel : TPanel READ FRecordPanel WRITE SetRecordPanel;
PROPERTY TabStop DEFAULT FALSE;
PROPERTY TitlePanel : TPanel READ FTitlePanel WRITE SetTitlePanel;
PROPERTY UseColor : BOOLEAN READ FUseColor WRITE SetUseColor DEFAULT TRUE;
PROPERTY UseFont : BOOLEAN READ FUseFont WRITE SetUseFont DEFAULT TRUE;
END;
FUNCTION CalcRect(Control : TControl ; CONST CellRect : TRect) : TRect;
{$IFDEF WIN32}
{$R MRO32.RES}
{$ELSE}
{$R MRO16.RES}
{$ENDIF}
IMPLEMENTATION