Remove checks GetComCtl32Version() aimed prior WinXP.

Windows XP always has ComCtl32Version 582 available. If the executable includes a manifest version 600 is available.
This commit is contained in:
Tobias Taschner
2015-08-28 10:22:37 +02:00
parent 4acb4cf476
commit 03b243da21
8 changed files with 176 additions and 264 deletions

View File

@@ -54,13 +54,6 @@ bool wxMSWDateControls::CheckInitialization()
// it's enough to give the error only once // it's enough to give the error only once
s_initResult = false; s_initResult = false;
if ( wxApp::GetComCtl32Version() < 470 )
{
wxLogError(_("This system doesn't support date controls, please upgrade your version of comctl32.dll"));
return false;
}
#if wxUSE_DYNLIB_CLASS #if wxUSE_DYNLIB_CLASS
INITCOMMONCONTROLSEX icex; INITCOMMONCONTROLSEX icex;
icex.dwSize = sizeof(icex); icex.dwSize = sizeof(icex);

View File

@@ -70,9 +70,7 @@ WXDWORD wxDatePickerCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const
{ {
WXDWORD styleMSW = wxDatePickerCtrlBase::MSWGetStyle(style, exstyle); WXDWORD styleMSW = wxDatePickerCtrlBase::MSWGetStyle(style, exstyle);
// although MSDN doesn't mention it, DTS_UPDOWN doesn't work with if ( style & wxDP_SPIN )
// comctl32.dll 4.72
if ( wxApp::GetComCtl32Version() > 472 && (style & wxDP_SPIN) )
styleMSW |= DTS_UPDOWN; styleMSW |= DTS_UPDOWN;
//else: drop down by default //else: drop down by default

View File

@@ -267,19 +267,14 @@ int wxDirDialog::ShowSHBrowseForFolder(WXHWND owner)
static const int verComCtl32 = wxApp::GetComCtl32Version(); static const int verComCtl32 = wxApp::GetComCtl32Version();
// we always add the edit box (it doesn't hurt anybody, does it?) if it is // we always add the edit box (it doesn't hurt anybody, does it?)
// supported by the system
if ( verComCtl32 >= 471 )
{
bi.ulFlags |= BIF_EDITBOX; bi.ulFlags |= BIF_EDITBOX;
}
// to have the "New Folder" button we must use the "new" dialog style which // to have the "New Folder" button we must use the "new" dialog style which
// is also the only way to have a resizable dialog // is also the only way to have a resizable dialog
// //
// "new" style is only available in the version 5.0+ of comctl32.dll
const bool needNewDir = !HasFlag(wxDD_DIR_MUST_EXIST); const bool needNewDir = !HasFlag(wxDD_DIR_MUST_EXIST);
if ( (needNewDir || HasFlag(wxRESIZE_BORDER)) && (verComCtl32 >= 500) ) if ( needNewDir || HasFlag(wxRESIZE_BORDER) )
{ {
if (needNewDir) if (needNewDir)
{ {

View File

@@ -277,10 +277,8 @@ bool wxListCtrl::Create(wxWindow *parent,
void wxListCtrl::MSWSetExListStyles() void wxListCtrl::MSWSetExListStyles()
{ {
// for comctl32.dll v 4.70+ we want to have some non default extended // we want to have some non default extended
// styles because it's prettier (and also because wxGTK does it like this) // styles because it's prettier (and also because wxGTK does it like this)
if ( wxApp::GetComCtl32Version() >= 470 )
{
::SendMessage ::SendMessage
( (
GetHwnd(), LVM_SETEXTENDEDLISTVIEWSTYLE, 0, GetHwnd(), LVM_SETEXTENDEDLISTVIEWSTYLE, 0,
@@ -296,7 +294,6 @@ void wxListCtrl::MSWSetExListStyles()
// it seems better to enable it by default than disable // it seems better to enable it by default than disable
LVS_EX_HEADERDRAGDROP LVS_EX_HEADERDRAGDROP
); );
}
} }
WXDWORD wxListCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const WXDWORD wxListCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const
@@ -359,13 +356,6 @@ WXDWORD wxListCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const
#if !( defined(__GNUWIN32__) && !wxCHECK_W32API_VERSION( 1, 0 ) ) #if !( defined(__GNUWIN32__) && !wxCHECK_W32API_VERSION( 1, 0 ) )
if ( style & wxLC_VIRTUAL ) if ( style & wxLC_VIRTUAL )
{ {
int ver = wxApp::GetComCtl32Version();
if ( ver < 470 )
{
wxLogWarning(_("Please install a newer version of comctl32.dll\n(at least version 4.70 is required but you have %d.%02d)\nor this program won't operate correctly."),
ver / 100, ver % 100);
}
wstyle |= LVS_OWNERDATA; wstyle |= LVS_OWNERDATA;
} }
#endif // ancient cygwin #endif // ancient cygwin
@@ -1622,7 +1612,7 @@ wxListCtrl::HitTest(const wxPoint& point, int& flags, long *ptrSubItem) const
long item; long item;
#ifdef LVM_SUBITEMHITTEST #ifdef LVM_SUBITEMHITTEST
if ( ptrSubItem && wxApp::GetComCtl32Version() >= 470 ) if ( ptrSubItem )
{ {
item = ListView_SubItemHitTest(GetHwnd(), &hitTestInfo); item = ListView_SubItemHitTest(GetHwnd(), &hitTestInfo);
*ptrSubItem = hitTestInfo.iSubItem; *ptrSubItem = hitTestInfo.iSubItem;
@@ -3279,8 +3269,6 @@ static void wxConvertToMSWListCol(HWND hwndList,
// see comment at the end of wxListCtrl::GetColumn() // see comment at the end of wxListCtrl::GetColumn()
#ifdef NM_CUSTOMDRAW // _WIN32_IE >= 0x0300 #ifdef NM_CUSTOMDRAW // _WIN32_IE >= 0x0300
if ( item.m_mask & wxLIST_MASK_IMAGE ) if ( item.m_mask & wxLIST_MASK_IMAGE )
{
if ( wxApp::GetComCtl32Version() >= 470 )
{ {
lvCol.mask |= LVCF_IMAGE; lvCol.mask |= LVCF_IMAGE;
@@ -3313,8 +3301,6 @@ static void wxConvertToMSWListCol(HWND hwndList,
lvCol.iImage = item.m_image; lvCol.iImage = item.m_image;
} }
//else: it doesn't support item images anyhow
}
#endif // _WIN32_IE >= 0x0300 #endif // _WIN32_IE >= 0x0300
} }

View File

@@ -168,17 +168,12 @@ int wxSpinButton::GetValue() const
{ {
int n; int n;
#ifdef UDM_GETPOS32 #ifdef UDM_GETPOS32
if ( wxApp::GetComCtl32Version() >= 580 )
{
// use the full 32 bit range if available // use the full 32 bit range if available
n = ::SendMessage(GetHwnd(), UDM_GETPOS32, 0, 0); n = ::SendMessage(GetHwnd(), UDM_GETPOS32, 0, 0);
} #else
else
#endif // UDM_GETPOS32
{
// we're limited to 16 bit // we're limited to 16 bit
n = (short)LOWORD(::SendMessage(GetHwnd(), UDM_GETPOS, 0, 0)); n = (short)LOWORD(::SendMessage(GetHwnd(), UDM_GETPOS, 0, 0));
} #endif // UDM_GETPOS32
if (n < m_min) n = m_min; if (n < m_min) n = m_min;
if (n > m_max) n = m_max; if (n > m_max) n = m_max;
@@ -191,16 +186,11 @@ void wxSpinButton::SetValue(int val)
// wxSpinButtonBase::SetValue(val); -- no, it is pure virtual // wxSpinButtonBase::SetValue(val); -- no, it is pure virtual
#ifdef UDM_SETPOS32 #ifdef UDM_SETPOS32
if ( wxApp::GetComCtl32Version() >= 580 )
{
// use the full 32 bit range if available // use the full 32 bit range if available
::SendMessage(GetHwnd(), UDM_SETPOS32, 0, val); ::SendMessage(GetHwnd(), UDM_SETPOS32, 0, val);
} #else
else // we're limited to 16 bit
#endif // UDM_SETPOS32
{
::SendMessage(GetHwnd(), UDM_SETPOS, 0, MAKELONG((short) val, 0)); ::SendMessage(GetHwnd(), UDM_SETPOS, 0, MAKELONG((short) val, 0));
} #endif // UDM_SETPOS32
} }
void wxSpinButton::NormalizeValue() void wxSpinButton::NormalizeValue()
@@ -215,17 +205,13 @@ void wxSpinButton::SetRange(int minVal, int maxVal)
wxSpinButtonBase::SetRange(minVal, maxVal); wxSpinButtonBase::SetRange(minVal, maxVal);
#ifdef UDM_SETRANGE32 #ifdef UDM_SETRANGE32
if ( wxApp::GetComCtl32Version() >= 471 )
{
// use the full 32 bit range if available // use the full 32 bit range if available
::SendMessage(GetHwnd(), UDM_SETRANGE32, minVal, maxVal); ::SendMessage(GetHwnd(), UDM_SETRANGE32, minVal, maxVal);
} #else
else // we're limited to 16 bit // we're limited to 16 bit
#endif // UDM_SETRANGE32
{
::SendMessage(GetHwnd(), UDM_SETRANGE, 0, ::SendMessage(GetHwnd(), UDM_SETRANGE, 0,
(LPARAM) MAKELONG((short)maxVal, (short)minVal)); (LPARAM) MAKELONG((short)maxVal, (short)minVal));
} #endif // UDM_SETRANGE32
// the current value might be out of the new range, force it to be in it // the current value might be out of the new range, force it to be in it
NormalizeValue(); NormalizeValue();

View File

@@ -386,7 +386,6 @@ bool wxToolBar::MSWCreateToolbar(const wxPoint& pos, const wxSize& size)
::SendMessage(GetHwnd(), TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); ::SendMessage(GetHwnd(), TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
#ifdef TB_SETEXTENDEDSTYLE #ifdef TB_SETEXTENDEDSTYLE
if ( wxApp::GetComCtl32Version() >= 471 )
::SendMessage(GetHwnd(), TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_DRAWDDARROWS); ::SendMessage(GetHwnd(), TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_DRAWDDARROWS);
#endif #endif
@@ -523,10 +522,10 @@ WXDWORD wxToolBar::MSWGetStyle(long style, WXDWORD *exstyle) const
if ( !(style & wxTB_NO_TOOLTIPS) ) if ( !(style & wxTB_NO_TOOLTIPS) )
msStyle |= TBSTYLE_TOOLTIPS; msStyle |= TBSTYLE_TOOLTIPS;
if ( style & wxTB_FLAT && wxApp::GetComCtl32Version() > 400 ) if ( style & wxTB_FLAT )
msStyle |= TBSTYLE_FLAT; msStyle |= TBSTYLE_FLAT;
if ( style & wxTB_HORZ_LAYOUT && wxApp::GetComCtl32Version() >= 470 ) if ( style & wxTB_HORZ_LAYOUT )
msStyle |= TBSTYLE_LIST; msStyle |= TBSTYLE_LIST;
if ( style & wxTB_NODIVIDER ) if ( style & wxTB_NODIVIDER )
@@ -607,10 +606,6 @@ void wxToolBar::CreateDisabledImageList()
{ {
wxDELETE(m_disabledImgList); wxDELETE(m_disabledImgList);
// as we can't use disabled image list with older versions of comctl32.dll,
// don't even bother creating it
if ( wxApp::GetComCtl32Version() >= 470 )
{
// search for the first disabled button img in the toolbar, if any // search for the first disabled button img in the toolbar, if any
for ( wxToolBarToolsList::compatibility_iterator for ( wxToolBarToolsList::compatibility_iterator
node = m_tools.GetFirst(); node; node = node->GetNext() ) node = m_tools.GetFirst(); node; node = node->GetNext() )
@@ -633,9 +628,6 @@ void wxToolBar::CreateDisabledImageList()
break; break;
} }
} }
// we don't have any disabled bitmaps
}
} }
bool wxToolBar::Realize() bool wxToolBar::Realize()
@@ -824,8 +816,6 @@ bool wxToolBar::Realize()
if ( oldToolBarBitmap ) if ( oldToolBarBitmap )
{ {
#ifdef TB_REPLACEBITMAP #ifdef TB_REPLACEBITMAP
if ( wxApp::GetComCtl32Version() >= 400 )
{
TBREPLACEBITMAP replaceBitmap; TBREPLACEBITMAP replaceBitmap;
replaceBitmap.hInstOld = NULL; replaceBitmap.hInstOld = NULL;
replaceBitmap.hInstNew = NULL; replaceBitmap.hInstNew = NULL;
@@ -842,17 +832,14 @@ bool wxToolBar::Realize()
// already done // already done
addBitmap = false; addBitmap = false;
} #else
else
#endif // TB_REPLACEBITMAP
{
// we can't replace the old bitmap, so we will add another one // we can't replace the old bitmap, so we will add another one
// (awfully inefficient, but what else to do?) and shift the bitmap // (awfully inefficient, but what else to do?) and shift the bitmap
// indices accordingly // indices accordingly
addBitmap = true; addBitmap = true;
bitmapId = m_nButtons; bitmapId = m_nButtons;
} #endif // TB_REPLACEBITMAP
} }
if ( addBitmap ) // no old bitmap or we can't replace it if ( addBitmap ) // no old bitmap or we can't replace it
@@ -867,9 +854,6 @@ bool wxToolBar::Realize()
} }
} }
// disable image lists are only supported in comctl32.dll 4.70+
if ( wxApp::GetComCtl32Version() >= 470 )
{
HIMAGELIST hil = m_disabledImgList HIMAGELIST hil = m_disabledImgList
? GetHimagelistOf(m_disabledImgList) ? GetHimagelistOf(m_disabledImgList)
: 0; : 0;
@@ -883,7 +867,6 @@ bool wxToolBar::Realize()
if ( oldImageList ) if ( oldImageList )
::DeleteObject(oldImageList); ::DeleteObject(oldImageList);
} }
}
// Next add the buttons and separators // Next add the buttons and separators
@@ -900,14 +883,6 @@ bool wxToolBar::Realize()
{ {
wxToolBarTool *tool = static_cast<wxToolBarTool *>(node->GetData()); wxToolBarTool *tool = static_cast<wxToolBarTool *>(node->GetData());
// don't add separators to the vertical toolbar with old comctl32.dll
// versions as they didn't handle this properly
if ( IsVertical() && tool->IsSeparator() &&
wxApp::GetComCtl32Version() <= 472 )
{
continue;
}
TBBUTTON& button = buttons[i]; TBBUTTON& button = buttons[i];
wxZeroMemory(button); wxZeroMemory(button);
@@ -1492,21 +1467,9 @@ void wxToolBar::SetRows(int nRows)
// The button size is bigger than the bitmap size // The button size is bigger than the bitmap size
wxSize wxToolBar::GetToolSize() const wxSize wxToolBar::GetToolSize() const
{ {
// TB_GETBUTTONSIZE is supported from version 4.70
#if defined(_WIN32_IE) && (_WIN32_IE >= 0x300 ) \
&& !( defined(__GNUWIN32__) && !wxCHECK_W32API_VERSION( 1, 0 ) )
if ( wxApp::GetComCtl32Version() >= 470 )
{
DWORD dw = ::SendMessage(GetHwnd(), TB_GETBUTTONSIZE, 0, 0); DWORD dw = ::SendMessage(GetHwnd(), TB_GETBUTTONSIZE, 0, 0);
return wxSize(LOWORD(dw), HIWORD(dw)); return wxSize(LOWORD(dw), HIWORD(dw));
}
else
#endif // comctl32.dll 4.70+
{
// defaults
return wxSize(m_defaultWidth + 8, m_defaultHeight + 7);
}
} }
wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const

View File

@@ -130,11 +130,8 @@ public:
// then as the control gets "focus lost" events and dismisses the // then as the control gets "focus lost" events and dismisses the
// tooltip which then reappears because mouse remains hovering over the // tooltip which then reappears because mouse remains hovering over the
// control, see SF patch 1821229 // control, see SF patch 1821229
if ( wxApp::GetComCtl32Version() >= 470 )
{
uFlags |= TTF_TRANSPARENT; uFlags |= TTF_TRANSPARENT;
} }
}
}; };
#ifdef __VISUALC__ #ifdef __VISUALC__
@@ -539,8 +536,6 @@ void wxToolTip::DoSetTip(WXHWND hWnd)
bool wxToolTip::AdjustMaxWidth() bool wxToolTip::AdjustMaxWidth()
{ {
if ( wxApp::GetComCtl32Version() >= 470 )
{
// use TTM_SETMAXTIPWIDTH to make tooltip multiline using the // use TTM_SETMAXTIPWIDTH to make tooltip multiline using the
// extent of its first line as max value // extent of its first line as max value
HFONT hfont = (HFONT) HFONT hfont = (HFONT)
@@ -611,9 +606,6 @@ bool wxToolTip::AdjustMaxWidth()
} }
return true; return true;
}
return false;
} }
void wxToolTip::DoForAllWindows(void (wxToolTip::*func)(WXHWND)) void wxToolTip::DoForAllWindows(void (wxToolTip::*func)(WXHWND))

View File

@@ -763,7 +763,6 @@ bool wxTreeCtrl::Create(wxWindow *parent,
if ( m_windowStyle & wxTR_FULL_ROW_HIGHLIGHT ) if ( m_windowStyle & wxTR_FULL_ROW_HIGHLIGHT )
{ {
if ( wxApp::GetComCtl32Version() >= 471 )
wstyle |= TVS_FULLROWSELECT; wstyle |= TVS_FULLROWSELECT;
} }