Added wxWindowMSW::GetThemedBorderStyle as a helper for 2.8

Improved help window borders


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@47962 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2007-08-08 12:38:13 +00:00
parent 8d4c087418
commit 84426bea01
5 changed files with 37 additions and 11 deletions

View File

@@ -219,6 +219,12 @@ public:
// created yet)
void MSWUpdateStyle(long flagsOld, long exflagsOld);
#if wxABI_VERSION >= 20805
// Helper for getting an appropriate theme style for the application. Unnecessary in
// 2.9 and above.
wxBorder GetThemedBorderStyle() const;
#endif
// translate wxWidgets coords into Windows ones suitable to be passed to
// ::CreateWindow()
//

View File

@@ -30,10 +30,6 @@
#include "wx/image.h"
#if defined(__WXMSW__) && wxUSE_UXTHEME
#include "wx/msw/uxtheme.h"
#endif
#define WXMAX(a,b) ((a)>(b)?(a):(b))
// ----------------------------------------------------------------------------
@@ -327,9 +323,10 @@ bool wxSearchCtrl::Create(wxWindow *parent, wxWindowID id,
{
int borderStyle = wxBORDER_SIMPLE;
#if defined(__WXMSW__) && wxUSE_UXTHEME && !(defined(__POCKETPC__) || defined(__SMARTPHONE__))
if (wxUxThemeEngine::GetIfActive())
borderStyle = wxBORDER_THEME;
#if defined(__WXMSW__)
borderStyle = GetThemedBorderStyle();
if (borderStyle == wxBORDER_SUNKEN)
borderStyle = wxBORDER_SIMPLE;
#elif defined(__WXGTK__)
borderStyle = wxBORDER_SUNKEN;
#endif

View File

@@ -108,8 +108,9 @@ class wxHtmlHelpHashData : public wxObject
class wxHtmlHelpHtmlWindow : public wxHtmlWindow
{
public:
wxHtmlHelpHtmlWindow(wxHtmlHelpWindow *win, wxWindow *parent)
: wxHtmlWindow(parent), m_Window(win)
wxHtmlHelpHtmlWindow(wxHtmlHelpWindow *win, wxWindow *parent, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition, const wxSize& sz = wxDefaultSize, long style = wxHW_DEFAULT_STYLE)
: wxHtmlWindow(parent, id, pos, sz, style), m_Window(win)
{
SetStandardFonts();
}
@@ -361,6 +362,14 @@ bool wxHtmlHelpWindow::Create(wxWindow* parent, wxWindowID id,
wxSizer *navigSizer = NULL;
#ifdef __WXMSW__
wxBorder htmlWindowBorder = GetThemedBorderStyle();
if (htmlWindowBorder == wxBORDER_SUNKEN)
htmlWindowBorder = wxBORDER_SIMPLE;
#else
wxBorder htmlWindowBorder = wxBORDER_SIMPLE;
#endif
if (helpStyle & (wxHF_CONTENTS | wxHF_INDEX | wxHF_SEARCH))
{
// traditional help controller; splitter window with html page on the
@@ -369,7 +378,7 @@ bool wxHtmlHelpWindow::Create(wxWindow* parent, wxWindowID id,
topWindowSizer->Add(m_Splitter, 1, wxEXPAND);
m_HtmlWin = new wxHtmlHelpHtmlWindow(this, m_Splitter);
m_HtmlWin = new wxHtmlHelpHtmlWindow(this, m_Splitter, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_DEFAULT_STYLE|htmlWindowBorder);
m_NavigPan = new wxPanel(m_Splitter, wxID_ANY);
m_NavigNotebook = new wxNotebook(m_NavigPan, wxID_HTML_NOTEBOOK,
wxDefaultPosition, wxDefaultSize);
@@ -382,7 +391,7 @@ bool wxHtmlHelpWindow::Create(wxWindow* parent, wxWindowID id,
else
{
// only html window, no notebook with index,contents etc
m_HtmlWin = new wxHtmlWindow(this);
m_HtmlWin = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_DEFAULT_STYLE|htmlWindowBorder);
topWindowSizer->Add(m_HtmlWin, 1, wxEXPAND);
}

View File

@@ -1425,6 +1425,19 @@ WXDWORD wxWindowMSW::MSWGetStyle(long flags, WXDWORD *exstyle) const
return style;
}
// Helper for getting an appropriate theme style for the application. Unnecessary in
// 2.9 and above.
wxBorder wxWindowMSW::GetThemedBorderStyle() const
{
#if defined(__POCKETPC__) || defined(__SMARTPHONE__)
return wxBORDER_SIMPLE
#elif wxUSE_UXTHEME
if (wxUxThemeEngine::GetIfActive())
return wxBORDER_THEME;
#endif
return wxBORDER_SUNKEN;
}
// Setup background and foreground colours correctly
void wxWindowMSW::SetupColours()
{

View File

@@ -40,6 +40,7 @@
*wxLogChain*DetachOldLog*;
*wxMemoryFSHandler*AddFileWithMimeType*;
*wxMetafileDC*DoGetTextExtent*;
*wxWindowMSW*GetThemedBorderStyle*;
*wxWizard*GetBitmap*;
*wxWizard*SetBitmap*;
};