unit uViewProveedores;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, uViewContactos, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
  cxDataStorage, cxEdit, DB, cxDBData, dxPSGlbl, dxPSUtl, dxPSEngn, dxPrnPg,
  dxBkgnd, dxWrap, dxPrnDev, dxPSCompsProvider, dxPSFillPatterns,
  dxPSEdgePatterns, ImgList, PngImageList, cxGridCustomPopupMenu,
  cxGridPopupMenu, dxPSCore, dxPScxCommon, dxPScxGrid6Lnk, uDADataTable,
  cxGridLevel, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
  cxClasses, cxControls, cxGridCustomView, cxGrid, dxPgsDlg, ActnList, TB2Item,
  SpTBXItem, TB2Toolbar, SpTBXDkPanels, TB2Dock, uViewFiltroBase, cxImageComboBox,
  uDAInterfaces, Menus, uCustomView, uViewBase, cxLookAndFeels,
  cxLookAndFeelPainters, dxPSPDFExportCore, dxPSPDFExport, cxDrawTextUtils,
  dxPSPrVwStd, dxPSPrVwAdv, dxPScxEditorProducers, dxPScxExtEditorProducers,
  dxPScxPageControlProducer;

type
  IViewProveedores = interface(IViewContactos)
    ['{C64C0439-5D1D-4B60-9FC0-4E75E58F7384}']
  end;

  TfrViewProveedores = class(TfrViewContactos, IViewProveedores)
    cxGridViewTIENDA_WEB: TcxGridDBColumn;
    cxGridViewHOMOLOGADO: TcxGridDBColumn;
    procedure cxGridViewICONOGetCellHint(Sender: TcxCustomGridTableItem;
      ARecord: TcxCustomGridRecord; ACellViewInfo: TcxGridTableDataCellViewInfo;
      const AMousePos: TPoint; var AHintText: TCaption;
      var AIsHintMultiLine: Boolean; var AHintTextRect: TRect);
    procedure cxGridViewICONOCustomDrawCell(Sender: TcxCustomGridTableView;
      ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo;
      var ADone: Boolean);
  end;

implementation

{$R *.dfm}

procedure TfrViewProveedores.cxGridViewICONOCustomDrawCell(
  Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
  AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
var
  R : TRect;
begin
  //inherited; <- No llamamos al padre porque queremos hacer tratamiento especial
  R := AViewInfo.ContentBounds;
  ACanvas.FillRect(R);
  if (cxGridView.DataController.DisplayTexts[AViewInfo.GridRecord.RecordIndex,
    cxGridViewHOMOLOGADO.Index] = '1') then
    ACanvas.DrawImage(GridPNGImageList, R.Left + 2, R.Top + 2, 2)
  else
    ACanvas.DrawImage(GridPNGImageList, R.Left + 2, R.Top + 2, 1);
  ADone := True;
end;

procedure TfrViewProveedores.cxGridViewICONOGetCellHint(
  Sender: TcxCustomGridTableItem; ARecord: TcxCustomGridRecord;
  ACellViewInfo: TcxGridTableDataCellViewInfo; const AMousePos: TPoint;
  var AHintText: TCaption; var AIsHintMultiLine: Boolean;
  var AHintTextRect: TRect);
begin
  inherited;
  if (cxGridView.DataController.DisplayTexts[ARecord.Index, cxGridViewHOMOLOGADO.Index] = '1') then
    AHintText := 'Proveedor homologado';
end;

end.
