cxgridchartview.pas

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

PAS
1,502
字号
    procedure CustomizationChanged; override;
    function GetCustomizationFormClass: TcxCustomGridCustomizationFormClass; override;
    function GetCustomizationFormDefaultWidth: Integer; override;
    function GetDataLevelInfoDragAndDropObjectClass: TcxGridChartDataGroupMovingObjectClass; virtual;

    property ViewInfo: TcxGridChartViewInfo read GetViewInfo;
  public
    constructor Create(AGridView: TcxCustomGridView); override;
    destructor Destroy; override;
    function HasDataLevelActiveValuePopup: Boolean;
    function HasDiagramSelectorPopup: Boolean;
    procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;

    procedure InitScrollBarsParameters; override;
    procedure Scroll(AScrollBarKind: TScrollBarKind; AScrollCode: TScrollCode;
      var AScrollPos: Integer); override;

    function GetValueHintText(ASeries: TcxGridChartSeries; AValueIndex: Integer): string; virtual;

    // data drill down
    function DataDrillDown(AValueIndex: Integer): Boolean; virtual;
    function DataDrillUp: Boolean; virtual;
    function IsDataDrillDownPossible(AValueIndex: Integer): Boolean;

    // paging
    function ActiveDiagramSupportsPaging: Boolean;
    property FirstVisibleCategoryIndex: Integer read GetFirstVisibleCategoryIndex write SetFirstVisibleCategoryIndex;
    property VisibleCategoryCount: Integer read GetVisibleCategoryCountValue;

    property CustomizationForm: TcxGridChartCustomizationForm read GetCustomizationForm;
    property DataLevelActiveValuePopup: TcxGridChartDataLevelActiveValuePopup read GetDataLevelActiveValuePopup;
    property DiagramSelectorPopup: TcxGridChartDiagramSelectorPopup read GetDiagramSelectorPopup;
    property GridView: TcxGridChartView read GetGridView;
    property IsDataGroupMoving: Boolean read GetIsDataGroupMoving;
    property MovingDataGroup: TcxGridChartDataGroup read FMovingDataGroup;
  end;

  { datacontroller }

  {$HPPEMIT '__interface IcxGridChartItem;'}

  IcxGridChartItem = interface
    ['{CDDAE712-6292-4814-A69E-7D871B299EB2}']
    procedure DataChanged;
    function GetDataBinding: TcxGridChartItemDataBinding;
    function GetID: Integer;
    procedure ValueTypeClassChanged;
  end;

  IcxGridChartViewItemsProvider = interface
    ['{852B466D-5068-4600-BBC6-0061BF69A0B0}']
    function GetItem(AItemClass: TcxGridChartItemClass; AIndex: Integer): TcxGridChartItem;
    procedure GetItemCaptions(AItemClass: TcxGridChartItemClass; ACaptions: TStringList);
    procedure InitItem(AItem: TcxGridChartItem; AIndex: Integer);
  end;

  TcxGridChartDataController = class(TcxDataController, IcxCustomGridDataController)
  private
    function GetGridViewValue: TcxGridChartView;
    function GetOnAfterSummary: TcxAfterSummaryEvent;
    function GetOnSummary: TcxSummaryEvent;
    procedure SetOnAfterSummary(Value: TcxAfterSummaryEvent);
    procedure SetOnSummary(Value: TcxSummaryEvent);
  protected
    { IcxCustomGridDataController }
    procedure AssignData(ADataController: TcxCustomDataController);
    procedure CreateAllItems(AMissingItemsOnly: Boolean);
    procedure DeleteAllItems;
    procedure GetFakeComponentLinks(AList: TList);
    function GetGridView: TcxCustomGridView;
    function HasAllItems: Boolean;
    function IsDataChangeable: Boolean;
    function IsDataLinked: Boolean;
    function SupportsCreateAllItems: Boolean;

    procedure DoValueTypeClassChanged(AItemIndex: Integer); override;
    //function GetChartViewItemIndex: Integer; override;
    function GetItemID(AItem: TObject): Integer; override;
    function GetSortingBySummaryEngineClass: TcxSortingBySummaryEngineClass; override;
    procedure Unlocked; override;
  public
    procedure BeginFullUpdate; override;
    procedure EndFullUpdate; override;
    function GetItem(Index: Integer): TObject; override;
    property GridView: TcxGridChartView read GetGridViewValue;
  published
    property Options;
    property OnAfterSummary: TcxAfterSummaryEvent read GetOnAfterSummary write SetOnAfterSummary;
    property OnCompare;
    property OnDataChanged;
    property OnFilterRecord;
    property OnRecordChanged;
    property OnSummary: TcxSummaryEvent read GetOnSummary write SetOnSummary;
  end;

  { painter }

  // title

  TcxGridChartTitlePainter = class(TcxCustomGridCellPainter)
  private
    function GetViewInfo: TcxCustomGridChartTitleViewInfo;
  protected
    procedure PrepareCanvasForDrawText; override;
    procedure UnprepareCanvasForDrawText; override;
  public
    property ViewInfo: TcxCustomGridChartTitleViewInfo read GetViewInfo;
  end;

  // legend

  TcxGridChartLegendItemPainter = class(TcxCustomGridCellPainter)
  private
    function GetViewInfo: TcxGridChartLegendItemViewInfo;
  protected
    procedure DrawContent; override;
    procedure DrawLegendKey; virtual;
    property ViewInfo: TcxGridChartLegendItemViewInfo read GetViewInfo;
  end;

  TcxGridChartLegendPainter = class(TcxCustomGridCellPainter)
  private
    function GetViewInfo: TcxGridChartLegendViewInfo;
  protected
    procedure DrawContent; override;
    function ExcludeFromClipRect: Boolean; override;
    property ViewInfo: TcxGridChartLegendViewInfo read GetViewInfo;
  end;

  // custom diagram

  TcxGridChartDiagramPainter = class(TcxCustomGridCellPainter)
  private
    function GetViewInfo: TcxGridChartDiagramViewInfo;
  protected
    procedure DrawValueCaptions; virtual;
    procedure DrawValues; virtual;
    procedure FillAndExcludeRect(const R: TRect);
    function NeedsPainting: Boolean; override;
    procedure Paint; override;
    procedure PrepareClipRegionForValueDrawing(AValueViewInfo: TcxGridChartDiagramValueViewInfo;
      AOriginalClipRegion: TcxRegion); virtual;
    property ViewInfo: TcxGridChartDiagramViewInfo read GetViewInfo;
  end;

  // histogram

  TcxGridChartHistogramTickMarkLabelsPainter = class(TcxCustomGridCellPainter)
  private
    function GetViewInfo: TcxGridChartHistogramTickMarkLabelsViewInfo;
  protected
    procedure DrawCaptions; virtual;
    procedure DrawContent; override;
  public
    property ViewInfo: TcxGridChartHistogramTickMarkLabelsViewInfo read GetViewInfo;
  end;

  TcxGridChartHistogramPainter = class(TcxGridChartDiagramPainter)
  private
    function GetViewInfo: TcxGridChartHistogramViewInfo;
  protected
    procedure DrawCategoryAxis; virtual;
    procedure DrawCategoryGridLines; virtual;
    procedure DrawContent; override;
    procedure DrawPlotBackground; virtual;
    procedure DrawValueAxis; virtual;
    procedure DrawValueGridLines; virtual;
    procedure DrawValuesBackground; virtual;
    function GetTransparentValues: Boolean; virtual; abstract;
    function GetValuesClipRect: TRect; virtual;
    procedure SetValuesClipRegion; virtual;

    property TransparentValues: Boolean read GetTransparentValues;
    property ViewInfo: TcxGridChartHistogramViewInfo read GetViewInfo;
  end;

  // column diagram

  TcxGridChartColumnDiagramValuePainter = class(TcxCustomGridCellPainter)
  protected
    function ExcludeFromClipRect: Boolean; override;
  end;

  TcxGridChartColumnDiagramPainter = class(TcxGridChartHistogramPainter)
  protected
    function GetTransparentValues: Boolean; override;
  end;

  // line diagram

  TcxGridChartLineDiagramLegendItemPainter = class(TcxGridChartLegendItemPainter)
  private
    function GetViewInfo: TcxGridChartLineDiagramLegendItemViewInfo;
  protected
    procedure DrawLegendKey; override;
    procedure DrawLine; virtual;
    procedure DrawMarker; virtual;
    property ViewInfo: TcxGridChartLineDiagramLegendItemViewInfo read GetViewInfo;
  end;

  TcxGridChartLineDiagramValuePainterClass = class of TcxGridChartLineDiagramValuePainter;

  TcxGridChartLineDiagramValuePainter = class(TcxCustomGridCellPainter)
  private
    function GetViewInfo: TcxGridChartLineDiagramValueViewInfo;
  protected
    function CanDrawDesignSelection: Boolean; override;
    procedure DrawContent; override;
    procedure DrawLine; virtual;
    procedure DrawMarker; virtual;
    property ViewInfo: TcxGridChartLineDiagramValueViewInfo read GetViewInfo;
  public
    class procedure DrawLineEx(ACanvas: TcxCanvas; const AStart, AFinish: TPoint;
      AStyle: TcxGridChartLineStyle; AWidth: Integer; AColor: TColor); virtual;
    class procedure DrawLines(ACanvas: TcxCanvas; const APoints: TPointArray;
      AStyle: TcxGridChartLineStyle; AWidth: Integer; AColor: TColor); virtual;
    class procedure DrawMarkerEx(ACanvas: TcxCanvas; const ABounds: TRect;
      const APoints: TPointArray; AStyle: TcxGridChartMarkerStyle;
      const AParams: TcxViewParams); virtual;
  end;

  TcxGridChartLineDiagramPainter = class(TcxGridChartHistogramPainter)
  protected
    procedure DrawContent; override;
    procedure DrawValuesDesignSelection; virtual;
    function GetTransparentValues: Boolean; override;
  end;

  // area diagram

  TcxGridChartAreaDiagramLegendItemPainter = class(TcxGridChartLineDiagramLegendItemPainter)
  protected
    procedure DrawAreaBackground; virtual;
    procedure DrawAreaBorder; virtual;
    procedure DrawLegendKey; override;
  end;

  TcxGridChartAreaDiagramValuePainter = class(TcxGridChartLineDiagramValuePainter)
  private
    function GetViewInfo: TcxGridChartAreaDiagramValueViewInfo;
  protected
    procedure DoDrawArea; virtual;
    procedure DrawArea; virtual;
    property ViewInfo: TcxGridChartAreaDiagramValueViewInfo read GetViewInfo;
  end;

  TcxGridChartAreaDiagramPainter = class(TcxGridChartLineDiagramPainter)
  protected
    procedure DrawValuesBackground; override;
  end;

  // pie diagram

  TcxGridChartPieDiagramValuePainter = class(TcxCustomGridCellPainter)
  private
    function GetViewInfo: TcxGridChartPieDiagramValueViewInfo;
  protected
    procedure DrawContent; override;
    procedure DrawLeaderLine; virtual;
    procedure DrawSlice; virtual;
    property ViewInfo: TcxGridChartPieDiagramValueViewInfo read GetViewInfo;
  public
    procedure MainPaint; override;
  end;

  TcxGridChartPieSeriesSiteCaptionPainter = class(TcxCustomGridCellPainter)
  protected
    function ExcludeFromClipRect: Boolean; override;
  end;

  TcxGridChartPieSeriesSitePainter = class(TcxCustomGridCellPainter)
  protected
    function CanDrawDesignSelection: Boolean; override;
    function ExcludeFromClipRect: Boolean; override;
  end;

  TcxGridChartPieDiagramPainter = class(TcxGridChartDiagramPainter)
  private
    function GetViewInfo: TcxGridChartPieDiagramViewInfo;
  protected
    procedure DrawContent; override;
    procedure DrawSeriesDesignSelection; virtual;
    procedure DrawSeriesSites; virtual;
    procedure DrawValues; override;
    procedure ExcludeSeriesPieAreasFromClipRegion; virtual;
    procedure PrepareClipRegionForValueDrawing(AValueViewInfo: TcxGridChartDiagramValueViewInfo;
      AOriginalClipRegion: TcxRegion); override;
    property ViewInfo: TcxGridChartPieDiagramViewInfo read GetViewInfo;
  end;

  // ToolBox

  TcxGridChartToolBoxItemSeparatorPainter = class(TcxCustomGridCellPainter)
  protected
    procedure DrawContent; override;
  end;

  TcxGridChartToolBoxDataLevelActiveValuePainter = class(TcxCustomGridCellPainter)
  private
    function GetViewInfo: TcxGridChartToolBoxDataLevelActiveValueViewInfo;
  protected

⌨️ 快捷键说明

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