mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-08 05:17:24 +01:00
gtk2: increased big icon size SM_CXICON,SM_CYICON to 128
git-svn-id: trunk@37691 -
This commit is contained in:
parent
07e2022646
commit
ece462c2a0
@ -1331,6 +1331,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TIcon.ReleaseHandle: HICON;
|
function TIcon.ReleaseHandle: HICON;
|
||||||
|
// simply return the current handle and set to 0 without freeing handles
|
||||||
begin
|
begin
|
||||||
HandleNeeded;
|
HandleNeeded;
|
||||||
Result := FSharedImage.ReleaseHandle;
|
Result := FSharedImage.ReleaseHandle;
|
||||||
|
|||||||
@ -5703,7 +5703,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
SM_CXICON,
|
SM_CXICON,
|
||||||
SM_CYICON:
|
SM_CYICON:
|
||||||
Result := 32;
|
// big icon size
|
||||||
|
// gtk recommends sizes 16,32,48. optional: 64 and 128
|
||||||
|
Result := 128;
|
||||||
SM_CXICONSPACING:
|
SM_CXICONSPACING:
|
||||||
begin
|
begin
|
||||||
//DebugLn('Trace:TODO: [TGtk2WidgetSet.GetSystemMetrics] --> SM_CXICONSPACING ');
|
//DebugLn('Trace:TODO: [TGtk2WidgetSet.GetSystemMetrics] --> SM_CXICONSPACING ');
|
||||||
@ -5826,6 +5828,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
SM_CXSMICON,
|
SM_CXSMICON,
|
||||||
SM_CYSMICON:
|
SM_CYSMICON:
|
||||||
|
// small icon size
|
||||||
|
// gtk recommends sizes 16,32,48. optional: 64 and 128
|
||||||
Result := 16;
|
Result := 16;
|
||||||
SM_CXSMSIZE:
|
SM_CXSMSIZE:
|
||||||
begin
|
begin
|
||||||
|
|||||||
@ -32,8 +32,8 @@ uses
|
|||||||
{$IFDEF HASX}
|
{$IFDEF HASX}
|
||||||
Gdk2x, X, XLib,
|
Gdk2x, X, XLib,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Classes, LCLType, Controls, LMessages, InterfaceBase,
|
Math, types, Classes, LazLogger, LCLType, Controls, LMessages, InterfaceBase,
|
||||||
Graphics,Forms, Math, WSForms, WSProc,
|
Graphics, Forms, WSForms, WSProc,
|
||||||
Gtk2Int, Gtk2Proc, Gtk2Def, Gtk2Extra, Gtk2Globals, Gtk2WSControls;
|
Gtk2Int, Gtk2Proc, Gtk2Def, Gtk2Extra, Gtk2Globals, Gtk2WSControls;
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -462,6 +462,15 @@ class procedure TGtk2WSCustomForm.SetIcon(const AForm: TCustomForm;
|
|||||||
const Small, Big: HICON);
|
const Small, Big: HICON);
|
||||||
var
|
var
|
||||||
List: PGList;
|
List: PGList;
|
||||||
|
{$IFDEF EnableGtk2WndIconList}
|
||||||
|
Icon: TIcon;
|
||||||
|
CurSize: Integer;
|
||||||
|
i: Integer;
|
||||||
|
LastIndex: Integer;
|
||||||
|
OldChange: TNotifyEvent;
|
||||||
|
OldCurrent: Integer;
|
||||||
|
IconHnd: HICON;
|
||||||
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
if not WSCheckHandleAllocated(AForm, 'SetIcon')
|
if not WSCheckHandleAllocated(AForm, 'SetIcon')
|
||||||
then Exit;
|
then Exit;
|
||||||
@ -469,10 +478,39 @@ begin
|
|||||||
if (AForm.Parent <> nil) or (AForm.ParentWindow <> 0) then Exit;
|
if (AForm.Parent <> nil) or (AForm.ParentWindow <> 0) then Exit;
|
||||||
|
|
||||||
List := nil;
|
List := nil;
|
||||||
|
{$IFDEF EnableGtk2WndIconList}
|
||||||
|
//debugln(['TGtk2WSCustomForm.SetIcon Form=',DbgSName(AForm)]);
|
||||||
|
Icon:=AForm.Icon;
|
||||||
|
if (Icon=nil) or Icon.Empty then
|
||||||
|
Icon:=Application.Icon;
|
||||||
|
if Assigned(Icon) and not Icon.Empty then
|
||||||
|
begin
|
||||||
|
CurSize:=16;
|
||||||
|
OldChange:=Icon.OnChange;
|
||||||
|
OldCurrent:=Icon.Current;
|
||||||
|
Icon.OnChange := nil;
|
||||||
|
LastIndex:=-1;
|
||||||
|
while CurSize<=256 do begin
|
||||||
|
i:=Icon.GetBestIndexForSize(Size(CurSize,CurSize));
|
||||||
|
if (i>=0) and (LastIndex<>i) then begin
|
||||||
|
Icon.Current := i;
|
||||||
|
IconHnd:=Icon.ReleaseHandle;
|
||||||
|
if IconHnd <> 0 then
|
||||||
|
List := g_list_append(List, {%H-}PGdkPixbuf(IconHnd));
|
||||||
|
//debugln(['TGtk2WSCustomForm.SetIcon adding ',CurSize]);
|
||||||
|
LastIndex:=i;
|
||||||
|
end;
|
||||||
|
CurSize:=CurSize*2;
|
||||||
|
end;
|
||||||
|
Icon.Current:=OldCurrent;
|
||||||
|
Icon.OnChange:=OldChange;
|
||||||
|
end;
|
||||||
|
{$ELSE}
|
||||||
if Small <> 0 then
|
if Small <> 0 then
|
||||||
List := g_list_append(List, {%H-}PGdkPixbuf(Small));
|
List := g_list_append(List, {%H-}PGdkPixbuf(Small));
|
||||||
if Big <> 0 then
|
if Big <> 0 then
|
||||||
List := g_list_append(List, {%H-}PGdkPixbuf(Big));
|
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);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user