unit AdvMainMenu;
interface
uses
Windows, Menus, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TAdvMainMenu =
class(TMainMenu)
private
{ Private-Deklarationen }
FOnLMBClicked: TNotifyEvent;
FOnRMBClicked: TNotifyEvent;
procedure LeftMouseButtonDown(
var Msg : TMouseInput);
message WM_LBUTTONDOWN;
procedure RightMouseButtonDown(
var Msg : TMouseInput);
message WM_RBUTTONDOWN;
protected
{ Protected-Deklarationen }
procedure DoLeftMouseButtonDown(
var Msg : TMouseInput);
dynamic;
procedure DoRightMouseButtonDown(
var Msg : TMouseInput);
dynamic;
public
{ Public-Deklarationen }
constructor Create(AOwner: TComponent);
override;
destructor Destroy;
override;
published
{ Published-Deklarationen }
property OnLMBClick: TNotifyEvent
read FOnLMBClicked
write FOnLMBClicked;
property OnRMBClick: TNotifyEvent
read FOnRMBClicked
write FOnRMBClicked;
end;
TAdvMenuItem =
class(TMenuItem)
private
{ Private-Deklarationen }
FOnLMBClicked: TNotifyEvent;
FOnRMBClicked: TNotifyEvent;
procedure LeftMouseButtonDown(
var Msg : TMouseInput);
message WM_LBUTTONDOWN;
procedure RightMouseButtonDown(
var Msg : TMouseInput);
message WM_RBUTTONDOWN;
protected
{ Protected-Deklarationen }
procedure DoLeftMouseButtonDown(
var Msg : TMouseInput);
dynamic;
procedure DoRightMouseButtonDown(
var Msg : TMouseInput);
dynamic;
public
{ Public-Deklarationen }
constructor Create(AOwner: TComponent);
override;
destructor Destroy;
override;
published
{ Published-Deklarationen }
property OnLMBClick: TNotifyEvent
read FOnLMBClicked
write FOnLMBClicked;
property OnRMBClick: TNotifyEvent
read FOnRMBClicked
write FOnRMBClicked;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('
Standard', [TAdvMainMenu]);
end;
constructor TAdvMainMenu.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
end;
destructor TAdvMainMenu.Destroy;
begin
inherited Destroy;
end;
procedure TAdvMainMenu.DoLeftMouseButtonDown(
var Msg: TMouseInput);
begin
If Assigned(FOnLMBClicked)
then
FOnLMBClicked(Self);
end;
procedure TAdvMainMenu.DoRightMouseButtonDown(
var Msg: TMouseInput);
begin
If Assigned(FOnRMBClicked)
then
FOnRMBClicked(Self);
end;
procedure TAdvMainMenu.LeftMouseButtonDown(
var Msg: TMouseInput);
begin
DoLeftMouseButtonDown(Msg);
end;
procedure TAdvMainMenu.RightMouseButtonDown(
var Msg: TMouseInput);
begin
DoRightMouseButtonDown(Msg);
end;
constructor TAdvMenuItem.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
end;
destructor TAdvMenuItem.Destroy;
begin
inherited Destroy;
end;
procedure TAdvMenuItem.DoLeftMouseButtonDown(
var Msg: TMouseInput);
begin
If Assigned(FOnLMBClicked)
then
FOnLMBClicked(Self);
end;
procedure TAdvMenuItem.DoRightMouseButtonDown(
var Msg: TMouseInput);
begin
If Assigned(FOnRMBClicked)
then
FOnRMBClicked(Self);
end;
procedure TAdvMenuItem.LeftMouseButtonDown(
var Msg: TMouseInput);
begin
DoLeftMouseButtonDown(Msg);
end;
procedure TAdvMenuItem.RightMouseButtonDown(
var Msg: TMouseInput);
begin
DoRightMouseButtonDown(Msg);
end;
end.