From 0fa685a539e25a34d937b9df56682d1977caa323 Mon Sep 17 00:00:00 2001 From: paul Date: Mon, 8 Nov 2010 08:17:16 +0000 Subject: [PATCH] win32: remove a mess with painting on notebook, add simple support for csParentBackground required for transparent frames painting git-svn-id: trunk@28149 - --- lcl/interfaces/win32/win32callback.inc | 19 ++++--------------- lcl/interfaces/win32/win32wscontrols.pp | 4 ++-- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/lcl/interfaces/win32/win32callback.inc b/lcl/interfaces/win32/win32callback.inc index 731c89771a..c3981e97fa 100644 --- a/lcl/interfaces/win32/win32callback.inc +++ b/lcl/interfaces/win32/win32callback.inc @@ -355,7 +355,6 @@ var isNotebook: boolean; isNativeControl: boolean; needParentPaint: boolean; - lNotebookFound: boolean; BufferWasSaved: Boolean; BackupBuffer: TDoubleBuffer; begin @@ -370,24 +369,14 @@ var // create a paint message isNotebook := ThemeServices.ThemesEnabled and (WndClassName(Window) = TabControlClsName); isNativeControl := GetIsNativeControl(Window); - ParentPaintWindow := 0; needParentPaint := GetNeedParentPaint(WindowInfo, lWinControl); // if needParentPaint and not isTabPage then background will be drawn in // WM_ERASEBKGND and WM_CTLCOLORSTATIC for native controls // sent by default paint handler - if WindowInfo^.isTabPage or (needParentPaint - and (not isNativeControl or (ControlDC <> 0))) then - begin - ParentPaintWindow := Window; - lNotebookFound := false; - while (ParentPaintWindow <> 0) and not lNotebookFound do - begin - // notebook is parent of window that has istabpage - if GetWin32WindowInfo(ParentPaintWindow)^.isTabPage then - lNotebookFound := true; - ParentPaintWindow := Windows.GetParent(ParentPaintWindow); - end; - end; + if WindowInfo^.isTabPage or (needParentPaint and (not isNativeControl or (ControlDC <> 0))) then + ParentPaintWindow := Windows.GetParent(Window) + else + ParentPaintWindow := 0; // if painting background of some control for tabpage, don't handle erase background // in parent of tabpage diff --git a/lcl/interfaces/win32/win32wscontrols.pp b/lcl/interfaces/win32/win32wscontrols.pp index 062d29083a..a7990724ba 100644 --- a/lcl/interfaces/win32/win32wscontrols.pp +++ b/lcl/interfaces/win32/win32wscontrols.pp @@ -285,8 +285,8 @@ begin if not NCCreateParams.Handled then begin WindowInfo := AllocWindowInfo(Window); - if GetWin32WindowInfo(Parent)^.needParentPaint then - WindowInfo^.needParentPaint := true; + WindowInfo^.needParentPaint := GetWin32WindowInfo(Parent)^.needParentPaint or + (Assigned(AWinControl) and (csParentBackground in AWinControl.ControlStyle)); WindowInfo^.WinControl := AWinControl; AWinControl.Handle := Window; if Assigned(SubClassWndProc) then