mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 00:54:03 +02:00
cocoa: hiding focus ring, if borderstyle is none. bug #34828
git-svn-id: trunk@62531 -
This commit is contained in:
parent
98c349fc08
commit
35bf1396b2
@ -245,6 +245,8 @@ var
|
|||||||
CocoaToggleBezel : NSBezelStyle = NSRoundedBezelStyle;
|
CocoaToggleBezel : NSBezelStyle = NSRoundedBezelStyle;
|
||||||
CocoaToggleType : NSButtonType = NSPushOnPushOffButton;
|
CocoaToggleType : NSButtonType = NSPushOnPushOffButton;
|
||||||
|
|
||||||
|
CocoaHideFocusNoBorder : Boolean = true;
|
||||||
|
|
||||||
{$ifdef COCOALOOPHIJACK}
|
{$ifdef COCOALOOPHIJACK}
|
||||||
// The flag is set to true once hi-jacked loop is finished (at the end of app)
|
// The flag is set to true once hi-jacked loop is finished (at the end of app)
|
||||||
// The flag is checked in Menus to avoid "double" Cmd+Q menu
|
// The flag is checked in Menus to avoid "double" Cmd+Q menu
|
||||||
|
@ -244,6 +244,7 @@ begin
|
|||||||
scroll.setAutohidesScrollers(true);
|
scroll.setAutohidesScrollers(true);
|
||||||
|
|
||||||
ScrollViewSetBorderStyle(scroll, TCustomCheckListBox(AWinControl).BorderStyle);
|
ScrollViewSetBorderStyle(scroll, TCustomCheckListBox(AWinControl).BorderStyle);
|
||||||
|
UpdateFocusRing(list, TCustomCheckListBox(AWinControl).BorderStyle);
|
||||||
|
|
||||||
Result := TLCLIntfHandle(scroll);
|
Result := TLCLIntfHandle(scroll);
|
||||||
end;
|
end;
|
||||||
|
@ -1027,6 +1027,7 @@ begin
|
|||||||
lCocoaLV.callback := lclcb;
|
lCocoaLV.callback := lclcb;
|
||||||
|
|
||||||
ScrollViewSetBorderStyle(lCocoaLV, TCustomListView(AWinControl).BorderStyle);
|
ScrollViewSetBorderStyle(lCocoaLV, TCustomListView(AWinControl).BorderStyle);
|
||||||
|
UpdateFocusRing(lTableLV, TCustomListView(AWinControl).BorderStyle);
|
||||||
|
|
||||||
{$IFDEF COCOA_DEBUG_LISTVIEW}
|
{$IFDEF COCOA_DEBUG_LISTVIEW}
|
||||||
WriteLn(Format('[TCocoaWSCustomListView.CreateHandle] headerView=%d', [PtrInt(lTableLV.headerView)]));
|
WriteLn(Format('[TCocoaWSCustomListView.CreateHandle] headerView=%d', [PtrInt(lTableLV.headerView)]));
|
||||||
@ -1039,6 +1040,7 @@ class procedure TCocoaWSCustomListView.SetBorderStyle(
|
|||||||
begin
|
begin
|
||||||
if not Assigned(AWinControl) or not AWinControl.HandleAllocated then Exit;
|
if not Assigned(AWinControl) or not AWinControl.HandleAllocated then Exit;
|
||||||
ScrollViewSetBorderStyle(NSScrollView(AWinControl.Handle), ABorderStyle);
|
ScrollViewSetBorderStyle(NSScrollView(AWinControl.Handle), ABorderStyle);
|
||||||
|
UpdateFocusRing(NSView(NSScrollView(AWinControl.Handle).documentView), ABorderStyle);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TCocoaWSCustomListView.ColumnDelete(const ALV: TCustomListView;
|
class procedure TCocoaWSCustomListView.ColumnDelete(const ALV: TCustomListView;
|
||||||
|
@ -160,6 +160,7 @@ function EmbedInManualScrollHost(AView: TCocoaManualScrollView): TCocoaManualScr
|
|||||||
function HWNDToTargetObject(AFormHandle: HWND): TObject;
|
function HWNDToTargetObject(AFormHandle: HWND): TObject;
|
||||||
|
|
||||||
procedure ScrollViewSetBorderStyle(sv: NSScrollView; astyle: TBorderStyle);
|
procedure ScrollViewSetBorderStyle(sv: NSScrollView; astyle: TBorderStyle);
|
||||||
|
procedure UpdateFocusRing(v: NSView; astyle: TBorderStyle);
|
||||||
|
|
||||||
function ButtonStateToShiftState(BtnState: PtrUInt): TShiftState;
|
function ButtonStateToShiftState(BtnState: PtrUInt): TShiftState;
|
||||||
function CocoaModifiersToKeyState(AModifiers: NSUInteger): PtrInt;
|
function CocoaModifiersToKeyState(AModifiers: NSUInteger): PtrInt;
|
||||||
@ -218,6 +219,17 @@ begin
|
|||||||
sv.setBorderType( NSBorderStyle[astyle] );
|
sv.setBorderType( NSBorderStyle[astyle] );
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure UpdateFocusRing(v: NSView; astyle: TBorderStyle);
|
||||||
|
const
|
||||||
|
NSFocusRing : array [TBorderStyle] of NSBorderType = (
|
||||||
|
NSFocusRingTypeNone, // bsNone
|
||||||
|
NSFocusRingTypeDefault // bsSingle s
|
||||||
|
);
|
||||||
|
begin
|
||||||
|
if Assigned(v) and CocoaHideFocusNoBorder then
|
||||||
|
v.setFocusRingType( NSFocusRing[astyle] );
|
||||||
|
end;
|
||||||
|
|
||||||
function EmbedInScrollView(AView: NSView; AReleaseView: Boolean): TCocoaScrollView;
|
function EmbedInScrollView(AView: NSView; AReleaseView: Boolean): TCocoaScrollView;
|
||||||
var
|
var
|
||||||
r: TRect;
|
r: TRect;
|
||||||
|
@ -943,6 +943,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
TextFieldSetAllignment(field, TCustomEdit(AWinControl).Alignment);
|
TextFieldSetAllignment(field, TCustomEdit(AWinControl).Alignment);
|
||||||
TextFieldSetBorderStyle(field, TCustomEdit(AWinControl).BorderStyle);
|
TextFieldSetBorderStyle(field, TCustomEdit(AWinControl).BorderStyle);
|
||||||
|
UpdateFocusRing(field, TCustomEdit(AWinControl).BorderStyle);
|
||||||
|
|
||||||
Result:=TLCLIntfHandle(field);
|
Result:=TLCLIntfHandle(field);
|
||||||
end;
|
end;
|
||||||
@ -969,6 +970,7 @@ begin
|
|||||||
if not Assigned(field) then Exit;
|
if not Assigned(field) then Exit;
|
||||||
field.setBordered_( ObjCBool(ABorderStyle <> bsNone) );
|
field.setBordered_( ObjCBool(ABorderStyle <> bsNone) );
|
||||||
field.setBezeled_( ObjCBool(ABorderStyle <> bsNone) );
|
field.setBezeled_( ObjCBool(ABorderStyle <> bsNone) );
|
||||||
|
UpdateFocusRing(field, ABorderStyle);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TCocoaWSCustomEdit.GetSelStart(const ACustomEdit: TCustomEdit): integer;
|
class function TCocoaWSCustomEdit.GetSelStart(const ACustomEdit: TCustomEdit): integer;
|
||||||
@ -1440,6 +1442,7 @@ begin
|
|||||||
scr.setDrawsBackground(false);
|
scr.setDrawsBackground(false);
|
||||||
|
|
||||||
ScrollViewSetBorderStyle(scr, TCustomMemo(AWinControl).BorderStyle);
|
ScrollViewSetBorderStyle(scr, TCustomMemo(AWinControl).BorderStyle);
|
||||||
|
UpdateFocusRing(txt, TCustomMemo(AWinControl).BorderStyle);
|
||||||
|
|
||||||
nr:=scr.documentVisibleRect;
|
nr:=scr.documentVisibleRect;
|
||||||
txt.setFrame(nr);
|
txt.setFrame(nr);
|
||||||
@ -1531,6 +1534,7 @@ begin
|
|||||||
if not Assigned(sv) then Exit;
|
if not Assigned(sv) then Exit;
|
||||||
|
|
||||||
ScrollViewSetBorderStyle(sv, ABorderStyle);
|
ScrollViewSetBorderStyle(sv, ABorderStyle);
|
||||||
|
UpdateFocusRing(NSView(sv.documentView), ABorderStyle);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TCocoaWSCustomMemo.GetCaretPos(const ACustomEdit: TCustomEdit): TPoint;
|
class function TCocoaWSCustomMemo.GetCaretPos(const ACustomEdit: TCustomEdit): TPoint;
|
||||||
@ -2086,6 +2090,7 @@ begin
|
|||||||
scroll.setHasVerticalScroller(true);
|
scroll.setHasVerticalScroller(true);
|
||||||
scroll.setAutohidesScrollers(true);
|
scroll.setAutohidesScrollers(true);
|
||||||
ScrollViewSetBorderStyle(scroll, lclListBox.BorderStyle);
|
ScrollViewSetBorderStyle(scroll, lclListBox.BorderStyle);
|
||||||
|
UpdateFocusRing(list, lclListBox.BorderStyle);
|
||||||
|
|
||||||
Result := TLCLIntfHandle(scroll);
|
Result := TLCLIntfHandle(scroll);
|
||||||
end;
|
end;
|
||||||
@ -2198,6 +2203,7 @@ begin
|
|||||||
if not Assigned(list) then Exit;
|
if not Assigned(list) then Exit;
|
||||||
|
|
||||||
ScrollViewSetBorderStyle(list.enclosingScrollView, ABorderStyle);
|
ScrollViewSetBorderStyle(list.enclosingScrollView, ABorderStyle);
|
||||||
|
UpdateFocusRing(list, ABorderStyle);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TCocoaWSCustomListBox.SetItemIndex(const ACustomListBox: TCustomListBox; const AIndex: integer);
|
class procedure TCocoaWSCustomListBox.SetItemIndex(const ACustomListBox: TCustomListBox; const AIndex: integer);
|
||||||
|
Loading…
Reference in New Issue
Block a user