Gtk3: implemented GetDesignerDC, IsDesignerDC and ReleaseDesignerDC

This commit is contained in:
zeljan1 2025-01-14 09:44:09 +01:00
parent 6d849e6312
commit 8882e05fe1
2 changed files with 36 additions and 0 deletions

View File

@ -1277,6 +1277,38 @@ begin
Top, Right - Left, Bottom - Top);
end;
function TGtk3WidgetSet.GetDesignerDC(WindowHandle: HWND): HDC;
var
Widget: TGtk3Widget absolute WindowHandle;
begin
Result := 0;
if IsValidHandle(WindowHandle) then
begin
if Widget is TGtk3DesignWidget then
Result := TGtk3DesignWidget(Widget).DesignContext;
if Result = 0 then
Result := GetDC(WindowHandle);
end;
end;
function TGtk3WidgetSet.IsDesignerDC(WindowHandle: HWND; DC: HDC): Boolean;
begin
Result := IsValidHandle(WindowHandle) and (TGtk3Widget(WindowHandle) is TGtk3DesignWidget);
if Result then
Result := TGtk3DesignWidget(DC).DesignContext = DC;
end;
function TGtk3WidgetSet.ReleaseDesignerDC(Window: HWND; DC: HDC): Integer;
begin
Result := 0;
if IsValidHandle(Window) and IsValidDC(DC) then
begin
if TGtk3DeviceContext(DC).CanRelease then
TGtk3DeviceContext(DC).Free;
Result := 1;
end;
end;
type
PPipeEventInfo = ^TPipeEventInfo;
TPipeEventInfo = record

View File

@ -65,5 +65,9 @@ procedure SetCanvasScaleFactor(DC: HDC; const AScaleFactor: double); override;
procedure SetEventHandlerFlags(AHandler: PEventHandler; NewFlags: dword); override;
procedure SetRubberBandRect(const ARubberBand: HWND; const ARect: TRect); override;
function GetDesignerDC(WindowHandle: HWND): HDC; override;
function IsDesignerDC(WindowHandle: HWND; DC: HDC): Boolean; override;
function ReleaseDesignerDC(Window: HWND; DC: HDC): Integer; override;
function TextUTF8Out(DC: HDC; X, Y: Integer; Str: PChar; Count: Longint): Boolean; override;
//##apiwiz##eps## // Do not remove, no wizard declaration after this line