Cocoa/Scroller: replace deprecated functions

This commit is contained in:
rich2014 2023-12-17 18:08:01 +08:00
parent 9f16f34839
commit fc3071a276
2 changed files with 8 additions and 6 deletions

View File

@ -569,7 +569,8 @@ begin
else
begin
f := frame;
w := NSScroller.scrollerWidth;
w := NSScroller.scrollerWidthForControlSize_scrollerStyle(
fhscroll.controlSize, fhscroll.preferredScrollerStyle);
r := NSMakeRect(0, 0, Max(f.size.width,w+1), w); // width<height to create a horizontal scroller
allocScroller( self, fhscroll, r, avisible);
fhscroll.setAutoresizingMask(NSViewWidthSizable);
@ -588,7 +589,8 @@ begin
else
begin
f := frame;
w := NSScroller.scrollerWidth;
w := NSScroller.scrollerWidthForControlSize_scrollerStyle(
fvscroll.controlSize, fvscroll.preferredScrollerStyle);
r := NSMakeRect(0, 0, w, Max(f.size.height,w+1)); // height<width to create a vertical scroller
allocScroller( self, fvscroll, r, avisible);
fvscroll.setAutoresizingMask(NSViewHeightSizable or NSViewMinXMargin);

View File

@ -1548,10 +1548,10 @@ begin
else if (BarKind = SB_Horz) and Assigned(NSScrollView(obj).horizontalScroller) then
Result:=round(NSScrollView(obj).verticalScroller.frame.size.height)
else
Result := Round(NSScroller.scrollerWidth);
Result := GetSystemMetrics(SM_CXVSCROLL);
end
else
Result := Round(NSScroller.scrollerWidth);
Result := GetSystemMetrics(SM_CXVSCROLL);
end;
function TCocoaWidgetSet.GetScrollbarVisible(Handle: HWND; SBStyle: Integer): boolean;
@ -2601,7 +2601,7 @@ begin
SM_CYHSCROLL,
SM_CXVSCROLL,
SM_CYVSCROLL:
Result := Round(NSScroller.scrollerWidthForControlSize(NSRegularControlSize));
Result := Round(NSScroller.scrollerWidthForControlSize_scrollerStyle(NSRegularControlSize, NSScrollerStyleLegacy));
SM_CXSCREEN,
SM_CXFULLSCREEN:
Result := Round(NSPrimaryScreenFrame.size.width);
@ -2631,7 +2631,7 @@ begin
end;
SM_CXDRAG,SM_CYDRAG: Result := 5;
SM_CXHTHUMB, SM_CYVTHUMB:
Result := Round(NSScroller.scrollerWidthForControlSize(NSRegularControlSize));
Result := Round(NSScroller.scrollerWidthForControlSize_scrollerStyle(NSRegularControlSize, NSScrollerStyleLegacy));
SM_SWSCROLLBARSPACING:
Result := 0;
SM_LCLHasFormAlphaBlend: