mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-09 15:57:54 +01:00
cocoa: implement GetKeyState, fix selected color
git-svn-id: trunk@34490 -
This commit is contained in:
parent
19e37fd59e
commit
aafc19458b
@ -1077,11 +1077,12 @@ begin
|
||||
Result := NSColor.controlTextColor;
|
||||
COLOR_APPWORKSPACE:
|
||||
Result := NSColor.windowBackgroundColor;
|
||||
COLOR_HIGHLIGHT,
|
||||
COLOR_HIGHLIGHT:
|
||||
Result := NSColor.selectedControlColor;
|
||||
COLOR_HOTLIGHT:
|
||||
Result := NSColor.alternateSelectedControlColor;
|
||||
COLOR_HIGHLIGHTTEXT:
|
||||
Result := NSColor.alternateSelectedControlTextColor;
|
||||
Result := NSColor.selectedControlTextColor;
|
||||
COLOR_SCROLLBAR:
|
||||
Result := NSColor.scrollBarColor;
|
||||
COLOR_BTNFACE:
|
||||
@ -1374,6 +1375,46 @@ begin
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
function TCocoaWidgetSet.GetKeyState(nVirtKey: Integer): Smallint;
|
||||
const
|
||||
StateDown = SmallInt($FF80);
|
||||
StateToggled = SmallInt($0001);
|
||||
DownMap: array[Boolean] of SmallInt = (0, StateDown);
|
||||
ToggleMap: array[Boolean] of SmallInt = (0, StateToggled);
|
||||
var
|
||||
Modifiers: NSUInteger;
|
||||
begin
|
||||
Modifiers := NSApp.currentEvent.modifierFlags;
|
||||
case nVirtKey of
|
||||
VK_MENU,
|
||||
VK_LMENU:
|
||||
// the ssAlt/VK_MENU is mapped to optionKey under MacOS
|
||||
Result := DownMap[(Modifiers and NSAlternateKeyMask) <> 0];
|
||||
VK_SHIFT,
|
||||
VK_LSHIFT:
|
||||
Result := DownMap[(Modifiers and NSShiftKeyMask) <> 0];
|
||||
VK_CONTROL,
|
||||
VK_LCONTROL:
|
||||
Result := DownMap[(Modifiers and NSControlKeyMask) <> 0];
|
||||
VK_LWIN, VK_RWIN:
|
||||
Result := DownMap[(Modifiers and NSCommandKeyMask) <> 0];
|
||||
VK_CAPITAL:
|
||||
Result := ToggleMap[(Modifiers and NSAlphaShiftKeyMask) <> 0];
|
||||
VK_LBUTTON:
|
||||
Result := DownMap[(GetCurrentEventButtonState and $01) <> 0];
|
||||
VK_RBUTTON:
|
||||
Result := DownMap[(GetCurrentEventButtonState and $02) <> 0];
|
||||
VK_MBUTTON:
|
||||
Result := DownMap[(GetCurrentEventButtonState and $03) <> 0];
|
||||
VK_XBUTTON1:
|
||||
Result := DownMap[(GetCurrentEventButtonState and $04) <> 0];
|
||||
VK_XBUTTON2:
|
||||
Result := DownMap[(GetCurrentEventButtonState and $05) <> 0];
|
||||
else
|
||||
Result := 0;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TCocoaWidgetSet.SelectObject(ADC: HDC; GDIObj: HGDIOBJ): HGDIOBJ;
|
||||
var
|
||||
dc: TCocoaContext;
|
||||
|
||||
@ -106,7 +106,7 @@ function GetDeviceSize(DC: HDC; var P: TPoint): Boolean; override;
|
||||
{function GetDIBits(DC: HDC; Bitmap: HBitmap; StartScan, NumScans: UINT; Bits: Pointer; var BitInfo: BitmapInfo; Usage: UINT): Integer; override;}
|
||||
function GetFocus: HWND; override;
|
||||
function GetForegroundWindow: HWND; override;
|
||||
{function GetKeyState(nVirtKey: Integer): Smallint; override;}
|
||||
function GetKeyState(nVirtKey: Integer): Smallint; override;
|
||||
function GetMonitorInfo(hMonitor: HMONITOR; lpmi: PMonitorInfo): Boolean; override;
|
||||
function GetObject(GDIObj: HGDIOBJ; BufSize: Integer; Buf: Pointer): Integer; override;
|
||||
function GetParent(Handle: HWND): HWND; override;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user