mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-31 03:31:19 +02:00
Merged revision(s) 61674 #f6181c1d0d, 61687-61688 #2a64470b79-#2a64470b79 from trunk:
cocoa: ultimate fix for modal menus not making clicks. #35929 ........ cocoa: notifying the tablelist about number of items changing. #35957 ........ cocoa: applying resource leak patch by Zoë Peterson. #35944 ........ git-svn-id: branches/fixes_2_0@61700 -
This commit is contained in:
parent
864f673246
commit
c5febdebb9
@ -191,8 +191,8 @@ type
|
||||
//carbon//class procedure SetHotTrackStyles(const ALV: TCustomListView; const AValue: TListHotTrackStyles); override;
|
||||
//carbon//class procedure SetHoverTime(const ALV: TCustomListView; const AValue: Integer); override;
|
||||
class procedure SetImageList(const ALV: TCustomListView; const {%H-}AList: TListViewImageList; const {%H-}AValue: TCustomImageListResolution); override;
|
||||
(*class procedure SetItemsCount(const ALV: TCustomListView; const Avalue: Integer); override;
|
||||
class procedure SetOwnerData(const ALV: TCustomListView; const {%H-}AValue: Boolean); override;*)
|
||||
class procedure SetItemsCount(const ALV: TCustomListView; const Avalue: Integer); override;
|
||||
(*class procedure SetOwnerData(const ALV: TCustomListView; const {%H-}AValue: Boolean); override;*)
|
||||
class procedure SetProperty(const ALV: TCustomListView; const AProp: TListViewProperty; const AIsSet: Boolean); override;
|
||||
class procedure SetProperties(const ALV: TCustomListView; const AProps: TListViewProperties); override;
|
||||
class procedure SetScrollBars(const ALV: TCustomListView; const AValue: TScrollStyle); override;
|
||||
@ -1432,6 +1432,16 @@ begin
|
||||
lTableLV.lclSetImagesInCell(Assigned(AValue));
|
||||
end;
|
||||
|
||||
class procedure TCocoaWSCustomListView.SetItemsCount(
|
||||
const ALV: TCustomListView; const Avalue: Integer);
|
||||
var
|
||||
lCocoaLV: TCocoaListView;
|
||||
lTableLV: TCocoaTableListView;
|
||||
begin
|
||||
if not CheckParams(lCocoaLV, lTableLV, ALV) then Exit;
|
||||
lTableLV.noteNumberOfRowsChanged();
|
||||
end;
|
||||
|
||||
class procedure TCocoaWSCustomListView.SetProperty(const ALV: TCustomListView;
|
||||
const AProp: TListViewProperty; const AIsSet: Boolean);
|
||||
var
|
||||
|
@ -269,6 +269,7 @@ begin
|
||||
{$else}
|
||||
AView.setHidden(false);
|
||||
{$endif}
|
||||
AView.release;
|
||||
SetViewDefaults(Result);
|
||||
if AView.isKindOfClass(TCocoaCustomControl) then
|
||||
TCocoaCustomControl(AView).auxMouseByParent := true;
|
||||
|
@ -88,6 +88,7 @@ type
|
||||
// is about to be activated.
|
||||
procedure menuNeedsUpdate(AMenu: NSMenu); message 'menuNeedsUpdate:';
|
||||
//procedure menuDidClose(AMenu: NSMenu); message 'menuDidClose:';
|
||||
function worksWhenModal: LCLObjCBoolean; message 'worksWhenModal';
|
||||
end;
|
||||
|
||||
TCocoaMenuItem_HideApp = objcclass(NSMenuItem)
|
||||
@ -386,6 +387,18 @@ begin
|
||||
menuItemCallback.ItemSelected;
|
||||
end;
|
||||
|
||||
function TCocoaMenuItem.worksWhenModal: LCLObjCBoolean;
|
||||
begin
|
||||
// refer to NSMenuItem.target (Apple) documentation
|
||||
// the method must be implemented in target and return TRUE
|
||||
// otherwise it won't work for modal!
|
||||
//
|
||||
// The method COULD be used to protect the main menu from being clicked
|
||||
// if a modal window doesn't have a menu.
|
||||
// But LCL disables (is it?) the app menu manually on modal
|
||||
Result := true;
|
||||
end;
|
||||
|
||||
{ menuDidClose should not change the structure of the menu.
|
||||
The restructuring is causing issues on Apple's special menus (i.e. HELP menu)
|
||||
See bug #35625
|
||||
@ -840,21 +853,6 @@ begin
|
||||
end;
|
||||
res := TCocoaMenu(APopupMenu.Handle).popUpMenuPositioningItem_atLocation_inView(
|
||||
nil, NSMakePoint(px, py), view);
|
||||
|
||||
// for whatever reason a context menu will not fire the "action"
|
||||
// of the specified target. Thus we're doing it here manually. :(
|
||||
// It seems a typical behaviour for all versions of macOS
|
||||
// todo: find out why. (calling runModalSession makes no difference)
|
||||
if Assigned(CocoaWidgetSet.Modals) and (CocoaWidgetSet.Modals.Count>0) then
|
||||
begin
|
||||
mnu := TCocoaMenu(APopupMenu.Handle).highlightedItem;
|
||||
if res and Assigned(mnu) then
|
||||
begin
|
||||
if mnu.respondsToSelector(ObjCSelector('lclItemSelected:')) then
|
||||
TCocoaMenuItem(mnu).lclItemSelected(mnu);
|
||||
end;
|
||||
end;
|
||||
|
||||
APopupMenu.Close; // notify LCL popup menu
|
||||
end;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user