+// ----------------------------------------------------------------------------
+// flicker-less notebook redraw
+// ----------------------------------------------------------------------------
+
+#if USE_NOTEBOOK_ANTIFLICKER
+
+// wnd proc for the spin button
+LRESULT APIENTRY _EXPORT wxNotebookSpinBtnWndProc(HWND hwnd,
+ UINT message,
+ WPARAM wParam,
+ LPARAM lParam)
+{
+ if ( message == WM_ERASEBKGND )
+ return 0;
+
+ return ::CallWindowProc(CASTWNDPROC gs_wndprocNotebookSpinBtn,
+ hwnd, message, wParam, lParam);
+}
+
+LRESULT APIENTRY _EXPORT wxNotebookWndProc(HWND hwnd,
+ UINT message,
+ WPARAM wParam,
+ LPARAM lParam)
+{
+ return ::CallWindowProc(CASTWNDPROC gs_wndprocNotebook,
+ hwnd, message, wParam, lParam);
+}
+
+void wxNotebook::OnEraseBackground(wxEraseEvent& WXUNUSED(event))
+{
+ // do nothing here
+}
+
+void wxNotebook::OnPaint(wxPaintEvent& WXUNUSED(event))
+{
+ wxPaintDC dc(this);
+ wxMemoryDC memdc;
+ RECT rc;
+ ::GetClientRect(GetHwnd(), &rc);
+ wxBitmap bmp(rc.right, rc.bottom);
+ memdc.SelectObject(bmp);
+
+ const wxLayoutDirection dir = dc.GetLayoutDirection();
+ memdc.SetLayoutDirection(dir);
+
+ // if there is no special brush just use the solid background colour
+#if wxUSE_UXTHEME
+ HBRUSH hbr = (HBRUSH)m_hbrBackground;
+#else
+ HBRUSH hbr = 0;
+#endif
+ wxBrush brush;
+ if ( !hbr )
+ {
+ brush = wxBrush(GetBackgroundColour());
+ hbr = GetHbrushOf(brush);
+ }
+
+ ::FillRect(GetHdcOf(memdc), &rc, hbr);
+
+ MSWDefWindowProc(WM_PAINT, (WPARAM)memdc.GetHDC(), 0);
+
+ // For some reason in RTL mode, source offset has to be -1, otherwise the
+ // right border (physical) remains unpainted.
+ const wxCoord ofs = dir == wxLayout_RightToLeft ? -1 : 0;
+ dc.Blit(ofs, 0, rc.right, rc.bottom, &memdc, ofs, 0);
+}
+
+#endif // USE_NOTEBOOK_ANTIFLICKER