mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 03:19:47 +02:00
cocoa: use the same way to get mertrics as for carbon since HiTheme is still supported on 64bit osx and is the only way to query theme metrics
git-svn-id: trunk@38928 -
This commit is contained in:
parent
8035a82e6f
commit
68ef99b929
@ -29,7 +29,7 @@ interface
|
|||||||
{.$I cocoadefines.inc}
|
{.$I cocoadefines.inc}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
// MacOSAll,
|
MacOSAll,
|
||||||
Classes, SysUtils, Types, LCLType, LCLProc, LCLClasses, LMessages,
|
Classes, SysUtils, Types, LCLType, LCLProc, LCLClasses, LMessages,
|
||||||
Controls, Forms, Graphics, Math, GraphType;
|
Controls, Forms, Graphics, Math, GraphType;
|
||||||
|
|
||||||
@ -68,9 +68,8 @@ function FontStyleToQDStyle(const AStyle: TFontStyles): MacOSAll.Style;
|
|||||||
function QDStyleToFontStyle(QDStyle: Integer): TFontStyles;}
|
function QDStyleToFontStyle(QDStyle: Integer): TFontStyles;}
|
||||||
|
|
||||||
procedure FillStandardDescription(out Desc: TRawImageDescription);
|
procedure FillStandardDescription(out Desc: TRawImageDescription);
|
||||||
|
function GetHiThemeMetric(Metric: ThemeMetric; DefaultValue: Integer = 0): Integer;
|
||||||
{function GetCarbonThemeMetric(Metric: ThemeMetric; DefaultValue: Integer = 0): Integer;
|
{
|
||||||
|
|
||||||
function CreateCustomHIView(const ARect: HIRect; ControlStyle: TControlStyle = []): HIViewRef;
|
function CreateCustomHIView(const ARect: HIRect; ControlStyle: TControlStyle = []): HIViewRef;
|
||||||
|
|
||||||
procedure SetControlViewStyle(Control: ControlRef; TinySize, SmallSize, NormalSize: Integer; ControlHeight: Boolean = True);
|
procedure SetControlViewStyle(Control: ControlRef; TinySize, SmallSize, NormalSize: Integer; ControlHeight: Boolean = True);
|
||||||
@ -618,19 +617,19 @@ begin
|
|||||||
Desc.MaskLineEnd := rileByteBoundary;
|
Desc.MaskLineEnd := rileByteBoundary;
|
||||||
Desc.MaskShift := 0;
|
Desc.MaskShift := 0;
|
||||||
end;
|
end;
|
||||||
(*
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Name: GetCarbonThemeMetric
|
Name: GetHiThemeMetric
|
||||||
Params: Metric - Theme metric
|
Params: Metric - Theme metric
|
||||||
DefaultValue
|
DefaultValue
|
||||||
Returns: Theme metric value or default value if fails
|
Returns: Theme metric value or default value if fails
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function GetCarbonThemeMetric(Metric: ThemeMetric; DefaultValue: Integer): Integer;
|
function GetHiThemeMetric(Metric: ThemeMetric; DefaultValue: Integer): Integer;
|
||||||
begin
|
begin
|
||||||
if OSError(GetThemeMetric(Metric, Result),
|
if GetThemeMetric(Metric, Result) <> noErr then
|
||||||
'GetCarbonThemeMetric', 'GetThemeMetric') then Result := DefaultValue;
|
Result := DefaultValue;
|
||||||
end;
|
end;
|
||||||
|
(*
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Name: CreateCustomHIView
|
Name: CreateCustomHIView
|
||||||
Params: ARect - Bounds rect
|
Params: ARect - Bounds rect
|
||||||
|
@ -1745,11 +1745,11 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
case NIndex of
|
case NIndex of
|
||||||
{ SM_CXHSCROLL,
|
SM_CXHSCROLL,
|
||||||
SM_CYHSCROLL,
|
SM_CYHSCROLL,
|
||||||
SM_CXVSCROLL,
|
SM_CXVSCROLL,
|
||||||
SM_CYVSCROLL:
|
SM_CYVSCROLL:
|
||||||
Result := 10;//GetCarbonThemeMetric(kThemeMetricScrollBarWidth);}
|
Result := GetHiThemeMetric(kThemeMetricScrollBarWidth);
|
||||||
SM_CXSCREEN,
|
SM_CXSCREEN,
|
||||||
SM_CXVIRTUALSCREEN: Result := Round(NSScreen.mainScreen.frame.size.width);
|
SM_CXVIRTUALSCREEN: Result := Round(NSScreen.mainScreen.frame.size.width);
|
||||||
SM_CYSCREEN,
|
SM_CYSCREEN,
|
||||||
@ -1769,10 +1769,10 @@ begin
|
|||||||
Result := 64 else}
|
Result := 64 else}
|
||||||
Result := 16;
|
Result := 16;
|
||||||
end;
|
end;
|
||||||
{ SM_CXHTHUMB:
|
SM_CXHTHUMB:
|
||||||
Result := 16;//GetCarbonThemeMetric(kThemeMetricScrollBarMinThumbWidth);
|
Result := GetHiThemeMetric(kThemeMetricScrollBarMinThumbWidth);
|
||||||
SM_CYVTHUMB:
|
SM_CYVTHUMB:
|
||||||
Result := 16;//GetCarbonThemeMetric(kThemeMetricScrollBarMinThumbHeight);}
|
Result := GetHiThemeMetric(kThemeMetricScrollBarMinThumbHeight);
|
||||||
SM_SWSCROLLBARSPACING:
|
SM_SWSCROLLBARSPACING:
|
||||||
Result := 0;
|
Result := 0;
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user