Use Explorer style for wxTreeCtrl with wxTR_TWIST_BUTTONS in wxMSW.

The tree control style used by Explorer uses rotating triangles instead of the
standard "+/-" buttons and so seems to correspond relatively well to this
style. And this provides a possibility to have a more standard-looking tree
controls in wxWidgets programs.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66850 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-02-06 01:00:48 +00:00
parent 1f77d487b7
commit e615d356fc
2 changed files with 23 additions and 0 deletions

View File

@@ -42,6 +42,7 @@
#include "wx/imaglist.h"
#include "wx/msw/dragimag.h"
#include "wx/msw/uxtheme.h"
// macros to hide the cast ugliness
// --------------------------------
@@ -741,6 +742,20 @@ bool wxTreeCtrl::Create(wxWindow *parent,
wxSetCCUnicodeFormat(GetHwnd());
if ( m_windowStyle & wxTR_TWIST_BUTTONS )
{
// Under Vista and later Explorer uses rotating ("twist") buttons
// instead of the default "+/-" ones so apply its theme to the tree
// control to implement this style.
if ( wxGetWinVersion() >= wxWinVersion_Vista )
{
if ( wxUxThemeEngine *theme = wxUxThemeEngine::GetIfActive() )
{
theme->SetWindowTheme(GetHwnd(), L"EXPLORER", NULL);
}
}
}
return true;
}