#include "wx/settings.h"
#endif //WX_PRECOMP
+#include "wx/scopeguard.h"
#include "wx/splitter.h"
#include "wx/renderer.h"
#include "wx/msw/private.h"
#define HSAS_SORTEDDOWN 2
#endif
-#if defined(__WXWINCE__) && !defined(DFCS_FLAT)
- #define DFCS_FLAT 0
+#if defined(__WXWINCE__)
+ #ifndef DFCS_FLAT
+ #define DFCS_FLAT 0
+ #endif
+ #ifndef DFCS_MONO
+ #define DFCS_MONO 0
+ #endif
#endif
#ifndef DFCS_HOT
const wxRect& rect,
int flags = 0);
+ virtual void DrawFocusRect(wxWindow* win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0);
+
+ virtual int GetHeaderButtonHeight(wxWindow *win);
+
private:
DECLARE_NO_COPY_CLASS(wxRendererMSW)
};
int flags = 0,
wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE,
wxHeaderButtonParams* params = NULL);
- virtual int GetHeaderButtonHeight(wxWindow *win);
virtual void DrawTreeItemButton(wxWindow *win,
wxDC& dc,
::DrawFrameControl(GetHdcOf(dc), &rc, DFC_BUTTON, style);
}
+void wxRendererMSW::DrawFocusRect(wxWindow * WXUNUSED(win),
+ wxDC& dc,
+ const wxRect& rect,
+ int WXUNUSED(flags))
+{
+ RECT rc;
+ wxCopyRectToRECT(rect, rc);
+
+ ::DrawFocusRect(GetHdcOf(dc), &rc);
+}
+
+int wxRendererMSW::GetHeaderButtonHeight(wxWindow * WXUNUSED(win))
+{
+ // some "reasonable" value returned in case of error, it doesn't really
+ // correspond to anything but it's better than returning 0
+ static const int DEFAULT_HEIGHT = 20;
+
+
+ // create a temporary header window just to get its geometry
+ HWND hwndHeader = ::CreateWindow(WC_HEADER, NULL, 0,
+ 0, 0, 0, 0, NULL, NULL, NULL, NULL);
+ if ( !hwndHeader )
+ return DEFAULT_HEIGHT;
+
+ wxON_BLOCK_EXIT1( ::DestroyWindow, hwndHeader );
+
+ // initialize the struct filled with the values by Header_Layout()
+ RECT parentRect = { 0, 0, 100, 100 };
+ WINDOWPOS wp = { 0, 0, 0, 0, 0, 0, 0 };
+ HDLAYOUT hdl = { &parentRect, &wp };
+
+ return Header_Layout(hwndHeader, &hdl) ? wp.cy : DEFAULT_HEIGHT;
+}
+
// ============================================================================
// wxRendererXP implementation
// ============================================================================
}
-int
-wxRendererXP::GetHeaderButtonHeight(wxWindow *win)
-{
- wxUxThemeHandle hTheme(win, L"HEADER");
- if ( !hTheme )
- {
- return m_rendererNative.GetHeaderButtonHeight(win);
- }
-
- HRESULT hr;
- int value = -1;
-
- hr = wxUxThemeEngine::Get()->GetThemeMetric( hTheme,
- NULL,
- HP_HEADERITEM,
- HIS_NORMAL,
- TMT_HEIGHT,
- &value );
- if ( hr == S_OK )
- return value;
- else
- return 20;
-}
-
-
void
wxRendererXP::DrawTreeItemButton(wxWindow *win,
wxDC& dc,
}
void
-wxRendererXP::DrawItemSelectionRect(wxWindow * WXUNUSED(win),
+wxRendererXP::DrawItemSelectionRect(wxWindow *win,
wxDC& dc,
const wxRect& rect,
int flags)
}
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 );
}