⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jvqcolorprovider.pas

📁 East make Tray Icon in delphi
💻 PAS
📖 第 1 页 / 共 5 页
字号:
    property TextSettings: TJvColorProviderTextSettings read Get_TextSettings
      write Set_TextSettings;
    property StandardColorSettings: TJvColorProviderColorGroupSettings
      read Get_StandardColorSettings write Set_StandardColorSettings;
    property SystemColorSettings: TJvColorProviderColorGroupSettings read Get_SystemColorSettings
      write Set_SystemColorSettings;
    property GroupingSettings: TJvColorProviderGroupingSettings read Get_GroupingSettings
      write Set_GroupingSettings;
    property Mapping: TJvColorProviderMapping read GetNameMappingIndex write SetNameMappingIndex
      default -1;
  end;

  TJvColorContextsManager = class(TJvBaseDataContextsManager)
  protected
    function New: IJvDataContext; override;
  end;

  TJvColorContext = class(TJvDataContext, IJvDataContextManager)
  protected
    function IsDeletable: Boolean; override;
    function IsStreamable: Boolean; override;
    procedure DefineProperties(Filer: TFiler); override;
    procedure ReadStdColors(Reader: TReader);
    procedure WriteStdColors(Writer: TWriter);
    procedure ReadSysColors(Reader: TReader);
    procedure WriteSysColors(Writer: TWriter);
    procedure ReadCstColors(Reader: TReader);
    procedure WriteCstColors(Writer: TWriter);
    procedure ReadCtxList(Reader: TReader; var List: TDynIntegerArray);
    procedure WriteCtxList(Writer: TWriter; const List: TDynIntegerArray);
  end;

  TJvColorMapItems = class(TJvBaseDataItems)
  private
    FConsumer: TJvDataConsumer;
    FItemInstances: TList;
    function GetClientProvider: IJvDataProvider;
    procedure SetClientProvider(Value: IJvDataProvider);
    procedure DataProviderChanging(ADataProvider: IJvDataProvider;
      AReason: TDataProviderChangeReason; Source: IUnknown);
    procedure DataProviderChanged(ADataProvider: IJvDataProvider;
      AReason: TDataProviderChangeReason; Source: IUnknown);
    procedure SubServiceCreated(Sender: TJvDataConsumer; SubSvc: TJvDataConsumerAggregatedObject);
    procedure ConsumerChanged(Sender: TJvDataConsumer; Reason: TJvDataConsumerChangeReason);
    procedure MappingAdding(Sender: TObject);
    procedure MappingAdded(Sender: TJvColorProviderSettings; Index: Integer;
      Mapping: TJvColorProviderNameMapping);
    procedure MappingDestroying(Sender: TJvColorProviderSettings; Index: Integer;
      Mapping: TJvColorProviderNameMapping);
    procedure MappingDestroyed(Sender: TObject);
  protected
    function GetCount: Integer; override;
    function GetItem(I: Integer): IJvDataItem; override;
    procedure InitImplementers; override;

    property Consumer: TJvDataConsumer read FConsumer;
  public
    constructor Create; override;
    destructor Destroy; override;
    procedure AfterConstruction; override;

    property ClientProvider: IJvDataProvider read GetClientProvider write SetClientProvider;
  end;

  TJvColorMapItem = class(TJvBaseDataItem, IJvDataItemText, IJvColorMapItem)
  private
    FIndex: Integer;
  protected
    function GetCaption: string;
    procedure SetCaption(const Value: string);
    function Editable: Boolean;
    function Get_NameMapping: TJvColorProviderNameMapping;
    procedure InitID; override;
    property Index: Integer read FIndex;
  public
    constructor Create(AOwner: IJvDataItems; AIndex: Integer);
    destructor Destroy; override;
  end;

  TJvColorMapItemsManager = class(TJvBaseDataItemsManagement)
  protected
    { IJvDataItemManagement methods }
    function Add(Item: IJvDataItem): IJvDataItem; override;
    function New: IJvDataItem; override;
    procedure Clear; override;
    procedure Delete(Index: Integer); override;
    procedure Remove(var Item: IJvDataItem); override;
  end;

  TJvColorConsumer = class(TInterfacedObject, IJvDataConsumer)
  protected
    { IJvDataConsumer methods }
    function VCLComponent: TComponent;
    function AttributeApplies(Attr: Integer): Boolean;
  end;

//=== { TJvColorProviderNameMapping } ========================================

constructor TJvColorProviderNameMapping.Create(AOwner: TJvColorProviderNameMappings; AName: string);
begin
  inherited Create;
  FOwner := AOwner;
  FName := AName;
end;

//=== { TJvColorProviderSubSettings } ========================================

constructor TJvColorProviderSubSettings.Create(AConsumerService: TJvDataConsumerAggregatedObject);
begin
  inherited Create;
  FConsumerServiceExt := AConsumerService;
end;

procedure TJvColorProviderSubSettings.Changed;
begin
  TJvDataConsumerAggregatedObjectAccessProtected(ConsumerServiceExt).Changed(ccrOther);
end;

procedure TJvColorProviderSubSettings.ViewChanged;
begin
  TJvDataConsumerAggregatedObjectAccessProtected(ConsumerServiceExt).NotifyViewChanged;
end;

procedure TJvColorProviderSubSettings.SetActive(Value: Boolean);
begin
  if Value <> Active then
  begin
    FActive := Value;
    Changed;
  end;
end;

//=== { TJvColorProviderColorBoxSettings } ===================================

constructor TJvColorProviderColorBoxSettings.Create(AConsumerService: TJvDataConsumerAggregatedObject);
begin
  inherited Create(AConsumerService);
  FActive := True;
  FHeight := 13;
  FMargin := 2;
  FShadowed := True;
  FShadowSize := 2;
  FSpacing := 4;
  FWidth := 21;
end;

procedure TJvColorProviderColorBoxSettings.SetHeight(Value: Integer);
begin
  if Value <> Height then
  begin
    FHeight := Value;
    Changed;
  end;
end;

procedure TJvColorProviderColorBoxSettings.SetMargin(Value: Integer);
begin
  if Value <> Margin then
  begin
    FMargin := Value;
    Changed;
  end;
end;

procedure TJvColorProviderColorBoxSettings.SetShadowed(Value: Boolean);
begin
  if Value <> Shadowed then
  begin
    FShadowed := Value;
    Changed;
  end;
end;

procedure TJvColorProviderColorBoxSettings.SetShadowSize(Value: Integer);
begin
  if Value <> ShadowSize then
  begin
    FShadowSize := Value;
    Changed;
  end;
end;

procedure TJvColorProviderColorBoxSettings.SetSpacing(Value: Integer);
begin
  if Value <> Spacing then
  begin
    FSpacing := Value;
    Changed;
  end;
end;

procedure TJvColorProviderColorBoxSettings.SetWidth(Value: Integer);
begin
  if Value <> Width then
  begin
    FWidth := Value;
    Changed;
  end;
end;

//=== { TJvColorProviderTextSettings } =======================================

constructor TJvColorProviderTextSettings.Create(AConsumerService: TJvDataConsumerAggregatedObject);
begin
  inherited Create(AConsumerService);
  FActive := True;
  FShowName := True;
end;

procedure TJvColorProviderTextSettings.SetShowHex(Value: Boolean);
begin
  if Value <> ShowHex then
  begin
    FShowHex := Value;
    Changed;
  end;
end;

procedure TJvColorProviderTextSettings.SetShowName(Value: Boolean);
begin
  if Value <> ShowName then
  begin
    FShowName := Value;
    Changed;
  end;
end;

procedure TJvColorProviderTextSettings.SetShowRGB(Value: Boolean);
begin
  if Value <> ShowRGB then
  begin
    FShowRGB := Value;
    Changed;
  end;
end;

//=== { TJvColorProviderGroupingSettings } ===================================

constructor TJvColorProviderGroupingSettings.Create(AConsumerService: TJvDataConsumerAggregatedObject);
begin
  inherited Create(AConsumerService);
  FActive := True;
  FFlatList := True;
  FHeaderAlign := ghaLeft;
  FHeaderStyle := [ghsBoldFont, ghsSingleCenterLine];
end;

procedure TJvColorProviderGroupingSettings.SetActive(Value: Boolean);
begin
  if Value <> Active then
  begin
    FActiveChanging := True;
    inherited SetActive(Value);
    FActiveChanging := False;
  end;
end;

procedure TJvColorProviderGroupingSettings.Changed;
begin
  if FActiveChanging then
    ViewChanged;
  inherited Changed;
end;

procedure TJvColorProviderGroupingSettings.SetFlatList(Value: Boolean);
begin
  if Value <> FlatList then
  begin
    FFlatList := Value;
    ViewChanged;
    Changed;
  end;
end;

procedure TJvColorProviderGroupingSettings.SetHeaderAlign(Value: TColorGroupHeaderAlign);
begin
  if Value <> HeaderAlign then
  begin
    FHeaderAlign := Value;
    Changed;
  end;
end;

procedure TJvColorProviderGroupingSettings.SetHeaderStyle(Value: TColorGroupHeaderStyles);
begin
  if (ghsSingleCenterLine in Value) and not (ghsSingleCenterLine in HeaderStyle) then
    Exclude(Value, ghsDoubleCenterLine)
  else
  if (ghsDoubleCenterLine in Value) and not (ghsDoubleCenterLine in HeaderStyle) then
    Exclude(Value, ghsSingleCenterLine);
  if Value <> HeaderStyle then
  begin
    FHeaderStyle := Value;
    Changed;
  end;
end;

//=== { TJvColorProviderColorGroupSettings } =================================

constructor TJvColorProviderColorGroupSettings.Create(AConsumerService: TJvDataConsumerAggregatedObject;
  ACaption: string);
begin
  inherited Create(AConsumerService);
  FActive := True;
  FCaption := ACaption;
end;

procedure TJvColorProviderColorGroupSettings.SetActive(Value: Boolean);
begin
  if Value <> Active then
  begin
    FActiveChanging := True;
    inherited SetActive(Value);
    FActiveChanging := False;
  end;
end;

procedure TJvColorProviderColorGroupSettings.Changed;
begin
  if FActiveChanging then
    ViewChanged;
  inherited Changed;
end;

procedure TJvColorProviderColorGroupSettings.SetCaption(Value: string);
begin
  if Value <> Caption then
  begin
    FCaption := Value;
    Changed;
  end;
end;

procedure TJvColorProviderColorGroupSettings.SetShowHeader(Value: Boolean);
begin
  if Value <> ShowHeader then
  begin
    FShowHeader := Value;
    Changed;
    ViewChanged;
  end;
end;

//=== { TJvColorProviderAddColorSettings } ===================================

constructor TJvColorProviderAddColorSettings.Create(AConsumerService: TJvDataConsumerAggregatedObject);
begin
  inherited Create(AConsumerService);
  FLocation := ailBottom;
  FStyle := ColorProviderColorAdderRegister.DefaultAdder;
  ColorProviderColorAdderRegister.RegisterNotify(Self);
end;

destructor TJvColorProviderAddColorSettings.Destroy;
begin
  ColorProviderColorAdderRegister.UnregisterNotify(Self);
  inherited Destroy;
end;

procedure TJvColorProviderAddColorSettings.SetLocation(Value: TJvColorProviderAddItemLocation);
begin
  if Value <> Location then
  begin
    FLocation := Value;
    Changed;
    ViewChanged;
  end;
end;

procedure TJvColorProviderAddColorSettings.SetCaption(Value: string);
begin
  if Value <> Caption then
  begin

⌨️ 快捷键说明

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