From 6f3f9b50aa275243ade3541ecccb95de22cf57a9 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Wed, 8 Aug 2007 12:39:56 +0000 Subject: [PATCH] Made wxBORDER_THEME the same as wxBORDER_DEFAULT Moved wxControl::GetBorderStyle into wxWindowMSW::GetBorderStyle but added GetBorderStyle to have the same behaviour as before (so e.g. notebook panels don't get borders) Improved help window borders git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47963 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/defs.h | 2 +- include/wx/generic/panelg.h | 2 ++ include/wx/msw/control.h | 3 --- include/wx/msw/window.h | 3 +++ src/html/helpwnd.cpp | 17 +++++++++++++---- src/msw/control.cpp | 5 ----- src/msw/window.cpp | 16 +++++++++++----- 7 files changed, 30 insertions(+), 18 deletions(-) diff --git a/include/wx/defs.h b/include/wx/defs.h index 43c15e50f3..c8f84b7ef4 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -1407,7 +1407,7 @@ enum wxBorder wxBORDER_RAISED = 0x04000000, wxBORDER_SUNKEN = 0x08000000, wxBORDER_DOUBLE = 0x10000000, /* deprecated */ - wxBORDER_THEME = 0x10000000, + wxBORDER_THEME = wxBORDER_DEFAULT, /* a mask to extract border style from the combination of flags */ wxBORDER_MASK = 0x1f200000 diff --git a/include/wx/generic/panelg.h b/include/wx/generic/panelg.h index ae5e74e829..cbda3af503 100644 --- a/include/wx/generic/panelg.h +++ b/include/wx/generic/panelg.h @@ -79,6 +79,8 @@ public: virtual bool IsCanvasWindow() const { return true; } #endif + // choose the default border for this window + virtual wxBorder GetDefaultBorder() const { return wxWindowBase::GetDefaultBorder(); } WX_DECLARE_CONTROL_CONTAINER(); diff --git a/include/wx/msw/control.h b/include/wx/msw/control.h index a2e56f7159..a8ee1e5075 100644 --- a/include/wx/msw/control.h +++ b/include/wx/msw/control.h @@ -72,9 +72,6 @@ public: virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; protected: - // choose the default border for this window - virtual wxBorder GetDefaultBorder() const; - // return default best size (doesn't really make any sense, override this) virtual wxSize DoGetBestSize() const; diff --git a/include/wx/msw/window.h b/include/wx/msw/window.h index 2b56566a73..cd55625acd 100644 --- a/include/wx/msw/window.h +++ b/include/wx/msw/window.h @@ -438,6 +438,9 @@ public: // wxControl virtual wxBorder GetDefaultBorderForControl() const; + // choose the default border for this window + virtual wxBorder GetDefaultBorder() const; + // synthesize a wxEVT_LEAVE_WINDOW event and set m_mouseInWindow to false void GenerateMouseLeave(); diff --git a/src/html/helpwnd.cpp b/src/html/helpwnd.cpp index e14ecb7105..4642854190 100644 --- a/src/html/helpwnd.cpp +++ b/src/html/helpwnd.cpp @@ -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 = GetDefaultBorder(); + 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); } diff --git a/src/msw/control.cpp b/src/msw/control.cpp index 2f1ae919e7..272ef5b701 100644 --- a/src/msw/control.cpp +++ b/src/msw/control.cpp @@ -226,11 +226,6 @@ bool wxControl::MSWCreateControl(const wxChar *classname, // various accessors // ---------------------------------------------------------------------------- -wxBorder wxControl::GetDefaultBorder() const -{ - return GetDefaultBorderForControl(); -} - WXDWORD wxControl::MSWGetStyle(long style, WXDWORD *exstyle) const { long msStyle = wxWindow::MSWGetStyle(style, exstyle); diff --git a/src/msw/window.cpp b/src/msw/window.cpp index e177b1a120..99bb37b398 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -1286,6 +1286,11 @@ void wxWindowMSW::MSWUpdateStyle(long flagsOld, long exflagsOld) } } +wxBorder wxWindowMSW::GetDefaultBorder() const +{ + return GetDefaultBorderForControl(); +} + wxBorder wxWindowMSW::GetDefaultBorderForControl() const { // we want to automatically give controls a sunken style (confusingly, @@ -1354,14 +1359,11 @@ WXDWORD wxWindowMSW::MSWGetStyle(long flags, WXDWORD *exstyle) const switch ( border ) { - default: - case wxBORDER_DEFAULT: - wxFAIL_MSG( _T("unknown border style") ); - // fall through + case wxBORDER_DEFAULT: // also wxBORDER_THEME + break; case wxBORDER_NONE: case wxBORDER_SIMPLE: - case wxBORDER_THEME: break; case wxBORDER_STATIC: @@ -1377,6 +1379,10 @@ WXDWORD wxWindowMSW::MSWGetStyle(long flags, WXDWORD *exstyle) const style &= ~WS_BORDER; break; + default: + wxFAIL_MSG( _T("unknown border style") ); + break; + // case wxBORDER_DOUBLE: // *exstyle |= WS_EX_DLGMODALFRAME; // break; -- 2.45.2