cxgridbandedtableview.pas

来自「胜天进销存源码,国产优秀的进销存」· PAS 代码 · 共 1,455 行 · 第 1/5 页

PAS
1,455
字号
    procedure RefreshVisibleItemsList;
    property VisibleItemsList: TList read FVisibleItems;
    property Width: Integer read GetWidth;
  public
    constructor Create(ABandRows: TcxGridBandRows);
    destructor Destroy; override;
    procedure ApplyBestFit(ACheckSizingAbility: Boolean = False; AFireEvents: Boolean = False);
    procedure Delete(AIndex: Integer);
    function IndexOf(AColumn: TcxGridBandedColumn): Integer;
    procedure Insert(AIndex: Integer; AColumn: TcxGridBandedColumn);
    procedure Move(ACurIndex, ANewIndex: Integer);

    property BandRows: TcxGridBandRows read FBandRows;
    property Count: Integer read GetCount;
    property Index: Integer read GetIndex;
    property IsFirst: Boolean read GetIsFirst;
    property IsLast: Boolean read GetIsLast;
    property Items[Index: Integer]: TcxGridBandedColumn read GetItem; default;
    property LineCount: Integer read GetLineCount;
    property LineOffset: Integer read GetLineOffset;
    property Visible: Boolean read GetVisible;
    property VisibleCount: Integer read GetVisibleCount;
    property VisibleIndex: Integer read GetVisibleIndex;
    property VisibleItems[Index: Integer]: TcxGridBandedColumn read GetVisibleItem;
  end;

  TcxGridBandRows = class
  private
    FBand: TcxGridBand;
    FItems: TList;
    FVisibleItems: TList;
    function GetCount: Integer;
    function GetFirstVisible: TcxGridBandRow;
    function GetGridView: TcxGridBandedTableView;
    function GetItem(Index: Integer): TcxGridBandRow;
    function GetLastVisible: TcxGridBandRow;
    function GetLineCount: Integer;
    function GetVisibleCount: Integer;
    function GetVisibleItem(Index: Integer): TcxGridBandRow;
    function GetWidth: Integer;
    procedure SetCount(Value: Integer);
    procedure RemoveItem(ARow: TcxGridBandRow);
  protected
    procedure RefreshVisibleItemsList;
    property GridView: TcxGridBandedTableView read GetGridView;
    property Width: Integer read GetWidth;
  public
    constructor Create(ABand: TcxGridBand); virtual;
    destructor Destroy; override;
    procedure ApplyBestFit(ACheckSizingAbility: Boolean = False; AFireEvents: Boolean = False);
    function GetLineIndex(ARowIndex: Integer): Integer;
    function GetRowIndex(ALineIndex: Integer): Integer;
    function Insert(AIndex: Integer): TcxGridBandRow;
    procedure MoveColumn(AColumn: TcxGridBandedColumn; ARowIndex, AColIndex: Integer);

    property Band: TcxGridBand read FBand;
    property Count: Integer read GetCount write SetCount;
    property FirstVisible: TcxGridBandRow read GetFirstVisible;
    property Items[Index: Integer]: TcxGridBandRow read GetItem; default;
    property LastVisible: TcxGridBandRow read GetLastVisible;
    property LineCount: Integer read GetLineCount;
    property VisibleCount: Integer read GetVisibleCount;
    property VisibleItems[Index: Integer]: TcxGridBandRow read GetVisibleItem;
  end;

  TcxGridBandChange = (bcProperty, bcLayout, bcSize);

  TcxGridBandCustomOptions = class(TPersistent)
  private
    FBand: TcxGridBand;
  protected
    procedure Changed(AChange: TcxGridBandChange); virtual;
  public
    constructor Create(ABand: TcxGridBand); virtual;
    procedure Assign(Source: TPersistent); override;
    property Band: TcxGridBand read FBand;
  end;  

  TcxGridBandOptionsClass = class of TcxGridBandOptions;

  TcxGridBandOptions = class(TcxGridBandCustomOptions)
  private
    FHoldOwnColumnsOnly: Boolean;
    FMoving: Boolean;
    FSizing: Boolean;
    procedure SetHoldOwnColumnsOnly(Value: Boolean);
    procedure SetMoving(Value: Boolean);
    procedure SetSizing(Value: Boolean);
  public
    constructor Create(ABand: TcxGridBand); override;
    procedure Assign(Source: TPersistent); override;
  published
    property HoldOwnColumnsOnly: Boolean read FHoldOwnColumnsOnly write SetHoldOwnColumnsOnly default False;
    property Moving: Boolean read FMoving write SetMoving default True;
    property Sizing: Boolean read FSizing write SetSizing default True;
  end;

  TcxGridBandPosition = class(TcxGridBandCustomOptions)
  private
    FBandIndex: Integer;
    FColIndex: Integer;
    function GetBandIndex: Integer;
    function GetColIndex: Integer;
    function GetGridView: TcxGridBandedTableView;
    function GetParentBand: TcxGridBand;
    function GetVisibleColIndex: Integer;
    procedure SetBandIndex(Value: Integer);
    procedure SetColIndex(Value: Integer);
    function IsColIndexStored: Boolean;
  protected
    function CheckBandIndex(var Value: Integer): Boolean;
    procedure SaveParams;
  public
    constructor Create(ABand: TcxGridBand); override;
    procedure Assign(Source: TPersistent); override;
    property GridView: TcxGridBandedTableView read GetGridView;
    property ParentBand: TcxGridBand read GetParentBand;
    property VisibleColIndex: Integer read GetVisibleColIndex;
  published
    property BandIndex: Integer read GetBandIndex write SetBandIndex default -1;
    property ColIndex: Integer read GetColIndex write SetColIndex stored IsColIndexStored;
  end;

  TcxGridBandGetHeaderStyle = procedure(Sender: TcxGridBandedTableView; ABand: TcxGridBand;
    {$IFDEF BCB}var{$ELSE}out{$ENDIF} AStyle: TcxStyle) of object;

  TcxGridBandStylesClass = class of TcxGridBandStyles;

  TcxGridBandStyles = class(TcxCustomGridStyles)
  private
    FOnGetHeaderStyle: TcxGridBandGetHeaderStyle;
    function GetBand: TcxGridBand;
    function GetGridViewValue: TcxGridBandedTableView;
    procedure SetOnGetHeaderStyle(Value: TcxGridBandGetHeaderStyle);
  protected
    procedure GetDefaultViewParams(Index: Integer; AData: TObject; out AParams: TcxViewParams); override;
    function GetGridView: TcxCustomGridView; override;
  public
    procedure Assign(Source: TPersistent); override;
    procedure GetHeaderParams(out AParams: TcxViewParams); virtual;
    property Band: TcxGridBand read GetBand;
    property GridView: TcxGridBandedTableView read GetGridViewValue;
  published
    property Background: TcxStyle index bsBackground read GetValue write SetValue;
    property Content: TcxStyle index bsContent read GetValue write SetValue;
    property Header: TcxStyle index bsHeader read GetValue write SetValue;
    property OnGetHeaderStyle: TcxGridBandGetHeaderStyle read FOnGetHeaderStyle
      write SetOnGetHeaderStyle;
  end;

  TcxGridBandGetStoredPropertiesEvent = procedure(Sender: TcxGridBand;
    AProperties: TStrings) of object;
  TcxGridBandGetStoredPropertyValueEvent = procedure(Sender: TcxGridBand;
    const AName: string; var AValue: Variant) of object;
  TcxGridBandSetStoredPropertyValueEvent = procedure(Sender: TcxGridBand;
    const AName: string; const AValue: Variant) of object;

  TcxGridBandClass = class of TcxGridBand;

  TcxGridBand = class(TCollectionItem, {$IFNDEF DELPHI6}IUnknown,{$ENDIF} IcxStoredObject)
  private
    FCaption: string;
    FChildBands: TList;
    FColumns: TList;
    FFixedKind: TcxGridBandFixedKind;
    FHeaderAlignmentHorz: TAlignment;
    FHeaderAlignmentVert: TcxAlignmentVert;
    FID: Integer;
    FIgnoreLoadingStatus: Boolean;
    FIsDestroying: Boolean;
    FOptions: TcxGridBandOptions;
    FParentBand: TcxGridBand;
    FPosition: TcxGridBandPosition;
    FRows: TcxGridBandRows;
    FSavedVisible: Boolean;
    FStyles: TcxGridBandStyles;
    FTag: TcxTag;
    FVisible: Boolean;
    FVisibleChildBands: TList;
    FVisibleForCustomization: Boolean;
    FWidth: Integer;
    FSubClassEvents: TNotifyEvent;
    FOnHeaderClick: TNotifyEvent;
    FOnGetStoredProperties: TcxGridBandGetStoredPropertiesEvent;
    FOnGetStoredPropertyValue: TcxGridBandGetStoredPropertyValueEvent;
    FOnSetStoredPropertyValue: TcxGridBandSetStoredPropertyValueEvent;
    function GetBandLevelIndex: Integer;
    function GetBands: TcxGridBands;
    function GetChildBand(Index: Integer): TcxGridBand;
    function GetChildBandCount: Integer;
    function GetChildItem(Index: Integer): TObject;
    function GetChildItemCount: Integer;
    function GetChildItemVisible(Index: Integer): Boolean;
    function GetColumnCount: Integer;
    function GetColumn(Index: Integer): TcxGridBandedColumn;
    function GetFirstChildBottomBand: TcxGridBand;
    function GetFirstVisibleChildBottomBand: TcxGridBand;
    function GetGridView: TcxGridBandedTableView;
    function GetHidden: Boolean;
    function GetIsBottom: Boolean;
    function GetIsEmpty: Boolean;
    function GetIsFirst: Boolean;
    function GetIsFirstNonEmpty: Boolean;
    function GetIsLast: Boolean;
    function GetIsLastAsChild: Boolean;
    function GetIsLastNonEmpty: Boolean;
    function GetIsLoading: Boolean;
    function GetIsMostRight: Boolean;
    function GetIsRoot: Boolean;
    function GetIsUpdating: Boolean;
    function GetIsVisibleBottom: Boolean;
    function GetMinWidth: Integer;
    function GetParentBandWithAssignedWidth: TcxGridBand;
    function GetRootIndex: Integer;
    function GetRootParentBand: TcxGridBand;
    function GetVisibleBandLevelCount: Integer;
    function GetVisibleBottomIndex: Integer;
    function GetVisibleChildBand(Index: Integer): TcxGridBand;
    function GetVisibleChildBandCount: Integer;
    function GetVisibleIndex: Integer;
    function GetVisibleRootIndex: Integer;
    function IsTagStored: Boolean;
    procedure SetCaption(const Value: string);
    procedure SetFixedKind(Value: TcxGridBandFixedKind);
    procedure SetHeaderAlignmentHorz(Value: TAlignment);
    procedure SetHeaderAlignmentVert(Value: TcxAlignmentVert);
    procedure SetHidden(Value: Boolean);
    procedure SetOnHeaderClick(Value: TNotifyEvent);
    procedure SetOnGetStoredProperties(Value: TcxGridBandGetStoredPropertiesEvent);
    procedure SetOnGetStoredPropertyValue(Value: TcxGridBandGetStoredPropertyValueEvent);
    procedure SetOnSetStoredPropertyValue(Value: TcxGridBandSetStoredPropertyValueEvent);
    procedure SetOptions(Value: TcxGridBandOptions);
    procedure SetPosition(Value: TcxGridBandPosition);
    procedure SetRootIndex(Value: Integer);
    procedure SetStyles(Value: TcxGridBandStyles);
    procedure SetTag(Value: TcxTag);
    procedure SetVisible(Value: Boolean);
    procedure SetVisibleForCustomization(Value: Boolean);
    procedure SetWidth(Value: Integer);

    procedure ReadHidden(Reader: TReader);

    procedure AddBand(ABand: TcxGridBand);
    procedure RemoveBand(ABand: TcxGridBand);
    procedure RefreshVisibleChildBandsList;

    procedure AddColumn(AColumn: TcxGridBandedColumn);
    procedure RemoveColumn(AColumn: TcxGridBandedColumn);
  protected
    procedure DefineProperties(Filer: TFiler); override;

    // IInterface
    function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
    function _AddRef: Integer; stdcall;
    function _Release: Integer; stdcall;
    // IcxStoredObject
    function GetObjectName: string; virtual;
    function GetProperties(AProperties: TStrings): Boolean; virtual;
    procedure GetPropertyValue(const AName: string; var AValue: Variant); virtual;
    procedure SetPropertyValue(const AName: string; const AValue: Variant); virtual;

    procedure AssignChildBandWidths;
    procedure AssignColumnWidths;
    function CanHide: Boolean; virtual;
    function CanMove: Boolean; virtual;
    function CanSize: Boolean; virtual;
    procedure Changed(AChange: TcxGridBandChange); virtual;
    procedure ForceWidth(Value: Integer); virtual;
    function GetActuallyVisible: Boolean; virtual;
    function GetDisplayName: string; override;
    function GetFixed: Boolean; virtual;
    function GetParentInParent(ABand: TcxGridBand): TcxGridBand;
    function HasFixedWidth: Boolean; virtual;
    function HasParentWithAssignedWidth: Boolean;
    function ColIndexOf(ABand: TcxGridBand): Integer; overload;
    procedure MoveBandsToRoot;
    procedure SetIndex(Value: Integer); override;
    function VisibleColIndexOf(ABand: TcxGridBand): Integer; overload;
    procedure VisibleForCustomizationChanged; virtual;

    procedure CheckChildrenVisibles;
    procedure CheckVisible;
    procedure SaveChildrenVisibles;
    procedure SaveColumnsVisibles;
    procedure SaveVisible;
    property ChildItemCount: Integer read GetChildItemCount;
    property ChildItems[Index: Integer]: TObject read GetChildItem;
    property ChildItemVisibles[Index: Integer]: Boolean read GetChildItemVisible;
    property SavedVisible: Boolean read FSavedVisible;

    function GetO

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?