utreelistform.pas

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

PAS
74
字号
unit uTreeListForm;

interface

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

type
    TTreeListForm = class(TForm, IPhotoNotify)
        TreeView: TTreeView;
    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
    TreeListForm: TTreeListForm;

implementation

{$R *.dfm}

{ TTreeListForm }

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

end;

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

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

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

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

{//////////////////////////////////////////////////////////////////////////////}
procedure TTreeListForm.SetPhotoMgr(photoMgr: IPhotoMgr);
begin
    fPhotoMgr := photoMgr;
end;

end.

⌨️ 快捷键说明

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