mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-28 13:20:18 +02:00
Adds LCLIntf functions for conveniently obtaining a native form Handle or a native Canvas Handle from the LCL
git-svn-id: trunk@34358 -
This commit is contained in:
parent
c01e1b5cde
commit
cf2403a126
@ -362,6 +362,16 @@ begin
|
|||||||
Result := KeyAndShiftStateToKeyString(AVKey, AShiftState);
|
Result := KeyAndShiftStateToKeyString(AVKey, AShiftState);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TWidgetSet.GetAvailableNativeCanvasTypes(DC: HDC; AAllowFallbackToParent: Boolean): TNativeCanvasTypes; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||||
|
begin
|
||||||
|
Result := [];
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TWidgetSet.GetAvailableNativeHandleTypes(Handle: HWND; AAllowFallbackToParent: Boolean): TNativeHandleTypes; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||||
|
begin
|
||||||
|
Result := [];
|
||||||
|
end;
|
||||||
|
|
||||||
function TWidgetSet.GetCaretRespondToFocus(handle: HWND;
|
function TWidgetSet.GetCaretRespondToFocus(handle: HWND;
|
||||||
var ShowHideOnFocus: boolean): Boolean;
|
var ShowHideOnFocus: boolean): Boolean;
|
||||||
begin
|
begin
|
||||||
@ -411,6 +421,16 @@ begin
|
|||||||
else Result := nil;
|
else Result := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TWidgetSet.GetNativeCanvas(DC: HDC; AHandleType: TNativeCanvasType; AAllowFallbackToParent: Boolean): PtrInt;
|
||||||
|
begin
|
||||||
|
Result := 0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TWidgetSet.GetNativeHandle(Handle: HWND; AHandleType: TNativeHandleType; AAllowFallbackToParent: Boolean): PtrInt;
|
||||||
|
begin
|
||||||
|
Result := 0;
|
||||||
|
end;
|
||||||
|
|
||||||
// TODO: remove
|
// TODO: remove
|
||||||
function TWidgetSet.GetScrollBarSize(Handle: HWND;
|
function TWidgetSet.GetScrollBarSize(Handle: HWND;
|
||||||
SBStyle: Integer): integer;
|
SBStyle: Integer): integer;
|
||||||
|
@ -211,6 +211,16 @@ begin
|
|||||||
Result := WidgetSet.Frame3d(DC, ARect, FrameWidth, Style);
|
Result := WidgetSet.Frame3d(DC, ARect, FrameWidth, Style);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function GetAvailableNativeCanvasTypes(DC: HDC; AAllowFallbackToParent: Boolean): TNativeCanvasTypes;
|
||||||
|
begin
|
||||||
|
Result := Widgetset.GetAvailableNativeCanvasTypes(DC, AAllowFallbackToParent);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function GetAvailableNativeHandleTypes(Handle: HWND; AAllowFallbackToParent: Boolean): TNativeHandleTypes;
|
||||||
|
begin
|
||||||
|
Result := Widgetset.GetAvailableNativeHandleTypes(Handle, AAllowFallbackToParent);
|
||||||
|
end;
|
||||||
|
|
||||||
function GetCaretRespondToFocus(handle: HWND; var ShowHideOnFocus: boolean): Boolean;
|
function GetCaretRespondToFocus(handle: HWND; var ShowHideOnFocus: boolean): Boolean;
|
||||||
begin
|
begin
|
||||||
Result := WidgetSet.GetCaretRespondToFocus(handle,ShowHideOnFocus);
|
Result := WidgetSet.GetCaretRespondToFocus(handle,ShowHideOnFocus);
|
||||||
@ -297,6 +307,16 @@ begin
|
|||||||
Result := WidgetSet.GetAcceleratorString(AVKey, AShiftState);
|
Result := WidgetSet.GetAcceleratorString(AVKey, AShiftState);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function GetNativeCanvas(DC: HDC; AHandleType: TNativeCanvasType; AAllowFallbackToParent: Boolean): PtrInt;
|
||||||
|
begin
|
||||||
|
Result := Widgetset.GetNativeCanvas(DC, AHandleType, AAllowFallbackToParent);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function GetNativeHandle(Handle: HWND; AHandleType: TNativeHandleType; AAllowFallbackToParent: Boolean): PtrInt;
|
||||||
|
begin
|
||||||
|
Result := Widgetset.GetNativeHandle(Handle, AHandleType, AAllowFallbackToParent);
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
function GetWindowRelativePosition(Handle: hwnd;
|
function GetWindowRelativePosition(Handle: hwnd;
|
||||||
var Left, Top: integer): boolean;
|
var Left, Top: integer): boolean;
|
||||||
|
@ -74,6 +74,8 @@ function Frame(DC: HDC; const ARect: TRect): Integer; {$IFDEF IF_BASE_MEMBER}vir
|
|||||||
function Frame3d(DC: HDC; var ARect: TRect; const FrameWidth : integer; const Style : TGraphicsBevelCut): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
function Frame3d(DC: HDC; var ARect: TRect; const FrameWidth : integer; const Style : TGraphicsBevelCut): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||||
|
|
||||||
function GetAcceleratorString(const AVKey: Byte; const AShiftState: TShiftState): String; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
function GetAcceleratorString(const AVKey: Byte; const AShiftState: TShiftState): String; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||||
|
function GetAvailableNativeCanvasTypes(DC: HDC; AAllowFallbackToParent: Boolean = False): TNativeCanvasTypes; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||||
|
function GetAvailableNativeHandleTypes(Handle: HWND; AAllowFallbackToParent: Boolean = False): TNativeHandleTypes; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||||
function GetCaretRespondToFocus(handle: HWND; var ShowHideOnFocus: boolean): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
function GetCaretRespondToFocus(handle: HWND; var ShowHideOnFocus: boolean): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||||
function GetClientBounds(handle : HWND; var ARect: TRect) : Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
function GetClientBounds(handle : HWND; var ARect: TRect) : Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||||
function GetCmdLineParamDescForInterface: string; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
function GetCmdLineParamDescForInterface: string; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||||
@ -82,6 +84,8 @@ function GetDCOriginRelativeToWindow(PaintDC: HDC; WindowHandle: HWND; var Origi
|
|||||||
function GetDesignerDC(WindowHandle: HWND): HDC; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
function GetDesignerDC(WindowHandle: HWND): HDC; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||||
function GetDeviceSize(DC: HDC; var p: TPoint): boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
function GetDeviceSize(DC: HDC; var p: TPoint): boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||||
function GetLCLOwnerObject(Handle: HWnd): TObject; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
function GetLCLOwnerObject(Handle: HWnd): TObject; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||||
|
function GetNativeCanvas(DC: HDC; AHandleType: TNativeCanvasType; AAllowFallbackToParent: Boolean = False): PtrInt; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||||
|
function GetNativeHandle(Handle: HWND; AHandleType: TNativeHandleType; AAllowFallbackToParent: Boolean = False): PtrInt; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||||
function GetScrollBarSize(Handle: HWND; SBStyle: Integer): integer; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
function GetScrollBarSize(Handle: HWND; SBStyle: Integer): integer; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||||
function GetScrollbarVisible(Handle: HWND; SBStyle: Integer): boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
function GetScrollbarVisible(Handle: HWND; SBStyle: Integer): boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||||
function GetWindowRelativePosition(Handle : hwnd; var Left, Top: integer): boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
function GetWindowRelativePosition(Handle : hwnd; var Left, Top: integer): boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||||
|
@ -137,6 +137,7 @@ type
|
|||||||
LastKey: Word; // Used for KeyRelease event
|
LastKey: Word; // Used for KeyRelease event
|
||||||
|
|
||||||
function FindWindowByXID(XWindowID: X.TWindow; out AWindowInfo: TX11WindowInfo): TWinControl;
|
function FindWindowByXID(XWindowID: X.TWindow; out AWindowInfo: TX11WindowInfo): TWinControl;
|
||||||
|
procedure AppProcessMessage;
|
||||||
{$endif}
|
{$endif}
|
||||||
{$ifdef CD_Android}
|
{$ifdef CD_Android}
|
||||||
procedure AndroidDebugLn(AStr: string);
|
procedure AndroidDebugLn(AStr: string);
|
||||||
@ -193,9 +194,6 @@ type
|
|||||||
procedure AppRun(const ALoop: TApplicationMainLoop); override;
|
procedure AppRun(const ALoop: TApplicationMainLoop); override;
|
||||||
procedure AppWaitMessage; override;
|
procedure AppWaitMessage; override;
|
||||||
procedure AppProcessMessages; override;
|
procedure AppProcessMessages; override;
|
||||||
{$ifdef CD_X11}
|
|
||||||
procedure AppProcessMessage;
|
|
||||||
{$endif}
|
|
||||||
procedure AppTerminate; override;
|
procedure AppTerminate; override;
|
||||||
procedure AppMinimize; override;
|
procedure AppMinimize; override;
|
||||||
procedure AppRestore; override;
|
procedure AppRestore; override;
|
||||||
@ -318,6 +316,19 @@ uses
|
|||||||
customdrawnprivate,
|
customdrawnprivate,
|
||||||
LCLMessageGlue;
|
LCLMessageGlue;
|
||||||
|
|
||||||
|
const
|
||||||
|
{$ifdef CD_Windows}
|
||||||
|
CDBackendNativeHandle = nhtWindowsHWND;
|
||||||
|
{$define CD_HasNativeFormHandle}
|
||||||
|
{$endif}
|
||||||
|
{$ifdef CD_X11}
|
||||||
|
CDBackendNativeHandle = nhtX11TWindow;
|
||||||
|
{$define CD_HasNativeFormHandle}
|
||||||
|
{$endif}
|
||||||
|
{$ifdef CD_Cocoa}
|
||||||
|
CDBackendNativeHandle = nhtCocoaNSWindow;
|
||||||
|
{$define CD_HasNativeFormHandle}
|
||||||
|
{$endif}
|
||||||
|
|
||||||
{$I customdrawnobject.inc}
|
{$I customdrawnobject.inc}
|
||||||
|
|
||||||
|
@ -237,10 +237,26 @@ begin
|
|||||||
QFontInfo_destroy(QtFontInfo);
|
QFontInfo_destroy(QtFontInfo);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end;*)
|
||||||
|
|
||||||
|
function TCDWidgetSet.GetAvailableNativeCanvasTypes(DC: HDC; AAllowFallbackToParent: Boolean = False): TNativeCanvasTypes;
|
||||||
|
begin
|
||||||
|
Result := [nctLazCanvas];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCDWidgetSet.GetAvailableNativeHandleTypes(Handle: HWND; AAllowFallbackToParent: Boolean = False): TNativeHandleTypes;
|
||||||
|
var
|
||||||
|
lBaseControl: TCDBaseControl absolute Handle;
|
||||||
|
begin
|
||||||
|
Result := [];
|
||||||
|
{$ifdef CD_HasNativeFormHandle}
|
||||||
|
if Handle = 0 then Exit;
|
||||||
|
if (lBaseControl is TCDForm) or AAllowFallbackToParent then
|
||||||
|
Result := [CDBackendNativeHandle];
|
||||||
|
{$endif}
|
||||||
|
end;
|
||||||
|
|
||||||
function TQtWidgetSet.GetDesignerDC(WindowHandle: HWND): HDC;
|
(*function TQtWidgetSet.GetDesignerDC(WindowHandle: HWND): HDC;
|
||||||
var
|
var
|
||||||
Widget: TQtWidget;
|
Widget: TQtWidget;
|
||||||
begin
|
begin
|
||||||
@ -253,6 +269,40 @@ begin
|
|||||||
|
|
||||||
if Result = 0 then
|
if Result = 0 then
|
||||||
Result := GetDC(WindowHandle);
|
Result := GetDC(WindowHandle);
|
||||||
|
end;*)
|
||||||
|
|
||||||
|
function TCDWidgetSet.GetNativeCanvas(DC: HDC; AHandleType: TNativeCanvasType; AAllowFallbackToParent: Boolean = False): PtrInt;
|
||||||
|
begin
|
||||||
|
Result := 0;
|
||||||
|
if AHandleType = nctLazCanvas then Result := PtrInt(DC);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCDWidgetSet.GetNativeHandle(Handle: HWND; AHandleType: TNativeHandleType; AAllowFallbackToParent: Boolean = False): PtrInt;
|
||||||
|
var
|
||||||
|
lBaseControl: TCDBaseControl absolute Handle;
|
||||||
|
lFormHandle: TCDForm;
|
||||||
|
lForm: TCustomForm;
|
||||||
|
begin
|
||||||
|
Result := 0;
|
||||||
|
{$ifdef CD_HasNativeFormHandle}
|
||||||
|
if Handle = 0 then Exit;
|
||||||
|
if (lBaseControl is TCDForm) or AAllowFallbackToParent then
|
||||||
|
begin
|
||||||
|
if (lBaseControl is TCDWinControl) then
|
||||||
|
begin
|
||||||
|
lForm := Forms.GetParentForm((lBaseControl as TCDWinControl).WinControl);
|
||||||
|
if lForm = nil then Exit;
|
||||||
|
lFormHandle := TCDForm(lForm.Handle);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
lFormHandle := TCDForm(lBaseControl);
|
||||||
|
|
||||||
|
if AHandleType = CDBackendNativeHandle then
|
||||||
|
begin
|
||||||
|
Result := lFormHandle.NativeHandle;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -261,7 +311,7 @@ end;
|
|||||||
Returns:
|
Returns:
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
|
|
||||||
function TQtWidgetSet.IntfSendsUTF8KeyPress: boolean;
|
(*function TQtWidgetSet.IntfSendsUTF8KeyPress: boolean;
|
||||||
begin
|
begin
|
||||||
Result := True;
|
Result := True;
|
||||||
end;
|
end;
|
||||||
|
@ -43,9 +43,13 @@ procedure DrawGrid(DC: HDC; const R: TRect; DX, DY: Integer); override;
|
|||||||
procedure DestroyRubberBand(ARubberBand: HWND); override;*)
|
procedure DestroyRubberBand(ARubberBand: HWND); override;*)
|
||||||
|
|
||||||
(*function FontCanUTF8(Font: HFont): boolean; override; // Dont implement, deprecated
|
(*function FontCanUTF8(Font: HFont): boolean; override; // Dont implement, deprecated
|
||||||
function FontIsMonoSpace(Font: HFont): boolean; override;
|
function FontIsMonoSpace(Font: HFont): boolean; override;*)
|
||||||
|
|
||||||
function GetDesignerDC(WindowHandle: HWND): HDC; override;*)
|
function GetAvailableNativeCanvasTypes(DC: HDC; AAllowFallbackToParent: Boolean = False): TNativeCanvasTypes; override;
|
||||||
|
function GetAvailableNativeHandleTypes(Handle: HWND; AAllowFallbackToParent: Boolean = False): TNativeHandleTypes; override;
|
||||||
|
//function GetDesignerDC(WindowHandle: HWND): HDC; override;
|
||||||
|
function GetNativeCanvas(DC: HDC; AHandleType: TNativeCanvasType; AAllowFallbackToParent: Boolean = False): PtrInt; override;
|
||||||
|
function GetNativeHandle(Handle: HWND; AHandleType: TNativeHandleType; AAllowFallbackToParent: Boolean = False): PtrInt; override;
|
||||||
|
|
||||||
procedure HideVirtualKeyboard();
|
procedure HideVirtualKeyboard();
|
||||||
|
|
||||||
|
@ -87,6 +87,15 @@ type
|
|||||||
|
|
||||||
TDockImageOperation = (disShow, disMove, disHide);
|
TDockImageOperation = (disShow, disMove, disHide);
|
||||||
|
|
||||||
|
// Types for native Handle integration
|
||||||
|
|
||||||
|
TNativeHandleType = (nhtWindowsHWND, nhtX11TWindow, nhtCocoaNSWindow,
|
||||||
|
nhtQtQWidget);
|
||||||
|
TNativeHandleTypes = set of TNativeHandleType;
|
||||||
|
|
||||||
|
TNativeCanvasType = (nctWindowsDC, nctLazCanvas);
|
||||||
|
TNativeCanvasTypes = set of TNativeCanvasType;
|
||||||
|
|
||||||
{$ifndef WINDOWS}
|
{$ifndef WINDOWS}
|
||||||
THandle = type PtrUInt; // define our own, because the SysUtils.THandle = System.THandle is a longint
|
THandle = type PtrUInt; // define our own, because the SysUtils.THandle = System.THandle is a longint
|
||||||
HANDLE = THandle;
|
HANDLE = THandle;
|
||||||
|
Loading…
Reference in New Issue
Block a user