X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/51c42fc50a57a09392e7d119608b74f91cf85d05..05d31b3aca84298974766d6021738fb64961a36b:/src/msw/renderer.cpp diff --git a/src/msw/renderer.cpp b/src/msw/renderer.cpp index e40371fca0..5ffa82c1c5 100644 --- a/src/msw/renderer.cpp +++ b/src/msw/renderer.cpp @@ -35,6 +35,7 @@ #include "wx/splitter.h" #include "wx/renderer.h" #include "wx/msw/private.h" +#include "wx/msw/dc.h" #include "wx/msw/uxtheme.h" // tmschema.h is in Win32 Platform SDK and might not be available with earlier @@ -227,7 +228,7 @@ wxRendererMSW::DrawComboBoxDropButton(wxWindow * WXUNUSED(win), if ( flags & wxCONTROL_PRESSED ) style |= DFCS_PUSHED | DFCS_FLAT; - ::DrawFrameControl(GetHdcOf(dc), &r, DFC_SCROLL, style); + ::DrawFrameControl(GetHdcOf(*((wxMSWDCImpl*)dc.GetImpl())), &r, DFC_SCROLL, style); } void @@ -251,7 +252,7 @@ wxRendererMSW::DrawCheckBox(wxWindow * WXUNUSED(win), if ( flags & wxCONTROL_CURRENT ) style |= DFCS_HOT; - ::DrawFrameControl(GetHdcOf(dc), &r, DFC_BUTTON, style); + ::DrawFrameControl(GetHdcOf(*((wxMSWDCImpl*)dc.GetImpl())), &r, DFC_BUTTON, style); } void @@ -280,7 +281,7 @@ wxRendererMSW::DrawPushButton(wxWindow * WXUNUSED(win), RECT rc; wxCopyRectToRECT(rect, rc); - ::DrawFrameControl(GetHdcOf(dc), &rc, DFC_BUTTON, style); + ::DrawFrameControl(GetHdcOf(*((wxMSWDCImpl*)dc.GetImpl())), &rc, DFC_BUTTON, style); } void wxRendererMSW::DrawFocusRect(wxWindow * WXUNUSED(win), @@ -291,7 +292,7 @@ void wxRendererMSW::DrawFocusRect(wxWindow * WXUNUSED(win), RECT rc; wxCopyRectToRECT(rect, rc); - ::DrawFocusRect(GetHdcOf(dc), &rc); + ::DrawFocusRect(GetHdcOf(*((wxMSWDCImpl*)dc.GetImpl())), &rc); } int wxRendererMSW::GetHeaderButtonHeight(wxWindow * WXUNUSED(win)) @@ -302,7 +303,7 @@ int wxRendererMSW::GetHeaderButtonHeight(wxWindow * WXUNUSED(win)) // create a temporary header window just to get its geometry - HWND hwndHeader = ::CreateWindow(WC_HEADER, NULL, NULL, + HWND hwndHeader = ::CreateWindow(WC_HEADER, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL); if ( !hwndHeader ) return DEFAULT_HEIGHT; @@ -311,7 +312,7 @@ int wxRendererMSW::GetHeaderButtonHeight(wxWindow * WXUNUSED(win)) // initialize the struct filled with the values by Header_Layout() RECT parentRect = { 0, 0, 100, 100 }; - WINDOWPOS wp = { 0 }; + WINDOWPOS wp = { 0, 0, 0, 0, 0, 0, 0 }; HDLAYOUT hdl = { &parentRect, &wp }; return Header_Layout(hwndHeader, &hdl) ? wp.cy : DEFAULT_HEIGHT; @@ -363,7 +364,7 @@ wxRendererXP::DrawComboBoxDropButton(wxWindow * win, wxUxThemeEngine::Get()->DrawThemeBackground ( hTheme, - GetHdcOf(dc), + GetHdcOf(*((wxMSWDCImpl*)dc.GetImpl())), CP_DROPDOWNBUTTON, state, &r, @@ -399,7 +400,7 @@ wxRendererXP::DrawHeaderButton(wxWindow *win, wxUxThemeEngine::Get()->DrawThemeBackground ( hTheme, - GetHdcOf(dc), + GetHdcOf(*((wxMSWDCImpl*)dc.GetImpl())), HP_HEADERITEM, state, &r, @@ -435,7 +436,7 @@ wxRendererXP::DrawTreeItemButton(wxWindow *win, wxUxThemeEngine::Get()->DrawThemeBackground ( hTheme, - GetHdcOf(dc), + GetHdcOf(*((wxMSWDCImpl*)dc.GetImpl())), TVP_GLYPH, state, &r, @@ -485,7 +486,7 @@ wxRendererXP::DrawCheckBox(wxWindow *win, wxUxThemeEngine::Get()->DrawThemeBackground ( hTheme, - GetHdcOf(dc), + GetHdcOf(*((wxMSWDCImpl*)dc.GetImpl())), BP_CHECKBOX, state, &r, @@ -524,7 +525,7 @@ wxRendererXP::DrawPushButton(wxWindow * win, wxUxThemeEngine::Get()->DrawThemeBackground ( hTheme, - GetHdcOf(dc), + GetHdcOf(*((wxMSWDCImpl*)dc.GetImpl())), BP_PUSHBUTTON, state, &r, @@ -534,7 +535,7 @@ wxRendererXP::DrawPushButton(wxWindow * win, } void -wxRendererXP::DrawItemSelectionRect(wxWindow * WXUNUSED(win), +wxRendererXP::DrawItemSelectionRect(wxWindow *win, wxDC& dc, const wxRect& rect, int flags) @@ -548,7 +549,7 @@ wxRendererXP::DrawItemSelectionRect(wxWindow * WXUNUSED(win), } else // !focused { - brush = wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW)); + brush = wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)); } } else // !selected @@ -557,12 +558,11 @@ wxRendererXP::DrawItemSelectionRect(wxWindow * WXUNUSED(win), } dc.SetBrush(brush); - - // unlike for wxRendererGeneric, on windows we _never_ want to draw - // the outline of the rectangle: dc.SetPen(*wxTRANSPARENT_PEN); - dc.DrawRectangle( rect ); + + if ((flags & wxCONTROL_FOCUSED) && (flags & wxCONTROL_CURRENT)) + DrawFocusRect( win, dc, rect, flags ); }