mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-07 15:56:00 +02:00
gtk2 intf: test for gtk_window_set_icon_from_file
git-svn-id: trunk@37706 -
This commit is contained in:
parent
15bf1e966f
commit
9ea3b4e0fe
@ -460,9 +460,25 @@ end;
|
|||||||
|
|
||||||
class procedure TGtk2WSCustomForm.SetIcon(const AForm: TCustomForm;
|
class procedure TGtk2WSCustomForm.SetIcon(const AForm: TCustomForm;
|
||||||
const Small, Big: HICON);
|
const Small, Big: HICON);
|
||||||
|
|
||||||
|
procedure SetSmallBigIcon;
|
||||||
|
var
|
||||||
|
List: PGList;
|
||||||
|
begin
|
||||||
|
List := nil;
|
||||||
|
if Small <> 0 then
|
||||||
|
List := g_list_append(List, {%H-}PGdkPixbuf(Small));
|
||||||
|
if Big <> 0 then
|
||||||
|
List := g_list_append(List, {%H-}PGdkPixbuf(Big));
|
||||||
|
gtk_window_set_icon_list({%H-}PGtkWindow(AForm.Handle), List);
|
||||||
|
if List <> nil
|
||||||
|
then g_list_free(List);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{$IFDEF Gtk2SetIconAll}
|
||||||
|
procedure SetAllIcons;
|
||||||
var
|
var
|
||||||
List: PGList;
|
List: PGList;
|
||||||
{$IFDEF EnableGtk2WndIconList}
|
|
||||||
Icon: TIcon;
|
Icon: TIcon;
|
||||||
CurSize: Integer;
|
CurSize: Integer;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
@ -470,15 +486,8 @@ var
|
|||||||
OldChange: TNotifyEvent;
|
OldChange: TNotifyEvent;
|
||||||
OldCurrent: Integer;
|
OldCurrent: Integer;
|
||||||
IconHnd: HICON;
|
IconHnd: HICON;
|
||||||
{$ENDIF}
|
|
||||||
begin
|
begin
|
||||||
if not WSCheckHandleAllocated(AForm, 'SetIcon')
|
|
||||||
then Exit;
|
|
||||||
|
|
||||||
if (AForm.Parent <> nil) or (AForm.ParentWindow <> 0) then Exit;
|
|
||||||
|
|
||||||
List := nil;
|
List := nil;
|
||||||
{$IFDEF EnableGtk2WndIconList}
|
|
||||||
//debugln(['TGtk2WSCustomForm.SetIcon Form=',DbgSName(AForm)]);
|
//debugln(['TGtk2WSCustomForm.SetIcon Form=',DbgSName(AForm)]);
|
||||||
Icon:=AForm.Icon;
|
Icon:=AForm.Icon;
|
||||||
if (Icon=nil) or Icon.Empty then
|
if (Icon=nil) or Icon.Empty then
|
||||||
@ -505,16 +514,40 @@ begin
|
|||||||
Icon.Current:=OldCurrent;
|
Icon.Current:=OldCurrent;
|
||||||
Icon.OnChange:=OldChange;
|
Icon.OnChange:=OldChange;
|
||||||
end;
|
end;
|
||||||
{$ELSE}
|
|
||||||
if Small <> 0 then
|
|
||||||
List := g_list_append(List, {%H-}PGdkPixbuf(Small));
|
|
||||||
if Big <> 0 then
|
|
||||||
List := g_list_append(List, {%H-}PGdkPixbuf(Big));
|
|
||||||
{$ENDIF}
|
|
||||||
gtk_window_set_icon_list({%H-}PGtkWindow(AForm.Handle), List);
|
gtk_window_set_icon_list({%H-}PGtkWindow(AForm.Handle), List);
|
||||||
if List <> nil
|
if List <> nil
|
||||||
then g_list_free(List);
|
then g_list_free(List);
|
||||||
end;
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IFDEF Gtk2SetIconFile}
|
||||||
|
procedure SetIconFromFile;
|
||||||
|
var
|
||||||
|
Filename: String;
|
||||||
|
begin
|
||||||
|
Filename:='test128x128.png';
|
||||||
|
debugln(['SetIconFromFile filename=',Filename]);
|
||||||
|
gtk_window_set_icon_from_file({%H-}PGtkWindow(AForm.Handle),PGChar(Filename),null);
|
||||||
|
debugln(['SetIconFromFile prg name="',g_get_prgname,'"']);
|
||||||
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
begin
|
||||||
|
if not WSCheckHandleAllocated(AForm, 'SetIcon')
|
||||||
|
then Exit;
|
||||||
|
|
||||||
|
if (AForm.Parent <> nil) or (AForm.ParentWindow <> 0) then Exit;
|
||||||
|
|
||||||
|
{$IFDEF Gtk2SetIconAll}
|
||||||
|
SetAllIcons;
|
||||||
|
{$ELSE}
|
||||||
|
{$IFDEF Gtk2SetIconFile}
|
||||||
|
SetIconFromFile;
|
||||||
|
{$ELSE}
|
||||||
|
SetSmallBigIcon;
|
||||||
|
{$ENDIF}
|
||||||
|
{$ENDIF}
|
||||||
|
end;
|
||||||
|
|
||||||
class procedure TGtk2WSCustomForm.SetAlphaBlend(const ACustomForm: TCustomForm;
|
class procedure TGtk2WSCustomForm.SetAlphaBlend(const ACustomForm: TCustomForm;
|
||||||
const AlphaBlend: Boolean; const Alpha: Byte);
|
const AlphaBlend: Boolean; const Alpha: Byte);
|
||||||
|
Loading…
Reference in New Issue
Block a user