mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-13 14:39:09 +02:00
lcl, win32: fix form.icon handling (#0012395)
git-svn-id: trunk@17077 -
This commit is contained in:
parent
28c3c5b1d3
commit
9dc2198062
@ -1265,7 +1265,7 @@ begin
|
|||||||
if HandleAllocated then
|
if HandleAllocated then
|
||||||
begin
|
begin
|
||||||
TWSCustomFormClass(WidgetSetClass).SetFormBorderStyle(Self, NewStyle);
|
TWSCustomFormClass(WidgetSetClass).SetFormBorderStyle(Self, NewStyle);
|
||||||
TWSCustomFormClass(WidgetSetClass).SetIcon(Self, 0, 0);
|
Perform(CM_ICONCHANGED, 0, 0);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ begin
|
|||||||
NumButtons := ButtonCount;
|
NumButtons := ButtonCount;
|
||||||
Buttons := TheButtons;
|
Buttons := TheButtons;
|
||||||
|
|
||||||
If (DefaultIndex >= ButtonCount) or
|
if (DefaultIndex >= ButtonCount) or
|
||||||
(DefaultIndex < 0)
|
(DefaultIndex < 0)
|
||||||
then
|
then
|
||||||
TheDefaultIndex := 0
|
TheDefaultIndex := 0
|
||||||
@ -268,12 +268,12 @@ begin
|
|||||||
theDefaultIndex := DefaultIndex;
|
theDefaultIndex := DefaultIndex;
|
||||||
|
|
||||||
// Assures a minimum text size
|
// Assures a minimum text size
|
||||||
If MSG = '' then MSG := ' ';
|
if MSG = '' then MSG := ' ';
|
||||||
|
|
||||||
// Initialize TextStyle
|
// Initialize TextStyle
|
||||||
FillChar(TextStyle, SizeOf(TTextStyle), 0);
|
FillChar(TextStyle, SizeOf(TTextStyle), 0);
|
||||||
|
|
||||||
With TextStyle do
|
with TextStyle do
|
||||||
begin
|
begin
|
||||||
Clipping := True;
|
Clipping := True;
|
||||||
Wordbreak := True;
|
Wordbreak := True;
|
||||||
@ -534,7 +534,7 @@ begin
|
|||||||
Top := Y;
|
Top := Y;
|
||||||
end;
|
end;
|
||||||
theModalResult := ShowModal;
|
theModalResult := ShowModal;
|
||||||
Case theModalResult of
|
case theModalResult of
|
||||||
-1 : Result := EscapeResult
|
-1 : Result := EscapeResult
|
||||||
else
|
else
|
||||||
Result := DialogResult[theModalResult];
|
Result := DialogResult[theModalResult];
|
||||||
|
@ -98,6 +98,7 @@ var
|
|||||||
SysMenu: HMENU;
|
SysMenu: HMENU;
|
||||||
Handle: HWND;
|
Handle: HWND;
|
||||||
DC: HDC;
|
DC: HDC;
|
||||||
|
AIcon: HICON;
|
||||||
begin
|
begin
|
||||||
Assert(False, 'Trace:Win32Object.Init - Start');
|
Assert(False, 'Trace:Win32Object.Init - Start');
|
||||||
if not WinRegister then
|
if not WinRegister then
|
||||||
@ -147,8 +148,8 @@ begin
|
|||||||
AllocWindowInfo(FAppHandle);
|
AllocWindowInfo(FAppHandle);
|
||||||
|
|
||||||
// set nice main icon
|
// set nice main icon
|
||||||
Windows.SendMessage(FAppHandle, WM_SETICON, ICON_BIG,
|
AIcon := Windows.LoadIcon(MainInstance, 'MAINICON');
|
||||||
LParam(Windows.LoadIcon(MainInstance, 'MAINICON')));
|
AppSetIcon(AIcon, AIcon);
|
||||||
// remove useless menuitems from sysmenu
|
// remove useless menuitems from sysmenu
|
||||||
SysMenu := Windows.GetSystemMenu(FAppHandle, False);
|
SysMenu := Windows.GetSystemMenu(FAppHandle, False);
|
||||||
Windows.DeleteMenu(SysMenu, SC_MAXIMIZE, MF_BYCOMMAND);
|
Windows.DeleteMenu(SysMenu, SC_MAXIMIZE, MF_BYCOMMAND);
|
||||||
@ -414,7 +415,10 @@ end;
|
|||||||
procedure TWin32WidgetSet.AppSetIcon(const Small, Big: HICON);
|
procedure TWin32WidgetSet.AppSetIcon(const Small, Big: HICON);
|
||||||
begin
|
begin
|
||||||
Windows.SendMessage(Win32Widgetset.AppHandle, WM_SETICON, ICON_SMALL, LPARAM(Small));
|
Windows.SendMessage(Win32Widgetset.AppHandle, WM_SETICON, ICON_SMALL, LPARAM(Small));
|
||||||
|
SetClassLong(Win32Widgetset.AppHandle, GCL_HICONSM, LONG(Small));
|
||||||
|
|
||||||
Windows.SendMessage(Win32Widgetset.AppHandle, WM_SETICON, ICON_BIG, LPARAM(Big));
|
Windows.SendMessage(Win32Widgetset.AppHandle, WM_SETICON, ICON_BIG, LPARAM(Big));
|
||||||
|
SetClassLong(Win32Widgetset.AppHandle, GCL_HICON, LONG(Big));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TWin32WidgetSet.AppSetTitle(const ATitle: string);
|
procedure TWin32WidgetSet.AppSetTitle(const ATitle: string);
|
||||||
@ -639,19 +643,6 @@ begin
|
|||||||
if Flags = SW_SHOWMAXIMIZED then
|
if Flags = SW_SHOWMAXIMIZED then
|
||||||
Windows.SendMessage(Handle, WM_SHOWWINDOW, 1, 0);
|
Windows.SendMessage(Handle, WM_SHOWWINDOW, 1, 0);
|
||||||
end;
|
end;
|
||||||
if (Sender is TCustomForm) then
|
|
||||||
begin
|
|
||||||
if TCustomForm(Sender).BorderStyle <> bsDialog then
|
|
||||||
begin
|
|
||||||
SetClassLong(Handle, GCL_HICONSM, LONG(TCustomForm(Sender).SmallIconHandle));
|
|
||||||
SetClassLong(Handle, GCL_HICON, LONG(TCustomForm(Sender).BigIconHandle));
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
SetClassLong(Handle, GCL_HICONSM, 0);
|
|
||||||
SetClassLong(Handle, GCL_HICON, 0);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
|
@ -414,11 +414,17 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TWin32WSCustomForm.SetIcon(const AForm: TCustomForm; const Small, Big: HICON);
|
class procedure TWin32WSCustomForm.SetIcon(const AForm: TCustomForm; const Small, Big: HICON);
|
||||||
|
var
|
||||||
|
Wnd: HWND;
|
||||||
begin
|
begin
|
||||||
if not WSCheckHandleAllocated(AForm, 'SetIcon') then
|
if not WSCheckHandleAllocated(AForm, 'SetIcon') then
|
||||||
Exit;
|
Exit;
|
||||||
SendMessage(AForm.Handle, WM_SETICON, ICON_SMALL, LPARAM(Small));
|
Wnd := AForm.Handle;
|
||||||
SendMessage(AForm.Handle, WM_SETICON, ICON_BIG, LPARAM(Big));
|
SendMessage(Wnd, WM_SETICON, ICON_SMALL, LPARAM(Small));
|
||||||
|
SetClassLong(Wnd, GCL_HICONSM, LONG(Small));
|
||||||
|
|
||||||
|
SendMessage(Wnd, WM_SETICON, ICON_BIG, LPARAM(Big));
|
||||||
|
SetClassLong(Wnd, GCL_HICON, LONG(Big));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TWin32WSCustomForm.SetShowInTaskbar(const AForm: TCustomForm;
|
class procedure TWin32WSCustomForm.SetShowInTaskbar(const AForm: TCustomForm;
|
||||||
|
Loading…
Reference in New Issue
Block a user