mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 04:59:20 +02:00
lcl: formatting
git-svn-id: trunk@20858 -
This commit is contained in:
parent
8d511f8bea
commit
c01c5e7c6f
@ -136,7 +136,8 @@ end;
|
|||||||
Creates the handle ( = object).
|
Creates the handle ( = object).
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TMenu.CreateHandle;
|
procedure TMenu.CreateHandle;
|
||||||
var i: integer;
|
var
|
||||||
|
i: integer;
|
||||||
begin
|
begin
|
||||||
FItems.Handle := TWSMenuClass(WidgetSetClass).CreateHandle(Self);
|
FItems.Handle := TWSMenuClass(WidgetSetClass).CreateHandle(Self);
|
||||||
// initiate creation of subitems
|
// initiate creation of subitems
|
||||||
|
@ -54,8 +54,8 @@ begin
|
|||||||
if Assigned(OnMenuPopupHandler) then OnMenuPopupHandler(Self);
|
if Assigned(OnMenuPopupHandler) then OnMenuPopupHandler(Self);
|
||||||
|
|
||||||
if (not Assigned(ActionLink) and AutoCheck) or (Assigned(ActionLink) and
|
if (not Assigned(ActionLink) and AutoCheck) or (Assigned(ActionLink) and
|
||||||
not (ActionLink.IsAutoCheckLinked) and AutoCheck)
|
not (ActionLink.IsAutoCheckLinked) and AutoCheck) then
|
||||||
then begin
|
begin
|
||||||
// Break a little Delphi compatibility
|
// Break a little Delphi compatibility
|
||||||
// It makes no sense to uncheck a checked RadioItem (besides, GTK can't handle it)
|
// It makes no sense to uncheck a checked RadioItem (besides, GTK can't handle it)
|
||||||
if (not RadioItem) or (not Checked) then
|
if (not RadioItem) or (not Checked) then
|
||||||
@ -65,12 +65,13 @@ begin
|
|||||||
{ Call OnClick if assigned and not equal to associated action's OnExecute.
|
{ Call OnClick if assigned and not equal to associated action's OnExecute.
|
||||||
If associated action's OnExecute assigned then call it, otherwise, call
|
If associated action's OnExecute assigned then call it, otherwise, call
|
||||||
OnClick. }
|
OnClick. }
|
||||||
if Assigned(FOnClick)
|
if Assigned(FOnClick) and (Action <> nil) and (FOnClick <> Action.OnExecute) then
|
||||||
and (Action <> nil) and (FOnClick <> Action.OnExecute) then
|
|
||||||
FOnClick(Self)
|
FOnClick(Self)
|
||||||
else if not (csDesigning in ComponentState) and (ActionLink <> nil) then
|
else
|
||||||
|
if not (csDesigning in ComponentState) and (ActionLink <> nil) then
|
||||||
FActionLink.Execute(Self)
|
FActionLink.Execute(Self)
|
||||||
else if Assigned(FOnClick) then
|
else
|
||||||
|
if Assigned(FOnClick) then
|
||||||
FOnClick(Self);
|
FOnClick(Self);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -118,28 +119,31 @@ end;
|
|||||||
Creates the handle ( = object).
|
Creates the handle ( = object).
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TMenuItem.CreateHandle;
|
procedure TMenuItem.CreateHandle;
|
||||||
var i: Integer;
|
var
|
||||||
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
//DebugLn('TMenuItem.CreateHandle ',dbgsName(Self),' ',dbgs(Self));
|
//DebugLn('TMenuItem.CreateHandle ',dbgsName(Self),' ',dbgs(Self));
|
||||||
//DebugLn('TMenuItem.CreateHandle START ',Name,':',ClassName);
|
//DebugLn('TMenuItem.CreateHandle START ',Name,':',ClassName);
|
||||||
if not FVisible then RaiseGDBException('');
|
if not FVisible then RaiseGDBException('');
|
||||||
Handle := TWSMenuItemClass(WidgetSetClass).CreateHandle(Self);
|
Handle := TWSMenuItemClass(WidgetSetClass).CreateHandle(Self);
|
||||||
if FItems<>nil then begin
|
if FItems <> nil then
|
||||||
for i := 0 to Count - 1 do begin
|
begin
|
||||||
|
for i := 0 to Count - 1 do
|
||||||
|
begin
|
||||||
if Items[i].Visible then
|
if Items[i].Visible then
|
||||||
Items[i].HandleNeeded;
|
Items[i].HandleNeeded;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if Parent <> nil then
|
if Parent <> nil then
|
||||||
begin
|
begin
|
||||||
Parent.HandleNeeded;
|
Parent.HandleNeeded;
|
||||||
//DebugLn('TMenuItem.CreateHandle Attaching ... ',Name,':',ClassName);
|
//DebugLn('TMenuItem.CreateHandle Attaching ... ',Name,':',ClassName);
|
||||||
if Parent.HandleAllocated then
|
if Parent.HandleAllocated then
|
||||||
TWSMenuItemClass(WidgetSetClass).AttachMenu(Self);
|
TWSMenuItemClass(WidgetSetClass).AttachMenu(Self);
|
||||||
end;
|
|
||||||
if (Parent<>nil) then
|
if HandleAllocated then
|
||||||
begin
|
begin
|
||||||
if HandleAllocated then begin
|
|
||||||
if ShortCut <> 0 then ShortCutChanged(0, Shortcut);
|
if ShortCut <> 0 then ShortCutChanged(0, Shortcut);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -648,19 +652,22 @@ end;
|
|||||||
Free the Handle
|
Free the Handle
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TMenuItem.DestroyHandle;
|
procedure TMenuItem.DestroyHandle;
|
||||||
var i: integer;
|
var
|
||||||
|
i: integer;
|
||||||
begin
|
begin
|
||||||
if not HandleAllocated then exit;
|
if not HandleAllocated then exit;
|
||||||
//DebugLn('TMenuItem.DestroyHandle ',dbgsName(Self),' ',dbgs(Self));
|
//DebugLn('TMenuItem.DestroyHandle ',dbgsName(Self),' ',dbgs(Self));
|
||||||
if assigned (FItems) then begin
|
if Assigned(FItems) then
|
||||||
i := FItems.Count-1;
|
begin
|
||||||
while i>=0 do begin
|
i := FItems.Count - 1;
|
||||||
|
while i >= 0 do
|
||||||
|
begin
|
||||||
TMenuItem(FItems[i]).DestroyHandle;
|
TMenuItem(FItems[i]).DestroyHandle;
|
||||||
dec(i);
|
dec(i);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
TWSMenuItemClass(WidgetSetClass).DestroyHandle(Self);
|
TWSMenuItemClass(WidgetSetClass).DestroyHandle(Self);
|
||||||
FHandle:=0;
|
FHandle := 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMenuItem.Loaded;
|
procedure TMenuItem.Loaded;
|
||||||
|
@ -54,7 +54,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPopupMenu.PopUp();
|
procedure TPopupMenu.PopUp();
|
||||||
var MousePos: TPoint;
|
var
|
||||||
|
MousePos: TPoint;
|
||||||
begin
|
begin
|
||||||
GetCursorPos(MousePos);
|
GetCursorPos(MousePos);
|
||||||
PopUp(MousePos.x,MousePos.y);
|
PopUp(MousePos.x,MousePos.y);
|
||||||
@ -62,7 +63,7 @@ end;
|
|||||||
|
|
||||||
procedure TPopupMenu.PopUp(X,Y : Integer);
|
procedure TPopupMenu.PopUp(X,Y : Integer);
|
||||||
begin
|
begin
|
||||||
if ActivePopupMenu<>nil then ActivePopupMenu.Close;
|
if ActivePopupMenu <> nil then ActivePopupMenu.Close;
|
||||||
FPopupPoint := Point(X, Y);
|
FPopupPoint := Point(X, Y);
|
||||||
ReleaseCapture;
|
ReleaseCapture;
|
||||||
DoPopup(Self);
|
DoPopup(Self);
|
||||||
|
Loading…
Reference in New Issue
Block a user