mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-21 23:19:29 +02:00
gtk2: implement TWsCustomForm.SetAlphaBlend
git-svn-id: trunk@23568 -
This commit is contained in:
parent
a7752848bf
commit
b24bd8f15d
@ -17,7 +17,7 @@
|
||||
* *
|
||||
* This file is part of the Lazarus Component Library (LCL) *
|
||||
* *
|
||||
* See the file COPYING.modifiedLGPL.txt, included in this distribution, *
|
||||
* See the file COPYING.modifiedLGPL.txt, included in this distribution, *
|
||||
* for details about the copyright. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
|
@ -5,7 +5,7 @@
|
||||
* *
|
||||
* This file is part of the Lazarus Component Library (LCL) *
|
||||
* *
|
||||
* See the file COPYING.modifiedLGPL.txt, included in this distribution, *
|
||||
* See the file COPYING.modifiedLGPL.txt, included in this distribution, *
|
||||
* for details about the copyright. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
@ -52,3 +52,22 @@ begin
|
||||
gdk_draw_pixmap(Dest, GC, Src, XSrc, YSrc, DestX, DestY, Width, Height);
|
||||
end;
|
||||
{$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
|
||||
dynlibs,
|
||||
{$ifdef HasX}
|
||||
xlib, x,
|
||||
{$endif}
|
||||
glib2, gdk2pixbuf, gdk2, gtk2,
|
||||
glib2, gdk2pixbuf, gdk2, gtk2, gtk2ext,
|
||||
{$ifdef HasGdk2X}
|
||||
gdk2x,
|
||||
{$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;
|
||||
{$endif}
|
||||
|
||||
var
|
||||
gtk_window_set_opacity: procedure(window: PGtkWindow; opacity: gdouble); cdecl;
|
||||
|
||||
{$ifdef ver2_2}
|
||||
{$ifdef darwin}
|
||||
// this linklib statement is not present in gtk2.pas
|
||||
|
@ -74,7 +74,8 @@ type
|
||||
published
|
||||
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; 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;
|
||||
const aLeft, aTop, aWidth, aHeight: integer; var aClientRect: TRect
|
||||
): boolean; override;
|
||||
@ -243,6 +244,18 @@ begin
|
||||
then g_list_free(List);
|
||||
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(
|
||||
const AWinControl: TWinControl; const aLeft, aTop, aWidth, aHeight: integer;
|
||||
var aClientRect: TRect): boolean;
|
||||
|
Loading…
Reference in New Issue
Block a user