From 3c2544bb7047ad8d639b83bc0725f68e4a1ddab8 Mon Sep 17 00:00:00 2001
From: Julian Smart <julian@anthemion.co.uk>
Date: Wed, 3 Mar 2004 20:44:37 +0000
Subject: [PATCH] Added wxSP_NO_XP_THEME style to wxSplitterWindow to switch
 off theming (some applications look bad without 3D borders)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26064 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 docs/changes.txt              | 10 ++++++++++
 docs/latex/wx/splitter.tex    |  6 ++----
 include/wx/splitter.h         |  1 +
 samples/splitter/splitter.cpp |  3 ++-
 src/msw/renderer.cpp          | 30 ++++++++++++++++++++++--------
 5 files changed, 37 insertions(+), 13 deletions(-)

diff --git a/docs/changes.txt b/docs/changes.txt
index 2bbf054412..3e46a9db91 100644
--- a/docs/changes.txt
+++ b/docs/changes.txt
@@ -77,8 +77,18 @@ OTHER CHANGES
 2.5.2
 -----
 
+All:
+
+All (GUI):
+
+- wxHtmlWindow now delays image scaling until rendering,
+  resulting in much better display of scaled images
+
 wxMSW:
+
 - wxWindow::Freeze()/Thaw() can now be nested
+- Added wxSP_NO_XP_THEME style to wxSplitterWindow to switch off
+  XP theming (some applications look bad without 3D borders)
 
 
 2.5.1
diff --git a/docs/latex/wx/splitter.tex b/docs/latex/wx/splitter.tex
index a76b73188b..71f0e82d58 100644
--- a/docs/latex/wx/splitter.tex
+++ b/docs/latex/wx/splitter.tex
@@ -6,10 +6,6 @@ This class manages up to two subwindows. The current view can be
 split into two programmatically (perhaps from a menu command), and unsplit
 either programmatically or via the wxSplitterWindow user interface.
 
-Appropriate 3D shading for the Windows 95 user interface is an option -
-this is also recommended for GTK. Optionally, the sash can be made to
-look more like the native control under MacOS X.
-
 \wxheading{Window styles}
 
 \begin{twocollist}\itemsep=0pt
@@ -18,6 +14,8 @@ look more like the native control under MacOS X.
 \twocolitem{\windowstyle{wxSP\_3DBORDER}}{Synonym for wxSP\_BORDER.}
 \twocolitem{\windowstyle{wxSP\_BORDER}}{Draws a standard border.}
 \twocolitem{\windowstyle{wxSP\_NOBORDER}}{No border (default).}
+\twocolitem{\windowstyle{wxSP\_NO\_XP\_THEME}}{Under Windows XP, switches off the attempt to draw the
+splitter using Windows XP theming, so the borders and sash will take on the pre-XP look.}
 \twocolitem{\windowstyle{wxSP\_PERMIT\_UNSPLIT}}{Always allow to
 unsplit, even with the minimum pane size other than zero.}
 \twocolitem{\windowstyle{wxSP\_LIVE\_UPDATE}}{Don't draw XOR line but resize the child windows immediately.}
diff --git a/include/wx/splitter.h b/include/wx/splitter.h
index c087846a7a..0858064c69 100644
--- a/include/wx/splitter.h
+++ b/include/wx/splitter.h
@@ -13,6 +13,7 @@
 #define wxSP_LIVE_UPDATE      0x0080
 #define wxSP_3DSASH           0x0100
 #define wxSP_3DBORDER         0x0200
+#define wxSP_NO_XP_THEME      0x0400
 #define wxSP_BORDER           wxSP_3DBORDER
 #define wxSP_3D               (wxSP_3DBORDER | wxSP_3DSASH)
 
diff --git a/samples/splitter/splitter.cpp b/samples/splitter/splitter.cpp
index c869422b91..c50441b75f 100644
--- a/samples/splitter/splitter.cpp
+++ b/samples/splitter/splitter.cpp
@@ -356,7 +356,8 @@ END_EVENT_TABLE()
 MySplitterWindow::MySplitterWindow(wxFrame *parent)
                 : wxSplitterWindow(parent, -1,
                                    wxDefaultPosition, wxDefaultSize,
-                                   0x700| wxSP_LIVE_UPDATE | wxCLIP_CHILDREN)
+                                   wxSP_3D | wxSP_LIVE_UPDATE |
+                                   wxCLIP_CHILDREN /* | wxSP_NO_XP_THEME */ )
 {
     m_frame = parent;
 }
diff --git a/src/msw/renderer.cpp b/src/msw/renderer.cpp
index 313865986c..d4c36549f8 100644
--- a/src/msw/renderer.cpp
+++ b/src/msw/renderer.cpp
@@ -30,8 +30,8 @@
     #include "wx/dc.h"
 #endif //WX_PRECOMP
 
+#include "wx/splitter.h"
 #include "wx/renderer.h"
-
 #include "wx/msw/uxtheme.h"
 
 // ----------------------------------------------------------------------------
@@ -116,17 +116,24 @@ wxRendererNative& wxRendererXP::Get()
 static const wxCoord SASH_WIDTH = 4;
 
 wxSplitterRenderParams
-wxRendererXP::GetSplitterParams(const wxWindow * WXUNUSED(win))
+wxRendererXP::GetSplitterParams(const wxWindow * win)
 {
-    return wxSplitterRenderParams(SASH_WIDTH, 0, false);
+    if (win->GetWindowStyle() & wxSP_NO_XP_THEME)
+        return m_rendererNative.GetSplitterParams(win);
+    else
+        return wxSplitterRenderParams(SASH_WIDTH, 0, false);
 }
 
 void
-wxRendererXP::DrawSplitterBorder(wxWindow * WXUNUSED(win),
-                                 wxDC& WXUNUSED(dc),
-                                 const wxRect& WXUNUSED(rect),
-                                 int WXUNUSED(flags))
+wxRendererXP::DrawSplitterBorder(wxWindow * win,
+                                 wxDC& dc,
+                                 const wxRect& rect,
+                                 int flags)
 {
+    if (win->GetWindowStyle() & wxSP_NO_XP_THEME)
+    {
+        m_rendererNative.DrawSplitterBorder(win, dc, rect, flags);
+    }
 }
 
 void
@@ -135,8 +142,15 @@ wxRendererXP::DrawSplitterSash(wxWindow *win,
                                const wxSize& size,
                                wxCoord position,
                                wxOrientation orient,
-                               int WXUNUSED(flags))
+                               int flags)
 {
+    if (win->GetWindowStyle() & wxSP_NO_XP_THEME)
+    {
+        m_rendererNative.DrawSplitterSash(
+                   win, dc, size, position, orient, flags);
+        return;
+    }
+    
     // I don't know if it is correct to use the rebar background for the
     // splitter but it least this works ok in the default theme
     wxUxThemeHandle hTheme(win, L"REBAR");
-- 
2.50.0

