2016-12-08 23:14:26 +00:00
|
|
|
unit mbOfficeColorDialog;
|
|
|
|
|
2016-12-20 15:41:10 +00:00
|
|
|
{$MODE DELPHI}
|
2016-12-08 23:14:26 +00:00
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
uses
|
|
|
|
LCLIntf, LCLType,
|
|
|
|
SysUtils, Classes, Graphics, Forms, OfficeMoreColorsDialog;
|
|
|
|
|
|
|
|
type
|
|
|
|
TmbOfficeColorDialog = class(TComponent)
|
|
|
|
private
|
2016-12-15 11:27:12 +00:00
|
|
|
FWin: TOfficeMoreColorsWin;
|
|
|
|
FSelColor: TColor;
|
|
|
|
FUseHint: boolean;
|
2017-01-02 11:15:19 +00:00
|
|
|
FMaxHue, FMaxSat, FMaxLum: Integer;
|
2016-12-08 23:14:26 +00:00
|
|
|
public
|
2016-12-15 11:27:12 +00:00
|
|
|
constructor Create(AOwner: TComponent); override;
|
|
|
|
function Execute: boolean; overload;
|
|
|
|
function Execute(AColor: TColor): boolean; overload;
|
2016-12-08 23:14:26 +00:00
|
|
|
published
|
2016-12-15 11:27:12 +00:00
|
|
|
property SelectedColor: TColor read FSelColor write FSelColor default clWhite;
|
2017-01-02 11:15:19 +00:00
|
|
|
property MaxHue: Integer read FMaxHue write FMaxHue default 359;
|
|
|
|
property MaxSaturation: Integer read FMaxSat write FMaxSat default 240;
|
|
|
|
property MaxLuminance: Integer read FMaxLum write FMaxLum default 240;
|
2016-12-15 11:27:12 +00:00
|
|
|
property UseHints: boolean read FUseHint write FUseHint default false;
|
2016-12-08 23:14:26 +00:00
|
|
|
end;
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
2016-12-11 22:56:25 +00:00
|
|
|
{ TmbOfficeColorDialog }
|
2016-12-08 23:14:26 +00:00
|
|
|
|
|
|
|
constructor TmbOfficeColorDialog.Create(AOwner: TComponent);
|
|
|
|
begin
|
2016-12-15 11:27:12 +00:00
|
|
|
inherited;
|
|
|
|
FSelColor := clWhite;
|
|
|
|
FUseHint := false;
|
2017-01-02 11:15:19 +00:00
|
|
|
FMaxHue := 359;
|
|
|
|
FMaxSat := 240;
|
|
|
|
FMaxLum := 240;
|
2016-12-08 23:14:26 +00:00
|
|
|
end;
|
|
|
|
|
|
|
|
function TmbOfficeColorDialog.Execute: boolean;
|
|
|
|
begin
|
2017-01-02 00:05:26 +00:00
|
|
|
Result := Execute(FSelColor);
|
2016-12-08 23:14:26 +00:00
|
|
|
end;
|
|
|
|
|
|
|
|
function TmbOfficeColorDialog.Execute(AColor: TColor): boolean;
|
|
|
|
begin
|
2016-12-15 11:27:12 +00:00
|
|
|
FWin := TOfficeMoreColorsWin.Create(Application);
|
|
|
|
try
|
|
|
|
FWin.OldSwatch.Color := AColor;
|
|
|
|
FWin.ShowHint := FUseHint;
|
2017-01-02 11:15:19 +00:00
|
|
|
FWin.MaxHue := FMaxHue;
|
|
|
|
FWin.MaxSaturation := FMaxSat;
|
|
|
|
FWin.MaxLuminance := FMaxLum;
|
2016-12-15 11:27:12 +00:00
|
|
|
Result := (FWin.ShowModal = IdOK);
|
|
|
|
if Result then
|
|
|
|
FSelColor := FWin.NewSwatch.Color
|
|
|
|
else
|
|
|
|
FSelColor := clNone;
|
|
|
|
finally
|
|
|
|
FWin.Free;
|
|
|
|
end;
|
2016-12-08 23:14:26 +00:00
|
|
|
end;
|
|
|
|
|
|
|
|
end.
|