mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 11:20:32 +02:00
Gtk3: added helper functions to convert cairo rect to TRect and vice versa.
This commit is contained in:
parent
2592b7e842
commit
f0e7cbe936
@ -25,7 +25,7 @@ uses
|
||||
BaseUnix, Unix,
|
||||
{$ENDIF}
|
||||
Classes, SysUtils, Controls, StdCtrls, Graphics,
|
||||
LazGtk3, LazGdk3, LazGLib2, LazGObject2, LazGdkPixbuf2, LazPango1,
|
||||
LazGtk3, LazGdk3, LazGLib2, LazGObject2, LazGdkPixbuf2, LazPango1, Lazcairo1,
|
||||
LCLType, InterfaceBase;
|
||||
|
||||
type
|
||||
@ -304,6 +304,9 @@ function RectFromPangoRect(APangoRect: TPangoRectangle): TRect;
|
||||
function GdkRectFromRect(R: TRect): TGdkRectangle;
|
||||
function GtkAllocationFromRect(R: TRect): TGtkAllocation;
|
||||
|
||||
function CairoRectFromRect(const R: TRect): Tcairo_rectangle_int_t;
|
||||
function RectFromCairoRect(const ACairoRect: Tcairo_rectangle_int_t): TRect;
|
||||
|
||||
function GdkKeyToLCLKey(AValue: Word): Word;
|
||||
function GdkModifierStateToLCL(AState: TGdkModifierType; const AIsKeyEvent: Boolean): PtrInt;
|
||||
function GdkModifierStateToShiftState(AState: TGdkModifierType): TShiftState;
|
||||
@ -420,6 +423,28 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function CairoRectFromRect(const R:TRect):Tcairo_rectangle_int_t;
|
||||
begin
|
||||
with Result do
|
||||
begin
|
||||
x := R.Left;
|
||||
y := R.Top;
|
||||
width := R.Right-R.Left;
|
||||
height := R.Bottom-R.Top;
|
||||
end;
|
||||
end;
|
||||
|
||||
function RectFromCairoRect(const ACairoRect:Tcairo_rectangle_int_t):TRect;
|
||||
begin
|
||||
with Result do
|
||||
begin
|
||||
Left := ACairoRect.x;
|
||||
Top := ACairoRect.y;
|
||||
Right := Left + ACairoRect.Width;
|
||||
Bottom := Top + ACairoRect.Height;
|
||||
end;
|
||||
end;
|
||||
|
||||
function GtkAllocationFromRect(R: TRect): TGtkAllocation;
|
||||
begin
|
||||
with Result do
|
||||
@ -1322,4 +1347,5 @@ begin
|
||||
g_list_free(TopList);
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user