Move wxPanel::HasTransparentBackground() to wxControlContainer

This MSW-specific hack is actually needed by all windows containing more than
one control, even if they don't derive from wxPanel (which is just the most
commonly used class for such windows), otherwise the parts of the window not
covered by the child controls won't have the correct appearance when the
window itself is inside a wxNotebook.

So do this for all classes inheriting from wxNavigationEnabled<>, notably this
fixes the wrong background for all kinds of picker controls (wxDirPickerCtrl,
wxFilePickerCtrl, ...) when they're used inside a wxNotebook.

After moving this method out of wxPanel, src/msw/panel.cpp became empty, so
also delete it and remove it from {bake,make,project} files.
This commit is contained in:
Vadim Zeitlin
2016-06-07 22:04:53 +02:00
parent 45919829c0
commit 7f603c959f
15 changed files with 51 additions and 149 deletions

View File

@@ -90,6 +90,16 @@ public:
// Returns true if we have any focusable children, false otherwise.
bool UpdateCanFocusChildren();
#ifdef __WXMSW__
// This is not strictly related to navigation, but all windows containing
// more than one children controls need to return from this method if any
// of their parents has an inheritable background, so do this automatically
// for all of them (another alternative could be to do it in wxWindow
// itself but this would be potentially more backwards incompatible and
// could conceivably break some custom windows).
bool HasTransparentBackground() const;
#endif // __WXMSW__
protected:
// set the focus to the child which had it the last time
virtual bool SetFocusToChild();
@@ -252,6 +262,13 @@ public:
BaseWindowClass::SetFocus();
}
#ifdef __WXMSW__
WXDLLIMPEXP_INLINE_CORE virtual bool HasTransparentBackground() wxOVERRIDE
{
return m_container.HasTransparentBackground();
}
#endif // __WXMSW__
protected:
#ifndef wxHAS_NATIVE_TAB_TRAVERSAL
void OnNavigationKey(wxNavigationKeyEvent& event)

View File

@@ -31,12 +31,6 @@ public:
Create(parent, winid, pos, size, style, name);
}
// This is overridden for MSW to return true for all panels that are child
// of a window with themed background (such as wxNotebook) which should
// show through the child panels.
virtual bool HasTransparentBackground();
#if WXWIN_COMPATIBILITY_2_8
wxDEPRECATED_CONSTRUCTOR(
wxPanel(wxWindow *parent,