upanelform.pas

来自「观察者模式delphi实例实现,同时注意软件的设计」· PAS 代码 · 共 73 行

PAS
73
字号
unit uPanelForm;

interface

uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, uInterface;

type
    TPanelForm = class(TForm, IPhotoNotify)
    private
        fPhotoMgr :IPhotoMgr;
    private
        //实现IPhotoNotify接口
        function SelPhoto(const photoID:Integer):Boolean;        
        function NewPhoto(const photoID:Integer):Boolean;
        function DelPhoto(const photoID:Integer):Boolean;
        function Refresh():Boolean;
        function PropChange(const photoID:Integer):Boolean;
        
    public
        procedure SetPhotoMgr(photoMgr:IPhotoMgr);
    end;

var
    PanelForm: TPanelForm;

implementation

{$R *.dfm}

{ TPanelForm }

{//////////////////////////////////////////////////////////////////////////////}
function TPanelForm.DelPhoto(const photoID: Integer): Boolean;
begin
    Result := True;
end;

{------------------------------------------------------------------------------}
function TPanelForm.NewPhoto(const photoID: Integer): Boolean;
begin
    Result := True;
    ShowMessage('New Photo' + IntToStr(photoID));
end;

{------------------------------------------------------------------------------}
function TPanelForm.PropChange(const photoID: Integer): Boolean;
begin
    Result := True;
end;

{------------------------------------------------------------------------------}
function TPanelForm.Refresh: Boolean;
begin
    Result := True;
end;

{------------------------------------------------------------------------------}
function TPanelForm.SelPhoto(const photoID: Integer): Boolean;
begin
    Result := True;
end;

{------------------------------------------------------------------------------}
procedure TPanelForm.SetPhotoMgr(photoMgr: IPhotoMgr);
begin
    fPhotoMgr := photoMgr;
end;

end.

⌨️ 快捷键说明

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