Finally really correct background erasing for wxMSW wxToolBar.
Do use TBSTYLE_FLAT and TBSTYLE_TRANSPARENT (the former actually implies the latter) for MSW toolbar as it is the only way to avoid the flicker of toolbar buttons. These styles were disabled before because of lack of understanding about how they worked: with them, the toolbar supposes that its parent takes care of erasing its background but wx didn't do this (in fact wxFrame did accidentally erase toolbar background because of the use of Win32 client rectangle, including tool/status bars, instead of wx client rectangle, excluding them, in wxWindowMSW::DoEraseBackground(), but it didn't do it correctly). Now we allow hooking WM_ERASEBKGND events processing in a parent window by a child one and use this to handle toolbar background erasing in toolbar itself. We still prevent the native toolbar from drawing dummy separators and always erase the area occupied by them ourselves and thus avoid the flicker entirely. The only remaining flicker in the toolbar sample is that of embedded wxStaticText control. It does appear with correctly transparent background and bitmaps with alpha channel also (still) are drawn correctly in wxStaticBitmaps embedded in the toolbar. Finally, we still use solid background brush for toolbar but we can easily use a themed background if really desired, there is just a single function to change to do it (MSWGetToolbarBgBrush()). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62971 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -447,6 +447,27 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
#if !defined(__WXWINCE__) && !defined(__WXUNIVERSAL__)
|
||||
#define wxHAS_MSW_BACKGROUND_ERASE_HOOK
|
||||
#endif
|
||||
|
||||
#ifdef wxHAS_MSW_BACKGROUND_ERASE_HOOK
|
||||
// allows the child to hook into its parent WM_ERASEBKGND processing: call
|
||||
// MSWSetEraseBgHook() with a non-NULL window to make parent call
|
||||
// MSWEraseBgHook() on this window (don't forget to reset it to NULL
|
||||
// afterwards)
|
||||
//
|
||||
// this hack is used by wxToolBar, see comments there
|
||||
void MSWSetEraseBgHook(wxWindow *child);
|
||||
|
||||
// return true if WM_ERASEBKGND is currently hooked
|
||||
bool MSWHasEraseBgHook() const;
|
||||
|
||||
// called when the window on which MSWSetEraseBgHook() had been called
|
||||
// receives WM_ERASEBKGND
|
||||
virtual bool MSWEraseBgHook(WXHDC WXUNUSED(hDC)) { return false; }
|
||||
#endif // wxHAS_MSW_BACKGROUND_ERASE_HOOK
|
||||
|
||||
// common part of Show/HideWithEffect()
|
||||
bool MSWShowWithEffect(bool show,
|
||||
wxShowEffect effect,
|
||||
|
Reference in New Issue
Block a user