mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-08 10:39:15 +02:00
carbon and cocoa widget set, printers4lazarus: fixed compilation with fpc 2.2.1 and higher
git-svn-id: trunk@15310 -
This commit is contained in:
parent
d6da0cd1a5
commit
561fbf548c
@ -21,7 +21,12 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LCLProc, LCLType, gl, Forms,
|
||||
FPCMacOSAll, CarbonInt, AGL, CarbonProc, CarbonDef, CarbonPrivate,
|
||||
{$ifdef ver2_2_0}
|
||||
FPCMacOSAll,
|
||||
{$else}
|
||||
MacOSAll,
|
||||
{$endif}
|
||||
CarbonInt, AGL, CarbonProc, CarbonDef, CarbonPrivate,
|
||||
WSLCLClasses, CarbonWSControls, CarbonUtils,
|
||||
Controls;
|
||||
|
||||
|
@ -1,6 +1,11 @@
|
||||
{%MainUnit ../osprinters.pas}
|
||||
uses
|
||||
FPCMacOSAll, Classes, SysUtils, Printers, LCLType, CarbonCanvas, CarbonPrinting;
|
||||
{$ifdef ver2_2_0}
|
||||
FPCMacOSAll,
|
||||
{$else}
|
||||
MacOSAll,
|
||||
{$endif}
|
||||
Classes, SysUtils, Printers, LCLType, CarbonCanvas, CarbonPrinting;
|
||||
|
||||
type
|
||||
{ TCarbonPrinterContext }
|
||||
|
@ -10,9 +10,14 @@ unit CarbonPrinting;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FPCMacOSAll;
|
||||
|
||||
// functions missing in FPCMacOSAll
|
||||
Classes, SysUtils,
|
||||
{$ifdef ver2_2_0}
|
||||
FPCMacOSAll;
|
||||
{$else}
|
||||
MacOSAll;
|
||||
{$endif}
|
||||
|
||||
// functions missing in MacOSAll
|
||||
type
|
||||
PMPaper = ^SInt32; { an opaque 32-bit type }
|
||||
PMPaperPtr = ^PMPaper; { when a var xx:PMPaper parameter can be nil, it is changed to xx: PMPaperPtr }
|
||||
|
@ -83,7 +83,14 @@ uses Controls, udlgSelectPrinter, udlgPropertiesPrinter, FileUtil;
|
||||
|
||||
{$ELSE}
|
||||
|
||||
uses Controls, Math, CarbonProc, FPCMacOSAll, LCLProc;
|
||||
uses
|
||||
Controls, Math, CarbonProc,
|
||||
{$ifdef ver2_2_0}
|
||||
FPCMacOSAll,
|
||||
{$else}
|
||||
MacOSAll,
|
||||
{$endif}
|
||||
LCLProc;
|
||||
{$I carbonprndialogs.inc}
|
||||
|
||||
{$ENDIF}
|
||||
|
@ -147,7 +147,7 @@ end;
|
||||
|
||||
function GetCaretBlinkTime: Cardinal;
|
||||
begin
|
||||
// TODO: use FPCMacOSAll.GetCaretTime
|
||||
// TODO: use MacOSAll.GetCaretTime
|
||||
Result := 600; // our default value
|
||||
end;
|
||||
|
||||
|
@ -154,7 +154,7 @@ type
|
||||
TEventInt = packed record
|
||||
case Integer of
|
||||
1: (Chars: array[0..4] of Char);
|
||||
2: (Int: FPCMacOSAll.UInt32);
|
||||
2: (Int: {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.UInt32);
|
||||
end;
|
||||
|
||||
const
|
||||
|
@ -555,7 +555,7 @@ begin
|
||||
if OSError(
|
||||
CreatePopupButtonControl(GetTopParentWindow,
|
||||
ParamsToCarbonRect(AParams), nil, -12345, False, 0, popupTitleLeftJust,
|
||||
FPCMacOSAll.Normal, Widget),
|
||||
{$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.Normal, Widget),
|
||||
Self, SCreateWidget, 'CreatePopupButtonControl')then RaiseCreateWidgetError(LCLObject);
|
||||
|
||||
OSError(CreateNewMenu(0, kMenuAttrAutoDisable, FPopupMenu),
|
||||
@ -1273,7 +1273,7 @@ end;
|
||||
procedure TCarbonMemo.CreateWidget(const AParams: TCreateParams);
|
||||
var
|
||||
Control: ControlRef;
|
||||
Options: FPCMacOSAll.OptionBits;
|
||||
Options: {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.OptionBits;
|
||||
R: HIRect;
|
||||
begin
|
||||
Options := kTXNMonostyledTextMask or kOutputTextInUnicodeEncodingMask;
|
||||
|
@ -572,7 +572,7 @@ end;
|
||||
procedure TCarbonMenu.SetBitmap(const ABitmap: TBitmap);
|
||||
var
|
||||
IconType: Byte;
|
||||
AHandle: FPCMacOSAll.Handle;
|
||||
AHandle: {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.Handle;
|
||||
CGImage: CGImageRef;
|
||||
const
|
||||
SName = 'SetBitmap';
|
||||
@ -714,9 +714,9 @@ begin
|
||||
if FParentMenu = nil then Exit;
|
||||
|
||||
if LCLMenuItem.Default then
|
||||
Style := FPCMAcOSAll.bold
|
||||
Style := {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.bold
|
||||
else
|
||||
Style := FPCMAcOSAll.normal;
|
||||
Style := {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.normal;
|
||||
|
||||
SetItemStyle(FParentMenu.Menu, GetIndex + 1, Style);
|
||||
end;
|
||||
|
@ -127,7 +127,7 @@ begin
|
||||
// Run our event loop until quitNow is set.
|
||||
Loop;
|
||||
finally
|
||||
FPCMacOSAll.RemoveEventHandler(QuitHandler);
|
||||
{$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.RemoveEventHandler(QuitHandler);
|
||||
end;
|
||||
finally
|
||||
DisposeEventHandlerUPP(QuitUPP);
|
||||
@ -438,7 +438,7 @@ begin
|
||||
ReleaseEvent(DummyEvent);
|
||||
end;
|
||||
finally
|
||||
FPCMacOSAll.RemoveEventHandler(EventLoopHandler);
|
||||
{$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.RemoveEventHandler(EventLoopHandler);
|
||||
end;
|
||||
finally
|
||||
DisposeEventHandlerUPP(EventLoopUPP);
|
||||
|
@ -228,7 +228,7 @@ function CarbonCommon_CursorChange(ANextHandler: EventHandlerCallRef;
|
||||
AEvent: EventRef;
|
||||
AWidget: TCarbonWidget): OSStatus; {$IFDEF darwin}mwpascal;{$ENDIF}
|
||||
var
|
||||
ALocation: FPCMacOSAll.Point;
|
||||
ALocation: {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.Point;
|
||||
AModifiers: UInt32;
|
||||
ACursorWasSet: Boolean;
|
||||
|
||||
|
@ -364,12 +364,12 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
function TCarbonControl.GetControlContentRect(var ARect: TRect): Boolean;
|
||||
var
|
||||
AClientRect: FPCMacOSAll.Rect;
|
||||
ClientRegion: FPCMacOSAll.RgnHandle;
|
||||
AClientRect: {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.Rect;
|
||||
ClientRegion: {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.RgnHandle;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
ClientRegion := FPCMacOSAll.NewRgn();
|
||||
ClientRegion := {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.NewRgn();
|
||||
try
|
||||
if OSError(GetControlRegion(ControlRef(Widget), kControlContentMetaPart, ClientRegion),
|
||||
Self, 'GetControlContentRect', 'GetControlRegion') then Exit;
|
||||
@ -377,7 +377,7 @@ begin
|
||||
Result := GetRegionBounds(ClientRegion, AClientRect) <> nil;
|
||||
if Result then ARect := CarbonRectToRect(AClientRect);
|
||||
finally
|
||||
FPCMacOSAll.DisposeRgn(ClientRegion);
|
||||
{$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.DisposeRgn(ClientRegion);
|
||||
end;
|
||||
|
||||
{$IFDEF VerboseBounds}
|
||||
@ -471,7 +471,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
function TCarbonControl.EmbedInScrollView(AScrollBars: TScrollStyle): HIViewRef;
|
||||
var
|
||||
ScrollOptions: FPCMacOSAll.OptionBits;
|
||||
ScrollOptions: {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.OptionBits;
|
||||
Bounds: HIRect;
|
||||
const
|
||||
SName = 'EmbedInScrollView';
|
||||
@ -642,7 +642,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
function TCarbonControl.IsVisible: Boolean;
|
||||
begin
|
||||
Result := FPCMacOSAll.IsControlVisible(Frames[0]);
|
||||
Result := {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.IsControlVisible(Frames[0]);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -656,16 +656,16 @@ function TCarbonControl.Enable(AEnable: Boolean): Boolean;
|
||||
var
|
||||
I: Integer;
|
||||
begin
|
||||
Result := not FPCMacOSAll.IsControlEnabled(Frames[0]);
|
||||
Result := not {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.IsControlEnabled(Frames[0]);
|
||||
|
||||
if AEnable then
|
||||
begin
|
||||
for I := 0 to GetFrameCount - 1 do
|
||||
OSError(FPCMacOSAll.EnableControl(Frames[I]), Self, SEnable, SEnableControl);
|
||||
OSError({$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.EnableControl(Frames[I]), Self, SEnable, SEnableControl);
|
||||
end
|
||||
else
|
||||
for I := 0 to GetFrameCount - 1 do
|
||||
OSError(FPCMacOSAll.DisableControl(Frames[I]), Self, SEnable, SDisableControl);
|
||||
OSError({$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.DisableControl(Frames[I]), Self, SEnable, SDisableControl);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -678,7 +678,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
function TCarbonControl.GetFrameBounds(var ARect: TRect): Boolean;
|
||||
var
|
||||
BoundsRect: FPCMacOSAll.Rect;
|
||||
BoundsRect: {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.Rect;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
@ -715,7 +715,7 @@ end;
|
||||
function TCarbonControl.GetScreenBounds(var ARect: TRect): Boolean;
|
||||
var
|
||||
BoundsRect: HIRect;
|
||||
WindowRect: FPCMacOSAll.Rect;
|
||||
WindowRect: {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.Rect;
|
||||
const
|
||||
SName = 'GetScreenBounds';
|
||||
begin
|
||||
@ -992,9 +992,9 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
function TCarbonControl.GetMousePos: TPoint;
|
||||
var
|
||||
P: FPCMacOSAll.Point;
|
||||
P: {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.Point;
|
||||
MousePoint: HIPoint;
|
||||
R: FPCMacOSAll.Rect;
|
||||
R: {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.Rect;
|
||||
const
|
||||
SName = 'GetMousePos';
|
||||
begin
|
||||
@ -1043,7 +1043,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
function TCarbonControl.GetPreferredSize: TPoint;
|
||||
var
|
||||
R: FPCMacOSAll.Rect;
|
||||
R: {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.Rect;
|
||||
S: SmallInt;
|
||||
begin
|
||||
Result.X := 0;
|
||||
|
@ -1103,8 +1103,8 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
function TCarbonWindow.GetMousePos: TPoint;
|
||||
var
|
||||
P: FPCMacOSAll.Point;
|
||||
R: FPCMacOSAll.Rect;
|
||||
P: {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.Point;
|
||||
R: {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.Rect;
|
||||
begin
|
||||
GetGlobalMouse(P);
|
||||
|
||||
@ -1132,7 +1132,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
function TCarbonWindow.GetClientRect(var ARect: TRect): Boolean;
|
||||
var
|
||||
AWndRect, AClientRect: FPCMacOSAll.Rect;
|
||||
AWndRect, AClientRect: {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.Rect;
|
||||
const
|
||||
SName = 'GetClientRect';
|
||||
begin
|
||||
@ -1191,7 +1191,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
function TCarbonWindow.IsVisible: Boolean;
|
||||
begin
|
||||
Result := FPCMacOSAll.IsWindowVisible(WindowRef(Widget));
|
||||
Result := {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.IsWindowVisible(WindowRef(Widget));
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -1203,20 +1203,20 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
function TCarbonWindow.Enable(AEnable: Boolean): boolean;
|
||||
begin
|
||||
Result := not FPCMacOSAll.IsControlEnabled(Content);
|
||||
Result := not {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.IsControlEnabled(Content);
|
||||
|
||||
// enable/disable window content
|
||||
// add/remove standard handler
|
||||
if AEnable then
|
||||
begin
|
||||
OSError(FPCMacOSAll.EnableControl(Content), Self, SEnable, SEnableControl);
|
||||
OSError({$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.EnableControl(Content), Self, SEnable, SEnableControl);
|
||||
OSError(
|
||||
ChangeWindowAttributes(WindowRef(Widget), kWindowStandardHandlerAttribute,
|
||||
kWindowNoAttributes), Self, SEnable, SChangeWindowAttrs);
|
||||
end
|
||||
else
|
||||
begin
|
||||
OSError(FPCMacOSAll.DisableControl(Content), Self, SEnable, SDisableControl);
|
||||
OSError({$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.DisableControl(Content), Self, SEnable, SDisableControl);
|
||||
OSError(
|
||||
ChangeWindowAttributes(WindowRef(Widget), kWindowNoAttributes,
|
||||
kWindowStandardHandlerAttribute), Self, SEnable, SChangeWindowAttrs);
|
||||
@ -1234,17 +1234,17 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
function TCarbonWindow.GetBounds(var ARect: TRect): Boolean;
|
||||
var
|
||||
AWndRect, AClientRect: FPCMacOSAll.Rect;
|
||||
AWndRect, AClientRect: {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.Rect;
|
||||
const
|
||||
SName = 'GetBounds';
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
if OSError(
|
||||
FPCMacOSAll.GetWindowBounds(WindowRef(Widget), kWindowStructureRgn, AWndRect),
|
||||
{$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.GetWindowBounds(WindowRef(Widget), kWindowStructureRgn, AWndRect),
|
||||
Self, SName, SGetWindowBounds, 'kWindowStructureRgn') then Exit;
|
||||
if OSError(
|
||||
FPCMacOSAll.GetWindowBounds(WindowRef(Widget), kWindowContentRgn, AClientRect),
|
||||
{$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.GetWindowBounds(WindowRef(Widget), kWindowContentRgn, AClientRect),
|
||||
Self, SName, SGetWindowBounds, 'kWindowContentRgn') then Exit;
|
||||
|
||||
ARect.Left := AWndRect.Left;
|
||||
@ -1313,7 +1313,7 @@ begin
|
||||
Resizing := True;
|
||||
try
|
||||
// set window width, height
|
||||
if OSError(FPCMacOSAll.SetWindowBounds(WindowRef(Widget), kWindowContentRgn,
|
||||
if OSError({$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.SetWindowBounds(WindowRef(Widget), kWindowContentRgn,
|
||||
GetCarbonRect(ARect)), Self, SName, 'SetWindowBounds') then Exit;
|
||||
// set window left, top
|
||||
if OSError(MoveWindowStructure(WindowRef(Widget), ARect.Left, ARect.Top),
|
||||
@ -1385,10 +1385,10 @@ begin
|
||||
|
||||
if AVisible or (csDesigning in LCLobject.ComponentState) then
|
||||
begin
|
||||
FPCMacOSAll.ShowWindow(WindowRef(Widget));
|
||||
{$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.ShowWindow(WindowRef(Widget));
|
||||
end
|
||||
else
|
||||
FPCMacOSAll.HideWindow(WindowRef(Widget));
|
||||
{$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.HideWindow(WindowRef(Widget));
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -1516,7 +1516,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
function TCarbonWindow.Show(AShow: Integer): Boolean;
|
||||
var
|
||||
P: FPCMacOSAll.Point;
|
||||
P: {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.Point;
|
||||
Maximized: Boolean;
|
||||
const
|
||||
SName = 'Show';
|
||||
|
@ -75,7 +75,7 @@ function ShiftStateToModifiers(const Shift: TShiftState): Byte;
|
||||
function FindCarbonFontID(const FontName: String): ATSUFontID;
|
||||
function CarbonFontIDToFontName(ID: ATSUFontID): String;
|
||||
|
||||
function FontStyleToQDStyle(const AStyle: TFontStyles): FPCMacOSAll.Style;
|
||||
function FontStyleToQDStyle(const AStyle: TFontStyles): {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.Style;
|
||||
|
||||
procedure FillStandardDescription(out Desc: TRawImageDescription);
|
||||
|
||||
@ -96,9 +96,9 @@ function StringsToCFArray(S: TStrings): CFArrayRef;
|
||||
|
||||
function RoundFixed(const F: Fixed): Integer;
|
||||
|
||||
function GetCarbonRect(Left, Top, Width, Height: Integer): FPCMacOSAll.Rect;
|
||||
function GetCarbonRect(const ARect: TRect): FPCMacOSAll.Rect;
|
||||
function ParamsToCarbonRect(const AParams: TCreateParams): FPCMacOSAll.Rect;
|
||||
function GetCarbonRect(Left, Top, Width, Height: Integer): {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.Rect;
|
||||
function GetCarbonRect(const ARect: TRect): {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.Rect;
|
||||
function ParamsToCarbonRect(const AParams: TCreateParams): {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.Rect;
|
||||
function ParamsToRect(const AParams: TCreateParams): TRect;
|
||||
|
||||
type
|
||||
@ -112,8 +112,8 @@ function RectToCGRect(const ARect: TRect): CGRect;
|
||||
function CGRectToRect(const ARect: CGRect): TRect;
|
||||
|
||||
function ParamsToHIRect(const AParams: TCreateParams): HIRect;
|
||||
function CarbonRectToRect(const ARect: FPCMacOSAll.Rect): TRect;
|
||||
function HIRectToCarbonRect(const ARect: HIRect): FPCMacOSAll.Rect;
|
||||
function CarbonRectToRect(const ARect: {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.Rect): TRect;
|
||||
function HIRectToCarbonRect(const ARect: HIRect): {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.Rect;
|
||||
|
||||
function PointToHIPoint(const APoint: TPoint): HIPoint;
|
||||
function PointToHISize(const APoint: TPoint): HISize;
|
||||
@ -125,8 +125,8 @@ function ColorToRGBColor(const AColor: TColor): RGBColor;
|
||||
function RGBColorToColor(const AColor: RGBColor): TColor;
|
||||
function CreateCGColor(const AColor: TColor): CGColorRef;
|
||||
|
||||
function DbgS(const ARect: FPCMacOSAll.Rect): string; overload;
|
||||
function DbgS(const AColor: FPCMacOSAll.RGBColor): string; overload;
|
||||
function DbgS(const ARect: {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.Rect): string; overload;
|
||||
function DbgS(const AColor: {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.RGBColor): string; overload;
|
||||
function DbgS(const APoint: HIPoint): string; overload;
|
||||
function DbgS(const ASize: HISize): string; overload;
|
||||
|
||||
@ -496,13 +496,13 @@ end;
|
||||
Params: AStyle - Font style
|
||||
Returns: QuickDraw Style
|
||||
------------------------------------------------------------------------------}
|
||||
function FontStyleToQDStyle(const AStyle: TFontStyles): FPCMacOSAll.Style;
|
||||
function FontStyleToQDStyle(const AStyle: TFontStyles): {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.Style;
|
||||
begin
|
||||
Result := FPCMacOSAll.normal;
|
||||
Result := {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.normal;
|
||||
|
||||
if fsBold in AStyle then Result := Result or FPCMacOSAll.bold;
|
||||
if fsItalic in AStyle then Result := Result or FPCMacOSAll.italic;
|
||||
if fsUnderline in AStyle then Result := Result or FPCMacOSAll.underline;
|
||||
if fsBold in AStyle then Result := Result or {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.bold;
|
||||
if fsItalic in AStyle then Result := Result or {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.italic;
|
||||
if fsUnderline in AStyle then Result := Result or {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.underline;
|
||||
// fsStrikeOut has no counterpart?
|
||||
end;
|
||||
|
||||
@ -714,7 +714,7 @@ end;
|
||||
Params: Left, Top, Width, Height - Coordinates
|
||||
Returns: Carbon Rect
|
||||
------------------------------------------------------------------------------}
|
||||
function GetCarbonRect(Left, Top, Width, Height: Integer): FPCMacOSAll.Rect;
|
||||
function GetCarbonRect(Left, Top, Width, Height: Integer): {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.Rect;
|
||||
begin
|
||||
Result.Left := Left;
|
||||
Result.Top := Top;
|
||||
@ -727,7 +727,7 @@ end;
|
||||
Params: ARect - Rectangle
|
||||
Returns: Carbon Rect
|
||||
------------------------------------------------------------------------------}
|
||||
function GetCarbonRect(const ARect: TRect): FPCMacOSAll.Rect;
|
||||
function GetCarbonRect(const ARect: TRect): {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.Rect;
|
||||
begin
|
||||
Result.Left := ARect.Left;
|
||||
Result.Top := ARect.Top;
|
||||
@ -740,7 +740,7 @@ end;
|
||||
Params: AParams - Creation parameters
|
||||
Returns: Carbon Rect from creation parameters
|
||||
------------------------------------------------------------------------------}
|
||||
function ParamsToCarbonRect(const AParams: TCreateParams): FPCMacOSAll.Rect;
|
||||
function ParamsToCarbonRect(const AParams: TCreateParams): {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.Rect;
|
||||
begin
|
||||
Result.Left := AParams.X;
|
||||
Result.Top := AParams.Y;
|
||||
@ -907,7 +907,7 @@ end;
|
||||
Params: ARect - Carbon Rect
|
||||
Returns: Rectangle
|
||||
------------------------------------------------------------------------------}
|
||||
function CarbonRectToRect(const ARect: FPCMacOSAll.Rect): TRect;
|
||||
function CarbonRectToRect(const ARect: {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.Rect): TRect;
|
||||
begin
|
||||
Result.Left := ARect.Left;
|
||||
Result.Top := ARect.Top;
|
||||
@ -920,7 +920,7 @@ end;
|
||||
Params: ARect - HIRect
|
||||
Returns: Carbon Rect
|
||||
------------------------------------------------------------------------------}
|
||||
function HIRectToCarbonRect(const ARect: HIRect): FPCMacOSAll.Rect;
|
||||
function HIRectToCarbonRect(const ARect: HIRect): {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.Rect;
|
||||
begin
|
||||
if CGRectIsNull(ARect) <> 0 then
|
||||
begin // CGRect passed is invalid!
|
||||
@ -1044,13 +1044,13 @@ begin
|
||||
Result := CGColorCreate(RGBColorSpace, @F[0]);
|
||||
end;
|
||||
|
||||
function DbgS(const ARect: FPCMacOSAll.Rect): String;
|
||||
function DbgS(const ARect: {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.Rect): String;
|
||||
begin
|
||||
Result := DbgS(ARect.left) + ', ' + DbgS(ARect.top)
|
||||
+ ', ' + DbgS(ARect.right) + ', ' + DbgS(ARect.bottom);
|
||||
end;
|
||||
|
||||
function DbgS(const AColor: FPCMacOSAll.RGBColor): String;
|
||||
function DbgS(const AColor: {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.RGBColor): String;
|
||||
begin
|
||||
Result :=
|
||||
'R: ' + IntToHex(AColor.Red, 4) +
|
||||
|
@ -713,14 +713,14 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
function TCarbonTabsControl.GetClientRect(var ARect: TRect): Boolean;
|
||||
var
|
||||
AClientRect: FPCMacOSAll.Rect;
|
||||
AClientRect: {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.Rect;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
//DebugLn('TCarbonTabsControl.GetClientRect');
|
||||
|
||||
if OSError(GetControlData(ControlRef(Widget), kControlEntireControl,
|
||||
kControlTabContentRectTag, SizeOf(FPCMacOSAll.Rect), @AClientRect, nil),
|
||||
kControlTabContentRectTag, SizeOf({$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.Rect), @AClientRect, nil),
|
||||
Self, 'GetClientRect', 'GetControlData') then Exit;
|
||||
|
||||
ARect := CarbonRectToRect(AClientRect);
|
||||
|
@ -1146,7 +1146,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
function TCarbonWidgetSet.GetCursorPos(var lpPoint: TPoint): Boolean;
|
||||
var
|
||||
Pt: FPCMacOSAll.Point;
|
||||
Pt: {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.Point;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
@ -1591,7 +1591,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
function TCarbonWidgetSet.GetSysColor(NIndex: Integer): DWORD;
|
||||
var
|
||||
C: FPCMacOSAll.RGBColor;
|
||||
C: {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.RGBColor;
|
||||
Depth: SInt16;
|
||||
R: OSStatus;
|
||||
begin
|
||||
@ -3201,8 +3201,8 @@ var
|
||||
Window: WindowRef;
|
||||
Control: ControlRef;
|
||||
WindowPart: WindowPartCode;
|
||||
P: FPCMacOSAll.Point;
|
||||
R: FPCMacOSAll.Rect;
|
||||
P: {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.Point;
|
||||
R: {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.Rect;
|
||||
begin
|
||||
Result := 0;
|
||||
|
||||
|
@ -516,11 +516,11 @@ begin
|
||||
begin
|
||||
//DebugLn('Style: ' + DbgS(Style));
|
||||
FontDialog.Font.Style := [];
|
||||
if (Style and FPCMacOSAll.bold) > 0 then
|
||||
if (Style and {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.bold) > 0 then
|
||||
FontDialog.Font.Style := FontDialog.Font.Style + [fsBold];
|
||||
if (Style and FPCMacOSAll.italic) > 0 then
|
||||
if (Style and {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.italic) > 0 then
|
||||
FontDialog.Font.Style := FontDialog.Font.Style + [fsItalic];
|
||||
if (Style and FPCMacOSAll.underline) > 0 then
|
||||
if (Style and {$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.underline) > 0 then
|
||||
FontDialog.Font.Style := FontDialog.Font.Style + [fsUnderline];
|
||||
end;
|
||||
|
||||
@ -629,7 +629,7 @@ begin
|
||||
CarbonWidgetSet.SetMainMenuEnabled(False);
|
||||
|
||||
FontDialog := AFontDialog;
|
||||
FPCMacOSAll.ShowWindow(Dialog);
|
||||
{$ifdef ver2_2_0}FPCMacOSAll{$else}MacOSAll{$endif}.ShowWindow(Dialog);
|
||||
|
||||
// show font panel
|
||||
if not FPIsFontPanelVisible then
|
||||
|
Loading…
Reference in New Issue
Block a user