From 3de03aa7ba78a9d87ee71d87af1b80a35da751ab Mon Sep 17 00:00:00 2001 From: paul Date: Fri, 17 Oct 2008 08:58:52 +0000 Subject: [PATCH] lcl, win32: fix icon for dialog forms (#0012395) git-svn-id: trunk@17031 - --- lcl/include/customform.inc | 8 +++++++- lcl/interfaces/win32/win32object.inc | 12 ++++++++++-- lcl/interfaces/win32/win32wsforms.pp | 1 - lcl/interfaces/wince/winceobject.inc | 15 +++++++++++++-- lcl/interfaces/wince/wincewsforms.pp | 1 - 5 files changed, 30 insertions(+), 7 deletions(-) diff --git a/lcl/include/customform.inc b/lcl/include/customform.inc index 0ec8965af9..4551e36d36 100644 --- a/lcl/include/customform.inc +++ b/lcl/include/customform.inc @@ -180,7 +180,10 @@ begin if HandleAllocated then begin FreeIconHandles; - TWSCustomFormClass(WidgetSetClass).SetIcon(Self, SmallIconHandle, BigIconHandle); + if BorderStyle <> bsDialog then + TWSCustomFormClass(WidgetSetClass).SetIcon(Self, SmallIconHandle, BigIconHandle) + else + TWSCustomFormClass(WidgetSetClass).SetIcon(Self, 0, 0); end; end; @@ -1260,7 +1263,10 @@ begin // We can not use inherited SetBorderStyle(NewStyle), // because TBorderStyle <> TFormBorderStyle; if HandleAllocated then + begin TWSCustomFormClass(WidgetSetClass).SetFormBorderStyle(Self, NewStyle); + TWSCustomFormClass(WidgetSetClass).SetIcon(Self, 0, 0); + end; end; {------------------------------------------------------------------------------ diff --git a/lcl/interfaces/win32/win32object.inc b/lcl/interfaces/win32/win32object.inc index 721cfcf97d..01a3d7fa95 100644 --- a/lcl/interfaces/win32/win32object.inc +++ b/lcl/interfaces/win32/win32object.inc @@ -641,8 +641,16 @@ begin end; if (Sender is TCustomForm) then begin - SetClassLong(Handle, GCL_HICONSM, LONG(TCustomForm(Sender).SmallIconHandle)); - SetClassLong(Handle, GCL_HICON, LONG(TCustomForm(Sender).BigIconHandle)); + 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 else diff --git a/lcl/interfaces/win32/win32wsforms.pp b/lcl/interfaces/win32/win32wsforms.pp index 3349e08ce2..447b472ff5 100644 --- a/lcl/interfaces/win32/win32wsforms.pp +++ b/lcl/interfaces/win32/win32wsforms.pp @@ -355,7 +355,6 @@ class procedure TWin32WSCustomForm.SetBorderIcons(const AForm: TCustomForm; begin UpdateWindowStyle(AForm.Handle, CalcBorderIconsFlags(AForm), WS_SYSMENU or WS_MINIMIZEBOX or WS_MAXIMIZEBOX); - SetIcon(AForm, 0, 0); end; class procedure TWin32WSCustomForm.SetFormBorderStyle(const AForm: TCustomForm; diff --git a/lcl/interfaces/wince/winceobject.inc b/lcl/interfaces/wince/winceobject.inc index a538d79910..c41d039e89 100644 --- a/lcl/interfaces/wince/winceobject.inc +++ b/lcl/interfaces/wince/winceobject.inc @@ -589,8 +589,19 @@ begin if Flags = SW_SHOWMAXIMIZED then Windows.SendMessage(Handle, WM_SHOWWINDOW, 1, 0); end; - if (Sender Is TCustomForm) then - SetClassLong(Handle, GCL_HICON, LONG(TCustomForm(Sender).GetIconHandle)); + 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 else begin diff --git a/lcl/interfaces/wince/wincewsforms.pp b/lcl/interfaces/wince/wincewsforms.pp index feb56b3160..5f62eeb133 100644 --- a/lcl/interfaces/wince/wincewsforms.pp +++ b/lcl/interfaces/wince/wincewsforms.pp @@ -355,7 +355,6 @@ class procedure TWinCEWSCustomForm.SetBorderIcons(const AForm: TCustomForm; begin UpdateWindowStyle(AForm.Handle, CalcBorderIconsFlags(AForm), WS_SYSMENU or WS_MINIMIZEBOX or WS_MAXIMIZEBOX); - SetIcon(AForm, 0, 0); end; class procedure TWinCEWSCustomForm.SetFormBorderStyle(const AForm: TCustomForm;