You've already forked lazarus-ccr
mbColorLib: Initial commit (still some issues)
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5452 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
84
components/mbColorLib/mbOfficeColorDialog.pas
Normal file
84
components/mbColorLib/mbOfficeColorDialog.pas
Normal file
@ -0,0 +1,84 @@
|
||||
unit mbOfficeColorDialog;
|
||||
|
||||
{$IFDEF FPC}
|
||||
{$MODE DELPHI}
|
||||
{$ENDIF}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{$IFDEF FPC}
|
||||
LCLIntf, LCLType,
|
||||
{$ELSE}
|
||||
Windows,
|
||||
{$ENDIF}
|
||||
SysUtils, Classes, Graphics, Forms, OfficeMoreColorsDialog;
|
||||
|
||||
type
|
||||
TmbOfficeColorDialog = class(TComponent)
|
||||
private
|
||||
FWin: TOfficeMoreColorsWin;
|
||||
FSelColor: TColor;
|
||||
FUseHint: boolean;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
function Execute: boolean; overload;
|
||||
function Execute(AColor: TColor): boolean; overload;
|
||||
published
|
||||
property SelectedColor: TColor read FSelColor write FSelColor default clWhite;
|
||||
property UseHints: boolean read FUseHint write FUseHint default false;
|
||||
end;
|
||||
|
||||
procedure Register;
|
||||
|
||||
implementation
|
||||
|
||||
{$IFDEF FPC}
|
||||
{$R mbOfficeColorDialog.dcr}
|
||||
{$ENDIF}
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterComponents('mbColor Lib', [TmbOfficeColorDialog]);
|
||||
end;
|
||||
|
||||
constructor TmbOfficeColorDialog.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
FSelColor := clWhite;
|
||||
FUseHint := false;
|
||||
end;
|
||||
|
||||
function TmbOfficeColorDialog.Execute: boolean;
|
||||
begin
|
||||
FWin := TOfficeMoreColorsWin.Create(Application);
|
||||
try
|
||||
FWin.OldSwatch.Color := FSelColor;
|
||||
FWin.ShowHint := FUseHint;
|
||||
Result := (FWin.ShowModal = IdOK);
|
||||
if Result then
|
||||
FSelColor := FWin.NewSwatch.Color
|
||||
else
|
||||
FSelColor := clNone;
|
||||
finally
|
||||
FWin.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TmbOfficeColorDialog.Execute(AColor: TColor): boolean;
|
||||
begin
|
||||
FWin := TOfficeMoreColorsWin.Create(Application);
|
||||
try
|
||||
FWin.OldSwatch.Color := AColor;
|
||||
FWin.ShowHint := FUseHint;
|
||||
Result := (FWin.ShowModal = IdOK);
|
||||
if Result then
|
||||
FSelColor := FWin.NewSwatch.Color
|
||||
else
|
||||
FSelColor := clNone;
|
||||
finally
|
||||
FWin.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
Reference in New Issue
Block a user