mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 22:59:07 +02:00
gtk2: implement TWsCustomForm.SetAlphaBlend
git-svn-id: trunk@23568 -
This commit is contained in:
parent
a7752848bf
commit
b24bd8f15d
@ -52,3 +52,22 @@ begin
|
|||||||
gdk_draw_pixmap(Dest, GC, Src, XSrc, YSrc, DestX, DestY, Width, Height);
|
gdk_draw_pixmap(Dest, GC, Src, XSrc, YSrc, DestX, DestY, Width, Height);
|
||||||
end;
|
end;
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
|
var
|
||||||
|
gtkhandle: tlibhandle;
|
||||||
|
libIter: Integer;
|
||||||
|
|
||||||
|
initialization
|
||||||
|
for libIter := High(GtkLibNames) downto Low(GtkLibNames) do
|
||||||
|
begin
|
||||||
|
gtkhandle := LoadLibrary(GtkLibNames[libIter]);
|
||||||
|
if gtkhandle <> 0 then
|
||||||
|
begin
|
||||||
|
pointer(gtk_window_set_opacity):=GetProcAddress(gtkhandle,'gtk_window_set_opacity');
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
finalization
|
||||||
|
if gtkhandle <> 0 then
|
||||||
|
FreeLibrary(gtkhandle);
|
||||||
|
@ -16,10 +16,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
|
dynlibs,
|
||||||
{$ifdef HasX}
|
{$ifdef HasX}
|
||||||
xlib, x,
|
xlib, x,
|
||||||
{$endif}
|
{$endif}
|
||||||
glib2, gdk2pixbuf, gdk2, gtk2,
|
glib2, gdk2pixbuf, gdk2, gtk2, gtk2ext,
|
||||||
{$ifdef HasGdk2X}
|
{$ifdef HasGdk2X}
|
||||||
gdk2x,
|
gdk2x,
|
||||||
{$endif}
|
{$endif}
|
||||||
@ -194,6 +195,9 @@ procedure gtk_file_chooser_set_do_overwrite_confirmation(chooser:PGtkFileChooser
|
|||||||
function gdk_screen_is_composited(screen: PGdkScreen): gboolean; cdecl; external gdklib;
|
function gdk_screen_is_composited(screen: PGdkScreen): gboolean; cdecl; external gdklib;
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
|
var
|
||||||
|
gtk_window_set_opacity: procedure(window: PGtkWindow; opacity: gdouble); cdecl;
|
||||||
|
|
||||||
{$ifdef ver2_2}
|
{$ifdef ver2_2}
|
||||||
{$ifdef darwin}
|
{$ifdef darwin}
|
||||||
// this linklib statement is not present in gtk2.pas
|
// this linklib statement is not present in gtk2.pas
|
||||||
|
@ -74,7 +74,8 @@ type
|
|||||||
published
|
published
|
||||||
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
|
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
|
||||||
class procedure SetIcon(const AForm: TCustomForm; const Small, Big: HICON); override;
|
class procedure SetIcon(const AForm: TCustomForm; const Small, Big: HICON); override;
|
||||||
|
class procedure SetAlphaBlend(const ACustomForm: TCustomForm;
|
||||||
|
const AlphaBlend: Boolean; const Alpha: Byte); override;
|
||||||
{ class function GetDefaultClientRect(const AWinControl: TWinControl;
|
{ class function GetDefaultClientRect(const AWinControl: TWinControl;
|
||||||
const aLeft, aTop, aWidth, aHeight: integer; var aClientRect: TRect
|
const aLeft, aTop, aWidth, aHeight: integer; var aClientRect: TRect
|
||||||
): boolean; override;
|
): boolean; override;
|
||||||
@ -243,6 +244,18 @@ begin
|
|||||||
then g_list_free(List);
|
then g_list_free(List);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class procedure TGtk2WSCustomForm.SetAlphaBlend(const ACustomForm: TCustomForm;
|
||||||
|
const AlphaBlend: Boolean; const Alpha: Byte);
|
||||||
|
begin
|
||||||
|
if not WSCheckHandleAllocated(ACustomForm, 'SetAlphaBlend') then
|
||||||
|
Exit;
|
||||||
|
if Assigned(gtk_window_set_opacity) then
|
||||||
|
if AlphaBlend then
|
||||||
|
gtk_window_set_opacity(PGtkWindow(ACustomForm.Handle), Alpha / 255)
|
||||||
|
else
|
||||||
|
gtk_window_set_opacity(PGtkWindow(ACustomForm.Handle), 1);
|
||||||
|
end;
|
||||||
|
|
||||||
{class function TGtk2WSCustomForm.GetDefaultClientRect(
|
{class function TGtk2WSCustomForm.GetDefaultClientRect(
|
||||||
const AWinControl: TWinControl; const aLeft, aTop, aWidth, aHeight: integer;
|
const AWinControl: TWinControl; const aLeft, aTop, aWidth, aHeight: integer;
|
||||||
var aClientRect: TRect): boolean;
|
var aClientRect: TRect): boolean;
|
||||||
|
Loading…
Reference in New Issue
Block a user