93 lines
2.5 KiB
Plaintext
93 lines
2.5 KiB
Plaintext
unit FCaPolicyCate;
|
|
|
|
interface
|
|
|
|
uses
|
|
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
|
|
Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Buttons, FCaPolicySel,
|
|
Define, Vcl.ExtCtrls, ManagerCaPolicy;
|
|
|
|
type
|
|
TFrmCaPolicyCate = class(TFrame)
|
|
pnClient: TPanel;
|
|
SpeedButton1: TSpeedButton;
|
|
SpeedButton2: TSpeedButton;
|
|
SpeedButton3: TSpeedButton;
|
|
SpeedButton4: TSpeedButton;
|
|
SpeedButton5: TSpeedButton;
|
|
SpeedButton6: TSpeedButton;
|
|
SpeedButton7: TSpeedButton;
|
|
procedure SpeedButton1Click(Sender: TObject);
|
|
procedure SpeedButton7Click(Sender: TObject);
|
|
private
|
|
{ Private declarations }
|
|
FrmCaPolicySel_: TFrmCaPolicySel;
|
|
SelCaKind_: TCtxAwareKind;
|
|
procedure CreateCaPolicySel(nCate: Integer);
|
|
public
|
|
{ Public declarations }
|
|
Constructor Create(aOwner: TComponent); override;
|
|
|
|
procedure process_WM_CAPOLICY_DLG_OK(var msg: TMessage); Message WM_CAPOLICY_DLG_OK;
|
|
procedure process_WM_CAPOLICY_DLG_CANCEL(var msg: TMessage); Message WM_CAPOLICY_DLG_CANCEL;
|
|
|
|
property SelectedCaKind: TCtxAwareKind read SelCaKind_;
|
|
end;
|
|
|
|
implementation
|
|
|
|
{$R *.dfm}
|
|
|
|
Constructor TFrmCaPolicyCate.Create(aOwner: TComponent);
|
|
begin
|
|
Inherited Create(aOwner);
|
|
SelCaKind_ := cakUnknown;
|
|
FrmCaPolicySel_ := nil;
|
|
end;
|
|
|
|
procedure TFrmCaPolicyCate.CreateCaPolicySel(nCate: Integer);
|
|
begin
|
|
if FrmCaPolicySel_ = nil then
|
|
begin
|
|
FrmCaPolicySel_ := TFrmCaPolicySel.Create(Self);
|
|
FrmCaPolicySel_.Parent := Self;
|
|
FrmCaPolicySel_.Align := alClient;
|
|
FrmCaPolicySel_.RefreshPolicy(nCate);
|
|
FrmCaPolicySel_.Visible := true;
|
|
|
|
pnClient.Visible := false;
|
|
end;
|
|
end;
|
|
|
|
procedure TFrmCaPolicyCate.SpeedButton1Click(Sender: TObject);
|
|
begin
|
|
if Sender is TSpeedButton then
|
|
CreateCaPolicySel(TSpeedButton(Sender).Tag);
|
|
end;
|
|
|
|
procedure TFrmCaPolicyCate.SpeedButton7Click(Sender: TObject);
|
|
begin
|
|
if (Owner <> nil) and (Owner is TWinControl) then
|
|
PostMessage(TWinControl(Owner).Handle, WM_CAPOLICY_DLG_CANCEL, 0, 0);
|
|
end;
|
|
|
|
procedure TFrmCaPolicyCate.process_WM_CAPOLICY_DLG_OK(var msg: TMessage);
|
|
begin
|
|
if (Owner <> nil) and (Owner is TWinControl) then
|
|
begin
|
|
SelCaKind_ := FrmCaPolicySel_.SelectedCaKind;
|
|
PostMessage(TWinControl(Owner).Handle, WM_CAPOLICY_DLG_OK, 0, 0);
|
|
end;
|
|
end;
|
|
|
|
procedure TFrmCaPolicyCate.process_WM_CAPOLICY_DLG_CANCEL(var msg: TMessage);
|
|
begin
|
|
if FrmCaPolicySel_ <> nil then
|
|
begin
|
|
pnClient.Visible := true;
|
|
FreeAndNil(FrmCaPolicySel_);
|
|
end;
|
|
end;
|
|
|
|
end.
|