📄 iwwebgrid.pas
字号:
{***************************************************************************}
{ TMS IntraWeb Component Pack Pro }
{ for Delphi & C++Builder }
{ version 2.2 }
{ }
{ written by TMS Software }
{ copyright ?2002 - 2004 }
{ Email : info@tmssoftware.com }
{ Web : http://www.tmssoftware.com }
{ }
{ The source code is given as is. The author is not responsible }
{ for any possible damage done due to the use of this code. }
{ The component can be freely used in any application. The complete }
{ source code remains property of the author and may not be distributed, }
{ published, given or sold in any form as such. No parts of the source }
{ code can be included in any other component or application without }
{ written authorization of the author. }
{***************************************************************************}
unit IWWebGrid;
{$I TMSDEFS.INC}
interface
{$R tmsiwgrid.res}
{$R tmsiwgridjs.res}
{$R tmsiwgridcal.res}
uses
{$IFDEF LINUX}
QControls, QGraphics, QIWPicCntnr, QImgList, IWJPEG,
{$ELSE}
Controls, Windows, Graphics, IWPicCntnr, IWTMSImg, JPEG,
{$ENDIF}
{$IFDEF DELPHI6_LVL}
Types,
{$ENDIF}
Classes,
IWControl, IWTypes, SysUtils, IWTMSBase, IWExtCtrls, IWHTMLTag,
IWFont, IWGlobal
{$IFDEF TMSIW51}
, IWColor
{$ENDIF}
{$IFDEF FREEWARE}
{$IFDEF TMSIW51}
, IWKlooch
{$ELSE}
{$IFNDEF DELPHI7_LVL}
, IWKlooch
{$ENDIF}
{$ENDIF}
{$ENDIF}
{$IFDEF TMSIW6}
, IWRenderContext
{$ENDIF}
;
{$IFDEF FREEWARE}
const
FWNOTICE = 'TMS IntraWeb Grid Components evaluation';
{$ENDIF}
type
TTIWCustomWebGrid = class;
TTIWWebGridColumns = class;
TTIWWidthType = (wtNone, wtAbsolute, wtPercent);
TTIWGridState = (gsInsert, gsEdit, gsBrowse);
TTIWColumnType = (ctNormal, ctCheckbox, ctButton, ctRowIndicator, ctRowNumber,
ctScroll, ctPopup, ctLinkField, ctLinkRowNumber, ctDataCheckbox, ctImage,
ctDataImage, ctURL, ctEmail, ctDataButton, ctRadioButton, ctDynEdit,
ctDynText, ctDynCombo, ctDynCheckBox, ctNode, ctProgress, ctPopupImage,
ctImageCheckBox, ctDataImageCheckBox, ctNoWrap);
TTIWDynEditType = (deText, deUnsigned, deSigned, deFloatUnsigned,
deFloatSigned);
TTIWFooterType = (ftText, ftPageSum, ftPageMin, ftPageMax, ftPageAvg, ftNone,
ftDynSum, ftDynMin, ftDynMax, ftDynAvg);
TTIWMouseSelect = (msNone, msSingleCell, msRow, msRowCheck, msSingleRowCheck, msMove, msClient, msEdit);
TTIWDetailRowShow = (dsNormal, dsOneOpen, dsAllOpen, dsServerOpen, dsServerOneOpen);
TTIWGridDateFormat = (gdEU, gdUS);
TIWRGColumnHeaderClick = procedure(Sender: TObject; ColumnIndex: Integer) of
object;
TIWRGButtonClick = procedure(Sender: TObject; RowIndex, ColumnIndex: Integer)
of object;
TIWRGCellDataEvent = procedure(Sender: TObject; RowIndex, ColumnIndex:
Integer; var AValue: string) of object;
TIWRGCellValueEvent = procedure(Sender: TObject; RowIndex, ColumnIndex:
Integer; AValue: string) of object;
TIWRGDetailGridEvent = procedure(Sender: TObject; RowIndex: Integer;
var AGrid: TTIWCustomWebGrid) of object;
TIWRGCellPropEvent = procedure(Sender: TObject; RowIndex, ColumnIndex:
Integer; AValue: string;
var AColor: TIWColor; var AAlignment: TAlignment; Font: TIWFont) of object;
TTIWRGImageIndexEvent = procedure(Sender: TObject; RowIndex, ColumnIndex:
Integer;
var AValue: integer) of object;
TTIWColumnEditor = (edNone, edEdit, edPassword, edCombo, edMemo, edCheckbox,
edEditNumeric, edEditFloat,
edEditLower, edEditUpper, edEditHex, edDatePicker, edSpinEdit, edPopupEdit);
TTIWPageEvent = procedure(Sender: TObject; Page: Integer) of object;
TTIWRowEvent = procedure(Sender: TObject; Row: Integer) of object;
TTIWCellAllowEvent = procedure(Sender: TObject; RowIndex, ColumnIndex: Integer;
var Allow: Boolean) of object;
TTIWBeforeLinkEvent = procedure(Sender: TObject; RowIndex, ColumnIndex:
Integer; var Allow: Boolean) of object;
TTIWAfterLinkEvent = procedure(Sender: TObject; RowIndex, ColumnIndex: Integer) of object;
TTIWFilterEvent = procedure(Sender: TObject; ColumnIndex: Integer; FilterValue: string) of object;
TTIWPostValidateEvent = procedure(Sender: TObject; PostData: TStringList; var Allow: Boolean) of object;
TTIWGetDynText = procedure(Sender: TObject; RowIndex, ColumnIndex: Integer; var
AValue: string) of object;
TTIWDirectEditUpdate = procedure(Sender: TObject; ACol,ARow: Integer; var Value: string; var Allow: Boolean) of object;
TTIWVAlign = (vaNone, vaTop, vaBottom, vaMiddle);
TTIWGradientDirection = (gdHorizontal, gdVertical);
TInnerBorders = (ibAll, ibRows, ibColumns, ibNone);
TOuterBorders = (obAll, obVertical, obHorizontal, obNone);
TCollapse = (coCollapse, coSeperate);
TTIWRGBorders = class(TPersistent)
private
FOwner: TTIWCustomWebGrid;
FInner: TInnerBorders;
FOuter: TOuterBorders;
FWidth: Integer;
FColor: TIWColor;
FSpacing: Integer;
FPadding: Integer;
FColorLight: TIWColor;
FColorDark: TIWColor;
FCollapsed: Boolean;
procedure SetInner(const Value: TInnerBorders);
procedure SetOuter(const Value: TOuterBorders);
procedure SetWidth(const Value: Integer);
procedure SeTIWColor(const Value: TIWColor);
procedure SetPadding(const Value: Integer);
procedure SetSpacing(const Value: Integer);
procedure SeTIWColorDark(const Value: TIWColor);
procedure SeTIWColorLight(const Value: TIWColor);
procedure SetCollapsed(const Value: Boolean);
public
constructor Create(AOwner: TTIWCustomWebGrid);
published
property Inner: TInnerBorders read FInner write SetInner;
property Outer: TOuterBorders read FOuter write SetOuter;
property Padding: Integer read FPadding write SetPadding;
property Spacing: Integer read FSpacing write SetSpacing;
property Width: Integer read FWidth write SetWidth;
property Collapsed: Boolean read FCollapsed write SetCollapsed;
property Color: TIWColor read FColor write SeTIWColor;
property ColorDark: TIWColor read FColorDark write SeTIWColorDark;
property ColorLight: TIWColor read FColorLight write SeTIWColorLight;
end;
TTIWScroll = (scNever, scAlways, scAuto);
TTIWHeaderStyle = (hsFlat, hsRaised);
TTIWWebGridOuterBorder = class(TPersistent)
private
FShow: Boolean;
FColor: TIWColor;
protected
public
published
property Show: Boolean read FShow write FShow;
property Color: TIWColor read FColor write FColor;
end;
TTIWWebGridScroll = class(TPersistent)
private
FStyle: TTIWScroll;
FOnChange: TNotifyEvent;
FPersistent: Boolean;
FScrollbar3DLightColor: TIWColor;
FScrollbarArrowColor: TIWColor;
FScrollbarBaseColor: TIWColor;
FScrollbarTrackColor: TIWColor;
FScrollbarDarkshadowColor: TIWColor;
FScrollbarFaceColor: TIWColor;
FScrollbarHighlightColor: TIWColor;
FScrollbarShadowColor: TIWColor;
procedure SetStyle(const Value: TTIWScroll);
protected
procedure Changed;
public
constructor Create;
published
property Style: TTIWScroll read FStyle write SetStyle;
property Persistent: Boolean read FPersistent write FPersistent default true;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
property Scrollbar3DLightColor: TIWColor read FScrollbar3DLightColor write FScrollbar3DLightColor;
property ScrollbarArrowColor: TIWColor read FScrollbarArrowColor write FScrollbarArrowColor;
property ScrollbarBaseColor: TIWColor read FScrollbarBaseColor write FScrollbarBaseColor;
property ScrollbarTrackColor: TIWColor read FScrollbarTrackColor write FScrollbarTrackColor;
property ScrollbarDarkshadowColor: TIWColor read FScrollbarDarkshadowColor write FScrollbarDarkshadowColor;
property ScrollbarFaceColor: TIWColor read FScrollbarFaceColor write FScrollbarFaceColor;
property ScrollbarHighlightColor: TIWColor read FScrollbarHighlightColor write FScrollbarHighlightColor;
property ScrollbarShadowColor: TIWColor read FScrollbarShadowColor write FScrollbarShadowColor;
end;
TTIWDataButtonType = (dbtButton, dbtImage, dbtLink);
TTIWWebGridRowHeader = class(TPersistent)
private
FShowRowHeader: Boolean;
FRowHeaderWidth: Integer;
FRowHeaderColor: TIWColor;
FRowHeaderGradient1: TIWColor;
FRowHeaderGradient2: TIWColor;
FRowHeaderGradientDirection: TTIWGradientDirection;
FRowHeaderBorders: TTIWRGBorders;
protected
// procedure Changed;
public
constructor Create(AOwner: TTIWCustomWebGrid);
destructor Destroy; override;
published
property Show: Boolean read FShowRowHeader write FShowRowHeader;
property Width: Integer read FRowHeaderWidth write FRowHeaderWidth;
property Borders: TTIWRGBorders read FRowHeaderBorders write FRowHeaderBorders;
property Color: TIWColor read FRowHeaderColor write FRowHeaderColor;
property Gradient1: TIWColor read FRowHeaderGradient1 write FRowHeaderGradient1;
property Gradient2: TIWColor read FRowHeaderGradient2 write FRowHeaderGradient2;
property GradientDirection: TTIWGradientDirection read FRowHeaderGradientDirection write FRowHeaderGradientDirection;
// property OnChange: TNotifyEvent read FOnChange write FOnChange;
end;
TTIWWebGridColumn = class(TCollectionItem)
private
FCalcValue: Double;
FOwner: TTIWWebGridColumns;
FTemplate: string;
FWidth: integer;
FTitle: string;
FColor: TIWColor;
FColumnHeaderColor: TIWColor;
FWidthType: TTIWWidthType;
FAlignment: TAlignment;
FColumnType: TTIWColumnType;
FButtonText: string;
FColumnHeaderClick: boolean;
FColumnHeaderAlignment: TAlignment;
FFont: TIWFont;
FColumnHeaderFont: TIWFont;
FPopupWidth: Integer;
FPopupColor: TIWColor;
FPopupColorTo: TIWColor;
FPopupColorGradientDirection: TTIWGradientDirection;
FImageHeight: Integer;
FImageWidth: Integer;
FShowHint: Boolean;
FEditor: TTIWColumnEditor;
FComboItems: TStringList;
FComboValues: TStringList;
FAllowSizing: Boolean;
FFooterText: string;
FFooterType: TTIWFooterType;
FFooterAlignment: TAlignment;
FTag: Integer;
FFooterFormat: string;
FImageIndex: Integer;
FColumnHeaderGradient1: TIWColor;
FColumnHeaderGradient2: TIWColor;
FFooterGradient1: TIWColor;
FFooterGradient2: TIWColor;
FFilter: Boolean;
FFilterList: TStringList;
FFilterIndex: Integer;
FFormula: string;
FDynPrecision: Integer;
FTitleSpan: Integer;
FSubTitleSpan: Integer;
FSubTitle: string;
FName: string;
FCheckTrue: string;
FCheckFalse: string;
FColumnHeaderCheckBox: Boolean;
FDynEditor: TTIWDynEditType;
FClickConfirm: string;
FHint: string;
FRequiredMsg: string;
FMaxLength: Integer;
FGradientDirection: TTIWGradientDirection;
FVisible: Boolean;
FTitleRowSpan: Boolean;
FSubTitleVAlign: TTIWVAlign;
FTitleVAlign: TTIWValign;
FVAlign: TTIWVAlign;
FDetailSpan: Integer;
FDetailTemplate: string;
FDetailColor: TIWColor;
FColumnHeaderNode: Boolean;
FProgressColor: TIWColor;
FPopupHeight: Integer;
FButtonWidth: integer;
FButtonColor: TIWColor;
FDataButtonType: TTIWDataButtonType;
FDefaultDynEdit: string;
FDefaultDynText: string;
FSpinEditMaxValue: Integer;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -