mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 21:20:30 +02:00
ideintf, designer: add MouseDown and MouseUp event handlers for designer
git-svn-id: trunk@51144 -
This commit is contained in:
parent
3fb93ad0bf
commit
cdfb590aee
@ -1244,6 +1244,8 @@ type
|
|||||||
htGetAncestorInstProp,
|
htGetAncestorInstProp,
|
||||||
htAddClicked, // user selected a component class and clicked on a form to add a component
|
htAddClicked, // user selected a component class and clicked on a form to add a component
|
||||||
htComponentRenamed,
|
htComponentRenamed,
|
||||||
|
htMouseDown,
|
||||||
|
htMouseUp,
|
||||||
// persistent selection
|
// persistent selection
|
||||||
htBeforeAddPersistent,
|
htBeforeAddPersistent,
|
||||||
htPersistentAdded,
|
htPersistentAdded,
|
||||||
@ -1332,6 +1334,10 @@ type
|
|||||||
procedure Unselect(const APersistent: TPersistent);
|
procedure Unselect(const APersistent: TPersistent);
|
||||||
function IsSelected(const APersistent: TPersistent): boolean;
|
function IsSelected(const APersistent: TPersistent): boolean;
|
||||||
procedure SelectOnlyThis(const APersistent: TPersistent);
|
procedure SelectOnlyThis(const APersistent: TPersistent);
|
||||||
|
procedure MouseDown(Sender: TObject; Button: TMouseButton;
|
||||||
|
Shift: TShiftState; X, Y: Integer);
|
||||||
|
procedure MouseUp(Sender: TObject; Button: TMouseButton;
|
||||||
|
Shift: TShiftState; X, Y: Integer);
|
||||||
// persistent objects
|
// persistent objects
|
||||||
function GetObject(const aName: ShortString): TPersistent;
|
function GetObject(const aName: ShortString): TPersistent;
|
||||||
function GetObjectName(Instance: TPersistent): ShortString;
|
function GetObjectName(Instance: TPersistent): ShortString;
|
||||||
@ -1412,6 +1418,14 @@ type
|
|||||||
const OnGetAncestorInstProp: TPropHookGetAncestorInstProp);
|
const OnGetAncestorInstProp: TPropHookGetAncestorInstProp);
|
||||||
procedure RemoveHandlerGetAncestorInstProp(
|
procedure RemoveHandlerGetAncestorInstProp(
|
||||||
const OnGetAncestorInstProp: TPropHookGetAncestorInstProp);
|
const OnGetAncestorInstProp: TPropHookGetAncestorInstProp);
|
||||||
|
procedure AddHandlerMouseDown(
|
||||||
|
const OnMouseDown: TMouseEvent);
|
||||||
|
procedure RemoveHandlerMouseDown(
|
||||||
|
const OnMouseDown: TMouseEvent);
|
||||||
|
procedure AddHandlerMouseUp(
|
||||||
|
const OnMouseUp: TMouseEvent);
|
||||||
|
procedure RemoveHandlerMouseUp(
|
||||||
|
const OnMouseUp: TMouseEvent);
|
||||||
// component create, delete, rename
|
// component create, delete, rename
|
||||||
procedure AddHandlerComponentRenamed(
|
procedure AddHandlerComponentRenamed(
|
||||||
const OnComponentRenamed: TPropHookComponentRenamed);
|
const OnComponentRenamed: TPropHookComponentRenamed);
|
||||||
@ -6108,6 +6122,34 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TPropertyEditorHook.MouseDown(Sender: TObject; Button: TMouseButton;
|
||||||
|
Shift: TShiftState; X, Y: Integer);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
Handler: TMouseEvent;
|
||||||
|
begin
|
||||||
|
i := GetHandlerCount(htMouseDown);
|
||||||
|
while GetNextHandlerIndex(htMouseDown, i) do
|
||||||
|
begin
|
||||||
|
Handler := TMouseEvent(FHandlers[htMouseDown][i]);
|
||||||
|
Handler(Sender, Button, Shift, X, Y);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TPropertyEditorHook.MouseUp(Sender: TObject; Button: TMouseButton;
|
||||||
|
Shift: TShiftState; X, Y: Integer);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
Handler: TMouseEvent;
|
||||||
|
begin
|
||||||
|
i := GetHandlerCount(htMouseUp);
|
||||||
|
while GetNextHandlerIndex(htMouseUp, i) do
|
||||||
|
begin
|
||||||
|
Handler := TMouseEvent(FHandlers[htMouseUp][i]);
|
||||||
|
Handler(Sender, Button, Shift, X, Y);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TPropertyEditorHook.Revert(Instance:TPersistent;
|
procedure TPropertyEditorHook.Revert(Instance:TPersistent;
|
||||||
PropInfo:PPropInfo);
|
PropInfo:PPropInfo);
|
||||||
var
|
var
|
||||||
@ -6499,12 +6541,35 @@ begin
|
|||||||
AddHandler(htModified,TMethod(OnModified));
|
AddHandler(htModified,TMethod(OnModified));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TPropertyEditorHook.AddHandlerMouseDown(const OnMouseDown: TMouseEvent
|
||||||
|
);
|
||||||
|
begin
|
||||||
|
AddHandler(htMouseDown,TMethod(OnMouseDown));
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TPropertyEditorHook.AddHandlerMouseUp(const OnMouseUp: TMouseEvent);
|
||||||
|
begin
|
||||||
|
AddHandler(htMouseUp,TMethod(OnMouseUp));
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TPropertyEditorHook.RemoveHandlerModified(
|
procedure TPropertyEditorHook.RemoveHandlerModified(
|
||||||
const OnModified: TPropHookModified);
|
const OnModified: TPropHookModified);
|
||||||
begin
|
begin
|
||||||
RemoveHandler(htModified,TMethod(OnModified));
|
RemoveHandler(htModified,TMethod(OnModified));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TPropertyEditorHook.RemoveHandlerMouseDown(
|
||||||
|
const OnMouseDown: TMouseEvent);
|
||||||
|
begin
|
||||||
|
RemoveHandler(htMouseDown,TMethod(OnMouseDown));
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TPropertyEditorHook.RemoveHandlerMouseUp(const OnMouseUp: TMouseEvent
|
||||||
|
);
|
||||||
|
begin
|
||||||
|
RemoveHandler(htMouseUp,TMethod(OnMouseUp));
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TPropertyEditorHook.AddHandlerRevert(const OnRevert: TPropHookRevert);
|
procedure TPropertyEditorHook.AddHandlerRevert(const OnRevert: TPropHookRevert);
|
||||||
begin
|
begin
|
||||||
AddHandler(htRevert,TMethod(OnRevert));
|
AddHandler(htRevert,TMethod(OnRevert));
|
||||||
|
@ -2142,8 +2142,12 @@ begin
|
|||||||
ControlSelection.AssignPersistent(MouseDownComponent);
|
ControlSelection.AssignPersistent(MouseDownComponent);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
if PropertyEditorHook<>nil then
|
||||||
|
PropertyEditorHook.MouseDown(Sender, Button, Shift, p.X, p.Y);
|
||||||
|
|
||||||
if not ControlSelection.OnlyVisualComponentsSelected and ShowComponentCaptions then
|
if not ControlSelection.OnlyVisualComponentsSelected and ShowComponentCaptions then
|
||||||
Form.Invalidate;
|
Form.Invalidate;
|
||||||
|
|
||||||
{$IFDEF VerboseDesigner}
|
{$IFDEF VerboseDesigner}
|
||||||
DebugLn('[TDesigner.MouseDownOnControl] END');
|
DebugLn('[TDesigner.MouseDownOnControl] END');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -2527,6 +2531,10 @@ begin
|
|||||||
Exclude(FFlags,dfHasSized);
|
Exclude(FFlags,dfHasSized);
|
||||||
MouseDownComponent:=nil;
|
MouseDownComponent:=nil;
|
||||||
MouseDownSender:=nil;
|
MouseDownSender:=nil;
|
||||||
|
|
||||||
|
if PropertyEditorHook<>nil then
|
||||||
|
PropertyEditorHook.MouseUp(Sender, Button, Shift, p.X, p.Y);
|
||||||
|
|
||||||
{$IFDEF VerboseDesigner}
|
{$IFDEF VerboseDesigner}
|
||||||
DebugLn('[TDesigner.MouseUpOnControl] END');
|
DebugLn('[TDesigner.MouseUpOnControl] END');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
Loading…
Reference in New Issue
Block a user