📄 motherctrl.pas
字号:
unit MotherCtrl;
interface
uses
SysUtils, stdctrls, forms, buttons, classes, controls, patterns,
MotherMdl, MotherView;
type
TControllerMother = class(TController)
model: TModelMother;
view: TViewMother;
protected
procedure DoCommand(ACommand: string; const args: TObject = nil); override;
public
constructor Create;
destructor Destroy; override;
procedure OnClick(Sender: TObject); //for ieventListener
procedure OnMouseEvent(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
end;
implementation
uses
commandlist;
procedure TControllerMother.OnClick(Sender: TObject);
begin
if Sender is TButton then
begin
self.SendCommand(View.getCommand, 'Mother');
self.SendCommand(CMD_NODE_SELECT, 'Mother');
end;
end;
procedure TControllerMother.OnMouseEvent(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
end;
constructor TControllerMother.Create;
begin
inherited;
model := TModelMother.Create;
view := TViewMother.create(nil);
view.setEventHandler(self.onclick);
model.RegObserver(view);
end;
destructor TControllerMother.destroy;
begin
freeAndNil(model);
freeAndNil(view);
inherited;
end;
procedure TControllerMother.DoCommand(ACommand: string; const args: TObject = nil);
begin
if ACommand = CMD_REQUIRE_MOTHERVIEW then
self.SendCommand(CMD_SHOW_MOTHERVIEW, view)
else if (ACommand = CMD_NODE_SELECT) and
(args <> nil) and
(uppercase(TCommand(args).getCommandTxt) = uppercase('Mother')) then
begin
model.response(ACommand, args as TCommand);
end
else if (ACommand = CMD_DAD_PLAYGAME) or
(ACommand = CMD_BABY_CHOCOLATE) or
(ACommand = CMD_BABY_CARTOON) or
(ACommand = CMD_CLEAR_SELECTION) then
model.response(ACommand);
end;
initialization
ControlCenter.RegController(TControllerMother.Create);
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -