mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-11 17:39:44 +02:00
cocoa: code moving and cleaning up units use
git-svn-id: trunk@58919 -
This commit is contained in:
parent
c2f1d4283e
commit
cbb9c40974
@ -34,7 +34,7 @@ uses
|
||||
MacOSAll, CocoaAll, CocoaUtils, CocoaGDIObjects,
|
||||
cocoa_extra,
|
||||
// LCL
|
||||
LCLType, StdCtrls;
|
||||
LCLType;
|
||||
|
||||
const
|
||||
SPINEDIT_DEFAULT_STEPPER_WIDTH = 15;
|
||||
|
@ -8,8 +8,8 @@ interface
|
||||
uses
|
||||
classes,
|
||||
MacOSAll, CocoaAll,
|
||||
SysUtils, Types, LCLType, LCLClasses, LCLProc, menus,//LMessages,
|
||||
Controls, Forms, Graphics, Math, GraphType;
|
||||
SysUtils, Types, LCLType, LCLClasses, LCLProc,
|
||||
Controls, Graphics, Math, GraphType;
|
||||
|
||||
const
|
||||
LCLEventSubTypeMessage = MaxShort - 1;
|
||||
@ -68,9 +68,6 @@ function NSColorToRGB(const Color: NSColor): TColorRef; inline;
|
||||
function NSColorToColorRef(const Color: NSColor): TColorRef;
|
||||
function ColorToNSColor(const Color: TColorRef): NSColor; inline;
|
||||
|
||||
// the returned "Key" should not be released, as it's not memory owned
|
||||
procedure ShortcutToKeyEquivalent(const AShortCut: TShortcut; out Key: NSString; out shiftKeyMask: NSUInteger);
|
||||
|
||||
const
|
||||
DEFAULT_CFSTRING_ENCODING = kCFStringEncodingUTF8;
|
||||
|
||||
@ -198,24 +195,6 @@ begin
|
||||
((Color shr 16) and $FF) / $FF, 1);
|
||||
end;
|
||||
|
||||
procedure ShortcutToKeyEquivalent(const AShortCut: TShortcut; out Key: NSString; out shiftKeyMask: NSUInteger);
|
||||
var
|
||||
w: word;
|
||||
s: TShiftState;
|
||||
begin
|
||||
ShortCutToKey(AShortCut, w, s);
|
||||
key := VirtualKeyCodeToMacString(w);
|
||||
shiftKeyMask := 0;
|
||||
if ssShift in s then
|
||||
ShiftKeyMask := ShiftKeyMask + NSShiftKeyMask;
|
||||
if ssAlt in s then
|
||||
ShiftKeyMask := ShiftKeyMask + NSAlternateKeyMask;
|
||||
if ssCtrl in s then
|
||||
ShiftKeyMask := ShiftKeyMask + NSControlKeyMask;
|
||||
if ssMeta in s then
|
||||
ShiftKeyMask := ShiftKeyMask + NSCommandKeyMask;
|
||||
end;
|
||||
|
||||
function CFStringToString(AString: CFStringRef): String;
|
||||
begin
|
||||
result:=CFStringToStr(AString);
|
||||
@ -365,7 +344,7 @@ end;
|
||||
function LCLCoordsToCocoa(AControl: TControl; X, Y: Integer): NSPoint;
|
||||
begin
|
||||
Result.x := X;
|
||||
Result.y := Screen.Height - Y;
|
||||
Result.y := NSScreen.mainScreen.frame.size.height - Y;
|
||||
if AControl <> nil then Result.y := Result.y - AControl.Height;
|
||||
end;
|
||||
|
||||
|
@ -149,6 +149,9 @@ type
|
||||
|
||||
procedure NSMenuItemSetBitmap(mn: NSMenuItem; bmp: TBitmap);
|
||||
|
||||
// the returned "Key" should not be released, as it's not memory owned
|
||||
procedure ShortcutToKeyEquivalent(const AShortCut: TShortcut; out Key: NSString; out shiftKeyMask: NSUInteger);
|
||||
|
||||
implementation
|
||||
|
||||
{ TLCLMenuItemCallback }
|
||||
@ -717,4 +720,23 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure ShortcutToKeyEquivalent(const AShortCut: TShortcut; out Key: NSString; out shiftKeyMask: NSUInteger);
|
||||
var
|
||||
w: word;
|
||||
s: TShiftState;
|
||||
begin
|
||||
ShortCutToKey(AShortCut, w, s);
|
||||
key := VirtualKeyCodeToMacString(w);
|
||||
shiftKeyMask := 0;
|
||||
if ssShift in s then
|
||||
ShiftKeyMask := ShiftKeyMask + NSShiftKeyMask;
|
||||
if ssAlt in s then
|
||||
ShiftKeyMask := ShiftKeyMask + NSAlternateKeyMask;
|
||||
if ssCtrl in s then
|
||||
ShiftKeyMask := ShiftKeyMask + NSControlKeyMask;
|
||||
if ssMeta in s then
|
||||
ShiftKeyMask := ShiftKeyMask + NSCommandKeyMask;
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user