mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-19 22:49:30 +02:00
Cocoa: Integrate not Managed ScrollBar and Legacy Implement
This commit is contained in:
parent
79b3c78ac0
commit
71d3a8aebb
@ -208,6 +208,8 @@ type
|
||||
procedure setFrame(newValue: NSRect); override;
|
||||
end;
|
||||
|
||||
function createLegacyScroller: TCocoaScrollBar;
|
||||
|
||||
function isMouseEventInScrollBar(host: TCocoaManualScrollView; event: NSEvent): Boolean;
|
||||
|
||||
// These settings are set by a user in "System Preferences"
|
||||
@ -441,23 +443,15 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure allocScroller(parent: TCocoaManualScrollView; var sc: NSScroller; dst: NSRect; aVisible: Boolean);
|
||||
// for the Scroller created separately through TCocoaWSScrollBar.CreateHandle(),
|
||||
// due to the lack of the control over the Layout by TCocoaManualScrollView,
|
||||
// only the Legacy Style can be used for compatibility.
|
||||
// it's the same logical relationship as NSScrollView and NSScroller.
|
||||
function createLegacyScroller: TCocoaScrollBar;
|
||||
begin
|
||||
sc:=TCocoaScrollBar(TCocoaScrollBar.alloc).initWithFrame(dst);
|
||||
parent.addSubview(sc);
|
||||
{$ifdef BOOLFIX}
|
||||
sc.setEnabled_(Ord(true));
|
||||
sc.setHidden_(Ord(not AVisible));
|
||||
{$else}
|
||||
sc.setEnabled(true);
|
||||
sc.setHidden(not AVisible);
|
||||
{$endif}
|
||||
TCocoaScrollBar(sc).preventBlock := true;
|
||||
//Suppress scrollers notifications.
|
||||
TCocoaScrollBar(sc).callback := parent.callback;
|
||||
TCocoaScrollBar(sc).suppressLCLMouse := true;
|
||||
sc.setTarget(sc);
|
||||
sc.setAction(objcselector('actionScrolling:'));
|
||||
Result:= TCocoaScrollBar(TCocoaScrollBar.alloc);
|
||||
Result.manager:= TCocoaScrollStyleManagerLegacy.createForScrollBar;
|
||||
Result.effect:= Result.manager.createScrollBarEffect(Result);
|
||||
end;
|
||||
|
||||
function allocScroller(parent: TCocoaManualScrollView; dst: NSRect; aVisible: Boolean)
|
||||
|
@ -2270,7 +2270,12 @@ begin
|
||||
prm.Height:=ScrollBase;
|
||||
end;
|
||||
|
||||
scr:=NSView(TCocoaScrollBar.alloc).lclInitWithCreateParams(prm);
|
||||
// for the Scroller created separately through TCocoaWSScrollBar.CreateHandle(),
|
||||
// due to the lack of the control over the Layout by TCocoaManualScrollView,
|
||||
// only the Legacy Style can be used for compatibility.
|
||||
// it's the same logical relationship as NSScrollView and NSScroller.
|
||||
scr:= createLegacyScroller;
|
||||
scr.lclInitWithCreateParams(prm);
|
||||
scr.callback:=TLCLCommonCallback.Create(scr, AWinControl);
|
||||
|
||||
// OnChange (scrolling) event handling
|
||||
|
Loading…
Reference in New Issue
Block a user