X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/140d93c02405492f501c61e2c59e9a10a0e19575..4b601a59b5f303a8866a18c90fff90aff393c6b7:/src/msw/window.cpp diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 58803775e8..ed1076ccfa 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -724,6 +724,9 @@ wxWindowMSW::MSWShowWithEffect(bool show, wxShowEffect effect, unsigned timeout) { + if ( effect == wxSHOW_EFFECT_NONE ) + return Show(show); + if ( !wxWindowBase::Show(show) ) return false; @@ -2682,7 +2685,7 @@ LRESULT WXDLLEXPORT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, WPARAM w // trace all messages: useful for the debugging but noticeably slows down // the code so don't do it by default #if wxDEBUG_LEVEL >= 2 - wxLogTrace(wxTraceMessages, + wxLogTrace("winmsg", wxT("Processing %s(hWnd=%p, wParam=%08lx, lParam=%08lx)"), wxGetMessageName(message), hWnd, (long)wParam, lParam); #endif // wxDEBUG_LEVEL >= 2 @@ -3546,7 +3549,7 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l if ( !processed ) { #if wxDEBUG_LEVEL >= 2 - wxLogTrace(wxTraceMessages, wxT("Forwarding %s to DefWindowProc."), + wxLogTrace("winmsg", wxT("Forwarding %s to DefWindowProc."), wxGetMessageName(message)); #endif // wxDEBUG_LEVEL >= 2 rc.result = MSWDefWindowProc(message, wParam, lParam); @@ -4698,6 +4701,69 @@ extern wxCOLORMAP *wxGetStdColourMap() return s_cmap; } +#if wxUSE_UXTHEME && !defined(TMT_FILLCOLOR) + #define TMT_FILLCOLOR 3802 + #define TMT_TEXTCOLOR 3803 + #define TMT_BORDERCOLOR 3801 +#endif + +wxColour wxWindowMSW::MSWGetThemeColour(const wchar_t *themeName, + int themePart, + int themeState, + MSWThemeColour themeColour, + wxSystemColour fallback) +{ +#if wxUSE_UXTHEME + const wxUxThemeEngine* theme = wxUxThemeEngine::GetIfActive(); + if ( theme ) + { + int themeProperty = 0; + + // TODO: Convert this into a table? Sure would be faster. + switch ( themeColour ) + { + case ThemeColourBackground: + themeProperty = TMT_FILLCOLOR; + break; + case ThemeColourText: + themeProperty = TMT_TEXTCOLOR; + break; + case ThemeColourBorder: + themeProperty = TMT_BORDERCOLOR; + break; + default: + wxFAIL_MSG(wxT("unsupported theme colour")); + }; + + wxUxThemeHandle hTheme(this, themeName); + COLORREF col; + HRESULT hr = theme->GetThemeColor + ( + hTheme, + themePart, + themeState, + themeProperty, + &col + ); + + if ( SUCCEEDED(hr) ) + return wxRGBToColour(col); + + wxLogApiError( + wxString::Format( + "GetThemeColor(%s, %i, %i, %i)", + themeName, themePart, themeState, themeProperty), + hr); + } +#else + wxUnusedVar(themeName); + wxUnusedVar(themePart); + wxUnusedVar(themeState); + wxUnusedVar(themeColour); +#endif + return wxSystemSettings::GetColour(fallback); +} + // --------------------------------------------------------------------------- // painting // --------------------------------------------------------------------------- @@ -4751,15 +4817,10 @@ void wxWindowMSW::OnPaint(wxPaintEvent& event) bool wxWindowMSW::HandleEraseBkgnd(WXHDC hdc) { - // standard non top level controls (i.e. except the dialogs) always erase - // their background themselves in HandleCtlColor() or have some control- - // specific ways to set the colours (common controls) - if ( IsOfStandardClass() && !IsTopLevel() ) - return false; - switch ( GetBackgroundStyle() ) { case wxBG_STYLE_ERASE: + case wxBG_STYLE_COLOUR: // we need to generate an erase background event { wxDCTemp dc(hdc, GetClientSize()); @@ -4778,7 +4839,7 @@ bool wxWindowMSW::HandleEraseBkgnd(WXHDC hdc) if ( rc ) { - // background erase by the user-defined handler + // background erased by the user-defined handler return true; } } @@ -4794,6 +4855,7 @@ bool wxWindowMSW::HandleEraseBkgnd(WXHDC hdc) break; case wxBG_STYLE_PAINT: + case wxBG_STYLE_TRANSPARENT: // no need to do anything here at all, background will be entirely // redrawn in WM_PAINT handler break; @@ -4817,7 +4879,7 @@ bool wxWindowMSW::DoEraseBackground(WXHDC hDC) } WXHBRUSH -wxWindowMSW::MSWGetBgBrushForChild(WXHDC WXUNUSED(hDC), WXHWND hWnd) +wxWindowMSW::MSWGetBgBrushForChild(WXHDC WXUNUSED(hDC), wxWindowMSW *child) { if ( m_hasBgCol ) { @@ -4829,11 +4891,10 @@ wxWindowMSW::MSWGetBgBrushForChild(WXHDC WXUNUSED(hDC), WXHWND hWnd) // children because it would look wrong if a child of non // transparent child would show our bg colour when the child itself // does not - wxWindow *win = wxFindWinFromHandle(hWnd); - if ( win == this || + if ( child == this || m_inheritBgCol || - (win && win->HasTransparentBackground() && - win->GetParent() == this) ) + (child->HasTransparentBackground() && + child->GetParent() == this) ) { // draw children with the same colour as the parent wxBrush * @@ -4846,14 +4907,11 @@ wxWindowMSW::MSWGetBgBrushForChild(WXHDC WXUNUSED(hDC), WXHWND hWnd) return 0; } -WXHBRUSH wxWindowMSW::MSWGetBgBrush(WXHDC hDC, WXHWND hWndToPaint) +WXHBRUSH wxWindowMSW::MSWGetBgBrush(WXHDC hDC, wxWindowMSW *child) { - if ( !hWndToPaint ) - hWndToPaint = GetHWND(); - for ( wxWindowMSW *win = this; win; win = win->GetParent() ) { - WXHBRUSH hBrush = win->MSWGetBgBrushForChild(hDC, hWndToPaint); + WXHBRUSH hBrush = win->MSWGetBgBrushForChild(hDC, child); if ( hBrush ) return hBrush; @@ -6096,11 +6154,8 @@ int wxCharCodeMSWToWX(int vk, WXLPARAM lParam) return wxk; } -WXWORD wxCharCodeWXToMSW(int wxk, bool *isVirtual) +WXWORD wxCharCodeWXToMSW(int wxk) { - if ( isVirtual ) - *isVirtual = true; - // check the table first for ( size_t n = 0; n < WXSIZEOF(gs_specialKeys); n++ ) { @@ -6175,8 +6230,6 @@ WXWORD wxCharCodeWXToMSW(int wxk, bool *isVirtual) else #endif // !__WXWINCE__ { - if ( isVirtual ) - *isVirtual = false; vk = (WXWORD)wxk; } }