Upgrade 3rdParty/WTL to WTL 10.0
This commit is contained in:
parent
cb0f746099
commit
1ead776429
|
@ -39,18 +39,18 @@
|
||||||
<ClInclude Include="atlctrlx.h" />
|
<ClInclude Include="atlctrlx.h" />
|
||||||
<ClInclude Include="atlddx.h" />
|
<ClInclude Include="atlddx.h" />
|
||||||
<ClInclude Include="atldlgs.h" />
|
<ClInclude Include="atldlgs.h" />
|
||||||
|
<ClInclude Include="atldwm.h" />
|
||||||
<ClInclude Include="atlfind.h" />
|
<ClInclude Include="atlfind.h" />
|
||||||
<ClInclude Include="atlframe.h" />
|
<ClInclude Include="atlframe.h" />
|
||||||
<ClInclude Include="atlgdi.h" />
|
<ClInclude Include="atlgdi.h" />
|
||||||
<ClInclude Include="atlmisc.h" />
|
<ClInclude Include="atlmisc.h" />
|
||||||
<ClInclude Include="atlprint.h" />
|
<ClInclude Include="atlprint.h" />
|
||||||
<ClInclude Include="atlres.h" />
|
<ClInclude Include="atlres.h" />
|
||||||
<ClInclude Include="atlresce.h" />
|
<ClInclude Include="atlribbon.h" />
|
||||||
<ClInclude Include="atlscrl.h" />
|
<ClInclude Include="atlscrl.h" />
|
||||||
<ClInclude Include="atlsplit.h" />
|
<ClInclude Include="atlsplit.h" />
|
||||||
<ClInclude Include="atltheme.h" />
|
<ClInclude Include="atltheme.h" />
|
||||||
<ClInclude Include="atluser.h" />
|
<ClInclude Include="atluser.h" />
|
||||||
<ClInclude Include="atlwince.h" />
|
|
||||||
<ClInclude Include="atlwinx.h" />
|
<ClInclude Include="atlwinx.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -28,6 +28,9 @@
|
||||||
<ClInclude Include="atldlgs.h">
|
<ClInclude Include="atldlgs.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="atldwm.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="atlfind.h">
|
<ClInclude Include="atlfind.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -46,7 +49,7 @@
|
||||||
<ClInclude Include="atlres.h">
|
<ClInclude Include="atlres.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="atlresce.h">
|
<ClInclude Include="atlribbon.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="atlscrl.h">
|
<ClInclude Include="atlscrl.h">
|
||||||
|
@ -61,9 +64,6 @@
|
||||||
<ClInclude Include="atluser.h">
|
<ClInclude Include="atluser.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="atlwince.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="atlwinx.h">
|
<ClInclude Include="atlwinx.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,13 +1,10 @@
|
||||||
// Windows Template Library - WTL version 8.1
|
// Windows Template Library - WTL version 10.0
|
||||||
// Copyright (C) Microsoft Corporation. All rights reserved.
|
// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved.
|
||||||
//
|
//
|
||||||
// This file is a part of the Windows Template Library.
|
// This file is a part of the Windows Template Library.
|
||||||
// The use and distribution terms for this software are covered by the
|
// The use and distribution terms for this software are covered by the
|
||||||
// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php)
|
// Microsoft Public License (http://opensource.org/licenses/MS-PL)
|
||||||
// which can be found in the file CPL.TXT at the root of this distribution.
|
// which can be found in the file MS-PL.txt at the root folder.
|
||||||
// By using this software in any fashion, you are agreeing to be bound by
|
|
||||||
// the terms of this license. You must not remove this notice, or
|
|
||||||
// any other, from this software.
|
|
||||||
|
|
||||||
#ifndef __ATLDDX_H__
|
#ifndef __ATLDDX_H__
|
||||||
#define __ATLDDX_H__
|
#define __ATLDDX_H__
|
||||||
|
@ -18,13 +15,7 @@
|
||||||
#error atlddx.h requires atlapp.h to be included first
|
#error atlddx.h requires atlapp.h to be included first
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_ATL_USE_DDX_FLOAT) && defined(_ATL_MIN_CRT)
|
#include <float.h>
|
||||||
#error Cannot use floating point DDX with _ATL_MIN_CRT defined
|
|
||||||
#endif // defined(_ATL_USE_DDX_FLOAT) && defined(_ATL_MIN_CRT)
|
|
||||||
|
|
||||||
#ifdef _ATL_USE_DDX_FLOAT
|
|
||||||
#include <float.h>
|
|
||||||
#endif // _ATL_USE_DDX_FLOAT
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -44,94 +35,92 @@ namespace WTL
|
||||||
#define BEGIN_DDX_MAP(thisClass) \
|
#define BEGIN_DDX_MAP(thisClass) \
|
||||||
BOOL DoDataExchange(BOOL bSaveAndValidate = FALSE, UINT nCtlID = (UINT)-1) \
|
BOOL DoDataExchange(BOOL bSaveAndValidate = FALSE, UINT nCtlID = (UINT)-1) \
|
||||||
{ \
|
{ \
|
||||||
bSaveAndValidate; \
|
(bSaveAndValidate); \
|
||||||
nCtlID;
|
(nCtlID);
|
||||||
|
|
||||||
#define DDX_TEXT(nID, var) \
|
#define DDX_TEXT(nID, var) \
|
||||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
if((nCtlID == (UINT)-1) || (nCtlID == nID)) \
|
||||||
{ \
|
{ \
|
||||||
if(!DDX_Text(nID, var, sizeof(var), bSaveAndValidate)) \
|
if(!DDX_Text(nID, var, sizeof(var), bSaveAndValidate)) \
|
||||||
return FALSE; \
|
return FALSE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DDX_TEXT_LEN(nID, var, len) \
|
#define DDX_TEXT_LEN(nID, var, len) \
|
||||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
if((nCtlID == (UINT)-1) || (nCtlID == nID)) \
|
||||||
{ \
|
{ \
|
||||||
if(!DDX_Text(nID, var, sizeof(var), bSaveAndValidate, TRUE, len)) \
|
if(!DDX_Text(nID, var, sizeof(var), bSaveAndValidate, TRUE, len)) \
|
||||||
return FALSE; \
|
return FALSE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DDX_INT(nID, var) \
|
#define DDX_INT(nID, var) \
|
||||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
if((nCtlID == (UINT)-1) || (nCtlID == nID)) \
|
||||||
{ \
|
{ \
|
||||||
if(!DDX_Int(nID, var, TRUE, bSaveAndValidate)) \
|
if(!DDX_Int(nID, var, TRUE, bSaveAndValidate)) \
|
||||||
return FALSE; \
|
return FALSE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DDX_INT_RANGE(nID, var, min, max) \
|
#define DDX_INT_RANGE(nID, var, min, max) \
|
||||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
if((nCtlID == (UINT)-1) || (nCtlID == nID)) \
|
||||||
{ \
|
{ \
|
||||||
if(!DDX_Int(nID, var, TRUE, bSaveAndValidate, TRUE, min, max)) \
|
if(!DDX_Int(nID, var, TRUE, bSaveAndValidate, TRUE, min, max)) \
|
||||||
return FALSE; \
|
return FALSE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DDX_UINT(nID, var) \
|
#define DDX_UINT(nID, var) \
|
||||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
if((nCtlID == (UINT)-1) || (nCtlID == nID)) \
|
||||||
{ \
|
{ \
|
||||||
if(!DDX_Int(nID, var, FALSE, bSaveAndValidate)) \
|
if(!DDX_Int(nID, var, FALSE, bSaveAndValidate)) \
|
||||||
return FALSE; \
|
return FALSE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DDX_UINT_RANGE(nID, var, min, max) \
|
#define DDX_UINT_RANGE(nID, var, min, max) \
|
||||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
if((nCtlID == (UINT)-1) || (nCtlID == nID)) \
|
||||||
{ \
|
{ \
|
||||||
if(!DDX_Int(nID, var, FALSE, bSaveAndValidate, TRUE, min, max)) \
|
if(!DDX_Int(nID, var, FALSE, bSaveAndValidate, TRUE, min, max)) \
|
||||||
return FALSE; \
|
return FALSE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _ATL_USE_DDX_FLOAT
|
|
||||||
#define DDX_FLOAT(nID, var) \
|
#define DDX_FLOAT(nID, var) \
|
||||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
if((nCtlID == (UINT)-1) || (nCtlID == nID)) \
|
||||||
{ \
|
{ \
|
||||||
if(!DDX_Float(nID, var, bSaveAndValidate)) \
|
if(!DDX_Float(nID, var, bSaveAndValidate)) \
|
||||||
return FALSE; \
|
return FALSE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DDX_FLOAT_RANGE(nID, var, min, max) \
|
#define DDX_FLOAT_RANGE(nID, var, min, max) \
|
||||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
if((nCtlID == (UINT)-1) || (nCtlID == nID)) \
|
||||||
{ \
|
{ \
|
||||||
if(!DDX_Float(nID, var, bSaveAndValidate, TRUE, min, max)) \
|
if(!DDX_Float(nID, var, bSaveAndValidate, TRUE, min, max)) \
|
||||||
return FALSE; \
|
return FALSE; \
|
||||||
}
|
}
|
||||||
#define DDX_FLOAT_P(nID, var, precision) \
|
#define DDX_FLOAT_P(nID, var, precision) \
|
||||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
if((nCtlID == (UINT)-1) || (nCtlID == nID)) \
|
||||||
{ \
|
{ \
|
||||||
if(!DDX_Float(nID, var, bSaveAndValidate, FALSE, 0, 0, precision)) \
|
if(!DDX_Float(nID, var, bSaveAndValidate, FALSE, 0, 0, precision)) \
|
||||||
return FALSE; \
|
return FALSE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DDX_FLOAT_P_RANGE(nID, var, min, max, precision) \
|
#define DDX_FLOAT_P_RANGE(nID, var, min, max, precision) \
|
||||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
if((nCtlID == (UINT)-1) || (nCtlID == nID)) \
|
||||||
{ \
|
{ \
|
||||||
if(!DDX_Float(nID, var, bSaveAndValidate, TRUE, min, max, precision)) \
|
if(!DDX_Float(nID, var, bSaveAndValidate, TRUE, min, max, precision)) \
|
||||||
return FALSE; \
|
return FALSE; \
|
||||||
}
|
}
|
||||||
#endif // _ATL_USE_DDX_FLOAT
|
|
||||||
|
|
||||||
#define DDX_CONTROL(nID, obj) \
|
#define DDX_CONTROL(nID, obj) \
|
||||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
if((nCtlID == (UINT)-1) || (nCtlID == nID)) \
|
||||||
DDX_Control(nID, obj, bSaveAndValidate);
|
DDX_Control(nID, obj, bSaveAndValidate);
|
||||||
|
|
||||||
#define DDX_CONTROL_HANDLE(nID, obj) \
|
#define DDX_CONTROL_HANDLE(nID, obj) \
|
||||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
if((nCtlID == (UINT)-1) || (nCtlID == nID)) \
|
||||||
DDX_Control_Handle(nID, obj, bSaveAndValidate);
|
DDX_Control_Handle(nID, obj, bSaveAndValidate);
|
||||||
|
|
||||||
#define DDX_CHECK(nID, var) \
|
#define DDX_CHECK(nID, var) \
|
||||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
if((nCtlID == (UINT)-1) || (nCtlID == nID)) \
|
||||||
DDX_Check(nID, var, bSaveAndValidate);
|
DDX_Check(nID, var, bSaveAndValidate);
|
||||||
|
|
||||||
#define DDX_RADIO(nID, var) \
|
#define DDX_RADIO(nID, var) \
|
||||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
if((nCtlID == (UINT)-1) || (nCtlID == nID)) \
|
||||||
DDX_Radio(nID, var, bSaveAndValidate);
|
DDX_Radio(nID, var, bSaveAndValidate);
|
||||||
|
|
||||||
#define END_DDX_MAP() \
|
#define END_DDX_MAP() \
|
||||||
|
@ -140,10 +129,9 @@ namespace WTL
|
||||||
|
|
||||||
// DDX support for Tab, Combo, ListBox and ListView selection index
|
// DDX support for Tab, Combo, ListBox and ListView selection index
|
||||||
// Note: Specialized versions require atlctrls.h to be included first
|
// Note: Specialized versions require atlctrls.h to be included first
|
||||||
#if (_MSC_VER >= 1300)
|
|
||||||
|
|
||||||
#define DDX_INDEX(CtrlClass, nID, var) \
|
#define DDX_INDEX(CtrlClass, nID, var) \
|
||||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
if((nCtlID == (UINT)-1) || (nCtlID == nID)) \
|
||||||
DDX_Index<CtrlClass>(nID, var, bSaveAndValidate);
|
DDX_Index<CtrlClass>(nID, var, bSaveAndValidate);
|
||||||
|
|
||||||
#ifdef __ATLCTRLS_H__
|
#ifdef __ATLCTRLS_H__
|
||||||
|
@ -153,8 +141,6 @@ namespace WTL
|
||||||
#define DDX_LISTVIEW_INDEX(nID, var) DDX_INDEX(WTL::CListViewCtrl, nID, var)
|
#define DDX_LISTVIEW_INDEX(nID, var) DDX_INDEX(WTL::CListViewCtrl, nID, var)
|
||||||
#endif // __ATLCTRLS_H__
|
#endif // __ATLCTRLS_H__
|
||||||
|
|
||||||
#endif // (_MSC_VER >= 1300)
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// CWinDataExchange - provides support for DDX
|
// CWinDataExchange - provides support for DDX
|
||||||
|
@ -228,7 +214,7 @@ public:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ATLASSERT(!bValidate || lstrlen(lpstrText) <= nLength);
|
ATLASSERT(!bValidate || (lstrlen(lpstrText) <= nLength));
|
||||||
bSuccess = pT->SetDlgItemText(nID, lpstrText);
|
bSuccess = pT->SetDlgItemText(nID, lpstrText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,7 +250,7 @@ public:
|
||||||
{
|
{
|
||||||
USES_CONVERSION;
|
USES_CONVERSION;
|
||||||
LPTSTR lpstrText = OLE2T(bstrText);
|
LPTSTR lpstrText = OLE2T(bstrText);
|
||||||
ATLASSERT(!bValidate || lstrlen(lpstrText) <= nLength);
|
ATLASSERT(!bValidate || (lstrlen(lpstrText) <= nLength));
|
||||||
bSuccess = pT->SetDlgItemText(nID, lpstrText);
|
bSuccess = pT->SetDlgItemText(nID, lpstrText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,7 +286,7 @@ public:
|
||||||
{
|
{
|
||||||
USES_CONVERSION;
|
USES_CONVERSION;
|
||||||
LPTSTR lpstrText = OLE2T(bstrText);
|
LPTSTR lpstrText = OLE2T(bstrText);
|
||||||
ATLASSERT(!bValidate || lstrlen(lpstrText) <= nLength);
|
ATLASSERT(!bValidate || (lstrlen(lpstrText) <= nLength));
|
||||||
bSuccess = pT->SetDlgItemText(nID, lpstrText);
|
bSuccess = pT->SetDlgItemText(nID, lpstrText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,8 +309,8 @@ public:
|
||||||
return bSuccess;
|
return bSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__)
|
#ifdef __ATLSTR_H__
|
||||||
BOOL DDX_Text(UINT nID, _CSTRING_NS::CString& strText, int /*cbSize*/, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0)
|
BOOL DDX_Text(UINT nID, ATL::CString& strText, int /*cbSize*/, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0)
|
||||||
{
|
{
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
BOOL bSuccess = TRUE;
|
BOOL bSuccess = TRUE;
|
||||||
|
@ -366,7 +352,7 @@ public:
|
||||||
}
|
}
|
||||||
return bSuccess;
|
return bSuccess;
|
||||||
}
|
}
|
||||||
#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__)
|
#endif // __ATLSTR_H__
|
||||||
|
|
||||||
// Numeric exchange
|
// Numeric exchange
|
||||||
template <class Type>
|
template <class Type>
|
||||||
|
@ -381,7 +367,7 @@ public:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ATLASSERT(!bValidate || nVal >= nMin && nVal <= nMax);
|
ATLASSERT(!bValidate || ((nVal >= nMin) && (nVal <= nMax)));
|
||||||
bSuccess = pT->SetDlgItemInt(nID, nVal, bSigned);
|
bSuccess = pT->SetDlgItemInt(nID, nVal, bSigned);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,7 +378,7 @@ public:
|
||||||
else if(bSave && bValidate) // validation
|
else if(bSave && bValidate) // validation
|
||||||
{
|
{
|
||||||
ATLASSERT(nMin != nMax);
|
ATLASSERT(nMin != nMax);
|
||||||
if(nVal < nMin || nVal > nMax)
|
if((nVal < nMin) || (nVal > nMax))
|
||||||
{
|
{
|
||||||
_XData data = { ddxDataInt };
|
_XData data = { ddxDataInt };
|
||||||
data.intData.nVal = (long)nVal;
|
data.intData.nVal = (long)nVal;
|
||||||
|
@ -406,18 +392,17 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Float exchange
|
// Float exchange
|
||||||
#ifdef _ATL_USE_DDX_FLOAT
|
|
||||||
static BOOL _AtlSimpleFloatParse(LPCTSTR lpszText, double& d)
|
static BOOL _AtlSimpleFloatParse(LPCTSTR lpszText, double& d)
|
||||||
{
|
{
|
||||||
ATLASSERT(lpszText != NULL);
|
ATLASSERT(lpszText != NULL);
|
||||||
while (*lpszText == _T(' ') || *lpszText == _T('\t'))
|
while ((*lpszText == _T(' ')) || (*lpszText == _T('\t')))
|
||||||
lpszText++;
|
lpszText++;
|
||||||
|
|
||||||
TCHAR chFirst = lpszText[0];
|
TCHAR chFirst = lpszText[0];
|
||||||
d = _tcstod(lpszText, (LPTSTR*)&lpszText);
|
d = _tcstod(lpszText, (LPTSTR*)&lpszText);
|
||||||
if (d == 0.0 && chFirst != _T('0'))
|
if ((d == 0.0) && (chFirst != _T('0')))
|
||||||
return FALSE; // could not convert
|
return FALSE; // could not convert
|
||||||
while (*lpszText == _T(' ') || *lpszText == _T('\t'))
|
while ((*lpszText == _T(' ')) || (*lpszText == _T('\t')))
|
||||||
lpszText++;
|
lpszText++;
|
||||||
|
|
||||||
if (*lpszText != _T('\0'))
|
if (*lpszText != _T('\0'))
|
||||||
|
@ -431,7 +416,7 @@ public:
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
BOOL bSuccess = TRUE;
|
BOOL bSuccess = TRUE;
|
||||||
const int cchBuff = 32;
|
const int cchBuff = 32;
|
||||||
TCHAR szBuff[cchBuff] = { 0 };
|
TCHAR szBuff[cchBuff] = {};
|
||||||
|
|
||||||
if(bSave)
|
if(bSave)
|
||||||
{
|
{
|
||||||
|
@ -444,8 +429,8 @@ public:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ATLASSERT(!bValidate || nVal >= nMin && nVal <= nMax);
|
ATLASSERT(!bValidate || ((nVal >= nMin) && (nVal <= nMax)));
|
||||||
SecureHelper::sprintf_x(szBuff, cchBuff, _T("%.*g"), nPrecision, nVal);
|
_stprintf_s(szBuff, cchBuff, _T("%.*g"), nPrecision, nVal);
|
||||||
bSuccess = pT->SetDlgItemText(nID, szBuff);
|
bSuccess = pT->SetDlgItemText(nID, szBuff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,7 +441,7 @@ public:
|
||||||
else if(bSave && bValidate) // validation
|
else if(bSave && bValidate) // validation
|
||||||
{
|
{
|
||||||
ATLASSERT(nMin != nMax);
|
ATLASSERT(nMin != nMax);
|
||||||
if(nVal < nMin || nVal > nMax)
|
if((nVal < nMin) || (nVal > nMax))
|
||||||
{
|
{
|
||||||
_XData data = { ddxDataFloat };
|
_XData data = { ddxDataFloat };
|
||||||
data.floatData.nVal = (double)nVal;
|
data.floatData.nVal = (double)nVal;
|
||||||
|
@ -474,7 +459,7 @@ public:
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
BOOL bSuccess = TRUE;
|
BOOL bSuccess = TRUE;
|
||||||
const int cchBuff = 32;
|
const int cchBuff = 32;
|
||||||
TCHAR szBuff[cchBuff] = { 0 };
|
TCHAR szBuff[cchBuff] = {};
|
||||||
|
|
||||||
if(bSave)
|
if(bSave)
|
||||||
{
|
{
|
||||||
|
@ -487,8 +472,8 @@ public:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ATLASSERT(!bValidate || nVal >= nMin && nVal <= nMax);
|
ATLASSERT(!bValidate || ((nVal >= nMin) && (nVal <= nMax)));
|
||||||
SecureHelper::sprintf_x(szBuff, cchBuff, _T("%.*g"), nPrecision, nVal);
|
_stprintf_s(szBuff, cchBuff, _T("%.*g"), nPrecision, nVal);
|
||||||
bSuccess = pT->SetDlgItemText(nID, szBuff);
|
bSuccess = pT->SetDlgItemText(nID, szBuff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -499,7 +484,7 @@ public:
|
||||||
else if(bSave && bValidate) // validation
|
else if(bSave && bValidate) // validation
|
||||||
{
|
{
|
||||||
ATLASSERT(nMin != nMax);
|
ATLASSERT(nMin != nMax);
|
||||||
if(nVal < nMin || nVal > nMax)
|
if((nVal < nMin) || (nVal > nMax))
|
||||||
{
|
{
|
||||||
_XData data = { ddxDataFloat };
|
_XData data = { ddxDataFloat };
|
||||||
data.floatData.nVal = nVal;
|
data.floatData.nVal = nVal;
|
||||||
|
@ -511,13 +496,12 @@ public:
|
||||||
}
|
}
|
||||||
return bSuccess;
|
return bSuccess;
|
||||||
}
|
}
|
||||||
#endif // _ATL_USE_DDX_FLOAT
|
|
||||||
|
|
||||||
// Full control subclassing (for CWindowImpl derived controls)
|
// Full control subclassing (for CWindowImpl derived controls)
|
||||||
template <class TControl>
|
template <class TControl>
|
||||||
void DDX_Control(UINT nID, TControl& ctrl, BOOL bSave)
|
void DDX_Control(UINT nID, TControl& ctrl, BOOL bSave)
|
||||||
{
|
{
|
||||||
if(!bSave && ctrl.m_hWnd == NULL)
|
if(!bSave && (ctrl.m_hWnd == NULL))
|
||||||
{
|
{
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
ctrl.SubclassWindow(pT->GetDlgItem(nID));
|
ctrl.SubclassWindow(pT->GetDlgItem(nID));
|
||||||
|
@ -528,7 +512,7 @@ public:
|
||||||
template <class TControl>
|
template <class TControl>
|
||||||
void DDX_Control_Handle(UINT nID, TControl& ctrl, BOOL bSave)
|
void DDX_Control_Handle(UINT nID, TControl& ctrl, BOOL bSave)
|
||||||
{
|
{
|
||||||
if(!bSave && ctrl.m_hWnd == NULL)
|
if(!bSave && (ctrl.m_hWnd == NULL))
|
||||||
{
|
{
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
ctrl = pT->GetDlgItem(nID);
|
ctrl = pT->GetDlgItem(nID);
|
||||||
|
@ -543,11 +527,11 @@ public:
|
||||||
if(bSave)
|
if(bSave)
|
||||||
{
|
{
|
||||||
nValue = (int)::SendMessage(hWndCtrl, BM_GETCHECK, 0, 0L);
|
nValue = (int)::SendMessage(hWndCtrl, BM_GETCHECK, 0, 0L);
|
||||||
ATLASSERT(nValue >= 0 && nValue <= 2);
|
ATLASSERT((nValue >= 0) && (nValue <= 2));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(nValue < 0 || nValue > 2)
|
if((nValue < 0) || (nValue > 2))
|
||||||
{
|
{
|
||||||
ATLTRACE2(atlTraceUI, 0, _T("ATL: Warning - dialog data checkbox value (%d) out of range.\n"), nValue);
|
ATLTRACE2(atlTraceUI, 0, _T("ATL: Warning - dialog data checkbox value (%d) out of range.\n"), nValue);
|
||||||
nValue = 0; // default to off
|
nValue = 0; // default to off
|
||||||
|
@ -611,11 +595,10 @@ public:
|
||||||
}
|
}
|
||||||
hWndCtrl = ::GetWindow(hWndCtrl, GW_HWNDNEXT);
|
hWndCtrl = ::GetWindow(hWndCtrl, GW_HWNDNEXT);
|
||||||
}
|
}
|
||||||
while (hWndCtrl != NULL && !(GetWindowLong(hWndCtrl, GWL_STYLE) & WS_GROUP));
|
while ((hWndCtrl != NULL) && !(GetWindowLong(hWndCtrl, GWL_STYLE) & WS_GROUP));
|
||||||
}
|
}
|
||||||
|
|
||||||
// DDX support for Tab, Combo, ListBox and ListView selection index
|
// DDX support for Tab, Combo, ListBox and ListView selection index
|
||||||
#if (_MSC_VER >= 1300)
|
|
||||||
template <class TCtrl>
|
template <class TCtrl>
|
||||||
INT _getSel(TCtrl& tCtrl)
|
INT _getSel(TCtrl& tCtrl)
|
||||||
{
|
{
|
||||||
|
@ -660,7 +643,6 @@ public:
|
||||||
else
|
else
|
||||||
_setSel(ctrl, nVal);
|
_setSel(ctrl, nVal);
|
||||||
}
|
}
|
||||||
#endif // (_MSC_VER >= 1300)
|
|
||||||
|
|
||||||
// Overrideables
|
// Overrideables
|
||||||
void OnDataExchangeError(UINT nCtrlID, BOOL /*bSave*/)
|
void OnDataExchangeError(UINT nCtrlID, BOOL /*bSave*/)
|
||||||
|
@ -680,6 +662,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}; // namespace WTL
|
} // namespace WTL
|
||||||
|
|
||||||
#endif // __ATLDDX_H__
|
#endif // __ATLDDX_H__
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,23 +1,16 @@
|
||||||
// Windows Template Library - WTL version 8.1
|
// Windows Template Library - WTL version 10.0
|
||||||
// Copyright (C) Microsoft Corporation. All rights reserved.
|
// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved.
|
||||||
//
|
//
|
||||||
// This file is a part of the Windows Template Library.
|
// This file is a part of the Windows Template Library.
|
||||||
// The use and distribution terms for this software are covered by the
|
// The use and distribution terms for this software are covered by the
|
||||||
// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php)
|
// Microsoft Public License (http://opensource.org/licenses/MS-PL)
|
||||||
// which can be found in the file CPL.TXT at the root of this distribution.
|
// which can be found in the file MS-PL.txt at the root folder.
|
||||||
// By using this software in any fashion, you are agreeing to be bound by
|
|
||||||
// the terms of this license. You must not remove this notice, or
|
|
||||||
// any other, from this software.
|
|
||||||
|
|
||||||
#ifndef __ATLDWM_H__
|
#ifndef __ATLDWM_H__
|
||||||
#define __ATLDWM_H__
|
#define __ATLDWM_H__
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifdef _WIN32_WCE
|
|
||||||
#error atldwm.h is not supported on Windows CE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __ATLAPP_H__
|
#ifndef __ATLAPP_H__
|
||||||
#error atldwm.h requires atlapp.h to be included first
|
#error atldwm.h requires atlapp.h to be included first
|
||||||
#endif
|
#endif
|
||||||
|
@ -28,11 +21,11 @@
|
||||||
|
|
||||||
#if (_WIN32_WINNT < 0x0600)
|
#if (_WIN32_WINNT < 0x0600)
|
||||||
#error atldwm.h requires _WIN32_WINNT >= 0x0600
|
#error atldwm.h requires _WIN32_WINNT >= 0x0600
|
||||||
#endif // (_WIN32_WINNT < 0x0600)
|
#endif
|
||||||
|
|
||||||
#ifndef _DWMAPI_H_
|
#ifndef _DWMAPI_H_
|
||||||
#include <dwmapi.h>
|
#include <dwmapi.h>
|
||||||
#endif // _DWMAPI_H_
|
#endif
|
||||||
#pragma comment(lib, "dwmapi.lib")
|
#pragma comment(lib, "dwmapi.lib")
|
||||||
|
|
||||||
// Note: To create an application that also runs on older versions of Windows,
|
// Note: To create an application that also runs on older versions of Windows,
|
||||||
|
@ -40,10 +33,7 @@
|
||||||
// Delay load is NOT AUTOMATIC for VC++ 7, you have to link to delayimp.lib,
|
// Delay load is NOT AUTOMATIC for VC++ 7, you have to link to delayimp.lib,
|
||||||
// and add dwmapi.dll in the Linker.Input.Delay Loaded DLLs section of the
|
// and add dwmapi.dll in the Linker.Input.Delay Loaded DLLs section of the
|
||||||
// project properties.
|
// project properties.
|
||||||
#if (_MSC_VER < 1300) && !defined(_WTL_NO_DWMAPI_DELAYLOAD)
|
|
||||||
#pragma comment(lib, "delayimp.lib")
|
|
||||||
#pragma comment(linker, "/delayload:dwmapi.dll")
|
|
||||||
#endif // (_MSC_VER < 1300) && !defined(_WTL_NO_DWMAPI_DELAYLOAD)
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Classes in this file:
|
// Classes in this file:
|
||||||
|
@ -106,32 +96,42 @@ public:
|
||||||
// Operations
|
// Operations
|
||||||
BOOL DwmIsCompositionEnabled() const
|
BOOL DwmIsCompositionEnabled() const
|
||||||
{
|
{
|
||||||
if(!IsDwmSupported()) return FALSE;
|
if(!IsDwmSupported())
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
BOOL bRes = FALSE;
|
BOOL bRes = FALSE;
|
||||||
return SUCCEEDED(::DwmIsCompositionEnabled(&bRes)) && bRes;
|
return (SUCCEEDED(::DwmIsCompositionEnabled(&bRes)) && bRes) ? TRUE : FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL DwmEnableComposition(UINT fEnable)
|
BOOL DwmEnableComposition(UINT fEnable)
|
||||||
{
|
{
|
||||||
if(!IsDwmSupported()) return FALSE;
|
if(!IsDwmSupported())
|
||||||
return SUCCEEDED(::DwmEnableComposition(fEnable));
|
return FALSE;
|
||||||
|
|
||||||
|
return SUCCEEDED(::DwmEnableComposition(fEnable)) ? TRUE : FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL DwmEnableMMCSS(BOOL fEnableMMCSS)
|
BOOL DwmEnableMMCSS(BOOL fEnableMMCSS)
|
||||||
{
|
{
|
||||||
if(!IsDwmSupported()) return FALSE;
|
if(!IsDwmSupported())
|
||||||
return SUCCEEDED(::DwmEnableMMCSS(fEnableMMCSS));
|
return FALSE;
|
||||||
|
|
||||||
|
return SUCCEEDED(::DwmEnableMMCSS(fEnableMMCSS)) ? TRUE : FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT DwmGetColorizationColor(DWORD* pcrColorization, BOOL* pfOpaqueBlend)
|
HRESULT DwmGetColorizationColor(DWORD* pcrColorization, BOOL* pfOpaqueBlend)
|
||||||
{
|
{
|
||||||
if(!IsDwmSupported()) return E_NOTIMPL;
|
if(!IsDwmSupported())
|
||||||
|
return E_NOTIMPL;
|
||||||
|
|
||||||
return ::DwmGetColorizationColor(pcrColorization, pfOpaqueBlend);
|
return ::DwmGetColorizationColor(pcrColorization, pfOpaqueBlend);
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT DwmFlush()
|
HRESULT DwmFlush()
|
||||||
{
|
{
|
||||||
if(!IsDwmSupported()) return E_NOTIMPL;
|
if(!IsDwmSupported())
|
||||||
|
return E_NOTIMPL;
|
||||||
|
|
||||||
return ::DwmFlush();
|
return ::DwmFlush();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -148,7 +148,9 @@ class CDwmImpl : public TBase
|
||||||
public:
|
public:
|
||||||
HRESULT DwmEnableBlurBehindWindow(const DWM_BLURBEHIND* pBB)
|
HRESULT DwmEnableBlurBehindWindow(const DWM_BLURBEHIND* pBB)
|
||||||
{
|
{
|
||||||
if(!IsDwmSupported()) return E_NOTIMPL;
|
if(!this->IsDwmSupported())
|
||||||
|
return E_NOTIMPL;
|
||||||
|
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||||
return ::DwmEnableBlurBehindWindow(pT->m_hWnd, pBB);
|
return ::DwmEnableBlurBehindWindow(pT->m_hWnd, pBB);
|
||||||
|
@ -156,7 +158,9 @@ public:
|
||||||
|
|
||||||
HRESULT DwmExtendFrameIntoClientArea(const MARGINS* pMargins)
|
HRESULT DwmExtendFrameIntoClientArea(const MARGINS* pMargins)
|
||||||
{
|
{
|
||||||
if(!IsDwmSupported()) return E_NOTIMPL;
|
if(!this->IsDwmSupported())
|
||||||
|
return E_NOTIMPL;
|
||||||
|
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||||
return ::DwmExtendFrameIntoClientArea(pT->m_hWnd, pMargins);
|
return ::DwmExtendFrameIntoClientArea(pT->m_hWnd, pMargins);
|
||||||
|
@ -170,7 +174,9 @@ public:
|
||||||
|
|
||||||
HRESULT DwmGetCompositionTimingInfo(DWM_TIMING_INFO* pTimingInfo)
|
HRESULT DwmGetCompositionTimingInfo(DWM_TIMING_INFO* pTimingInfo)
|
||||||
{
|
{
|
||||||
if(!IsDwmSupported()) return E_NOTIMPL;
|
if(!this->IsDwmSupported())
|
||||||
|
return E_NOTIMPL;
|
||||||
|
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||||
return ::DwmGetCompositionTimingInfo(pT->m_hWnd, pTimingInfo);
|
return ::DwmGetCompositionTimingInfo(pT->m_hWnd, pTimingInfo);
|
||||||
|
@ -178,7 +184,9 @@ public:
|
||||||
|
|
||||||
HRESULT DwmGetWindowAttribute(DWORD dwAttribute, PVOID pvAttribute, DWORD cbAttribute)
|
HRESULT DwmGetWindowAttribute(DWORD dwAttribute, PVOID pvAttribute, DWORD cbAttribute)
|
||||||
{
|
{
|
||||||
if(!IsDwmSupported()) return E_NOTIMPL;
|
if(!this->IsDwmSupported())
|
||||||
|
return E_NOTIMPL;
|
||||||
|
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||||
return ::DwmGetWindowAttribute(pT->m_hWnd, dwAttribute, pvAttribute, cbAttribute);
|
return ::DwmGetWindowAttribute(pT->m_hWnd, dwAttribute, pvAttribute, cbAttribute);
|
||||||
|
@ -186,7 +194,9 @@ public:
|
||||||
|
|
||||||
HRESULT DwmModifyPreviousDxFrameDuration(INT cRefreshes, BOOL fRelative)
|
HRESULT DwmModifyPreviousDxFrameDuration(INT cRefreshes, BOOL fRelative)
|
||||||
{
|
{
|
||||||
if(!IsDwmSupported()) return E_NOTIMPL;
|
if(!this->IsDwmSupported())
|
||||||
|
return E_NOTIMPL;
|
||||||
|
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||||
return ::DwmModifyPreviousDxFrameDuration(pT->m_hWnd, cRefreshes, fRelative);
|
return ::DwmModifyPreviousDxFrameDuration(pT->m_hWnd, cRefreshes, fRelative);
|
||||||
|
@ -194,7 +204,9 @@ public:
|
||||||
|
|
||||||
HRESULT DwmSetDxFrameDuration(INT cRefreshes)
|
HRESULT DwmSetDxFrameDuration(INT cRefreshes)
|
||||||
{
|
{
|
||||||
if(!IsDwmSupported()) return E_NOTIMPL;
|
if(!this->IsDwmSupported())
|
||||||
|
return E_NOTIMPL;
|
||||||
|
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||||
return ::DwmSetDxFrameDuration(pT->m_hWnd, cRefreshes);
|
return ::DwmSetDxFrameDuration(pT->m_hWnd, cRefreshes);
|
||||||
|
@ -202,7 +214,9 @@ public:
|
||||||
|
|
||||||
HRESULT DwmSetPresentParameters(DWM_PRESENT_PARAMETERS* pPresentParams)
|
HRESULT DwmSetPresentParameters(DWM_PRESENT_PARAMETERS* pPresentParams)
|
||||||
{
|
{
|
||||||
if(!IsDwmSupported()) return E_NOTIMPL;
|
if(!this->IsDwmSupported())
|
||||||
|
return E_NOTIMPL;
|
||||||
|
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||||
return ::DwmSetPresentParameters(pT->m_hWnd, pPresentParams);
|
return ::DwmSetPresentParameters(pT->m_hWnd, pPresentParams);
|
||||||
|
@ -210,7 +224,9 @@ public:
|
||||||
|
|
||||||
HRESULT DwmSetWindowAttribute(DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute)
|
HRESULT DwmSetWindowAttribute(DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute)
|
||||||
{
|
{
|
||||||
if(!IsDwmSupported()) return E_NOTIMPL;
|
if(!this->IsDwmSupported())
|
||||||
|
return E_NOTIMPL;
|
||||||
|
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||||
return ::DwmSetWindowAttribute(pT->m_hWnd, dwAttribute, pvAttribute, cbAttribute);
|
return ::DwmSetWindowAttribute(pT->m_hWnd, dwAttribute, pvAttribute, cbAttribute);
|
||||||
|
@ -218,7 +234,9 @@ public:
|
||||||
|
|
||||||
HRESULT DwmAttachMilContent()
|
HRESULT DwmAttachMilContent()
|
||||||
{
|
{
|
||||||
if(!IsDwmSupported()) return E_NOTIMPL;
|
if(!this->IsDwmSupported())
|
||||||
|
return E_NOTIMPL;
|
||||||
|
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||||
return ::DwmAttachMilContent(pT->m_hWnd);
|
return ::DwmAttachMilContent(pT->m_hWnd);
|
||||||
|
@ -226,7 +244,9 @@ public:
|
||||||
|
|
||||||
HRESULT DwmDetachMilContent()
|
HRESULT DwmDetachMilContent()
|
||||||
{
|
{
|
||||||
if(!IsDwmSupported()) return E_NOTIMPL;
|
if(!this->IsDwmSupported())
|
||||||
|
return E_NOTIMPL;
|
||||||
|
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||||
return ::DwmDetachMilContent(pT->m_hWnd);
|
return ::DwmDetachMilContent(pT->m_hWnd);
|
||||||
|
@ -242,7 +262,7 @@ public:
|
||||||
|
|
||||||
CDwmWindowT< TBase >& operator =(HWND hWnd)
|
CDwmWindowT< TBase >& operator =(HWND hWnd)
|
||||||
{
|
{
|
||||||
m_hWnd = hWnd;
|
this->m_hWnd = hWnd;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -262,12 +282,11 @@ public:
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
CDwmThumbnailT(HTHUMBNAIL hThumbnail = NULL) : m_hThumbnail(hThumbnail)
|
CDwmThumbnailT(HTHUMBNAIL hThumbnail = NULL) : m_hThumbnail(hThumbnail)
|
||||||
{
|
{ }
|
||||||
}
|
|
||||||
|
|
||||||
~CDwmThumbnailT()
|
~CDwmThumbnailT()
|
||||||
{
|
{
|
||||||
if(t_bManaged && m_hThumbnail != NULL)
|
if(t_bManaged && (m_hThumbnail != NULL))
|
||||||
Unregister();
|
Unregister();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,7 +299,7 @@ public:
|
||||||
|
|
||||||
void Attach(HTHUMBNAIL hThumbnailNew)
|
void Attach(HTHUMBNAIL hThumbnailNew)
|
||||||
{
|
{
|
||||||
if(t_bManaged && m_hThumbnail != NULL && m_hThumbnail != hThumbnailNew)
|
if(t_bManaged && (m_hThumbnail != NULL) && (m_hThumbnail != hThumbnailNew))
|
||||||
Unregister();
|
Unregister();
|
||||||
m_hThumbnail = hThumbnailNew;
|
m_hThumbnail = hThumbnailNew;
|
||||||
}
|
}
|
||||||
|
@ -297,16 +316,24 @@ public:
|
||||||
ATLASSERT(::IsWindow(hwndDestination));
|
ATLASSERT(::IsWindow(hwndDestination));
|
||||||
ATLASSERT(::IsWindow(hwndSource));
|
ATLASSERT(::IsWindow(hwndSource));
|
||||||
ATLASSERT(m_hThumbnail==NULL);
|
ATLASSERT(m_hThumbnail==NULL);
|
||||||
if(!IsDwmSupported()) return E_NOTIMPL;
|
|
||||||
|
if(!this->IsDwmSupported())
|
||||||
|
return E_NOTIMPL;
|
||||||
|
|
||||||
return ::DwmRegisterThumbnail(hwndDestination, hwndSource, &m_hThumbnail);
|
return ::DwmRegisterThumbnail(hwndDestination, hwndSource, &m_hThumbnail);
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT Unregister()
|
HRESULT Unregister()
|
||||||
{
|
{
|
||||||
if(!IsDwmSupported()) return E_NOTIMPL;
|
if(!this->IsDwmSupported())
|
||||||
if(m_hThumbnail == NULL) return S_FALSE;
|
return E_NOTIMPL;
|
||||||
|
if(m_hThumbnail == NULL)
|
||||||
|
return S_FALSE;
|
||||||
|
|
||||||
HRESULT Hr = ::DwmUnregisterThumbnail(m_hThumbnail);
|
HRESULT Hr = ::DwmUnregisterThumbnail(m_hThumbnail);
|
||||||
if(SUCCEEDED(Hr)) m_hThumbnail = NULL;
|
if(SUCCEEDED(Hr))
|
||||||
|
m_hThumbnail = NULL;
|
||||||
|
|
||||||
return Hr;
|
return Hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -316,7 +343,9 @@ public:
|
||||||
|
|
||||||
HRESULT UpdateProperties(const DWM_THUMBNAIL_PROPERTIES* ptnProperties)
|
HRESULT UpdateProperties(const DWM_THUMBNAIL_PROPERTIES* ptnProperties)
|
||||||
{
|
{
|
||||||
if(!IsDwmSupported()) return E_NOTIMPL;
|
if(!this->IsDwmSupported())
|
||||||
|
return E_NOTIMPL;
|
||||||
|
|
||||||
ATLASSERT(m_hThumbnail != NULL);
|
ATLASSERT(m_hThumbnail != NULL);
|
||||||
return ::DwmUpdateThumbnailProperties(m_hThumbnail, ptnProperties);
|
return ::DwmUpdateThumbnailProperties(m_hThumbnail, ptnProperties);
|
||||||
}
|
}
|
||||||
|
@ -324,7 +353,9 @@ public:
|
||||||
// Attributes
|
// Attributes
|
||||||
HRESULT QuerySourceSize(PSIZE pSize)
|
HRESULT QuerySourceSize(PSIZE pSize)
|
||||||
{
|
{
|
||||||
if(!IsDwmSupported()) return E_NOTIMPL;
|
if(!this->IsDwmSupported())
|
||||||
|
return E_NOTIMPL;
|
||||||
|
|
||||||
ATLASSERT(m_hThumbnail != NULL);
|
ATLASSERT(m_hThumbnail != NULL);
|
||||||
return ::DwmQueryThumbnailSourceSize(m_hThumbnail, pSize);
|
return ::DwmQueryThumbnailSourceSize(m_hThumbnail, pSize);
|
||||||
}
|
}
|
||||||
|
@ -340,10 +371,9 @@ typedef CDwmThumbnailT<false, CDwm> CDwmThumbnailHandle;
|
||||||
// CAeroControlImpl - Base class for controls on Glass
|
// CAeroControlImpl - Base class for controls on Glass
|
||||||
|
|
||||||
template <class T, class TBase = ATL::CWindow, class TWinTraits = ATL::CControlWinTraits>
|
template <class T, class TBase = ATL::CWindow, class TWinTraits = ATL::CControlWinTraits>
|
||||||
class CAeroControlImpl :
|
class CAeroControlImpl : public CThemeImpl<T>,
|
||||||
public CThemeImpl<T>,
|
public CBufferedPaintImpl<T>,
|
||||||
public CBufferedPaintImpl<T>,
|
public ATL::CWindowImpl<T, TBase, TWinTraits>
|
||||||
public ATL::CWindowImpl<T, TBase, TWinTraits>
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef CThemeImpl<T> _themeClass;
|
typedef CThemeImpl<T> _themeClass;
|
||||||
|
@ -352,7 +382,7 @@ public:
|
||||||
|
|
||||||
CAeroControlImpl()
|
CAeroControlImpl()
|
||||||
{
|
{
|
||||||
m_PaintParams.dwFlags = BPPF_ERASE;
|
this->m_PaintParams.dwFlags = BPPF_ERASE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static LPCWSTR GetThemeName()
|
static LPCWSTR GetThemeName()
|
||||||
|
@ -377,13 +407,16 @@ public:
|
||||||
{
|
{
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
pT->Init();
|
pT->Init();
|
||||||
|
|
||||||
bHandled = FALSE;
|
bHandled = FALSE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT OnActivate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
|
LRESULT OnActivate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
if(IsThemingSupported()) Invalidate(FALSE);
|
if(this->IsThemingSupported())
|
||||||
|
this->Invalidate(FALSE);
|
||||||
|
|
||||||
bHandled = FALSE;
|
bHandled = FALSE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -391,23 +424,26 @@ public:
|
||||||
// Operations
|
// Operations
|
||||||
BOOL SubclassWindow(HWND hWnd)
|
BOOL SubclassWindow(HWND hWnd)
|
||||||
{
|
{
|
||||||
ATLASSERT(m_hWnd == NULL);
|
ATLASSERT(this->m_hWnd == NULL);
|
||||||
ATLASSERT(::IsWindow(hWnd));
|
ATLASSERT(::IsWindow(hWnd));
|
||||||
BOOL bRet = _windowClass::SubclassWindow(hWnd);
|
BOOL bRet = _windowClass::SubclassWindow(hWnd);
|
||||||
if(bRet) {
|
if(bRet)
|
||||||
|
{
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
pT->Init();
|
pT->Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
return bRet;
|
return bRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implementation
|
// Implementation
|
||||||
LRESULT DefWindowProc()
|
LRESULT DefWindowProc()
|
||||||
{
|
{
|
||||||
const _ATL_MSG* pMsg = m_pCurrentMsg;
|
const ATL::_ATL_MSG* pMsg = this->m_pCurrentMsg;
|
||||||
LRESULT lRes = 0;
|
LRESULT lRes = 0;
|
||||||
if(pMsg != NULL)
|
if(pMsg != NULL)
|
||||||
lRes = DefWindowProc(pMsg->message, pMsg->wParam, pMsg->lParam);
|
lRes = DefWindowProc(pMsg->message, pMsg->wParam, pMsg->lParam);
|
||||||
|
|
||||||
return lRes;
|
return lRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -415,7 +451,9 @@ public:
|
||||||
{
|
{
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
LRESULT lRes = 0;
|
LRESULT lRes = 0;
|
||||||
if( ::DwmDefWindowProc(pT->m_hWnd, uMsg, wParam, lParam, &lRes) ) return lRes;
|
if(::DwmDefWindowProc(pT->m_hWnd, uMsg, wParam, lParam, &lRes) != FALSE)
|
||||||
|
return lRes;
|
||||||
|
|
||||||
return _windowClass::DefWindowProc(uMsg, wParam, lParam);
|
return _windowClass::DefWindowProc(uMsg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,12 +461,12 @@ public:
|
||||||
{
|
{
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
HDC hDCPaint = NULL;
|
HDC hDCPaint = NULL;
|
||||||
RECT rcClient = { 0 };
|
RECT rcClient = {};
|
||||||
GetClientRect(&rcClient);
|
this->GetClientRect(&rcClient);
|
||||||
m_BufferedPaint.Begin(hDC, &rcClient, m_dwFormat, &m_PaintParams, &hDCPaint);
|
this->m_BufferedPaint.Begin(hDC, &rcClient, this->m_dwFormat, &this->m_PaintParams, &hDCPaint);
|
||||||
ATLASSERT(hDCPaint != NULL);
|
ATLASSERT(hDCPaint != NULL);
|
||||||
pT->DoAeroPaint(hDCPaint, rcClient, rcPaint);
|
pT->DoAeroPaint(hDCPaint, rcClient, rcPaint);
|
||||||
m_BufferedPaint.End();
|
this->m_BufferedPaint.End();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoPaint(HDC /*hdc*/, RECT& /*rcClient*/)
|
void DoPaint(HDC /*hdc*/, RECT& /*rcClient*/)
|
||||||
|
@ -440,22 +478,21 @@ public:
|
||||||
void Init()
|
void Init()
|
||||||
{
|
{
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
SetThemeClassList(pT->GetThemeName());
|
(void)pT; // avoid level 4 warning
|
||||||
if(m_lpstrThemeClassList != NULL)
|
this->SetThemeClassList(pT->GetThemeName());
|
||||||
OpenThemeData();
|
if(this->m_lpstrThemeClassList != NULL)
|
||||||
|
this->OpenThemeData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoAeroPaint(HDC hDC, RECT& /*rcClient*/, RECT& rcPaint)
|
void DoAeroPaint(HDC hDC, RECT& /*rcClient*/, RECT& rcPaint)
|
||||||
{
|
{
|
||||||
DefWindowProc(WM_PAINT, (WPARAM) hDC, 0L);
|
DefWindowProc(WM_PAINT, (WPARAM) hDC, 0L);
|
||||||
m_BufferedPaint.MakeOpaque(&rcPaint);
|
this->m_BufferedPaint.MakeOpaque(&rcPaint);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __ATLTHEME_H__
|
#endif // __ATLTHEME_H__
|
||||||
|
|
||||||
|
} // namespace WTL
|
||||||
}; // namespace WTL
|
|
||||||
|
|
||||||
|
|
||||||
#endif // __ATLDWM_H__
|
#endif // __ATLDWM_H__
|
||||||
|
|
|
@ -1,23 +1,16 @@
|
||||||
// Windows Template Library - WTL version 8.1
|
// Windows Template Library - WTL version 10.0
|
||||||
// Copyright (C) Microsoft Corporation. All rights reserved.
|
// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved.
|
||||||
//
|
//
|
||||||
// This file is a part of the Windows Template Library.
|
// This file is a part of the Windows Template Library.
|
||||||
// The use and distribution terms for this software are covered by the
|
// The use and distribution terms for this software are covered by the
|
||||||
// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php)
|
// Microsoft Public License (http://opensource.org/licenses/MS-PL)
|
||||||
// which can be found in the file CPL.TXT at the root of this distribution.
|
// which can be found in the file MS-PL.txt at the root folder.
|
||||||
// By using this software in any fashion, you are agreeing to be bound by
|
|
||||||
// the terms of this license. You must not remove this notice, or
|
|
||||||
// any other, from this software.
|
|
||||||
|
|
||||||
#ifndef __ATLFIND_H__
|
#ifndef __ATLFIND_H__
|
||||||
#define __ATLFIND_H__
|
#define __ATLFIND_H__
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifdef _WIN32_WCE
|
|
||||||
#error atlfind.h is not supported on Windows CE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __ATLCTRLS_H__
|
#ifndef __ATLCTRLS_H__
|
||||||
#error atlfind.h requires atlctrls.h to be included first
|
#error atlfind.h requires atlctrls.h to be included first
|
||||||
#endif
|
#endif
|
||||||
|
@ -26,8 +19,8 @@
|
||||||
#error atlfind.h requires atldlgs.h to be included first
|
#error atlfind.h requires atldlgs.h to be included first
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !((defined(__ATLMISC_H__) && defined(_WTL_USE_CSTRING)) || defined(__ATLSTR_H__))
|
#ifndef __ATLSTR_H__
|
||||||
#error atlfind.h requires CString (either from ATL's atlstr.h or WTL's atlmisc.h with _WTL_USE_CSTRING)
|
#error atlfind.h requires CString
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,13 +46,6 @@ protected:
|
||||||
// Typedefs
|
// Typedefs
|
||||||
typedef CEditFindReplaceImplBase<T, TFindReplaceDialog> thisClass;
|
typedef CEditFindReplaceImplBase<T, TFindReplaceDialog> thisClass;
|
||||||
|
|
||||||
// Data members
|
|
||||||
TFindReplaceDialog* m_pFindReplaceDialog;
|
|
||||||
_CSTRING_NS::CString m_sFindNext, m_sReplaceWith;
|
|
||||||
BOOL m_bFindOnly, m_bFirstSearch, m_bMatchCase, m_bWholeWord, m_bFindDown;
|
|
||||||
LONG m_nInitialSearchPos;
|
|
||||||
HCURSOR m_hOldCursor;
|
|
||||||
|
|
||||||
// Enumerations
|
// Enumerations
|
||||||
enum TranslationTextItem
|
enum TranslationTextItem
|
||||||
{
|
{
|
||||||
|
@ -70,6 +56,13 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
// Data members
|
||||||
|
TFindReplaceDialog* m_pFindReplaceDialog;
|
||||||
|
ATL::CString m_sFindNext, m_sReplaceWith;
|
||||||
|
BOOL m_bFindOnly, m_bFirstSearch, m_bMatchCase, m_bWholeWord, m_bFindDown;
|
||||||
|
LONG m_nInitialSearchPos;
|
||||||
|
HCURSOR m_hOldCursor;
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
CEditFindReplaceImplBase() :
|
CEditFindReplaceImplBase() :
|
||||||
m_pFindReplaceDialog(NULL),
|
m_pFindReplaceDialog(NULL),
|
||||||
|
@ -86,25 +79,12 @@ public:
|
||||||
// Message Handlers
|
// Message Handlers
|
||||||
BEGIN_MSG_MAP(thisClass)
|
BEGIN_MSG_MAP(thisClass)
|
||||||
ALT_MSG_MAP(1)
|
ALT_MSG_MAP(1)
|
||||||
MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
|
|
||||||
MESSAGE_HANDLER(TFindReplaceDialog::GetFindReplaceMsg(), OnFindReplaceCmd)
|
MESSAGE_HANDLER(TFindReplaceDialog::GetFindReplaceMsg(), OnFindReplaceCmd)
|
||||||
COMMAND_ID_HANDLER(ID_EDIT_FIND, OnEditFind)
|
COMMAND_ID_HANDLER(ID_EDIT_FIND, OnEditFind)
|
||||||
COMMAND_ID_HANDLER(ID_EDIT_REPEAT, OnEditRepeat)
|
COMMAND_ID_HANDLER(ID_EDIT_REPEAT, OnEditRepeat)
|
||||||
COMMAND_ID_HANDLER(ID_EDIT_REPLACE, OnEditReplace)
|
COMMAND_ID_HANDLER(ID_EDIT_REPLACE, OnEditReplace)
|
||||||
END_MSG_MAP()
|
END_MSG_MAP()
|
||||||
|
|
||||||
LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
|
|
||||||
{
|
|
||||||
if(m_pFindReplaceDialog != NULL)
|
|
||||||
{
|
|
||||||
m_pFindReplaceDialog->SendMessage(WM_CLOSE);
|
|
||||||
ATLASSERT(m_pFindReplaceDialog == NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
bHandled = FALSE;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
LRESULT OnFindReplaceCmd(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/)
|
LRESULT OnFindReplaceCmd(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/)
|
||||||
{
|
{
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
|
@ -207,7 +187,8 @@ public:
|
||||||
{
|
{
|
||||||
// You can override all of this in a derived class
|
// You can override all of this in a derived class
|
||||||
|
|
||||||
TFindReplaceDialog* findReplaceDialog = new TFindReplaceDialog();
|
TFindReplaceDialog* findReplaceDialog = NULL;
|
||||||
|
ATLTRY(findReplaceDialog = new TFindReplaceDialog());
|
||||||
if(findReplaceDialog == NULL)
|
if(findReplaceDialog == NULL)
|
||||||
{
|
{
|
||||||
::MessageBeep(MB_ICONHAND);
|
::MessageBeep(MB_ICONHAND);
|
||||||
|
@ -241,30 +222,29 @@ public:
|
||||||
// (CEdit::GetSel uses int&, and CRichEditCtrlT::GetSel uses LONG&)
|
// (CEdit::GetSel uses int&, and CRichEditCtrlT::GetSel uses LONG&)
|
||||||
::SendMessage(pT->m_hWnd, EM_GETSEL, (WPARAM)&nStartChar, (LPARAM)&nEndChar);
|
::SendMessage(pT->m_hWnd, EM_GETSEL, (WPARAM)&nStartChar, (LPARAM)&nEndChar);
|
||||||
POINT point = pT->PosFromChar(nStartChar);
|
POINT point = pT->PosFromChar(nStartChar);
|
||||||
::ClientToScreen(pT->GetParent(), &point);
|
pT->ClientToScreen(&point);
|
||||||
CRect rect;
|
RECT rect = {};
|
||||||
::GetWindowRect(hWndDialog, &rect);
|
::GetWindowRect(hWndDialog, &rect);
|
||||||
if(rect.PtInRect(point))
|
if(::PtInRect(&rect, point) != FALSE)
|
||||||
{
|
{
|
||||||
if(point.y > rect.Height())
|
if(point.y > (rect.bottom - rect.top))
|
||||||
{
|
{
|
||||||
rect.OffsetRect(0, point.y - rect.bottom - 20);
|
::OffsetRect(&rect, 0, point.y - rect.bottom - 20);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int nVertExt = GetSystemMetrics(SM_CYSCREEN);
|
int nVertExt = GetSystemMetrics(SM_CYSCREEN);
|
||||||
if(point.y + rect.Height() < nVertExt)
|
if((point.y + (rect.bottom - rect.top)) < nVertExt)
|
||||||
rect.OffsetRect(0, 40 + point.y - rect.top);
|
::OffsetRect(&rect, 0, 40 + point.y - rect.top);
|
||||||
}
|
}
|
||||||
|
|
||||||
::MoveWindow(hWndDialog, rect.left, rect.top, rect.Width(), rect.Height(), TRUE);
|
::MoveWindow(hWndDialog, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD GetFindReplaceDialogFlags(void) const
|
DWORD GetFindReplaceDialogFlags() const
|
||||||
{
|
{
|
||||||
DWORD dwFlags = 0;
|
DWORD dwFlags = 0;
|
||||||
|
|
||||||
if(m_bFindDown)
|
if(m_bFindDown)
|
||||||
dwFlags |= FR_DOWN;
|
dwFlags |= FR_DOWN;
|
||||||
if(m_bMatchCase)
|
if(m_bMatchCase)
|
||||||
|
@ -296,12 +276,12 @@ public:
|
||||||
|
|
||||||
ATLASSERT(m_pFindReplaceDialog == NULL);
|
ATLASSERT(m_pFindReplaceDialog == NULL);
|
||||||
|
|
||||||
_CSTRING_NS::CString findNext;
|
ATL::CString findNext;
|
||||||
pT->GetSelText(findNext);
|
pT->GetSelText(findNext);
|
||||||
// if selection is empty or spans multiple lines use old find text
|
// if selection is empty or spans multiple lines use old find text
|
||||||
if(findNext.IsEmpty() || (findNext.FindOneOf(_T("\n\r")) != -1))
|
if(findNext.IsEmpty() || (findNext.FindOneOf(_T("\n\r")) != -1))
|
||||||
findNext = m_sFindNext;
|
findNext = m_sFindNext;
|
||||||
_CSTRING_NS::CString replaceWith = m_sReplaceWith;
|
ATL::CString replaceWith = m_sReplaceWith;
|
||||||
DWORD dwFlags = pT->GetFindReplaceDialogFlags();
|
DWORD dwFlags = pT->GetFindReplaceDialogFlags();
|
||||||
|
|
||||||
m_pFindReplaceDialog = pT->CreateFindReplaceDialog(bFindOnly,
|
m_pFindReplaceDialog = pT->CreateFindReplaceDialog(bFindOnly,
|
||||||
|
@ -325,11 +305,11 @@ public:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// length is the same, check contents
|
// length is the same, check contents
|
||||||
_CSTRING_NS::CString selectedText;
|
ATL::CString selectedText;
|
||||||
pT->GetSelText(selectedText);
|
pT->GetSelText(selectedText);
|
||||||
|
|
||||||
return (bMatchCase && selectedText.Compare(lpszCompare) == 0) ||
|
return (bMatchCase && (selectedText.Compare(lpszCompare) == 0)) ||
|
||||||
(!bMatchCase && selectedText.CompareNoCase(lpszCompare) == 0);
|
(!bMatchCase && (selectedText.CompareNoCase(lpszCompare) == 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextNotFound(LPCTSTR lpszFind)
|
void TextNotFound(LPCTSTR lpszFind)
|
||||||
|
@ -339,9 +319,9 @@ public:
|
||||||
pT->OnTextNotFound(lpszFind);
|
pT->OnTextNotFound(lpszFind);
|
||||||
}
|
}
|
||||||
|
|
||||||
_CSTRING_NS::CString GetTranslationText(enum TranslationTextItem eItem) const
|
ATL::CString GetTranslationText(enum TranslationTextItem eItem) const
|
||||||
{
|
{
|
||||||
_CSTRING_NS::CString text;
|
ATL::CString text;
|
||||||
switch(eItem)
|
switch(eItem)
|
||||||
{
|
{
|
||||||
case eText_OnReplaceAllMessage:
|
case eText_OnReplaceAllMessage:
|
||||||
|
@ -445,12 +425,11 @@ public:
|
||||||
|
|
||||||
::SetCursor(m_hOldCursor);
|
::SetCursor(m_hOldCursor);
|
||||||
|
|
||||||
_CSTRING_NS::CString message = pT->GetTranslationText(eText_OnReplaceAllMessage);
|
ATL::CString message = pT->GetTranslationText(eText_OnReplaceAllMessage);
|
||||||
if(message.GetLength() > 0)
|
if(message.GetLength() > 0)
|
||||||
{
|
{
|
||||||
_CSTRING_NS::CString formattedMessage;
|
ATL::CString formattedMessage;
|
||||||
formattedMessage.Format(message,
|
formattedMessage.Format(message, replaceCount, (LPCTSTR)m_sFindNext, (LPCTSTR)m_sReplaceWith);
|
||||||
replaceCount, m_sFindNext, m_sReplaceWith);
|
|
||||||
if(m_pFindReplaceDialog != NULL)
|
if(m_pFindReplaceDialog != NULL)
|
||||||
{
|
{
|
||||||
m_pFindReplaceDialog->MessageBox(formattedMessage,
|
m_pFindReplaceDialog->MessageBox(formattedMessage,
|
||||||
|
@ -469,10 +448,10 @@ public:
|
||||||
void OnTextNotFound(LPCTSTR lpszFind)
|
void OnTextNotFound(LPCTSTR lpszFind)
|
||||||
{
|
{
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
_CSTRING_NS::CString message = pT->GetTranslationText(eText_OnTextNotFoundMessage);
|
ATL::CString message = pT->GetTranslationText(eText_OnTextNotFoundMessage);
|
||||||
if(message.GetLength() > 0)
|
if(message.GetLength() > 0)
|
||||||
{
|
{
|
||||||
_CSTRING_NS::CString formattedMessage;
|
ATL::CString formattedMessage;
|
||||||
formattedMessage.Format(message, lpszFind);
|
formattedMessage.Format(message, lpszFind);
|
||||||
if(m_pFindReplaceDialog != NULL)
|
if(m_pFindReplaceDialog != NULL)
|
||||||
{
|
{
|
||||||
|
@ -523,29 +502,7 @@ protected:
|
||||||
typedef CEditFindReplaceImpl<T, TFindReplaceDialog> thisClass;
|
typedef CEditFindReplaceImpl<T, TFindReplaceDialog> thisClass;
|
||||||
typedef CEditFindReplaceImplBase<T, TFindReplaceDialog> baseClass;
|
typedef CEditFindReplaceImplBase<T, TFindReplaceDialog> baseClass;
|
||||||
|
|
||||||
// Data members
|
|
||||||
LPTSTR m_pShadowBuffer; // Special shadow buffer only used in some cases.
|
|
||||||
UINT m_nShadowSize;
|
|
||||||
int m_bShadowBufferNeeded; // TRUE, FALSE, < 0 => Need to check
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructors
|
|
||||||
CEditFindReplaceImpl() :
|
|
||||||
m_pShadowBuffer(NULL),
|
|
||||||
m_nShadowSize(0),
|
|
||||||
m_bShadowBufferNeeded(-1)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~CEditFindReplaceImpl()
|
|
||||||
{
|
|
||||||
if(m_pShadowBuffer != NULL)
|
|
||||||
{
|
|
||||||
delete [] m_pShadowBuffer;
|
|
||||||
m_pShadowBuffer = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Message Handlers
|
// Message Handlers
|
||||||
BEGIN_MSG_MAP(thisClass)
|
BEGIN_MSG_MAP(thisClass)
|
||||||
ALT_MSG_MAP(1)
|
ALT_MSG_MAP(1)
|
||||||
|
@ -573,14 +530,14 @@ public:
|
||||||
int iDir = bFindDown ? +1 : -1;
|
int iDir = bFindDown ? +1 : -1;
|
||||||
|
|
||||||
// can't find a match before the first character
|
// can't find a match before the first character
|
||||||
if(nStart == 0 && iDir < 0)
|
if((nStart == 0) && (iDir < 0))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
LPCTSTR lpszText = pT->LockBuffer();
|
LPCTSTR lpszText = pT->LockBuffer();
|
||||||
|
|
||||||
bool isDBCS = false;
|
bool isDBCS = false;
|
||||||
#ifdef _MBCS
|
#ifdef _MBCS
|
||||||
CPINFO info = { 0 };
|
CPINFO info = {};
|
||||||
::GetCPInfo(::GetOEMCP(), &info);
|
::GetCPInfo(::GetOEMCP(), &info);
|
||||||
isDBCS = (info.MaxCharSize > 1);
|
isDBCS = (info.MaxCharSize > 1);
|
||||||
#endif
|
#endif
|
||||||
|
@ -590,7 +547,7 @@ public:
|
||||||
// always go back one for search backwards
|
// always go back one for search backwards
|
||||||
nStart -= int((lpszText + nStart) - ::CharPrev(lpszText, lpszText + nStart));
|
nStart -= int((lpszText + nStart) - ::CharPrev(lpszText, lpszText + nStart));
|
||||||
}
|
}
|
||||||
else if(nStartChar != nEndChar && pT->SameAsSelected(lpszFind, bMatchCase, bWholeWord))
|
else if((nStartChar != nEndChar) && (pT->SameAsSelected(lpszFind, bMatchCase, bWholeWord)))
|
||||||
{
|
{
|
||||||
// easy to go backward/forward with SBCS
|
// easy to go backward/forward with SBCS
|
||||||
#ifndef _UNICODE
|
#ifndef _UNICODE
|
||||||
|
@ -602,9 +559,9 @@ public:
|
||||||
|
|
||||||
// handle search with nStart past end of buffer
|
// handle search with nStart past end of buffer
|
||||||
UINT nLenFind = ::lstrlen(lpszFind);
|
UINT nLenFind = ::lstrlen(lpszFind);
|
||||||
if(nStart + nLenFind - 1 >= nLen)
|
if((nStart + nLenFind - 1) >= nLen)
|
||||||
{
|
{
|
||||||
if(iDir < 0 && nLen >= nLenFind)
|
if((iDir < 0) && (nLen >= nLenFind))
|
||||||
{
|
{
|
||||||
if(isDBCS)
|
if(isDBCS)
|
||||||
{
|
{
|
||||||
|
@ -621,7 +578,7 @@ public:
|
||||||
// single-byte character set is easy and fast
|
// single-byte character set is easy and fast
|
||||||
nStart = nLen - nLenFind;
|
nStart = nLen - nLenFind;
|
||||||
}
|
}
|
||||||
ATLASSERT(nStart + nLenFind - 1 <= nLen);
|
ATLASSERT((nStart + nLenFind - 1) <= nLen);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -655,9 +612,9 @@ public:
|
||||||
while(lpsz <= lpszStop)
|
while(lpsz <= lpszStop)
|
||||||
{
|
{
|
||||||
#ifndef _UNICODE
|
#ifndef _UNICODE
|
||||||
if(!bMatchCase || (*lpsz == *lpszFind && (!::IsDBCSLeadByte(*lpsz) || lpsz[1] == lpszFind[1])))
|
if(!bMatchCase || ((*lpsz == *lpszFind) && (!::IsDBCSLeadByte(*lpsz) || (lpsz[1] == lpszFind[1]))))
|
||||||
#else
|
#else
|
||||||
if(!bMatchCase || (*lpsz == *lpszFind && lpsz[1] == lpszFind[1]))
|
if(!bMatchCase || ((*lpsz == *lpszFind) && (lpsz[1] == lpszFind[1])))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
LPTSTR lpch = (LPTSTR)(lpsz + nLenFind);
|
LPTSTR lpch = (LPTSTR)(lpsz + nLenFind);
|
||||||
|
@ -686,7 +643,7 @@ public:
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// single-byte string search
|
// single-byte string search
|
||||||
UINT nCompare;
|
UINT nCompare = 0;
|
||||||
if(iDir < 0)
|
if(iDir < 0)
|
||||||
nCompare = (UINT)(lpsz - lpszText) + 1;
|
nCompare = (UINT)(lpsz - lpszText) + 1;
|
||||||
else
|
else
|
||||||
|
@ -695,7 +652,7 @@ public:
|
||||||
while(nCompare > 0)
|
while(nCompare > 0)
|
||||||
{
|
{
|
||||||
ATLASSERT(lpsz >= lpszText);
|
ATLASSERT(lpsz >= lpszText);
|
||||||
ATLASSERT(lpsz + nLenFind - 1 <= lpszText + nLen - 1);
|
ATLASSERT((lpsz + nLenFind - 1) <= (lpszText + nLen - 1));
|
||||||
|
|
||||||
LPSTR lpch = (LPSTR)(lpsz + nLenFind);
|
LPSTR lpch = (LPSTR)(lpsz + nLenFind);
|
||||||
char chSave = *lpch;
|
char chSave = *lpch;
|
||||||
|
@ -726,35 +683,20 @@ public:
|
||||||
LPCTSTR LockBuffer() const
|
LPCTSTR LockBuffer() const
|
||||||
{
|
{
|
||||||
const T* pT = static_cast<const T*>(this);
|
const T* pT = static_cast<const T*>(this);
|
||||||
|
|
||||||
ATLASSERT(pT->m_hWnd != NULL);
|
ATLASSERT(pT->m_hWnd != NULL);
|
||||||
|
|
||||||
BOOL useShadowBuffer = pT->UseShadowBuffer();
|
#ifndef _UNICODE
|
||||||
if(useShadowBuffer)
|
// If common controls version 6 is in use (such as via theming), then EM_GETHANDLE
|
||||||
|
// will always return a UNICODE string. You're really not supposed to superclass
|
||||||
|
// or subclass common controls with an ANSI windows procedure.
|
||||||
|
DWORD dwMajor = 0, dwMinor = 0;
|
||||||
|
HRESULT hRet = ATL::AtlGetCommCtrlVersion(&dwMajor, &dwMinor);
|
||||||
|
if(SUCCEEDED(hRet) && (dwMajor >= 6))
|
||||||
{
|
{
|
||||||
if(m_pShadowBuffer == NULL || pT->GetModify())
|
ATLTRACE2(atlTraceUI, 0, _T("AtlFind Warning: You have compiled for MBCS/ANSI but are using common controls version 6 or later which are always Unicode.\r\n"));
|
||||||
{
|
ATLASSERT(FALSE);
|
||||||
ATLASSERT(m_pShadowBuffer != NULL || m_nShadowSize == 0);
|
|
||||||
UINT nSize = pT->GetWindowTextLength() + 1;
|
|
||||||
if(nSize > m_nShadowSize)
|
|
||||||
{
|
|
||||||
// need more room for shadow buffer
|
|
||||||
T* pThisNoConst = const_cast<T*>(pT);
|
|
||||||
delete[] m_pShadowBuffer;
|
|
||||||
pThisNoConst->m_pShadowBuffer = NULL;
|
|
||||||
pThisNoConst->m_nShadowSize = 0;
|
|
||||||
pThisNoConst->m_pShadowBuffer = new TCHAR[nSize];
|
|
||||||
pThisNoConst->m_nShadowSize = nSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
// update the shadow buffer with GetWindowText
|
|
||||||
ATLASSERT(m_nShadowSize >= nSize);
|
|
||||||
ATLASSERT(m_pShadowBuffer != NULL);
|
|
||||||
pT->GetWindowText(m_pShadowBuffer, nSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
return m_pShadowBuffer;
|
|
||||||
}
|
}
|
||||||
|
#endif // !_UNICODE
|
||||||
|
|
||||||
HLOCAL hLocal = pT->GetHandle();
|
HLOCAL hLocal = pT->GetHandle();
|
||||||
ATLASSERT(hLocal != NULL);
|
ATLASSERT(hLocal != NULL);
|
||||||
|
@ -767,23 +709,18 @@ public:
|
||||||
void UnlockBuffer() const
|
void UnlockBuffer() const
|
||||||
{
|
{
|
||||||
const T* pT = static_cast<const T*>(this);
|
const T* pT = static_cast<const T*>(this);
|
||||||
|
|
||||||
ATLASSERT(pT->m_hWnd != NULL);
|
ATLASSERT(pT->m_hWnd != NULL);
|
||||||
|
|
||||||
BOOL useShadowBuffer = pT->UseShadowBuffer();
|
HLOCAL hLocal = pT->GetHandle();
|
||||||
if(!useShadowBuffer)
|
ATLASSERT(hLocal != NULL);
|
||||||
{
|
::LocalUnlock(hLocal);
|
||||||
HLOCAL hLocal = pT->GetHandle();
|
|
||||||
ATLASSERT(hLocal != NULL);
|
|
||||||
::LocalUnlock(hLocal);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT GetBufferLength() const
|
UINT GetBufferLength() const
|
||||||
{
|
{
|
||||||
const T* pT = static_cast<const T*>(this);
|
const T* pT = static_cast<const T*>(this);
|
||||||
|
|
||||||
ATLASSERT(pT->m_hWnd != NULL);
|
ATLASSERT(pT->m_hWnd != NULL);
|
||||||
|
|
||||||
UINT nLen = 0;
|
UINT nLen = 0;
|
||||||
LPCTSTR lpszText = pT->LockBuffer();
|
LPCTSTR lpszText = pT->LockBuffer();
|
||||||
if(lpszText != NULL)
|
if(lpszText != NULL)
|
||||||
|
@ -797,12 +734,12 @@ public:
|
||||||
{
|
{
|
||||||
LPCTSTR lpsz = lpszText + nIndex;
|
LPCTSTR lpsz = lpszText + nIndex;
|
||||||
LPCTSTR lpszStop = lpszText + nLen;
|
LPCTSTR lpszStop = lpszText + nLen;
|
||||||
while(lpsz < lpszStop && *lpsz != _T('\r'))
|
while((lpsz < lpszStop) && (*lpsz != _T('\r')))
|
||||||
++lpsz;
|
++lpsz;
|
||||||
return LONG(lpsz - lpszText);
|
return LONG(lpsz - lpszText);
|
||||||
}
|
}
|
||||||
|
|
||||||
LONG GetSelText(_CSTRING_NS::CString& strText) const
|
LONG GetSelText(ATL::CString& strText) const
|
||||||
{
|
{
|
||||||
const T* pT = static_cast<const T*>(this);
|
const T* pT = static_cast<const T*>(this);
|
||||||
|
|
||||||
|
@ -811,90 +748,12 @@ public:
|
||||||
ATLASSERT((UINT)nEndChar <= pT->GetBufferLength());
|
ATLASSERT((UINT)nEndChar <= pT->GetBufferLength());
|
||||||
LPCTSTR lpszText = pT->LockBuffer();
|
LPCTSTR lpszText = pT->LockBuffer();
|
||||||
LONG nLen = pT->EndOfLine(lpszText, nEndChar, nStartChar) - nStartChar;
|
LONG nLen = pT->EndOfLine(lpszText, nEndChar, nStartChar) - nStartChar;
|
||||||
SecureHelper::memcpy_x(strText.GetBuffer(nLen), nLen * sizeof(TCHAR), lpszText + nStartChar, nLen * sizeof(TCHAR));
|
ATL::Checked::memcpy_s(strText.GetBuffer(nLen), nLen * sizeof(TCHAR), lpszText + nStartChar, nLen * sizeof(TCHAR));
|
||||||
strText.ReleaseBuffer(nLen);
|
strText.ReleaseBuffer(nLen);
|
||||||
pT->UnlockBuffer();
|
pT->UnlockBuffer();
|
||||||
|
|
||||||
return nLen;
|
return nLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL UseShadowBuffer(void) const
|
|
||||||
{
|
|
||||||
const T* pT = static_cast<const T*>(this);
|
|
||||||
|
|
||||||
if(pT->m_bShadowBufferNeeded < 0)
|
|
||||||
{
|
|
||||||
T* pThisNoConst = const_cast<T*>(pT);
|
|
||||||
|
|
||||||
OSVERSIONINFO ovi = { 0 };
|
|
||||||
ovi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
|
||||||
::GetVersionEx(&ovi);
|
|
||||||
|
|
||||||
bool bWin9x = (ovi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS);
|
|
||||||
if(bWin9x)
|
|
||||||
{
|
|
||||||
// Windows 95, 98, ME
|
|
||||||
// Under Win9x, it is necessary to maintain a shadow buffer.
|
|
||||||
// It is only updated when the control contents have been changed.
|
|
||||||
pThisNoConst->m_bShadowBufferNeeded = TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Windows NT, 2000, XP, etc.
|
|
||||||
pThisNoConst->m_bShadowBufferNeeded = FALSE;
|
|
||||||
|
|
||||||
#ifndef _UNICODE
|
|
||||||
// On Windows XP (or later), if common controls version 6 is in use
|
|
||||||
// (such as via theming), then EM_GETHANDLE will always return a UNICODE string.
|
|
||||||
// If theming is enabled and Common Controls version 6 is in use,
|
|
||||||
// you're really not suppose to superclass or subclass common controls
|
|
||||||
// with an ANSI windows procedure (so its best to only theme if you use UNICODE).
|
|
||||||
// Using a shadow buffer uses GetWindowText instead, so it solves
|
|
||||||
// this problem for us (although it makes it a little less efficient).
|
|
||||||
|
|
||||||
if((ovi.dwMajorVersion == 5 && ovi.dwMinorVersion >= 1) || (ovi.dwMajorVersion > 5))
|
|
||||||
{
|
|
||||||
// We use DLLVERSIONINFO_private so we don't have to depend on shlwapi.h
|
|
||||||
typedef struct _DLLVERSIONINFO_private
|
|
||||||
{
|
|
||||||
DWORD cbSize;
|
|
||||||
DWORD dwMajorVersion;
|
|
||||||
DWORD dwMinorVersion;
|
|
||||||
DWORD dwBuildNumber;
|
|
||||||
DWORD dwPlatformID;
|
|
||||||
} DLLVERSIONINFO_private;
|
|
||||||
|
|
||||||
HMODULE hModule = ::LoadLibrary("comctl32.dll");
|
|
||||||
if(hModule != NULL)
|
|
||||||
{
|
|
||||||
typedef HRESULT (CALLBACK *LPFN_DllGetVersion)(DLLVERSIONINFO_private *);
|
|
||||||
LPFN_DllGetVersion fnDllGetVersion = (LPFN_DllGetVersion)::GetProcAddress(hModule, "DllGetVersion");
|
|
||||||
if(fnDllGetVersion != NULL)
|
|
||||||
{
|
|
||||||
DLLVERSIONINFO_private version = { 0 };
|
|
||||||
version.cbSize = sizeof(DLLVERSIONINFO_private);
|
|
||||||
if(SUCCEEDED(fnDllGetVersion(&version)))
|
|
||||||
{
|
|
||||||
if(version.dwMajorVersion >= 6)
|
|
||||||
{
|
|
||||||
pThisNoConst->m_bShadowBufferNeeded = TRUE;
|
|
||||||
|
|
||||||
ATLTRACE2(atlTraceUI, 0, _T("Warning: You have compiled for MBCS/ANSI but are using common controls version 6 or later (likely through a manifest file).\r\n"));
|
|
||||||
ATLTRACE2(atlTraceUI, 0, _T("If you use common controls version 6 or later, you should only do so for UNICODE builds.\r\n"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
::FreeLibrary(hModule);
|
|
||||||
hModule = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif // !_UNICODE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (pT->m_bShadowBufferNeeded != FALSE);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -934,24 +793,19 @@ public:
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
|
|
||||||
ATLASSERT(lpszFind != NULL);
|
ATLASSERT(lpszFind != NULL);
|
||||||
FINDTEXTEX ft = { 0 };
|
FINDTEXTEX ft = {};
|
||||||
|
|
||||||
pT->GetSel(ft.chrg);
|
pT->GetSel(ft.chrg);
|
||||||
if(m_bFirstSearch)
|
if(this->m_bFirstSearch)
|
||||||
{
|
{
|
||||||
if(bFindDown)
|
if(bFindDown)
|
||||||
m_nInitialSearchPos = ft.chrg.cpMin;
|
this->m_nInitialSearchPos = ft.chrg.cpMin;
|
||||||
else
|
else
|
||||||
m_nInitialSearchPos = ft.chrg.cpMax;
|
this->m_nInitialSearchPos = ft.chrg.cpMax;
|
||||||
m_bFirstSearch = FALSE;
|
this->m_bFirstSearch = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (_RICHEDIT_VER >= 0x0200)
|
|
||||||
ft.lpstrText = (LPTSTR)lpszFind;
|
ft.lpstrText = (LPTSTR)lpszFind;
|
||||||
#else // !(_RICHEDIT_VER >= 0x0200)
|
|
||||||
USES_CONVERSION;
|
|
||||||
ft.lpstrText = T2A((LPTSTR)lpszFind);
|
|
||||||
#endif // !(_RICHEDIT_VER >= 0x0200)
|
|
||||||
|
|
||||||
if(ft.chrg.cpMin != ft.chrg.cpMax) // i.e. there is a selection
|
if(ft.chrg.cpMin != ft.chrg.cpMax) // i.e. there is a selection
|
||||||
{
|
{
|
||||||
|
@ -962,18 +816,18 @@ public:
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// won't wraparound backwards
|
// won't wraparound backwards
|
||||||
ft.chrg.cpMin = max(ft.chrg.cpMin, 0);
|
ft.chrg.cpMin = __max(ft.chrg.cpMin, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD dwFlags = bMatchCase ? FR_MATCHCASE : 0;
|
DWORD dwFlags = bMatchCase ? FR_MATCHCASE : 0;
|
||||||
dwFlags |= bWholeWord ? FR_WHOLEWORD : 0;
|
dwFlags |= bWholeWord ? FR_WHOLEWORD : 0;
|
||||||
|
|
||||||
ft.chrg.cpMax = pT->GetTextLength() + m_nInitialSearchPos;
|
ft.chrg.cpMax = pT->GetTextLength() + this->m_nInitialSearchPos;
|
||||||
|
|
||||||
if(bFindDown)
|
if(bFindDown)
|
||||||
{
|
{
|
||||||
if(m_nInitialSearchPos >= 0)
|
if(this->m_nInitialSearchPos >= 0)
|
||||||
ft.chrg.cpMax = pT->GetTextLength();
|
ft.chrg.cpMax = pT->GetTextLength();
|
||||||
|
|
||||||
dwFlags |= FR_DOWN;
|
dwFlags |= FR_DOWN;
|
||||||
|
@ -981,7 +835,7 @@ public:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(m_nInitialSearchPos >= 0)
|
if(this->m_nInitialSearchPos >= 0)
|
||||||
ft.chrg.cpMax = 0;
|
ft.chrg.cpMax = 0;
|
||||||
|
|
||||||
dwFlags &= ~FR_DOWN;
|
dwFlags &= ~FR_DOWN;
|
||||||
|
@ -989,26 +843,25 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL bRet = FALSE;
|
BOOL bRet = FALSE;
|
||||||
|
|
||||||
if(pT->FindAndSelect(dwFlags, ft) != -1)
|
if(pT->FindAndSelect(dwFlags, ft) != -1)
|
||||||
{
|
{
|
||||||
bRet = TRUE; // we found the text
|
bRet = TRUE; // we found the text
|
||||||
}
|
}
|
||||||
else if(m_nInitialSearchPos > 0)
|
else if(this->m_nInitialSearchPos > 0)
|
||||||
{
|
{
|
||||||
// if the original starting point was not the beginning
|
// if the original starting point was not the beginning
|
||||||
// of the buffer and we haven't already been here
|
// of the buffer and we haven't already been here
|
||||||
if(bFindDown)
|
if(bFindDown)
|
||||||
{
|
{
|
||||||
ft.chrg.cpMin = 0;
|
ft.chrg.cpMin = 0;
|
||||||
ft.chrg.cpMax = m_nInitialSearchPos;
|
ft.chrg.cpMax = this->m_nInitialSearchPos;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ft.chrg.cpMin = pT->GetTextLength();
|
ft.chrg.cpMin = pT->GetTextLength();
|
||||||
ft.chrg.cpMax = m_nInitialSearchPos;
|
ft.chrg.cpMax = this->m_nInitialSearchPos;
|
||||||
}
|
}
|
||||||
m_nInitialSearchPos = m_nInitialSearchPos - pT->GetTextLength();
|
this->m_nInitialSearchPos = this->m_nInitialSearchPos - pT->GetTextLength();
|
||||||
|
|
||||||
bRet = (pT->FindAndSelect(dwFlags, ft) != -1) ? TRUE : FALSE;
|
bRet = (pT->FindAndSelect(dwFlags, ft) != -1) ? TRUE : FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1027,6 +880,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}; // namespace WTL
|
} // namespace WTL
|
||||||
|
|
||||||
#endif // __ATLFIND_H__
|
#endif // __ATLFIND_H__
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,23 +1,16 @@
|
||||||
// Windows Template Library - WTL version 8.1
|
// Windows Template Library - WTL version 10.0
|
||||||
// Copyright (C) Microsoft Corporation. All rights reserved.
|
// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved.
|
||||||
//
|
//
|
||||||
// This file is a part of the Windows Template Library.
|
// This file is a part of the Windows Template Library.
|
||||||
// The use and distribution terms for this software are covered by the
|
// The use and distribution terms for this software are covered by the
|
||||||
// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php)
|
// Microsoft Public License (http://opensource.org/licenses/MS-PL)
|
||||||
// which can be found in the file CPL.TXT at the root of this distribution.
|
// which can be found in the file MS-PL.txt at the root folder.
|
||||||
// By using this software in any fashion, you are agreeing to be bound by
|
|
||||||
// the terms of this license. You must not remove this notice, or
|
|
||||||
// any other, from this software.
|
|
||||||
|
|
||||||
#ifndef __ATLPRINT_H__
|
#ifndef __ATLPRINT_H__
|
||||||
#define __ATLPRINT_H__
|
#define __ATLPRINT_H__
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifdef _WIN32_WCE
|
|
||||||
#error atlprint.h is not supported on Windows CE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __ATLAPP_H__
|
#ifndef __ATLAPP_H__
|
||||||
#error atlprint.h requires atlapp.h to be included first
|
#error atlprint.h requires atlapp.h to be included first
|
||||||
#endif
|
#endif
|
||||||
|
@ -26,6 +19,8 @@
|
||||||
#error atlprint.h requires atlwin.h to be included first
|
#error atlprint.h requires atlwin.h to be included first
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <winspool.h>
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Classes in this file:
|
// Classes in this file:
|
||||||
|
@ -63,11 +58,8 @@ template <> class _printer_info<4> { public: typedef PRINTER_INFO_4 infotype; };
|
||||||
template <> class _printer_info<5> { public: typedef PRINTER_INFO_5 infotype; };
|
template <> class _printer_info<5> { public: typedef PRINTER_INFO_5 infotype; };
|
||||||
template <> class _printer_info<6> { public: typedef PRINTER_INFO_6 infotype; };
|
template <> class _printer_info<6> { public: typedef PRINTER_INFO_6 infotype; };
|
||||||
template <> class _printer_info<7> { public: typedef PRINTER_INFO_7 infotype; };
|
template <> class _printer_info<7> { public: typedef PRINTER_INFO_7 infotype; };
|
||||||
// these are not in the old (vc6.0) headers
|
|
||||||
#ifdef _ATL_USE_NEW_PRINTER_INFO
|
|
||||||
template <> class _printer_info<8> { public: typedef PRINTER_INFO_8 infotype; };
|
template <> class _printer_info<8> { public: typedef PRINTER_INFO_8 infotype; };
|
||||||
template <> class _printer_info<9> { public: typedef PRINTER_INFO_9 infotype; };
|
template <> class _printer_info<9> { public: typedef PRINTER_INFO_9 infotype; };
|
||||||
#endif // _ATL_USE_NEW_PRINTER_INFO
|
|
||||||
|
|
||||||
|
|
||||||
template <unsigned int t_nInfo>
|
template <unsigned int t_nInfo>
|
||||||
|
@ -195,26 +187,18 @@ public:
|
||||||
bool OpenDefaultPrinter(const DEVMODE* pDevMode = NULL)
|
bool OpenDefaultPrinter(const DEVMODE* pDevMode = NULL)
|
||||||
{
|
{
|
||||||
ClosePrinter();
|
ClosePrinter();
|
||||||
const int cchBuff = 512;
|
|
||||||
TCHAR buffer[cchBuff];
|
DWORD cchBuff = 0;
|
||||||
buffer[0] = 0;
|
::GetDefaultPrinter(NULL, &cchBuff);
|
||||||
::GetProfileString(_T("windows"), _T("device"), _T(",,,"), buffer, cchBuff);
|
TCHAR* pszBuff = new TCHAR[cchBuff];
|
||||||
int nLen = lstrlen(buffer);
|
BOOL bRet = ::GetDefaultPrinter(pszBuff, &cchBuff);
|
||||||
if (nLen != 0)
|
if(bRet != FALSE)
|
||||||
{
|
{
|
||||||
LPTSTR lpsz = buffer;
|
|
||||||
while (*lpsz)
|
|
||||||
{
|
|
||||||
if (*lpsz == _T(','))
|
|
||||||
{
|
|
||||||
*lpsz = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
lpsz = CharNext(lpsz);
|
|
||||||
}
|
|
||||||
PRINTER_DEFAULTS pdefs = { NULL, (DEVMODE*)pDevMode, PRINTER_ACCESS_USE };
|
PRINTER_DEFAULTS pdefs = { NULL, (DEVMODE*)pDevMode, PRINTER_ACCESS_USE };
|
||||||
::OpenPrinter(buffer, &m_hPrinter, (pDevMode == NULL) ? NULL : &pdefs);
|
::OpenPrinter(pszBuff, &m_hPrinter, (pDevMode == NULL) ? NULL : &pdefs);
|
||||||
}
|
}
|
||||||
|
delete [] pszBuff;
|
||||||
|
|
||||||
return m_hPrinter != NULL;
|
return m_hPrinter != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,31 +221,43 @@ public:
|
||||||
|
|
||||||
HANDLE CopyToHDEVNAMES() const
|
HANDLE CopyToHDEVNAMES() const
|
||||||
{
|
{
|
||||||
HANDLE h = NULL;
|
HANDLE hDevNames = NULL;
|
||||||
CPrinterInfo<5> pinfon5;
|
CPrinterInfo<5> pinfon5;
|
||||||
CPrinterInfo<2> pinfon2;
|
CPrinterInfo<2> pinfon2;
|
||||||
LPTSTR lpszPrinterName = NULL;
|
LPTSTR lpszPrinterName = NULL;
|
||||||
|
LPTSTR lpszPortName = NULL;
|
||||||
// Some printers fail for PRINTER_INFO_5 in some situations
|
// Some printers fail for PRINTER_INFO_5 in some situations
|
||||||
if (pinfon5.GetPrinterInfo(m_hPrinter))
|
if(pinfon5.GetPrinterInfo(m_hPrinter))
|
||||||
lpszPrinterName = pinfon5.m_pi->pPrinterName;
|
|
||||||
else if (pinfon2.GetPrinterInfo(m_hPrinter))
|
|
||||||
lpszPrinterName = pinfon2.m_pi->pPrinterName;
|
|
||||||
if (lpszPrinterName != NULL)
|
|
||||||
{
|
{
|
||||||
int nLen = sizeof(DEVNAMES) + (lstrlen(lpszPrinterName) + 1) * sizeof(TCHAR);
|
lpszPrinterName = pinfon5.m_pi->pPrinterName;
|
||||||
h = ::GlobalAlloc(GMEM_MOVEABLE, nLen);
|
lpszPortName = pinfon5.m_pi->pPortName;
|
||||||
BYTE* pv = (BYTE*)::GlobalLock(h);
|
}
|
||||||
|
else if(pinfon2.GetPrinterInfo(m_hPrinter))
|
||||||
|
{
|
||||||
|
lpszPrinterName = pinfon2.m_pi->pPrinterName;
|
||||||
|
lpszPortName = pinfon2.m_pi->pPortName;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(lpszPrinterName != NULL)
|
||||||
|
{
|
||||||
|
int nLen = sizeof(DEVNAMES) + (lstrlen(lpszPrinterName) + 1 + lstrlen(lpszPortName) + 1) * sizeof(TCHAR);
|
||||||
|
hDevNames = ::GlobalAlloc(GMEM_MOVEABLE, nLen);
|
||||||
|
BYTE* pv = (BYTE*)::GlobalLock(hDevNames);
|
||||||
DEVNAMES* pdev = (DEVNAMES*)pv;
|
DEVNAMES* pdev = (DEVNAMES*)pv;
|
||||||
if (pv != NULL)
|
if(pv != NULL)
|
||||||
{
|
{
|
||||||
memset(pv, 0, nLen);
|
memset(pv, 0, nLen);
|
||||||
pdev->wDeviceOffset = sizeof(DEVNAMES) / sizeof(TCHAR);
|
pdev->wDeviceOffset = sizeof(DEVNAMES) / sizeof(TCHAR);
|
||||||
pv = pv + sizeof(DEVNAMES); // now points to end
|
pv = pv + sizeof(DEVNAMES); // now points to end
|
||||||
SecureHelper::strcpy_x((LPTSTR)pv, lstrlen(lpszPrinterName) + 1, lpszPrinterName);
|
ATL::Checked::tcscpy_s((LPTSTR)pv, lstrlen(lpszPrinterName) + 1, lpszPrinterName);
|
||||||
::GlobalUnlock(h);
|
pdev->wOutputOffset = (WORD)(sizeof(DEVNAMES) / sizeof(TCHAR) + lstrlen(lpszPrinterName) + 1);
|
||||||
|
pv = pv + (lstrlen(lpszPrinterName) + 1) * sizeof(TCHAR);
|
||||||
|
ATL::Checked::tcscpy_s((LPTSTR)pv, lstrlen(lpszPortName) + 1, lpszPortName);
|
||||||
|
::GlobalUnlock(hDevNames);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return h;
|
|
||||||
|
return hDevNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
HDC CreatePrinterDC(const DEVMODE* pdm = NULL) const
|
HDC CreatePrinterDC(const DEVMODE* pdm = NULL) const
|
||||||
|
@ -381,7 +377,7 @@ public:
|
||||||
if (h != NULL)
|
if (h != NULL)
|
||||||
{
|
{
|
||||||
void* p = ::GlobalLock(h);
|
void* p = ::GlobalLock(h);
|
||||||
SecureHelper::memcpy_x(p, nSize, pdm, nSize);
|
ATL::Checked::memcpy_s(p, nSize, pdm, nSize);
|
||||||
::GlobalUnlock(h);
|
::GlobalUnlock(h);
|
||||||
}
|
}
|
||||||
Attach(h);
|
Attach(h);
|
||||||
|
@ -409,7 +405,7 @@ public:
|
||||||
if (h != NULL)
|
if (h != NULL)
|
||||||
{
|
{
|
||||||
void* p = ::GlobalLock(h);
|
void* p = ::GlobalLock(h);
|
||||||
SecureHelper::memcpy_x(p, nSize, m_pDevMode, nSize);
|
ATL::Checked::memcpy_s(p, nSize, m_pDevMode, nSize);
|
||||||
::GlobalUnlock(h);
|
::GlobalUnlock(h);
|
||||||
}
|
}
|
||||||
return h;
|
return h;
|
||||||
|
@ -421,7 +417,7 @@ public:
|
||||||
{
|
{
|
||||||
bool bRet = false;
|
bool bRet = false;
|
||||||
LONG nLen = ::DocumentProperties(NULL, hPrinter, NULL, NULL, NULL, 0);
|
LONG nLen = ::DocumentProperties(NULL, hPrinter, NULL, NULL, NULL, 0);
|
||||||
CTempBuffer<DEVMODE, _WTL_STACK_ALLOC_THRESHOLD> buff;
|
ATL::CTempBuffer<DEVMODE, _WTL_STACK_ALLOC_THRESHOLD> buff;
|
||||||
DEVMODE* pdm = buff.AllocateBytes(nLen);
|
DEVMODE* pdm = buff.AllocateBytes(nLen);
|
||||||
if(pdm != NULL)
|
if(pdm != NULL)
|
||||||
{
|
{
|
||||||
|
@ -443,7 +439,7 @@ public:
|
||||||
|
|
||||||
bool bRet = false;
|
bool bRet = false;
|
||||||
LONG nLen = ::DocumentProperties(hWnd, hPrinter, pi.m_pi->pName, NULL, NULL, 0);
|
LONG nLen = ::DocumentProperties(hWnd, hPrinter, pi.m_pi->pName, NULL, NULL, 0);
|
||||||
CTempBuffer<DEVMODE, _WTL_STACK_ALLOC_THRESHOLD> buff;
|
ATL::CTempBuffer<DEVMODE, _WTL_STACK_ALLOC_THRESHOLD> buff;
|
||||||
DEVMODE* pdm = buff.AllocateBytes(nLen);
|
DEVMODE* pdm = buff.AllocateBytes(nLen);
|
||||||
if(pdm != NULL)
|
if(pdm != NULL)
|
||||||
{
|
{
|
||||||
|
@ -535,6 +531,9 @@ public:
|
||||||
class ATL_NO_VTABLE CPrintJobInfo : public IPrintJobInfo
|
class ATL_NO_VTABLE CPrintJobInfo : public IPrintJobInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
CPrintJobInfo() : m_nPJState(0)
|
||||||
|
{ }
|
||||||
|
|
||||||
virtual void BeginPrintJob(HDC /*hDC*/) // allocate handles needed, etc
|
virtual void BeginPrintJob(HDC /*hDC*/) // allocate handles needed, etc
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -585,8 +584,10 @@ public:
|
||||||
unsigned long m_nEndPage;
|
unsigned long m_nEndPage;
|
||||||
|
|
||||||
// Constructor/destructor
|
// Constructor/destructor
|
||||||
CPrintJob() : m_nJobID(0), m_bCancel(false), m_bComplete(true)
|
CPrintJob() : m_pInfo(NULL), m_pDefDevMode(NULL), m_nJobID(0), m_bCancel(false), m_bComplete(true), m_nStartPage(0), m_nEndPage(0)
|
||||||
{ }
|
{
|
||||||
|
memset(&m_docinfo, 0, sizeof(m_docinfo));
|
||||||
|
}
|
||||||
|
|
||||||
~CPrintJob()
|
~CPrintJob()
|
||||||
{
|
{
|
||||||
|
@ -629,7 +630,7 @@ public:
|
||||||
|
|
||||||
// Create a thread and return
|
// Create a thread and return
|
||||||
DWORD dwThreadID = 0;
|
DWORD dwThreadID = 0;
|
||||||
#if !defined(_ATL_MIN_CRT) && defined(_MT)
|
#ifdef _MT
|
||||||
HANDLE hThread = (HANDLE)_beginthreadex(NULL, 0, (UINT (WINAPI*)(void*))StartProc, this, 0, (UINT*)&dwThreadID);
|
HANDLE hThread = (HANDLE)_beginthreadex(NULL, 0, (UINT (WINAPI*)(void*))StartProc, this, 0, (UINT*)&dwThreadID);
|
||||||
#else
|
#else
|
||||||
HANDLE hThread = ::CreateThread(NULL, 0, StartProc, (void*)this, 0, &dwThreadID);
|
HANDLE hThread = ::CreateThread(NULL, 0, StartProc, (void*)this, 0, &dwThreadID);
|
||||||
|
@ -715,8 +716,11 @@ public:
|
||||||
DEVMODE* m_pCurDevMode;
|
DEVMODE* m_pCurDevMode;
|
||||||
SIZE m_sizeCurPhysOffset;
|
SIZE m_sizeCurPhysOffset;
|
||||||
|
|
||||||
|
// Implementation - data
|
||||||
|
int m_nCurPage;
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
CPrintPreview() : m_pInfo(NULL), m_pDefDevMode(NULL), m_pCurDevMode(NULL)
|
CPrintPreview() : m_pInfo(NULL), m_pDefDevMode(NULL), m_pCurDevMode(NULL), m_nCurPage(0)
|
||||||
{
|
{
|
||||||
m_sizeCurPhysOffset.cx = 0;
|
m_sizeCurPhysOffset.cx = 0;
|
||||||
m_sizeCurPhysOffset.cy = 0;
|
m_sizeCurPhysOffset.cy = 0;
|
||||||
|
@ -773,6 +777,11 @@ public:
|
||||||
|
|
||||||
CEnhMetaFileInfo emfinfo(m_meta);
|
CEnhMetaFileInfo emfinfo(m_meta);
|
||||||
ENHMETAHEADER* pmh = emfinfo.GetEnhMetaFileHeader();
|
ENHMETAHEADER* pmh = emfinfo.GetEnhMetaFileHeader();
|
||||||
|
if(pmh == NULL)
|
||||||
|
{
|
||||||
|
ATLASSERT(FALSE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Compute whether we are OK vertically or horizontally
|
// Compute whether we are OK vertically or horizontally
|
||||||
int x2 = pmh->szlDevice.cx;
|
int x2 = pmh->szlDevice.cx;
|
||||||
|
@ -806,15 +815,18 @@ public:
|
||||||
{
|
{
|
||||||
CEnhMetaFileInfo emfinfo(m_meta);
|
CEnhMetaFileInfo emfinfo(m_meta);
|
||||||
ENHMETAHEADER* pmh = emfinfo.GetEnhMetaFileHeader();
|
ENHMETAHEADER* pmh = emfinfo.GetEnhMetaFileHeader();
|
||||||
|
if(pmh == NULL)
|
||||||
|
{
|
||||||
|
ATLASSERT(FALSE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int nOffsetX = MulDiv(m_sizeCurPhysOffset.cx, rc.right-rc.left, pmh->szlDevice.cx);
|
int nOffsetX = MulDiv(m_sizeCurPhysOffset.cx, rc.right-rc.left, pmh->szlDevice.cx);
|
||||||
int nOffsetY = MulDiv(m_sizeCurPhysOffset.cy, rc.bottom-rc.top, pmh->szlDevice.cy);
|
int nOffsetY = MulDiv(m_sizeCurPhysOffset.cy, rc.bottom-rc.top, pmh->szlDevice.cy);
|
||||||
|
|
||||||
dc.OffsetWindowOrg(-nOffsetX, -nOffsetY);
|
dc.OffsetWindowOrg(-nOffsetX, -nOffsetY);
|
||||||
dc.PlayMetaFile(m_meta, &rc);
|
dc.PlayMetaFile(m_meta, &rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implementation - data
|
|
||||||
int m_nCurPage;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -825,12 +837,12 @@ template <class T, class TBase = ATL::CWindow, class TWinTraits = ATL::CControlW
|
||||||
class ATL_NO_VTABLE CPrintPreviewWindowImpl : public ATL::CWindowImpl<T, TBase, TWinTraits>, public CPrintPreview
|
class ATL_NO_VTABLE CPrintPreviewWindowImpl : public ATL::CWindowImpl<T, TBase, TWinTraits>, public CPrintPreview
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DECLARE_WND_CLASS_EX(NULL, CS_VREDRAW | CS_HREDRAW, -1)
|
DECLARE_WND_CLASS_EX2(NULL, T, CS_VREDRAW | CS_HREDRAW, -1)
|
||||||
|
|
||||||
enum { m_cxOffset = 10, m_cyOffset = 10 };
|
enum { m_cxOffset = 10, m_cyOffset = 10 };
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
CPrintPreviewWindowImpl() : m_nMaxPage(0), m_nMinPage(0)
|
CPrintPreviewWindowImpl() : m_nMinPage(0), m_nMaxPage(0)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
// Operations
|
// Operations
|
||||||
|
@ -847,7 +859,7 @@ public:
|
||||||
if (m_nCurPage == m_nMaxPage)
|
if (m_nCurPage == m_nMaxPage)
|
||||||
return false;
|
return false;
|
||||||
SetPage(m_nCurPage + 1);
|
SetPage(m_nCurPage + 1);
|
||||||
Invalidate();
|
this->Invalidate();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -858,7 +870,7 @@ public:
|
||||||
if (m_nCurPage == 0)
|
if (m_nCurPage == 0)
|
||||||
return false;
|
return false;
|
||||||
SetPage(m_nCurPage - 1);
|
SetPage(m_nCurPage - 1);
|
||||||
Invalidate();
|
this->Invalidate();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -877,7 +889,7 @@ public:
|
||||||
LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||||
{
|
{
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
RECT rc = { 0 };
|
RECT rc = {};
|
||||||
|
|
||||||
if(wParam != NULL)
|
if(wParam != NULL)
|
||||||
{
|
{
|
||||||
|
@ -886,7 +898,7 @@ public:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CPaintDC dc(m_hWnd);
|
CPaintDC dc(this->m_hWnd);
|
||||||
pT->DoPrePaint(dc.m_hDC, rc);
|
pT->DoPrePaint(dc.m_hDC, rc);
|
||||||
pT->DoPaint(dc.m_hDC, rc);
|
pT->DoPaint(dc.m_hDC, rc);
|
||||||
}
|
}
|
||||||
|
@ -897,11 +909,11 @@ public:
|
||||||
// Painting helper
|
// Painting helper
|
||||||
void DoPrePaint(CDCHandle dc, RECT& rc)
|
void DoPrePaint(CDCHandle dc, RECT& rc)
|
||||||
{
|
{
|
||||||
RECT rcClient = { 0 };
|
RECT rcClient = {};
|
||||||
GetClientRect(&rcClient);
|
this->GetClientRect(&rcClient);
|
||||||
RECT rcArea = rcClient;
|
RECT rcArea = rcClient;
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
pT; // avoid level 4 warning
|
(void)pT; // avoid level 4 warning
|
||||||
::InflateRect(&rcArea, -pT->m_cxOffset, -pT->m_cyOffset);
|
::InflateRect(&rcArea, -pT->m_cxOffset, -pT->m_cyOffset);
|
||||||
if (rcArea.left > rcArea.right)
|
if (rcArea.left > rcArea.right)
|
||||||
rcArea.right = rcArea.left;
|
rcArea.right = rcArea.left;
|
||||||
|
@ -944,7 +956,7 @@ public:
|
||||||
|
|
||||||
CZoomPrintPreviewWindowImpl()
|
CZoomPrintPreviewWindowImpl()
|
||||||
{
|
{
|
||||||
SetScrollExtendedStyle(SCRL_DISABLENOSCROLL);
|
this->SetScrollExtendedStyle(SCRL_DISABLENOSCROLL);
|
||||||
InitZoom();
|
InitZoom();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -952,9 +964,9 @@ public:
|
||||||
void InitZoom()
|
void InitZoom()
|
||||||
{
|
{
|
||||||
m_bSized = false;
|
m_bSized = false;
|
||||||
m_nZoomMode = ZOOMMODE_OFF;
|
this->m_nZoomMode = ZOOMMODE_OFF;
|
||||||
m_fZoomScaleMin = 1.0;
|
this->m_fZoomScaleMin = 1.0;
|
||||||
m_fZoomScale = 1.0;
|
this->m_fZoomScale = 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BEGIN_MSG_MAP(CZoomPrintPreviewWindowImpl)
|
BEGIN_MSG_MAP(CZoomPrintPreviewWindowImpl)
|
||||||
|
@ -962,9 +974,7 @@ public:
|
||||||
MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl< T >::OnVScroll)
|
MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl< T >::OnVScroll)
|
||||||
MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl< T >::OnHScroll)
|
MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl< T >::OnHScroll)
|
||||||
MESSAGE_HANDLER(WM_MOUSEWHEEL, CScrollImpl< T >::OnMouseWheel)
|
MESSAGE_HANDLER(WM_MOUSEWHEEL, CScrollImpl< T >::OnMouseWheel)
|
||||||
#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400))
|
MESSAGE_HANDLER(WM_MOUSEHWHEEL, CScrollImpl< T >::OnMouseHWheel)
|
||||||
MESSAGE_HANDLER(m_uMsgMouseWheel, CScrollImpl< T >::OnMouseWheel)
|
|
||||||
#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400))
|
|
||||||
MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl< T >::OnSettingChange)
|
MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl< T >::OnSettingChange)
|
||||||
MESSAGE_HANDLER(WM_LBUTTONDOWN, CZoomScrollImpl< T >::OnLButtonDown)
|
MESSAGE_HANDLER(WM_LBUTTONDOWN, CZoomScrollImpl< T >::OnLButtonDown)
|
||||||
MESSAGE_HANDLER(WM_MOUSEMOVE, CZoomScrollImpl< T >::OnMouseMove)
|
MESSAGE_HANDLER(WM_MOUSEMOVE, CZoomScrollImpl< T >::OnMouseMove)
|
||||||
|
@ -992,14 +1002,14 @@ public:
|
||||||
LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
SIZE sizeClient = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)};
|
SIZE sizeClient = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)};
|
||||||
POINT ptOffset = m_ptOffset;
|
POINT ptOffset = this->m_ptOffset;
|
||||||
SIZE sizeAll = m_sizeAll;
|
SIZE sizeAll = this->m_sizeAll;
|
||||||
SetScrollSize(sizeClient);
|
this->SetScrollSize(sizeClient);
|
||||||
if(sizeAll.cx > 0)
|
if(sizeAll.cx > 0)
|
||||||
ptOffset.x = ::MulDiv(ptOffset.x, m_sizeAll.cx, sizeAll.cx);
|
ptOffset.x = ::MulDiv(ptOffset.x, this->m_sizeAll.cx, sizeAll.cx);
|
||||||
if(sizeAll.cy > 0)
|
if(sizeAll.cy > 0)
|
||||||
ptOffset.y = ::MulDiv(ptOffset.y, m_sizeAll.cy, sizeAll.cy);
|
ptOffset.y = ::MulDiv(ptOffset.y, this->m_sizeAll.cy, sizeAll.cy);
|
||||||
SetScrollOffset(ptOffset);
|
this->SetScrollOffset(ptOffset);
|
||||||
CScrollImpl< T >::OnSize(uMsg, wParam, lParam, bHandled);
|
CScrollImpl< T >::OnSize(uMsg, wParam, lParam, bHandled);
|
||||||
if(!m_bSized)
|
if(!m_bSized)
|
||||||
{
|
{
|
||||||
|
@ -1019,7 +1029,7 @@ public:
|
||||||
LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||||
{
|
{
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
RECT rc = { 0 };
|
RECT rc = {};
|
||||||
|
|
||||||
if(wParam != NULL)
|
if(wParam != NULL)
|
||||||
{
|
{
|
||||||
|
@ -1027,11 +1037,11 @@ public:
|
||||||
int nMapModeSav = dc.GetMapMode();
|
int nMapModeSav = dc.GetMapMode();
|
||||||
dc.SetMapMode(MM_ANISOTROPIC);
|
dc.SetMapMode(MM_ANISOTROPIC);
|
||||||
SIZE szWindowExt = { 0, 0 };
|
SIZE szWindowExt = { 0, 0 };
|
||||||
dc.SetWindowExt(m_sizeLogAll, &szWindowExt);
|
dc.SetWindowExt(this->m_sizeLogAll, &szWindowExt);
|
||||||
SIZE szViewportExt = { 0, 0 };
|
SIZE szViewportExt = { 0, 0 };
|
||||||
dc.SetViewportExt(m_sizeAll, &szViewportExt);
|
dc.SetViewportExt(this->m_sizeAll, &szViewportExt);
|
||||||
POINT ptViewportOrg = { 0, 0 };
|
POINT ptViewportOrg = { 0, 0 };
|
||||||
dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y, &ptViewportOrg);
|
dc.SetViewportOrg(-this->m_ptOffset.x, -this->m_ptOffset.y, &ptViewportOrg);
|
||||||
|
|
||||||
pT->DoPrePaint(dc, rc);
|
pT->DoPrePaint(dc, rc);
|
||||||
pT->DoPaint(dc, rc);
|
pT->DoPaint(dc, rc);
|
||||||
|
@ -1060,17 +1070,17 @@ public:
|
||||||
|
|
||||||
void DoPrePaint(CDCHandle dc, RECT& rc)
|
void DoPrePaint(CDCHandle dc, RECT& rc)
|
||||||
{
|
{
|
||||||
RECT rcClient;
|
RECT rcClient = {};
|
||||||
GetClientRect(&rcClient);
|
this->GetClientRect(&rcClient);
|
||||||
RECT rcArea = rcClient;
|
RECT rcArea = rcClient;
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
pT; // avoid level 4 warning
|
(void)pT; // avoid level 4 warning
|
||||||
::InflateRect(&rcArea, -pT->m_cxOffset, -pT->m_cyOffset);
|
::InflateRect(&rcArea, -pT->m_cxOffset, -pT->m_cyOffset);
|
||||||
if (rcArea.left > rcArea.right)
|
if (rcArea.left > rcArea.right)
|
||||||
rcArea.right = rcArea.left;
|
rcArea.right = rcArea.left;
|
||||||
if (rcArea.top > rcArea.bottom)
|
if (rcArea.top > rcArea.bottom)
|
||||||
rcArea.bottom = rcArea.top;
|
rcArea.bottom = rcArea.top;
|
||||||
GetPageRect(rcArea, &rc);
|
this->GetPageRect(rcArea, &rc);
|
||||||
HBRUSH hbrOld = dc.SelectBrush(::GetSysColorBrush(COLOR_BTNSHADOW));
|
HBRUSH hbrOld = dc.SelectBrush(::GetSysColorBrush(COLOR_BTNSHADOW));
|
||||||
dc.PatBlt(rcClient.left, rcClient.top, rc.left - rcClient.left, rcClient.bottom - rcClient.top, PATCOPY);
|
dc.PatBlt(rcClient.left, rcClient.top, rc.left - rcClient.left, rcClient.bottom - rcClient.top, PATCOPY);
|
||||||
dc.PatBlt(rc.left, rcClient.top, rc.right - rc.left, rc.top - rcClient.top, PATCOPY);
|
dc.PatBlt(rc.left, rcClient.top, rc.right - rc.left, rc.top - rcClient.top, PATCOPY);
|
||||||
|
@ -1086,13 +1096,19 @@ public:
|
||||||
|
|
||||||
void DoPaint(CDCHandle dc, RECT& rc)
|
void DoPaint(CDCHandle dc, RECT& rc)
|
||||||
{
|
{
|
||||||
CEnhMetaFileInfo emfinfo(m_meta);
|
CEnhMetaFileInfo emfinfo(this->m_meta);
|
||||||
ENHMETAHEADER* pmh = emfinfo.GetEnhMetaFileHeader();
|
ENHMETAHEADER* pmh = emfinfo.GetEnhMetaFileHeader();
|
||||||
int nOffsetX = MulDiv(m_sizeCurPhysOffset.cx, rc.right-rc.left, pmh->szlDevice.cx);
|
if(pmh == NULL)
|
||||||
int nOffsetY = MulDiv(m_sizeCurPhysOffset.cy, rc.bottom-rc.top, pmh->szlDevice.cy);
|
{
|
||||||
|
ATLASSERT(FALSE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int nOffsetX = MulDiv(this->m_sizeCurPhysOffset.cx, rc.right-rc.left, pmh->szlDevice.cx);
|
||||||
|
int nOffsetY = MulDiv(this->m_sizeCurPhysOffset.cy, rc.bottom-rc.top, pmh->szlDevice.cy);
|
||||||
|
|
||||||
dc.OffsetWindowOrg(-nOffsetX, -nOffsetY);
|
dc.OffsetWindowOrg(-nOffsetX, -nOffsetY);
|
||||||
dc.PlayMetaFile(m_meta, &rc);
|
dc.PlayMetaFile(this->m_meta, &rc);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1104,6 +1120,6 @@ public:
|
||||||
|
|
||||||
#endif // __ATLSCRL_H__
|
#endif // __ATLSCRL_H__
|
||||||
|
|
||||||
}; // namespace WTL
|
} // namespace WTL
|
||||||
|
|
||||||
#endif // __ATLPRINT_H__
|
#endif // __ATLPRINT_H__
|
||||||
|
|
|
@ -1,46 +1,37 @@
|
||||||
// Windows Template Library - WTL version 8.1
|
// Windows Template Library - WTL version 10.0
|
||||||
// Copyright (C) Microsoft Corporation. All rights reserved.
|
// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved.
|
||||||
//
|
//
|
||||||
// This file is a part of the Windows Template Library.
|
// This file is a part of the Windows Template Library.
|
||||||
// The use and distribution terms for this software are covered by the
|
// The use and distribution terms for this software are covered by the
|
||||||
// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php)
|
// Microsoft Public License (http://opensource.org/licenses/MS-PL)
|
||||||
// which can be found in the file CPL.TXT at the root of this distribution.
|
// which can be found in the file MS-PL.txt at the root folder.
|
||||||
// By using this software in any fashion, you are agreeing to be bound by
|
|
||||||
// the terms of this license. You must not remove this notice, or
|
|
||||||
// any other, from this software.
|
|
||||||
|
|
||||||
#ifndef __ATLRES_H__
|
#ifndef __ATLRES_H__
|
||||||
#define __ATLRES_H__
|
#define __ATLRES_H__
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#if defined(_WIN32_WCE) && !defined(__ATLRESCE_H__)
|
|
||||||
#error Use atlresCE.h instead of atlres.h for Windows CE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef RC_INVOKED
|
#ifdef RC_INVOKED
|
||||||
#ifndef _INC_WINDOWS
|
#ifndef _INC_WINDOWS
|
||||||
|
|
||||||
#define _INC_WINDOWS
|
#define _INC_WINDOWS
|
||||||
|
|
||||||
#ifndef _WIN32_WCE
|
#define VS_VERSION_INFO 1
|
||||||
#define VS_VERSION_INFO 1
|
|
||||||
|
|
||||||
#ifdef APSTUDIO_INVOKED
|
#ifdef APSTUDIO_INVOKED
|
||||||
#define APSTUDIO_HIDDEN_SYMBOLS // Ignore following symbols
|
#define APSTUDIO_HIDDEN_SYMBOLS // Ignore following symbols
|
||||||
#endif // APSTUDIO_INVOKED
|
#endif // APSTUDIO_INVOKED
|
||||||
|
|
||||||
#ifndef WINVER
|
#ifndef WINVER
|
||||||
#define WINVER 0x0400 // default to Windows Version 4.0
|
#define WINVER 0x0500
|
||||||
#endif // !WINVER
|
#endif // !WINVER
|
||||||
|
|
||||||
#include <winresrc.h>
|
#include <winresrc.h>
|
||||||
|
|
||||||
// operation messages sent to DLGINIT
|
// operation messages sent to DLGINIT
|
||||||
#define LB_ADDSTRING (WM_USER+1)
|
#define LB_ADDSTRING (WM_USER+1)
|
||||||
#define CB_ADDSTRING (WM_USER+3)
|
#define CB_ADDSTRING (WM_USER+3)
|
||||||
#endif // !_WIN32_WCE
|
|
||||||
|
|
||||||
#ifdef APSTUDIO_INVOKED
|
#ifdef APSTUDIO_INVOKED
|
||||||
#undef APSTUDIO_HIDDEN_SYMBOLS
|
#undef APSTUDIO_HIDDEN_SYMBOLS
|
||||||
|
@ -150,6 +141,9 @@
|
||||||
#define ID_EDIT_SELECT_ALL 0xE12A
|
#define ID_EDIT_SELECT_ALL 0xE12A
|
||||||
#define ID_EDIT_UNDO 0xE12B
|
#define ID_EDIT_UNDO 0xE12B
|
||||||
#define ID_EDIT_REDO 0xE12C
|
#define ID_EDIT_REDO 0xE12C
|
||||||
|
#define ID_EDIT_DELETE ID_EDIT_CLEAR
|
||||||
|
#define ID_EDIT_FIND_NEXT ID_EDIT_REPEAT
|
||||||
|
#define ID_EDIT_FIND_PREVIOUS 0xE12D
|
||||||
|
|
||||||
// Window commands
|
// Window commands
|
||||||
#define ID_WINDOW_NEW 0xE130
|
#define ID_WINDOW_NEW 0xE130
|
||||||
|
@ -184,6 +178,8 @@
|
||||||
#define ID_NEXT_PANE 0xE150
|
#define ID_NEXT_PANE 0xE150
|
||||||
#define ID_PREV_PANE 0xE151
|
#define ID_PREV_PANE 0xE151
|
||||||
#define ID_PANE_CLOSE 0xE152
|
#define ID_PANE_CLOSE 0xE152
|
||||||
|
#define ID_PANE_NEXT ID_NEXT_PANE
|
||||||
|
#define ID_PANE_PREVIOUS ID_PREV_PANE
|
||||||
|
|
||||||
// Format
|
// Format
|
||||||
#define ID_FORMAT_FONT 0xE160
|
#define ID_FORMAT_FONT 0xE160
|
||||||
|
@ -217,7 +213,7 @@
|
||||||
#define ID_VIEW_TOOLBAR 0xE800
|
#define ID_VIEW_TOOLBAR 0xE800
|
||||||
#define ID_VIEW_STATUS_BAR 0xE801
|
#define ID_VIEW_STATUS_BAR 0xE801
|
||||||
#define ID_VIEW_REFRESH 0xE803
|
#define ID_VIEW_REFRESH 0xE803
|
||||||
#define ID_VIEW_RIBBON 0xE804 // Ribbon
|
#define ID_VIEW_RIBBON 0xE804
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Standard control IDs
|
// Standard control IDs
|
||||||
|
|
|
@ -1,93 +0,0 @@
|
||||||
// Windows Template Library - WTL version 8.1
|
|
||||||
// Copyright (C) Microsoft Corporation. All rights reserved.
|
|
||||||
//
|
|
||||||
// This file is a part of the Windows Template Library.
|
|
||||||
// The use and distribution terms for this software are covered by the
|
|
||||||
// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php)
|
|
||||||
// which can be found in the file CPL.TXT at the root of this distribution.
|
|
||||||
// By using this software in any fashion, you are agreeing to be bound by
|
|
||||||
// the terms of this license. You must not remove this notice, or
|
|
||||||
// any other, from this software.
|
|
||||||
|
|
||||||
#ifndef __ATLRESCE_H__
|
|
||||||
#define __ATLRESCE_H__
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
#error atlresCE.h is only for Windows CE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef RC_INVOKED
|
|
||||||
#ifndef _INC_WINDOWS
|
|
||||||
|
|
||||||
#define VS_VERSION_INFO 1
|
|
||||||
|
|
||||||
#ifdef APSTUDIO_INVOKED
|
|
||||||
#define APSTUDIO_HIDDEN_SYMBOLS // Ignore following symbols
|
|
||||||
#endif // APSTUDIO_INVOKED
|
|
||||||
|
|
||||||
#ifndef WINVER
|
|
||||||
#define WINVER 0x0400 // default to Windows Version 4.0
|
|
||||||
#endif // !WINVER
|
|
||||||
|
|
||||||
#if !defined(WCEOLE_ENABLE_DIALOGEX)
|
|
||||||
#define DIALOGEX DIALOG DISCARDABLE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <commctrl.h>
|
|
||||||
#define SHMENUBAR RCDATA
|
|
||||||
|
|
||||||
#if defined(SHELLSDK_MODULES_AYGSHELL)
|
|
||||||
#include <aygshell.h>
|
|
||||||
#else
|
|
||||||
#define NOMENU 0xFFFF
|
|
||||||
#define IDS_SHNEW 1
|
|
||||||
#define IDM_SHAREDNEW 10
|
|
||||||
#define IDM_SHAREDNEWDEFAULT 11
|
|
||||||
#endif
|
|
||||||
#ifndef I_IMAGENONE
|
|
||||||
#define I_IMAGENONE (-2)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
#endif // !_INC_WINDOWS
|
|
||||||
#endif // RC_INVOKED
|
|
||||||
|
|
||||||
#include "atlres.h"
|
|
||||||
|
|
||||||
#ifdef APSTUDIO_INVOKED
|
|
||||||
#undef APSTUDIO_HIDDEN_SYMBOLS
|
|
||||||
#endif // APSTUDIO_INVOKED
|
|
||||||
|
|
||||||
// Visual Studio dialog editor bug fix
|
|
||||||
#ifndef DS_FIXEDSYS
|
|
||||||
#define DS_FIXEDSYS 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define IDC_INFOSTATIC 0xFFFE // == IDC_STATIC -1
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Smartphone and PPC 2005 Resource IDs
|
|
||||||
|
|
||||||
// Command and associated string resource IDs
|
|
||||||
#define ID_MENU_OK 0xE790
|
|
||||||
#define ID_MENU_CANCEL 0xE791
|
|
||||||
#define ID_MENU 0xE792
|
|
||||||
#define ID_ACTION 0xE793
|
|
||||||
#define ID_VIEW_FULLSCREEN 0xE802
|
|
||||||
|
|
||||||
// MenuBar resource IDs
|
|
||||||
#define ATL_IDM_MENU_DONE 0xE701
|
|
||||||
#define ATL_IDM_MENU_CANCEL 0xE702
|
|
||||||
#define ATL_IDM_MENU_DONECANCEL 0xE703
|
|
||||||
|
|
||||||
// Default device MenuBar control ID and MenuBar resource ID
|
|
||||||
#define ATL_IDW_MENU_BAR 0xE802
|
|
||||||
|
|
||||||
// SmartPhone spinned controls ID offset for CSpinCtrl
|
|
||||||
#define ATL_IDW_SPIN_ID 9999
|
|
||||||
|
|
||||||
#endif // __ATLRESCE_H__
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,13 +1,10 @@
|
||||||
// Windows Template Library - WTL version 8.1
|
// Windows Template Library - WTL version 10.0
|
||||||
// Copyright (C) Microsoft Corporation. All rights reserved.
|
// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved.
|
||||||
//
|
//
|
||||||
// This file is a part of the Windows Template Library.
|
// This file is a part of the Windows Template Library.
|
||||||
// The use and distribution terms for this software are covered by the
|
// The use and distribution terms for this software are covered by the
|
||||||
// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php)
|
// Microsoft Public License (http://opensource.org/licenses/MS-PL)
|
||||||
// which can be found in the file CPL.TXT at the root of this distribution.
|
// which can be found in the file MS-PL.txt at the root folder.
|
||||||
// By using this software in any fashion, you are agreeing to be bound by
|
|
||||||
// the terms of this license. You must not remove this notice, or
|
|
||||||
// any other, from this software.
|
|
||||||
|
|
||||||
#ifndef __ATLSPLIT_H__
|
#ifndef __ATLSPLIT_H__
|
||||||
#define __ATLSPLIT_H__
|
#define __ATLSPLIT_H__
|
||||||
|
@ -26,9 +23,9 @@
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Classes in this file:
|
// Classes in this file:
|
||||||
//
|
//
|
||||||
// CSplitterImpl<T, t_bVertical>
|
// CSplitterImpl<T>
|
||||||
// CSplitterWindowImpl<T, t_bVertical, TBase, TWinTraits>
|
// CSplitterWindowImpl<T, TBase, TWinTraits>
|
||||||
// CSplitterWindowT<t_bVertical>
|
// CSplitterWindowT<t_bVertical> - CSplitterWindow, CHorSplitterWindow
|
||||||
|
|
||||||
|
|
||||||
namespace WTL
|
namespace WTL
|
||||||
|
@ -50,61 +47,52 @@ namespace WTL
|
||||||
#define SPLIT_RIGHTALIGNED 0x00000004
|
#define SPLIT_RIGHTALIGNED 0x00000004
|
||||||
#define SPLIT_BOTTOMALIGNED SPLIT_RIGHTALIGNED
|
#define SPLIT_BOTTOMALIGNED SPLIT_RIGHTALIGNED
|
||||||
#define SPLIT_GRADIENTBAR 0x00000008
|
#define SPLIT_GRADIENTBAR 0x00000008
|
||||||
|
#define SPLIT_FLATBAR 0x00000020
|
||||||
#define SPLIT_FIXEDBARSIZE 0x00000010
|
#define SPLIT_FIXEDBARSIZE 0x00000010
|
||||||
|
|
||||||
// Note: SPLIT_PROPORTIONAL and SPLIT_RIGHTALIGNED/SPLIT_BOTTOMALIGNED are
|
// Note: SPLIT_PROPORTIONAL and SPLIT_RIGHTALIGNED/SPLIT_BOTTOMALIGNED are
|
||||||
// mutually exclusive. If both are set, splitter defaults to SPLIT_PROPORTIONAL
|
// mutually exclusive. If both are set, splitter defaults to SPLIT_PROPORTIONAL.
|
||||||
|
// Also, SPLIT_FLATBAR overrides SPLIT_GRADIENTBAR if both are set.
|
||||||
|
|
||||||
|
|
||||||
template <class T, bool t_bVertical = true>
|
template <class T>
|
||||||
class CSplitterImpl
|
class CSplitterImpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum { m_nPanesCount = 2, m_nPropMax = 10000 };
|
enum { m_nPanesCount = 2, m_nPropMax = INT_MAX, m_cxyStep = 10 };
|
||||||
|
|
||||||
|
bool m_bVertical;
|
||||||
HWND m_hWndPane[m_nPanesCount];
|
HWND m_hWndPane[m_nPanesCount];
|
||||||
RECT m_rcSplitter;
|
RECT m_rcSplitter;
|
||||||
int m_xySplitterPos;
|
int m_xySplitterPos; // splitter bar position
|
||||||
|
int m_xySplitterPosNew; // internal - new position while moving
|
||||||
|
HWND m_hWndFocusSave;
|
||||||
int m_nDefActivePane;
|
int m_nDefActivePane;
|
||||||
int m_cxySplitBar; // splitter bar width/height
|
int m_cxySplitBar; // splitter bar width/height
|
||||||
static HCURSOR m_hCursor;
|
HCURSOR m_hCursor;
|
||||||
int m_cxyMin; // minimum pane size
|
int m_cxyMin; // minimum pane size
|
||||||
int m_cxyBarEdge; // splitter bar edge
|
int m_cxyBarEdge; // splitter bar edge
|
||||||
bool m_bFullDrag;
|
bool m_bFullDrag;
|
||||||
int m_cxyDragOffset;
|
int m_cxyDragOffset; // internal
|
||||||
int m_nProportionalPos;
|
int m_nProportionalPos;
|
||||||
bool m_bUpdateProportionalPos;
|
bool m_bUpdateProportionalPos;
|
||||||
DWORD m_dwExtendedStyle; // splitter specific extended styles
|
DWORD m_dwExtendedStyle; // splitter specific extended styles
|
||||||
int m_nSinglePane; // single pane mode
|
int m_nSinglePane; // single pane mode
|
||||||
|
int m_xySplitterDefPos; // default position
|
||||||
|
bool m_bProportionalDefPos; // porportinal def pos
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
CSplitterImpl() :
|
CSplitterImpl(bool bVertical = true) :
|
||||||
m_xySplitterPos(-1), m_nDefActivePane(SPLIT_PANE_NONE),
|
m_bVertical(bVertical), m_xySplitterPos(-1), m_xySplitterPosNew(-1), m_hWndFocusSave(NULL),
|
||||||
m_cxySplitBar(4), m_cxyMin(0), m_cxyBarEdge(0), m_bFullDrag(true),
|
m_nDefActivePane(SPLIT_PANE_NONE), m_cxySplitBar(4), m_hCursor(NULL), m_cxyMin(0), m_cxyBarEdge(0),
|
||||||
m_cxyDragOffset(0), m_nProportionalPos(0), m_bUpdateProportionalPos(true),
|
m_bFullDrag(true), m_cxyDragOffset(0), m_nProportionalPos(0), m_bUpdateProportionalPos(true),
|
||||||
m_dwExtendedStyle(SPLIT_PROPORTIONAL),
|
m_dwExtendedStyle(SPLIT_PROPORTIONAL), m_nSinglePane(SPLIT_PANE_NONE),
|
||||||
m_nSinglePane(SPLIT_PANE_NONE)
|
m_xySplitterDefPos(-1), m_bProportionalDefPos(false)
|
||||||
{
|
{
|
||||||
m_hWndPane[SPLIT_PANE_LEFT] = NULL;
|
m_hWndPane[SPLIT_PANE_LEFT] = NULL;
|
||||||
m_hWndPane[SPLIT_PANE_RIGHT] = NULL;
|
m_hWndPane[SPLIT_PANE_RIGHT] = NULL;
|
||||||
|
|
||||||
::SetRectEmpty(&m_rcSplitter);
|
::SetRectEmpty(&m_rcSplitter);
|
||||||
|
|
||||||
if(m_hCursor == NULL)
|
|
||||||
{
|
|
||||||
CStaticDataInitCriticalSectionLock lock;
|
|
||||||
if(FAILED(lock.Lock()))
|
|
||||||
{
|
|
||||||
ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CSplitterImpl::CSplitterImpl.\n"));
|
|
||||||
ATLASSERT(FALSE);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(m_hCursor == NULL)
|
|
||||||
m_hCursor = ::LoadCursor(NULL, t_bVertical ? IDC_SIZEWE : IDC_SIZENS);
|
|
||||||
|
|
||||||
lock.Unlock();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes
|
// Attributes
|
||||||
|
@ -137,17 +125,33 @@ public:
|
||||||
|
|
||||||
bool SetSplitterPos(int xyPos = -1, bool bUpdate = true)
|
bool SetSplitterPos(int xyPos = -1, bool bUpdate = true)
|
||||||
{
|
{
|
||||||
if(xyPos == -1) // -1 == middle
|
if(xyPos == -1) // -1 == default position
|
||||||
{
|
{
|
||||||
if(t_bVertical)
|
if(m_bProportionalDefPos)
|
||||||
xyPos = (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) / 2;
|
{
|
||||||
else
|
ATLASSERT((m_xySplitterDefPos >= 0) && (m_xySplitterDefPos <= m_nPropMax));
|
||||||
xyPos = (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge) / 2;
|
|
||||||
|
if(m_bVertical)
|
||||||
|
xyPos = ::MulDiv(m_xySplitterDefPos, m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge, m_nPropMax);
|
||||||
|
else
|
||||||
|
xyPos = ::MulDiv(m_xySplitterDefPos, m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge, m_nPropMax);
|
||||||
|
}
|
||||||
|
else if(m_xySplitterDefPos != -1)
|
||||||
|
{
|
||||||
|
xyPos = m_xySplitterDefPos;
|
||||||
|
}
|
||||||
|
else // not set, use middle position
|
||||||
|
{
|
||||||
|
if(m_bVertical)
|
||||||
|
xyPos = (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) / 2;
|
||||||
|
else
|
||||||
|
xyPos = (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge) / 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adjust if out of valid range
|
// Adjust if out of valid range
|
||||||
int cxyMax = 0;
|
int cxyMax = 0;
|
||||||
if(t_bVertical)
|
if(m_bVertical)
|
||||||
cxyMax = m_rcSplitter.right - m_rcSplitter.left;
|
cxyMax = m_rcSplitter.right - m_rcSplitter.left;
|
||||||
else
|
else
|
||||||
cxyMax = m_rcSplitter.bottom - m_rcSplitter.top;
|
cxyMax = m_rcSplitter.bottom - m_rcSplitter.top;
|
||||||
|
@ -179,9 +183,14 @@ public:
|
||||||
return bRet;
|
return bRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GetSplitterPos() const
|
||||||
|
{
|
||||||
|
return m_xySplitterPos;
|
||||||
|
}
|
||||||
|
|
||||||
void SetSplitterPosPct(int nPct, bool bUpdate = true)
|
void SetSplitterPosPct(int nPct, bool bUpdate = true)
|
||||||
{
|
{
|
||||||
ATLASSERT(nPct >= 0 && nPct <= 100);
|
ATLASSERT((nPct >= 0) && (nPct <= 100));
|
||||||
|
|
||||||
m_nProportionalPos = ::MulDiv(nPct, m_nPropMax, 100);
|
m_nProportionalPos = ::MulDiv(nPct, m_nPropMax, 100);
|
||||||
UpdateProportionalPos();
|
UpdateProportionalPos();
|
||||||
|
@ -190,20 +199,21 @@ public:
|
||||||
UpdateSplitterLayout();
|
UpdateSplitterLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetSplitterPos() const
|
int GetSplitterPosPct() const
|
||||||
{
|
{
|
||||||
return m_xySplitterPos;
|
int cxyTotal = m_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge);
|
||||||
|
return ((cxyTotal > 0) && (m_xySplitterPos >= 0)) ? ::MulDiv(m_xySplitterPos, 100, cxyTotal) : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SetSinglePaneMode(int nPane = SPLIT_PANE_NONE)
|
bool SetSinglePaneMode(int nPane = SPLIT_PANE_NONE)
|
||||||
{
|
{
|
||||||
ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT || nPane == SPLIT_PANE_NONE);
|
ATLASSERT((nPane == SPLIT_PANE_LEFT) || (nPane == SPLIT_PANE_RIGHT) || (nPane == SPLIT_PANE_NONE));
|
||||||
if(!(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT || nPane == SPLIT_PANE_NONE))
|
if(!((nPane == SPLIT_PANE_LEFT) || (nPane == SPLIT_PANE_RIGHT) || (nPane == SPLIT_PANE_NONE)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(nPane != SPLIT_PANE_NONE)
|
if(nPane != SPLIT_PANE_NONE)
|
||||||
{
|
{
|
||||||
if(!::IsWindowVisible(m_hWndPane[nPane]))
|
if(::IsWindowVisible(m_hWndPane[nPane]) == FALSE)
|
||||||
::ShowWindow(m_hWndPane[nPane], SW_SHOW);
|
::ShowWindow(m_hWndPane[nPane], SW_SHOW);
|
||||||
int nOtherPane = (nPane == SPLIT_PANE_LEFT) ? SPLIT_PANE_RIGHT : SPLIT_PANE_LEFT;
|
int nOtherPane = (nPane == SPLIT_PANE_LEFT) ? SPLIT_PANE_RIGHT : SPLIT_PANE_LEFT;
|
||||||
::ShowWindow(m_hWndPane[nOtherPane], SW_HIDE);
|
::ShowWindow(m_hWndPane[nOtherPane], SW_HIDE);
|
||||||
|
@ -218,6 +228,7 @@ public:
|
||||||
|
|
||||||
m_nSinglePane = nPane;
|
m_nSinglePane = nPane;
|
||||||
UpdateSplitterLayout();
|
UpdateSplitterLayout();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,55 +249,73 @@ public:
|
||||||
m_dwExtendedStyle = dwExtendedStyle;
|
m_dwExtendedStyle = dwExtendedStyle;
|
||||||
else
|
else
|
||||||
m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask);
|
m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask);
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
if(IsProportional() && IsRightAligned())
|
if(IsProportional() && IsRightAligned())
|
||||||
ATLTRACE2(atlTraceUI, 0, _T("CSplitterImpl::SetSplitterExtendedStyle - SPLIT_PROPORTIONAL and SPLIT_RIGHTALIGNED are mutually exclusive, defaulting to SPLIT_PROPORTIONAL.\n"));
|
ATLTRACE2(atlTraceUI, 0, _T("CSplitterImpl::SetSplitterExtendedStyle - SPLIT_PROPORTIONAL and SPLIT_RIGHTALIGNED are mutually exclusive, defaulting to SPLIT_PROPORTIONAL.\n"));
|
||||||
#endif // _DEBUG
|
#endif // _DEBUG
|
||||||
|
|
||||||
return dwPrevStyle;
|
return dwPrevStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetSplitterDefaultPos(int xyPos = -1)
|
||||||
|
{
|
||||||
|
m_xySplitterDefPos = xyPos;
|
||||||
|
m_bProportionalDefPos = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetSplitterDefaultPosPct(int nPct)
|
||||||
|
{
|
||||||
|
ATLASSERT((nPct >= 0) && (nPct <= 100));
|
||||||
|
|
||||||
|
m_xySplitterDefPos = ::MulDiv(nPct, m_nPropMax, 100);
|
||||||
|
m_bProportionalDefPos = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Splitter operations
|
// Splitter operations
|
||||||
void SetSplitterPanes(HWND hWndLeftTop, HWND hWndRightBottom, bool bUpdate = true)
|
void SetSplitterPanes(HWND hWndLeftTop, HWND hWndRightBottom, bool bUpdate = true)
|
||||||
{
|
{
|
||||||
m_hWndPane[SPLIT_PANE_LEFT] = hWndLeftTop;
|
m_hWndPane[SPLIT_PANE_LEFT] = hWndLeftTop;
|
||||||
m_hWndPane[SPLIT_PANE_RIGHT] = hWndRightBottom;
|
m_hWndPane[SPLIT_PANE_RIGHT] = hWndRightBottom;
|
||||||
ATLASSERT(m_hWndPane[SPLIT_PANE_LEFT] == NULL || m_hWndPane[SPLIT_PANE_RIGHT] == NULL || m_hWndPane[SPLIT_PANE_LEFT] != m_hWndPane[SPLIT_PANE_RIGHT]);
|
ATLASSERT((m_hWndPane[SPLIT_PANE_LEFT] == NULL) || (m_hWndPane[SPLIT_PANE_RIGHT] == NULL) || (m_hWndPane[SPLIT_PANE_LEFT] != m_hWndPane[SPLIT_PANE_RIGHT]));
|
||||||
if(bUpdate)
|
if(bUpdate)
|
||||||
UpdateSplitterLayout();
|
UpdateSplitterLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SetSplitterPane(int nPane, HWND hWnd, bool bUpdate = true)
|
bool SetSplitterPane(int nPane, HWND hWnd, bool bUpdate = true)
|
||||||
{
|
{
|
||||||
ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT);
|
ATLASSERT((nPane == SPLIT_PANE_LEFT) || (nPane == SPLIT_PANE_RIGHT));
|
||||||
|
if((nPane != SPLIT_PANE_LEFT) && (nPane != SPLIT_PANE_RIGHT))
|
||||||
if(nPane != SPLIT_PANE_LEFT && nPane != SPLIT_PANE_RIGHT)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_hWndPane[nPane] = hWnd;
|
m_hWndPane[nPane] = hWnd;
|
||||||
ATLASSERT(m_hWndPane[SPLIT_PANE_LEFT] == NULL || m_hWndPane[SPLIT_PANE_RIGHT] == NULL || m_hWndPane[SPLIT_PANE_LEFT] != m_hWndPane[SPLIT_PANE_RIGHT]);
|
ATLASSERT((m_hWndPane[SPLIT_PANE_LEFT] == NULL) || (m_hWndPane[SPLIT_PANE_RIGHT] == NULL) || (m_hWndPane[SPLIT_PANE_LEFT] != m_hWndPane[SPLIT_PANE_RIGHT]));
|
||||||
if(bUpdate)
|
if(bUpdate)
|
||||||
UpdateSplitterLayout();
|
UpdateSplitterLayout();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND GetSplitterPane(int nPane) const
|
HWND GetSplitterPane(int nPane) const
|
||||||
{
|
{
|
||||||
ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT);
|
ATLASSERT((nPane == SPLIT_PANE_LEFT) || (nPane == SPLIT_PANE_RIGHT));
|
||||||
|
if((nPane != SPLIT_PANE_LEFT) && (nPane != SPLIT_PANE_RIGHT))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if(nPane != SPLIT_PANE_LEFT && nPane != SPLIT_PANE_RIGHT)
|
|
||||||
return false;
|
|
||||||
return m_hWndPane[nPane];
|
return m_hWndPane[nPane];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SetActivePane(int nPane)
|
bool SetActivePane(int nPane)
|
||||||
{
|
{
|
||||||
ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT);
|
ATLASSERT((nPane == SPLIT_PANE_LEFT) || (nPane == SPLIT_PANE_RIGHT));
|
||||||
|
if((nPane != SPLIT_PANE_LEFT) && (nPane != SPLIT_PANE_RIGHT))
|
||||||
|
return false;
|
||||||
|
if((m_nSinglePane != SPLIT_PANE_NONE) && (nPane != m_nSinglePane))
|
||||||
|
return false;
|
||||||
|
|
||||||
if(nPane != SPLIT_PANE_LEFT && nPane != SPLIT_PANE_RIGHT)
|
|
||||||
return false;
|
|
||||||
if(m_nSinglePane != SPLIT_PANE_NONE && nPane != m_nSinglePane)
|
|
||||||
return false;
|
|
||||||
::SetFocus(m_hWndPane[nPane]);
|
::SetFocus(m_hWndPane[nPane]);
|
||||||
m_nDefActivePane = nPane;
|
m_nDefActivePane = nPane;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,13 +327,14 @@ public:
|
||||||
{
|
{
|
||||||
for(int nPane = 0; nPane < m_nPanesCount; nPane++)
|
for(int nPane = 0; nPane < m_nPanesCount; nPane++)
|
||||||
{
|
{
|
||||||
if(hWndFocus == m_hWndPane[nPane] || ::IsChild(m_hWndPane[nPane], hWndFocus))
|
if((hWndFocus == m_hWndPane[nPane]) || (::IsChild(m_hWndPane[nPane], hWndFocus) != FALSE))
|
||||||
{
|
{
|
||||||
nRet = nPane;
|
nRet = nPane;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nRet;
|
return nRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,16 +356,18 @@ public:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return SetActivePane(nPane);
|
return SetActivePane(nPane);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SetDefaultActivePane(int nPane)
|
bool SetDefaultActivePane(int nPane)
|
||||||
{
|
{
|
||||||
ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT);
|
ATLASSERT((nPane == SPLIT_PANE_LEFT) || (nPane == SPLIT_PANE_RIGHT));
|
||||||
|
if((nPane != SPLIT_PANE_LEFT) && (nPane != SPLIT_PANE_RIGHT))
|
||||||
if(nPane != SPLIT_PANE_LEFT && nPane != SPLIT_PANE_RIGHT)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_nDefActivePane = nPane;
|
m_nDefActivePane = nPane;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,6 +381,7 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false; // not found
|
return false; // not found
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,7 +393,7 @@ public:
|
||||||
void DrawSplitter(CDCHandle dc)
|
void DrawSplitter(CDCHandle dc)
|
||||||
{
|
{
|
||||||
ATLASSERT(dc.m_hDC != NULL);
|
ATLASSERT(dc.m_hDC != NULL);
|
||||||
if(m_nSinglePane == SPLIT_PANE_NONE && m_xySplitterPos == -1)
|
if((m_nSinglePane == SPLIT_PANE_NONE) && (m_xySplitterPos == -1))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
|
@ -381,38 +414,107 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// call to initiate moving splitter bar with keyboard
|
||||||
|
void MoveSplitterBar()
|
||||||
|
{
|
||||||
|
T* pT = static_cast<T*>(this);
|
||||||
|
|
||||||
|
int x = 0;
|
||||||
|
int y = 0;
|
||||||
|
if(m_bVertical)
|
||||||
|
{
|
||||||
|
x = m_xySplitterPos + (m_cxySplitBar / 2) + m_cxyBarEdge;
|
||||||
|
y = (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge) / 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x = (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) / 2;
|
||||||
|
y = m_xySplitterPos + (m_cxySplitBar / 2) + m_cxyBarEdge;
|
||||||
|
}
|
||||||
|
|
||||||
|
POINT pt = { x, y };
|
||||||
|
pT->ClientToScreen(&pt);
|
||||||
|
::SetCursorPos(pt.x, pt.y);
|
||||||
|
|
||||||
|
m_xySplitterPosNew = m_xySplitterPos;
|
||||||
|
pT->SetCapture();
|
||||||
|
m_hWndFocusSave = pT->SetFocus();
|
||||||
|
::SetCursor(m_hCursor);
|
||||||
|
if(!m_bFullDrag)
|
||||||
|
DrawGhostBar();
|
||||||
|
if(m_bVertical)
|
||||||
|
m_cxyDragOffset = x - m_rcSplitter.left - m_xySplitterPos;
|
||||||
|
else
|
||||||
|
m_cxyDragOffset = y - m_rcSplitter.top - m_xySplitterPos;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetOrientation(bool bVertical, bool bUpdate = true)
|
||||||
|
{
|
||||||
|
if(m_bVertical != bVertical)
|
||||||
|
{
|
||||||
|
m_bVertical = bVertical;
|
||||||
|
|
||||||
|
m_hCursor = ::LoadCursor(NULL, m_bVertical ? IDC_SIZEWE : IDC_SIZENS);
|
||||||
|
|
||||||
|
T* pT = static_cast<T*>(this);
|
||||||
|
pT->GetSystemSettings(false);
|
||||||
|
|
||||||
|
if(m_bVertical)
|
||||||
|
m_xySplitterPos = ::MulDiv(m_xySplitterPos, m_rcSplitter.right - m_rcSplitter.left, m_rcSplitter.bottom - m_rcSplitter.top);
|
||||||
|
else
|
||||||
|
m_xySplitterPos = ::MulDiv(m_xySplitterPos, m_rcSplitter.bottom - m_rcSplitter.top, m_rcSplitter.right - m_rcSplitter.left);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(bUpdate)
|
||||||
|
UpdateSplitterLayout();
|
||||||
|
}
|
||||||
|
|
||||||
// Overrideables
|
// Overrideables
|
||||||
void DrawSplitterBar(CDCHandle dc)
|
void DrawSplitterBar(CDCHandle dc)
|
||||||
{
|
{
|
||||||
RECT rect = { 0 };
|
RECT rect = {};
|
||||||
if(GetSplitterBarRect(&rect))
|
if(GetSplitterBarRect(&rect))
|
||||||
{
|
{
|
||||||
dc.FillRect(&rect, COLOR_3DFACE);
|
dc.FillRect(&rect, COLOR_3DFACE);
|
||||||
|
|
||||||
#if (!defined(_WIN32_WCE) || (_WIN32_WCE >= 420))
|
if((m_dwExtendedStyle & SPLIT_FLATBAR) != 0)
|
||||||
if((m_dwExtendedStyle & SPLIT_GRADIENTBAR) != 0)
|
{
|
||||||
|
RECT rect1 = rect;
|
||||||
|
if(m_bVertical)
|
||||||
|
rect1.right = rect1.left + 1;
|
||||||
|
else
|
||||||
|
rect1.bottom = rect1.top + 1;
|
||||||
|
dc.FillRect(&rect1, COLOR_WINDOW);
|
||||||
|
|
||||||
|
rect1 = rect;
|
||||||
|
if(m_bVertical)
|
||||||
|
rect1.left = rect1.right - 1;
|
||||||
|
else
|
||||||
|
rect1.top = rect1.bottom - 1;
|
||||||
|
dc.FillRect(&rect1, COLOR_3DSHADOW);
|
||||||
|
}
|
||||||
|
else if((m_dwExtendedStyle & SPLIT_GRADIENTBAR) != 0)
|
||||||
{
|
{
|
||||||
RECT rect2 = rect;
|
RECT rect2 = rect;
|
||||||
if(t_bVertical)
|
if(m_bVertical)
|
||||||
rect2.left = (rect.left + rect.right) / 2 - 1;
|
rect2.left = (rect.left + rect.right) / 2 - 1;
|
||||||
else
|
else
|
||||||
rect2.top = (rect.top + rect.bottom) / 2 - 1;
|
rect2.top = (rect.top + rect.bottom) / 2 - 1;
|
||||||
|
|
||||||
dc.GradientFillRect(rect2, ::GetSysColor(COLOR_3DFACE), ::GetSysColor(COLOR_3DSHADOW), t_bVertical);
|
dc.GradientFillRect(rect2, ::GetSysColor(COLOR_3DFACE), ::GetSysColor(COLOR_3DSHADOW), m_bVertical);
|
||||||
}
|
}
|
||||||
#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 420)
|
|
||||||
|
|
||||||
// draw 3D edge if needed
|
// draw 3D edge if needed
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
if((pT->GetExStyle() & WS_EX_CLIENTEDGE) != 0)
|
if((pT->GetExStyle() & WS_EX_CLIENTEDGE) != 0)
|
||||||
dc.DrawEdge(&rect, EDGE_RAISED, t_bVertical ? (BF_LEFT | BF_RIGHT) : (BF_TOP | BF_BOTTOM));
|
dc.DrawEdge(&rect, EDGE_RAISED, m_bVertical ? (BF_LEFT | BF_RIGHT) : (BF_TOP | BF_BOTTOM));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// called only if pane is empty
|
// called only if pane is empty
|
||||||
void DrawSplitterPane(CDCHandle dc, int nPane)
|
void DrawSplitterPane(CDCHandle dc, int nPane)
|
||||||
{
|
{
|
||||||
RECT rect = { 0 };
|
RECT rect = {};
|
||||||
if(GetSplitterPaneRect(nPane, &rect))
|
if(GetSplitterPaneRect(nPane, &rect))
|
||||||
{
|
{
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
|
@ -426,9 +528,7 @@ public:
|
||||||
BEGIN_MSG_MAP(CSplitterImpl)
|
BEGIN_MSG_MAP(CSplitterImpl)
|
||||||
MESSAGE_HANDLER(WM_CREATE, OnCreate)
|
MESSAGE_HANDLER(WM_CREATE, OnCreate)
|
||||||
MESSAGE_HANDLER(WM_PAINT, OnPaint)
|
MESSAGE_HANDLER(WM_PAINT, OnPaint)
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint)
|
MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint)
|
||||||
#endif // !_WIN32_WCE
|
|
||||||
if(IsInteractive())
|
if(IsInteractive())
|
||||||
{
|
{
|
||||||
MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor)
|
MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor)
|
||||||
|
@ -437,39 +537,48 @@ public:
|
||||||
MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp)
|
MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp)
|
||||||
MESSAGE_HANDLER(WM_LBUTTONDBLCLK, OnLButtonDoubleClick)
|
MESSAGE_HANDLER(WM_LBUTTONDBLCLK, OnLButtonDoubleClick)
|
||||||
MESSAGE_HANDLER(WM_CAPTURECHANGED, OnCaptureChanged)
|
MESSAGE_HANDLER(WM_CAPTURECHANGED, OnCaptureChanged)
|
||||||
|
MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown)
|
||||||
}
|
}
|
||||||
MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
|
MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
MESSAGE_HANDLER(WM_MOUSEACTIVATE, OnMouseActivate)
|
MESSAGE_HANDLER(WM_MOUSEACTIVATE, OnMouseActivate)
|
||||||
#endif // !_WIN32_WCE
|
|
||||||
MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange)
|
MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange)
|
||||||
END_MSG_MAP()
|
END_MSG_MAP()
|
||||||
|
|
||||||
LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
|
LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
pT->GetSystemSettings(false);
|
pT->Init();
|
||||||
|
|
||||||
bHandled = FALSE;
|
bHandled = FALSE;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||||
{
|
{
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
|
|
||||||
// try setting position if not set
|
// try setting position if not set
|
||||||
if(m_nSinglePane == SPLIT_PANE_NONE && m_xySplitterPos == -1)
|
if((m_nSinglePane == SPLIT_PANE_NONE) && (m_xySplitterPos == -1))
|
||||||
pT->SetSplitterPos();
|
pT->SetSplitterPos();
|
||||||
|
|
||||||
// do painting
|
// do painting
|
||||||
CPaintDC dc(pT->m_hWnd);
|
if(wParam != NULL)
|
||||||
pT->DrawSplitter(dc.m_hDC);
|
{
|
||||||
|
pT->DrawSplitter((HDC)wParam);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CPaintDC dc(pT->m_hWnd);
|
||||||
|
pT->DrawSplitter(dc.m_hDC);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT OnSetCursor(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
LRESULT OnSetCursor(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
if((HWND)wParam == pT->m_hWnd && LOWORD(lParam) == HTCLIENT)
|
if(((HWND)wParam == pT->m_hWnd) && (LOWORD(lParam) == HTCLIENT))
|
||||||
{
|
{
|
||||||
DWORD dwPos = ::GetMessagePos();
|
DWORD dwPos = ::GetMessagePos();
|
||||||
POINT ptPos = { GET_X_LPARAM(dwPos), GET_Y_LPARAM(dwPos) };
|
POINT ptPos = { GET_X_LPARAM(dwPos), GET_Y_LPARAM(dwPos) };
|
||||||
|
@ -482,20 +591,20 @@ public:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
int xPos = GET_X_LPARAM(lParam);
|
int xPos = GET_X_LPARAM(lParam);
|
||||||
int yPos = GET_Y_LPARAM(lParam);
|
int yPos = GET_Y_LPARAM(lParam);
|
||||||
if((wParam & MK_LBUTTON) && ::GetCapture() == pT->m_hWnd)
|
if(::GetCapture() == pT->m_hWnd)
|
||||||
{
|
{
|
||||||
int xyNewSplitPos = 0;
|
int xyNewSplitPos = 0;
|
||||||
if(t_bVertical)
|
if(m_bVertical)
|
||||||
xyNewSplitPos = xPos - m_rcSplitter.left - m_cxyDragOffset;
|
xyNewSplitPos = xPos - m_rcSplitter.left - m_cxyDragOffset;
|
||||||
else
|
else
|
||||||
xyNewSplitPos = yPos - m_rcSplitter.top - m_cxyDragOffset;
|
xyNewSplitPos = yPos - m_rcSplitter.top - m_cxyDragOffset;
|
||||||
|
|
||||||
if(xyNewSplitPos == -1) // avoid -1, that means middle
|
if(xyNewSplitPos == -1) // avoid -1, that means default position
|
||||||
xyNewSplitPos = -2;
|
xyNewSplitPos = -2;
|
||||||
|
|
||||||
if(m_xySplitterPos != xyNewSplitPos)
|
if(m_xySplitterPos != xyNewSplitPos)
|
||||||
|
@ -525,27 +634,40 @@ public:
|
||||||
|
|
||||||
LRESULT OnLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled)
|
LRESULT OnLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
|
T* pT = static_cast<T*>(this);
|
||||||
int xPos = GET_X_LPARAM(lParam);
|
int xPos = GET_X_LPARAM(lParam);
|
||||||
int yPos = GET_Y_LPARAM(lParam);
|
int yPos = GET_Y_LPARAM(lParam);
|
||||||
if(IsOverSplitterBar(xPos, yPos))
|
if((::GetCapture() != pT->m_hWnd) && IsOverSplitterBar(xPos, yPos))
|
||||||
{
|
{
|
||||||
T* pT = static_cast<T*>(this);
|
m_xySplitterPosNew = m_xySplitterPos;
|
||||||
pT->SetCapture();
|
pT->SetCapture();
|
||||||
|
m_hWndFocusSave = pT->SetFocus();
|
||||||
::SetCursor(m_hCursor);
|
::SetCursor(m_hCursor);
|
||||||
if(!m_bFullDrag)
|
if(!m_bFullDrag)
|
||||||
DrawGhostBar();
|
DrawGhostBar();
|
||||||
if(t_bVertical)
|
if(m_bVertical)
|
||||||
m_cxyDragOffset = xPos - m_rcSplitter.left - m_xySplitterPos;
|
m_cxyDragOffset = xPos - m_rcSplitter.left - m_xySplitterPos;
|
||||||
else
|
else
|
||||||
m_cxyDragOffset = yPos - m_rcSplitter.top - m_xySplitterPos;
|
m_cxyDragOffset = yPos - m_rcSplitter.top - m_xySplitterPos;
|
||||||
}
|
}
|
||||||
|
else if((::GetCapture() == pT->m_hWnd) && !IsOverSplitterBar(xPos, yPos))
|
||||||
|
{
|
||||||
|
::ReleaseCapture();
|
||||||
|
}
|
||||||
|
|
||||||
bHandled = FALSE;
|
bHandled = FALSE;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT OnLButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
|
LRESULT OnLButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
::ReleaseCapture();
|
T* pT = static_cast<T*>(this);
|
||||||
|
if(::GetCapture() == pT->m_hWnd)
|
||||||
|
{
|
||||||
|
m_xySplitterPosNew = m_xySplitterPos;
|
||||||
|
::ReleaseCapture();
|
||||||
|
}
|
||||||
|
|
||||||
bHandled = FALSE;
|
bHandled = FALSE;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -553,60 +675,130 @@ public:
|
||||||
LRESULT OnLButtonDoubleClick(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
LRESULT OnLButtonDoubleClick(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||||
{
|
{
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
pT->SetSplitterPos(); // middle
|
pT->SetSplitterPos(); // default
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT OnCaptureChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
LRESULT OnCaptureChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||||
{
|
{
|
||||||
if(!m_bFullDrag)
|
if(!m_bFullDrag)
|
||||||
{
|
|
||||||
DrawGhostBar();
|
DrawGhostBar();
|
||||||
|
|
||||||
|
if((m_xySplitterPosNew != -1) && (!m_bFullDrag || (m_xySplitterPos != m_xySplitterPosNew)))
|
||||||
|
{
|
||||||
|
m_xySplitterPos = m_xySplitterPosNew;
|
||||||
|
m_xySplitterPosNew = -1;
|
||||||
UpdateSplitterLayout();
|
UpdateSplitterLayout();
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
pT->UpdateWindow();
|
pT->UpdateWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(m_hWndFocusSave != NULL)
|
||||||
|
::SetFocus(m_hWndFocusSave);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT OnKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled)
|
||||||
|
{
|
||||||
|
T* pT = static_cast<T*>(this);
|
||||||
|
if(::GetCapture() == pT->m_hWnd)
|
||||||
|
{
|
||||||
|
switch(wParam)
|
||||||
|
{
|
||||||
|
case VK_RETURN:
|
||||||
|
m_xySplitterPosNew = m_xySplitterPos;
|
||||||
|
// FALLTHROUGH
|
||||||
|
case VK_ESCAPE:
|
||||||
|
::ReleaseCapture();
|
||||||
|
break;
|
||||||
|
case VK_LEFT:
|
||||||
|
case VK_RIGHT:
|
||||||
|
if(m_bVertical)
|
||||||
|
{
|
||||||
|
POINT pt = {};
|
||||||
|
::GetCursorPos(&pt);
|
||||||
|
int xyPos = m_xySplitterPos + ((wParam == VK_LEFT) ? -pT->m_cxyStep : pT->m_cxyStep);
|
||||||
|
int cxyMax = m_rcSplitter.right - m_rcSplitter.left;
|
||||||
|
if(xyPos < (m_cxyMin + m_cxyBarEdge))
|
||||||
|
xyPos = m_cxyMin;
|
||||||
|
else if(xyPos > (cxyMax - m_cxySplitBar - m_cxyBarEdge - m_cxyMin))
|
||||||
|
xyPos = cxyMax - m_cxySplitBar - m_cxyBarEdge - m_cxyMin;
|
||||||
|
pt.x += xyPos - m_xySplitterPos;
|
||||||
|
::SetCursorPos(pt.x, pt.y);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case VK_UP:
|
||||||
|
case VK_DOWN:
|
||||||
|
if(!m_bVertical)
|
||||||
|
{
|
||||||
|
POINT pt = {};
|
||||||
|
::GetCursorPos(&pt);
|
||||||
|
int xyPos = m_xySplitterPos + ((wParam == VK_UP) ? -pT->m_cxyStep : pT->m_cxyStep);
|
||||||
|
int cxyMax = m_rcSplitter.bottom - m_rcSplitter.top;
|
||||||
|
if(xyPos < (m_cxyMin + m_cxyBarEdge))
|
||||||
|
xyPos = m_cxyMin;
|
||||||
|
else if(xyPos > (cxyMax - m_cxySplitBar - m_cxyBarEdge - m_cxyMin))
|
||||||
|
xyPos = cxyMax - m_cxySplitBar - m_cxyBarEdge - m_cxyMin;
|
||||||
|
pt.y += xyPos - m_xySplitterPos;
|
||||||
|
::SetCursorPos(pt.x, pt.y);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bHandled = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT OnSetFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM, BOOL& bHandled)
|
LRESULT OnSetFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
if(m_nSinglePane == SPLIT_PANE_NONE)
|
T* pT = static_cast<T*>(this);
|
||||||
|
if(::GetCapture() != pT->m_hWnd)
|
||||||
{
|
{
|
||||||
if(m_nDefActivePane == SPLIT_PANE_LEFT || m_nDefActivePane == SPLIT_PANE_RIGHT)
|
if(m_nSinglePane == SPLIT_PANE_NONE)
|
||||||
::SetFocus(m_hWndPane[m_nDefActivePane]);
|
{
|
||||||
}
|
if((m_nDefActivePane == SPLIT_PANE_LEFT) || (m_nDefActivePane == SPLIT_PANE_RIGHT))
|
||||||
else
|
::SetFocus(m_hWndPane[m_nDefActivePane]);
|
||||||
{
|
}
|
||||||
::SetFocus(m_hWndPane[m_nSinglePane]);
|
else
|
||||||
|
{
|
||||||
|
::SetFocus(m_hWndPane[m_nSinglePane]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bHandled = FALSE;
|
bHandled = FALSE;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
LRESULT OnMouseActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/)
|
LRESULT OnMouseActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/)
|
||||||
{
|
{
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
LRESULT lRet = pT->DefWindowProc(uMsg, wParam, lParam);
|
LRESULT lRet = pT->DefWindowProc(uMsg, wParam, lParam);
|
||||||
if(lRet == MA_ACTIVATE || lRet == MA_ACTIVATEANDEAT)
|
if((lRet == MA_ACTIVATE) || (lRet == MA_ACTIVATEANDEAT))
|
||||||
{
|
{
|
||||||
DWORD dwPos = ::GetMessagePos();
|
DWORD dwPos = ::GetMessagePos();
|
||||||
POINT pt = { GET_X_LPARAM(dwPos), GET_Y_LPARAM(dwPos) };
|
POINT pt = { GET_X_LPARAM(dwPos), GET_Y_LPARAM(dwPos) };
|
||||||
pT->ScreenToClient(&pt);
|
pT->ScreenToClient(&pt);
|
||||||
RECT rcPane = { 0 };
|
RECT rcPane = {};
|
||||||
for(int nPane = 0; nPane < m_nPanesCount; nPane++)
|
for(int nPane = 0; nPane < m_nPanesCount; nPane++)
|
||||||
{
|
{
|
||||||
if(GetSplitterPaneRect(nPane, &rcPane) && ::PtInRect(&rcPane, pt))
|
if(GetSplitterPaneRect(nPane, &rcPane) && (::PtInRect(&rcPane, pt) != FALSE))
|
||||||
{
|
{
|
||||||
m_nDefActivePane = nPane;
|
m_nDefActivePane = nPane;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return lRet;
|
return lRet;
|
||||||
}
|
}
|
||||||
#endif // !_WIN32_WCE
|
|
||||||
|
|
||||||
LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||||
{
|
{
|
||||||
|
@ -617,13 +809,21 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implementation - internal helpers
|
// Implementation - internal helpers
|
||||||
|
void Init()
|
||||||
|
{
|
||||||
|
m_hCursor = ::LoadCursor(NULL, m_bVertical ? IDC_SIZEWE : IDC_SIZENS);
|
||||||
|
|
||||||
|
T* pT = static_cast<T*>(this);
|
||||||
|
pT->GetSystemSettings(false);
|
||||||
|
}
|
||||||
|
|
||||||
void UpdateSplitterLayout()
|
void UpdateSplitterLayout()
|
||||||
{
|
{
|
||||||
if(m_nSinglePane == SPLIT_PANE_NONE && m_xySplitterPos == -1)
|
if((m_nSinglePane == SPLIT_PANE_NONE) && (m_xySplitterPos == -1))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
RECT rect = { 0 };
|
RECT rect = {};
|
||||||
if(m_nSinglePane == SPLIT_PANE_NONE)
|
if(m_nSinglePane == SPLIT_PANE_NONE)
|
||||||
{
|
{
|
||||||
if(GetSplitterBarRect(&rect))
|
if(GetSplitterBarRect(&rect))
|
||||||
|
@ -655,10 +855,10 @@ public:
|
||||||
bool GetSplitterBarRect(LPRECT lpRect) const
|
bool GetSplitterBarRect(LPRECT lpRect) const
|
||||||
{
|
{
|
||||||
ATLASSERT(lpRect != NULL);
|
ATLASSERT(lpRect != NULL);
|
||||||
if(m_nSinglePane != SPLIT_PANE_NONE || m_xySplitterPos == -1)
|
if((m_nSinglePane != SPLIT_PANE_NONE) || (m_xySplitterPos == -1))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(t_bVertical)
|
if(m_bVertical)
|
||||||
{
|
{
|
||||||
lpRect->left = m_rcSplitter.left + m_xySplitterPos;
|
lpRect->left = m_rcSplitter.left + m_xySplitterPos;
|
||||||
lpRect->top = m_rcSplitter.top;
|
lpRect->top = m_rcSplitter.top;
|
||||||
|
@ -678,7 +878,7 @@ public:
|
||||||
|
|
||||||
bool GetSplitterPaneRect(int nPane, LPRECT lpRect) const
|
bool GetSplitterPaneRect(int nPane, LPRECT lpRect) const
|
||||||
{
|
{
|
||||||
ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT);
|
ATLASSERT((nPane == SPLIT_PANE_LEFT) || (nPane == SPLIT_PANE_RIGHT));
|
||||||
ATLASSERT(lpRect != NULL);
|
ATLASSERT(lpRect != NULL);
|
||||||
bool bRet = true;
|
bool bRet = true;
|
||||||
if(m_nSinglePane != SPLIT_PANE_NONE)
|
if(m_nSinglePane != SPLIT_PANE_NONE)
|
||||||
|
@ -690,7 +890,7 @@ public:
|
||||||
}
|
}
|
||||||
else if(nPane == SPLIT_PANE_LEFT)
|
else if(nPane == SPLIT_PANE_LEFT)
|
||||||
{
|
{
|
||||||
if(t_bVertical)
|
if(m_bVertical)
|
||||||
{
|
{
|
||||||
lpRect->left = m_rcSplitter.left;
|
lpRect->left = m_rcSplitter.left;
|
||||||
lpRect->top = m_rcSplitter.top;
|
lpRect->top = m_rcSplitter.top;
|
||||||
|
@ -707,7 +907,7 @@ public:
|
||||||
}
|
}
|
||||||
else if(nPane == SPLIT_PANE_RIGHT)
|
else if(nPane == SPLIT_PANE_RIGHT)
|
||||||
{
|
{
|
||||||
if(t_bVertical)
|
if(m_bVertical)
|
||||||
{
|
{
|
||||||
lpRect->left = m_rcSplitter.left + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge;
|
lpRect->left = m_rcSplitter.left + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge;
|
||||||
lpRect->top = m_rcSplitter.top;
|
lpRect->top = m_rcSplitter.top;
|
||||||
|
@ -726,44 +926,46 @@ public:
|
||||||
{
|
{
|
||||||
bRet = false;
|
bRet = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return bRet;
|
return bRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsOverSplitterRect(int x, int y) const
|
bool IsOverSplitterRect(int x, int y) const
|
||||||
{
|
{
|
||||||
// -1 == don't check
|
// -1 == don't check
|
||||||
return ((x == -1 || (x >= m_rcSplitter.left && x <= m_rcSplitter.right)) &&
|
return (((x == -1) || ((x >= m_rcSplitter.left) && (x <= m_rcSplitter.right))) &&
|
||||||
(y == -1 || (y >= m_rcSplitter.top && y <= m_rcSplitter.bottom)));
|
((y == -1) || ((y >= m_rcSplitter.top) && (y <= m_rcSplitter.bottom))));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsOverSplitterBar(int x, int y) const
|
bool IsOverSplitterBar(int x, int y) const
|
||||||
{
|
{
|
||||||
if(m_nSinglePane != SPLIT_PANE_NONE)
|
if(m_nSinglePane != SPLIT_PANE_NONE)
|
||||||
return false;
|
return false;
|
||||||
if(m_xySplitterPos == -1 || !IsOverSplitterRect(x, y))
|
if((m_xySplitterPos == -1) || !IsOverSplitterRect(x, y))
|
||||||
return false;
|
return false;
|
||||||
int xy = t_bVertical ? x : y;
|
int xy = m_bVertical ? x : y;
|
||||||
int xyOff = t_bVertical ? m_rcSplitter.left : m_rcSplitter.top;
|
int xyOff = m_bVertical ? m_rcSplitter.left : m_rcSplitter.top;
|
||||||
return ((xy >= (xyOff + m_xySplitterPos)) && (xy < xyOff + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge));
|
|
||||||
|
return ((xy >= (xyOff + m_xySplitterPos)) && (xy < (xyOff + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawGhostBar()
|
void DrawGhostBar()
|
||||||
{
|
{
|
||||||
RECT rect = { 0 };
|
RECT rect = {};
|
||||||
if(GetSplitterBarRect(&rect))
|
if(GetSplitterBarRect(&rect))
|
||||||
{
|
{
|
||||||
// convert client to window coordinates
|
// convert client to window coordinates
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
RECT rcWnd = { 0 };
|
RECT rcWnd = {};
|
||||||
pT->GetWindowRect(&rcWnd);
|
pT->GetWindowRect(&rcWnd);
|
||||||
::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rcWnd, 2);
|
::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rcWnd, 2);
|
||||||
::OffsetRect(&rect, -rcWnd.left, -rcWnd.top);
|
::OffsetRect(&rect, -rcWnd.left, -rcWnd.top);
|
||||||
|
|
||||||
// invert the brush pattern (looks just like frame window sizing)
|
// invert the brush pattern (looks just like frame window sizing)
|
||||||
CWindowDC dc(pT->m_hWnd);
|
CBrush brush(CDCHandle::GetHalftoneBrush());
|
||||||
CBrush brush = CDCHandle::GetHalftoneBrush();
|
|
||||||
if(brush.m_hBrush != NULL)
|
if(brush.m_hBrush != NULL)
|
||||||
{
|
{
|
||||||
|
CWindowDC dc(pT->m_hWnd);
|
||||||
CBrushHandle brushOld = dc.SelectBrush(brush);
|
CBrushHandle brushOld = dc.SelectBrush(brush);
|
||||||
dc.PatBlt(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, PATINVERT);
|
dc.PatBlt(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, PATINVERT);
|
||||||
dc.SelectBrush(brushOld);
|
dc.SelectBrush(brushOld);
|
||||||
|
@ -775,28 +977,22 @@ public:
|
||||||
{
|
{
|
||||||
if((m_dwExtendedStyle & SPLIT_FIXEDBARSIZE) == 0)
|
if((m_dwExtendedStyle & SPLIT_FIXEDBARSIZE) == 0)
|
||||||
{
|
{
|
||||||
#ifndef _WIN32_WCE
|
m_cxySplitBar = ::GetSystemMetrics(m_bVertical ? SM_CXSIZEFRAME : SM_CYSIZEFRAME);
|
||||||
m_cxySplitBar = ::GetSystemMetrics(t_bVertical ? SM_CXSIZEFRAME : SM_CYSIZEFRAME);
|
|
||||||
#else // CE specific
|
|
||||||
m_cxySplitBar = 2 * ::GetSystemMetrics(t_bVertical ? SM_CXEDGE : SM_CYEDGE);
|
|
||||||
#endif // _WIN32_WCE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
if((pT->GetExStyle() & WS_EX_CLIENTEDGE))
|
if((pT->GetExStyle() & WS_EX_CLIENTEDGE) != 0)
|
||||||
{
|
{
|
||||||
m_cxyBarEdge = 2 * ::GetSystemMetrics(t_bVertical ? SM_CXEDGE : SM_CYEDGE);
|
m_cxyBarEdge = 2 * ::GetSystemMetrics(m_bVertical ? SM_CXEDGE : SM_CYEDGE);
|
||||||
m_cxyMin = 0;
|
m_cxyMin = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_cxyBarEdge = 0;
|
m_cxyBarEdge = 0;
|
||||||
m_cxyMin = 2 * ::GetSystemMetrics(t_bVertical ? SM_CXEDGE : SM_CYEDGE);
|
m_cxyMin = 2 * ::GetSystemMetrics(m_bVertical ? SM_CXEDGE : SM_CYEDGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
::SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &m_bFullDrag, 0);
|
::SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &m_bFullDrag, 0);
|
||||||
#endif // !_WIN32_WCE
|
|
||||||
|
|
||||||
if(bUpdate)
|
if(bUpdate)
|
||||||
UpdateSplitterLayout();
|
UpdateSplitterLayout();
|
||||||
|
@ -809,7 +1005,7 @@ public:
|
||||||
|
|
||||||
void StoreProportionalPos()
|
void StoreProportionalPos()
|
||||||
{
|
{
|
||||||
int cxyTotal = t_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge);
|
int cxyTotal = m_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge);
|
||||||
if(cxyTotal > 0)
|
if(cxyTotal > 0)
|
||||||
m_nProportionalPos = ::MulDiv(m_xySplitterPos, m_nPropMax, cxyTotal);
|
m_nProportionalPos = ::MulDiv(m_xySplitterPos, m_nPropMax, cxyTotal);
|
||||||
else
|
else
|
||||||
|
@ -819,7 +1015,7 @@ public:
|
||||||
|
|
||||||
void UpdateProportionalPos()
|
void UpdateProportionalPos()
|
||||||
{
|
{
|
||||||
int cxyTotal = t_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge);
|
int cxyTotal = m_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge);
|
||||||
if(cxyTotal > 0)
|
if(cxyTotal > 0)
|
||||||
{
|
{
|
||||||
int xyNewPos = ::MulDiv(m_nProportionalPos, cxyTotal, m_nPropMax);
|
int xyNewPos = ::MulDiv(m_nProportionalPos, cxyTotal, m_nPropMax);
|
||||||
|
@ -836,7 +1032,7 @@ public:
|
||||||
|
|
||||||
void StoreRightAlignPos()
|
void StoreRightAlignPos()
|
||||||
{
|
{
|
||||||
int cxyTotal = t_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge);
|
int cxyTotal = m_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge);
|
||||||
if(cxyTotal > 0)
|
if(cxyTotal > 0)
|
||||||
m_nProportionalPos = cxyTotal - m_xySplitterPos;
|
m_nProportionalPos = cxyTotal - m_xySplitterPos;
|
||||||
else
|
else
|
||||||
|
@ -846,7 +1042,7 @@ public:
|
||||||
|
|
||||||
void UpdateRightAlignPos()
|
void UpdateRightAlignPos()
|
||||||
{
|
{
|
||||||
int cxyTotal = t_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge);
|
int cxyTotal = m_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge);
|
||||||
if(cxyTotal > 0)
|
if(cxyTotal > 0)
|
||||||
{
|
{
|
||||||
m_bUpdateProportionalPos = false;
|
m_bUpdateProportionalPos = false;
|
||||||
|
@ -861,24 +1057,37 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T, bool t_bVertical> HCURSOR CSplitterImpl< T, t_bVertical>::m_hCursor = NULL;
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// CSplitterWindowImpl - Implements a splitter window
|
// CSplitterWindowImpl - Implements a splitter window
|
||||||
|
|
||||||
template <class T, bool t_bVertical = true, class TBase = ATL::CWindow, class TWinTraits = ATL::CControlWinTraits>
|
template <class T, class TBase = ATL::CWindow, class TWinTraits = ATL::CControlWinTraits>
|
||||||
class ATL_NO_VTABLE CSplitterWindowImpl : public ATL::CWindowImpl< T, TBase, TWinTraits >, public CSplitterImpl< T , t_bVertical >
|
class ATL_NO_VTABLE CSplitterWindowImpl : public ATL::CWindowImpl< T, TBase, TWinTraits >, public CSplitterImpl< T >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DECLARE_WND_CLASS_EX(NULL, CS_DBLCLKS, COLOR_WINDOW)
|
DECLARE_WND_CLASS_EX2(NULL, T, CS_DBLCLKS, COLOR_WINDOW)
|
||||||
|
|
||||||
typedef CSplitterImpl< T , t_bVertical > _baseClass;
|
CSplitterWindowImpl(bool bVertical = true) : CSplitterImpl< T >(bVertical)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
BOOL SubclassWindow(HWND hWnd)
|
||||||
|
{
|
||||||
|
BOOL bRet = ATL::CWindowImpl< T, TBase, TWinTraits >::SubclassWindow(hWnd);
|
||||||
|
if(bRet != FALSE)
|
||||||
|
{
|
||||||
|
T* pT = static_cast<T*>(this);
|
||||||
|
pT->Init();
|
||||||
|
|
||||||
|
this->SetSplitterRect();
|
||||||
|
}
|
||||||
|
|
||||||
|
return bRet;
|
||||||
|
}
|
||||||
|
|
||||||
BEGIN_MSG_MAP(CSplitterWindowImpl)
|
BEGIN_MSG_MAP(CSplitterWindowImpl)
|
||||||
MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground)
|
MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground)
|
||||||
MESSAGE_HANDLER(WM_SIZE, OnSize)
|
MESSAGE_HANDLER(WM_SIZE, OnSize)
|
||||||
CHAIN_MSG_MAP(_baseClass)
|
CHAIN_MSG_MAP(CSplitterImpl< T >)
|
||||||
FORWARD_NOTIFICATIONS()
|
FORWARD_NOTIFICATIONS()
|
||||||
END_MSG_MAP()
|
END_MSG_MAP()
|
||||||
|
|
||||||
|
@ -891,7 +1100,7 @@ public:
|
||||||
LRESULT OnSize(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled)
|
LRESULT OnSize(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
if(wParam != SIZE_MINIMIZED)
|
if(wParam != SIZE_MINIMIZED)
|
||||||
SetSplitterRect();
|
this->SetSplitterRect();
|
||||||
|
|
||||||
bHandled = FALSE;
|
bHandled = FALSE;
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -900,18 +1109,21 @@ public:
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// CSplitterWindow - Implements a splitter window to be used as is
|
// CSplitterWindow/CHorSplitterWindow - Implements splitter windows to be used as is
|
||||||
|
|
||||||
template <bool t_bVertical = true>
|
template <bool t_bVertical = true>
|
||||||
class CSplitterWindowT : public CSplitterWindowImpl<CSplitterWindowT<t_bVertical>, t_bVertical>
|
class CSplitterWindowT : public CSplitterWindowImpl<CSplitterWindowT<t_bVertical> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DECLARE_WND_CLASS_EX(_T("WTL_SplitterWindow"), CS_DBLCLKS, COLOR_WINDOW)
|
DECLARE_WND_CLASS_EX2(_T("WTL_SplitterWindow"), CSplitterWindowT<t_bVertical>, CS_DBLCLKS, COLOR_WINDOW)
|
||||||
|
|
||||||
|
CSplitterWindowT() : CSplitterWindowImpl<CSplitterWindowT<t_bVertical> >(t_bVertical)
|
||||||
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef CSplitterWindowT<true> CSplitterWindow;
|
typedef CSplitterWindowT<true> CSplitterWindow;
|
||||||
typedef CSplitterWindowT<false> CHorSplitterWindow;
|
typedef CSplitterWindowT<false> CHorSplitterWindow;
|
||||||
|
|
||||||
}; // namespace WTL
|
} // namespace WTL
|
||||||
|
|
||||||
#endif // __ATLSPLIT_H__
|
#endif // __ATLSPLIT_H__
|
||||||
|
|
|
@ -1,23 +1,16 @@
|
||||||
// Windows Template Library - WTL version 8.1
|
// Windows Template Library - WTL version 10.0
|
||||||
// Copyright (C) Microsoft Corporation. All rights reserved.
|
// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved.
|
||||||
//
|
//
|
||||||
// This file is a part of the Windows Template Library.
|
// This file is a part of the Windows Template Library.
|
||||||
// The use and distribution terms for this software are covered by the
|
// The use and distribution terms for this software are covered by the
|
||||||
// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php)
|
// Microsoft Public License (http://opensource.org/licenses/MS-PL)
|
||||||
// which can be found in the file CPL.TXT at the root of this distribution.
|
// which can be found in the file MS-PL.txt at the root folder.
|
||||||
// By using this software in any fashion, you are agreeing to be bound by
|
|
||||||
// the terms of this license. You must not remove this notice, or
|
|
||||||
// any other, from this software.
|
|
||||||
|
|
||||||
#ifndef __ATLTHEME_H__
|
#ifndef __ATLTHEME_H__
|
||||||
#define __ATLTHEME_H__
|
#define __ATLTHEME_H__
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifdef _WIN32_WCE
|
|
||||||
#error atltheme.h is not supported on Windows CE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __ATLAPP_H__
|
#ifndef __ATLAPP_H__
|
||||||
#error atltheme.h requires atlapp.h to be included first
|
#error atltheme.h requires atlapp.h to be included first
|
||||||
#endif
|
#endif
|
||||||
|
@ -26,22 +19,7 @@
|
||||||
#error atltheme.h requires atlwin.h to be included first
|
#error atltheme.h requires atlwin.h to be included first
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (_WIN32_WINNT < 0x0501)
|
#include <vssym32.h>
|
||||||
#error atltheme.h requires _WIN32_WINNT >= 0x0501
|
|
||||||
#endif // (_WIN32_WINNT < 0x0501)
|
|
||||||
|
|
||||||
#if defined(_WTL_USE_VSSYM32) || (defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN))
|
|
||||||
#include <vssym32.h>
|
|
||||||
#else
|
|
||||||
#ifndef TMSCHEMA_H
|
|
||||||
#include <tmschema.h>
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _UXTHEME_H_
|
|
||||||
#include <uxtheme.h>
|
|
||||||
#endif
|
|
||||||
#pragma comment(lib, "uxtheme.lib")
|
|
||||||
|
|
||||||
// Note: To create an application that also runs on older versions of Windows,
|
// Note: To create an application that also runs on older versions of Windows,
|
||||||
// use delay load of uxtheme.dll and ensure that no calls to the Theme API are
|
// use delay load of uxtheme.dll and ensure that no calls to the Theme API are
|
||||||
|
@ -61,18 +39,6 @@
|
||||||
// Delay load is NOT AUTOMATIC for VC++ 7, you have to link to delayimp.lib,
|
// Delay load is NOT AUTOMATIC for VC++ 7, you have to link to delayimp.lib,
|
||||||
// and add uxtheme.dll in the Linker.Input.Delay Loaded DLLs section of the
|
// and add uxtheme.dll in the Linker.Input.Delay Loaded DLLs section of the
|
||||||
// project properties.
|
// project properties.
|
||||||
#if (_MSC_VER < 1300) && !defined(_WTL_NO_THEME_DELAYLOAD)
|
|
||||||
#pragma comment(lib, "delayimp.lib")
|
|
||||||
#pragma comment(linker, "/delayload:uxtheme.dll")
|
|
||||||
#endif // (_MSC_VER < 1300) && !defined(_WTL_NO_THEME_DELAYLOAD)
|
|
||||||
|
|
||||||
// Hack: Signatures in uxtheme.h changed - the only way to check which variant of uxtheme.h
|
|
||||||
// is included is to check for presence of new defines MAX_THEMECOLOR and MAX_THEMESIZE
|
|
||||||
#ifndef _WTL_NEW_UXTHEME
|
|
||||||
#if defined(MAX_THEMECOLOR) && defined(MAX_THEMESIZE)
|
|
||||||
#define _WTL_NEW_UXTHEME
|
|
||||||
#endif // defined(MAX_THEMECOLOR) && defined(MAX_THEMESIZE)
|
|
||||||
#endif // _WTL_NEW_UXTHEME
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -197,11 +163,14 @@ public:
|
||||||
return ::DrawThemeBackground(m_hTheme, hDC, nPartID, nStateID, pRect, pClipRect);
|
return ::DrawThemeBackground(m_hTheme, hDC, nPartID, nStateID, pRect, pClipRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Missing in original uxtheme.h
|
||||||
|
#ifdef DTBG_CLIPRECT
|
||||||
HRESULT DrawThemeBackgroundEx(HDC hDC, int nPartID, int nStateID, LPCRECT pRect, const DTBGOPTS* pOptions = NULL)
|
HRESULT DrawThemeBackgroundEx(HDC hDC, int nPartID, int nStateID, LPCRECT pRect, const DTBGOPTS* pOptions = NULL)
|
||||||
{
|
{
|
||||||
ATLASSERT(m_hTheme != NULL);
|
ATLASSERT(m_hTheme != NULL);
|
||||||
return ::DrawThemeBackgroundEx(m_hTheme, hDC, nPartID, nStateID, pRect, pOptions);
|
return ::DrawThemeBackgroundEx(m_hTheme, hDC, nPartID, nStateID, pRect, pOptions);
|
||||||
}
|
}
|
||||||
|
#endif // DTBG_CLIPRECT
|
||||||
|
|
||||||
HRESULT DrawThemeText(HDC hDC, int nPartID, int nStateID, LPCWSTR pszText, int nCharCount, DWORD dwTextFlags, DWORD dwTextFlags2, LPCRECT pRect)
|
HRESULT DrawThemeText(HDC hDC, int nPartID, int nStateID, LPCWSTR pszText, int nCharCount, DWORD dwTextFlags, DWORD dwTextFlags2, LPCRECT pRect)
|
||||||
{
|
{
|
||||||
|
@ -221,7 +190,7 @@ public:
|
||||||
return ::GetThemeBackgroundExtent(m_hTheme, hDC, nPartID, nStateID, pContentRect, pExtentRect);
|
return ::GetThemeBackgroundExtent(m_hTheme, hDC, nPartID, nStateID, pContentRect, pExtentRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT GetThemePartSize(HDC hDC, int nPartID, int nStateID, LPRECT pRect, enum THEMESIZE eSize, LPSIZE pSize) const
|
HRESULT GetThemePartSize(HDC hDC, int nPartID, int nStateID, LPCRECT pRect, enum THEMESIZE eSize, LPSIZE pSize) const
|
||||||
{
|
{
|
||||||
ATLASSERT(m_hTheme != NULL);
|
ATLASSERT(m_hTheme != NULL);
|
||||||
return ::GetThemePartSize(m_hTheme, hDC, nPartID, nStateID, pRect, eSize, pSize);
|
return ::GetThemePartSize(m_hTheme, hDC, nPartID, nStateID, pRect, eSize, pSize);
|
||||||
|
@ -236,12 +205,7 @@ public:
|
||||||
HRESULT GetThemeTextMetrics(HDC hDC, int nPartID, int nStateID, PTEXTMETRICW pTextMetric) const
|
HRESULT GetThemeTextMetrics(HDC hDC, int nPartID, int nStateID, PTEXTMETRICW pTextMetric) const
|
||||||
{
|
{
|
||||||
ATLASSERT(m_hTheme != NULL);
|
ATLASSERT(m_hTheme != NULL);
|
||||||
#ifdef _WTL_NEW_UXTHEME
|
|
||||||
return ::GetThemeTextMetrics(m_hTheme, hDC, nPartID, nStateID, pTextMetric);
|
return ::GetThemeTextMetrics(m_hTheme, hDC, nPartID, nStateID, pTextMetric);
|
||||||
#else // !_WTL_NEW_UXTHEME
|
|
||||||
// Note: The cast to PTEXTMETRIC is because uxtheme.h incorrectly uses it instead of PTEXTMETRICW
|
|
||||||
return ::GetThemeTextMetrics(m_hTheme, hDC, nPartID, nStateID, (PTEXTMETRIC)pTextMetric);
|
|
||||||
#endif // !_WTL_NEW_UXTHEME
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT GetThemeBackgroundRegion(HDC hDC, int nPartID, int nStateID, LPCRECT pRect, HRGN* pRegion) const
|
HRESULT GetThemeBackgroundRegion(HDC hDC, int nPartID, int nStateID, LPCRECT pRect, HRGN* pRegion) const
|
||||||
|
@ -326,23 +290,13 @@ public:
|
||||||
HRESULT GetThemeFont(int nPartID, HDC hDC, int nStateID, int nPropID, LOGFONTW* pFont) const
|
HRESULT GetThemeFont(int nPartID, HDC hDC, int nStateID, int nPropID, LOGFONTW* pFont) const
|
||||||
{
|
{
|
||||||
ATLASSERT(m_hTheme != NULL);
|
ATLASSERT(m_hTheme != NULL);
|
||||||
#ifdef _WTL_NEW_UXTHEME
|
|
||||||
return ::GetThemeFont(m_hTheme, hDC, nPartID, nStateID, nPropID, pFont);
|
return ::GetThemeFont(m_hTheme, hDC, nPartID, nStateID, nPropID, pFont);
|
||||||
#else // !_WTL_NEW_UXTHEME
|
|
||||||
// Note: The cast to LOGFONT* is because uxtheme.h incorrectly uses it instead of LOGFONTW*
|
|
||||||
return ::GetThemeFont(m_hTheme, hDC, nPartID, nStateID, nPropID, (LOGFONT*)pFont);
|
|
||||||
#endif // !_WTL_NEW_UXTHEME
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT GetThemeFont(HDC hDC, int nPartID, int nStateID, int nPropID, LOGFONTW* pFont) const
|
HRESULT GetThemeFont(HDC hDC, int nPartID, int nStateID, int nPropID, LOGFONTW* pFont) const
|
||||||
{
|
{
|
||||||
ATLASSERT(m_hTheme != NULL);
|
ATLASSERT(m_hTheme != NULL);
|
||||||
#ifdef _WTL_NEW_UXTHEME
|
|
||||||
return ::GetThemeFont(m_hTheme, hDC, nPartID, nStateID, nPropID, pFont);
|
return ::GetThemeFont(m_hTheme, hDC, nPartID, nStateID, nPropID, pFont);
|
||||||
#else // !_WTL_NEW_UXTHEME
|
|
||||||
// Note: The cast to LOGFONT* is because uxtheme.h incorrectly uses it instead of LOGFONTW*
|
|
||||||
return ::GetThemeFont(m_hTheme, hDC, nPartID, nStateID, nPropID, (LOGFONT*)pFont);
|
|
||||||
#endif // !_WTL_NEW_UXTHEME
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT GetThemeRect(int nPartID, int nStateID, int nPropID, LPRECT pRect) const
|
HRESULT GetThemeRect(int nPartID, int nStateID, int nPropID, LPRECT pRect) const
|
||||||
|
@ -402,12 +356,7 @@ public:
|
||||||
HRESULT GetThemeSysFont(int nFontID, LOGFONTW* plf) const
|
HRESULT GetThemeSysFont(int nFontID, LOGFONTW* plf) const
|
||||||
{
|
{
|
||||||
ATLASSERT(m_hTheme != NULL);
|
ATLASSERT(m_hTheme != NULL);
|
||||||
#ifdef _WTL_NEW_UXTHEME
|
|
||||||
return ::GetThemeSysFont(m_hTheme, nFontID, plf);
|
return ::GetThemeSysFont(m_hTheme, nFontID, plf);
|
||||||
#else // !_WTL_NEW_UXTHEME
|
|
||||||
// Note: The cast to LOGFONT* is because uxtheme.h incorrectly uses it instead of LOGFONTW*
|
|
||||||
return ::GetThemeSysFont(m_hTheme, nFontID, (LOGFONT*)plf);
|
|
||||||
#endif // !_WTL_NEW_UXTHEME
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT GetThemeSysString(int nStringID, LPWSTR pszStringBuff, int cchMaxStringChars) const
|
HRESULT GetThemeSysString(int nStringID, LPWSTR pszStringBuff, int cchMaxStringChars) const
|
||||||
|
@ -422,7 +371,6 @@ public:
|
||||||
return ::GetThemeSysInt(m_hTheme, nIntID, pnValue);
|
return ::GetThemeSysInt(m_hTheme, nIntID, pnValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WTL_NEW_UXTHEME
|
|
||||||
HTHEME OpenThemeDataEx(HWND hWnd, LPCWSTR pszClassList, DWORD dwFlags)
|
HTHEME OpenThemeDataEx(HWND hWnd, LPCWSTR pszClassList, DWORD dwFlags)
|
||||||
{
|
{
|
||||||
if(!IsThemingSupported())
|
if(!IsThemingSupported())
|
||||||
|
@ -433,6 +381,7 @@ public:
|
||||||
return m_hTheme;
|
return m_hTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (_WIN32_WINNT >= 0x0600)
|
||||||
HRESULT DrawThemeTextEx(HDC hDC, int nPartID, int nStateID, LPCWSTR pszText, int cchText, DWORD dwTextFlags, LPRECT lpRect, const DTTOPTS* pOptions)
|
HRESULT DrawThemeTextEx(HDC hDC, int nPartID, int nStateID, LPCWSTR pszText, int cchText, DWORD dwTextFlags, LPRECT lpRect, const DTTOPTS* pOptions)
|
||||||
{
|
{
|
||||||
ATLASSERT(m_hTheme != NULL);
|
ATLASSERT(m_hTheme != NULL);
|
||||||
|
@ -444,7 +393,7 @@ public:
|
||||||
ATLASSERT(m_hTheme != NULL);
|
ATLASSERT(m_hTheme != NULL);
|
||||||
return ::GetThemeTransitionDuration(m_hTheme, nPartID, nFromStateID, nToStateID, nPropID, &dwDuration);
|
return ::GetThemeTransitionDuration(m_hTheme, nPartID, nFromStateID, nToStateID, nPropID, &dwDuration);
|
||||||
}
|
}
|
||||||
#endif // _WTL_NEW_UXTHEME
|
#endif // (_WIN32_WINNT >= 0x0600)
|
||||||
|
|
||||||
#if (_WIN32_WINNT >= 0x0600)
|
#if (_WIN32_WINNT >= 0x0600)
|
||||||
HRESULT GetThemeBitmap(int nPartID, int nStateID, int nPropID, ULONG uFlags, HBITMAP& hBitmap)
|
HRESULT GetThemeBitmap(int nPartID, int nStateID, int nPropID, ULONG uFlags, HBITMAP& hBitmap)
|
||||||
|
@ -459,6 +408,26 @@ public:
|
||||||
return ::GetThemeStream(m_hTheme, nPartID, nStateID, nPropID, ppvStream, pcbStream, hInstance);
|
return ::GetThemeStream(m_hTheme, nPartID, nStateID, nPropID, ppvStream, pcbStream, hInstance);
|
||||||
}
|
}
|
||||||
#endif // (_WIN32_WINNT >= 0x0600)
|
#endif // (_WIN32_WINNT >= 0x0600)
|
||||||
|
|
||||||
|
#if (_WIN32_WINNT >= 0x0602)
|
||||||
|
HRESULT GetThemeAnimationProperty(int iStoryboardId, int iTargetId, TA_PROPERTY eProperty, VOID* pvProperty, DWORD cbSize, DWORD* pcbSizeOut)
|
||||||
|
{
|
||||||
|
ATLASSERT(m_hTheme != NULL);
|
||||||
|
return ::GetThemeAnimationProperty(m_hTheme, iStoryboardId, iTargetId, eProperty, pvProperty, cbSize, pcbSizeOut);
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT GetThemeAnimationTransform(int iStoryboardId, int iTargetId, DWORD dwTransformIndex, TA_TRANSFORM* pTransform, DWORD cbSize, DWORD* pcbSizeOut)
|
||||||
|
{
|
||||||
|
ATLASSERT(m_hTheme != NULL);
|
||||||
|
return ::GetThemeAnimationTransform(m_hTheme, iStoryboardId, iTargetId, dwTransformIndex, pTransform, cbSize, pcbSizeOut);
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT GetThemeTimingFunction(int iTimingFunctionId, TA_TIMINGFUNCTION* pTimingFunction, DWORD cbSize, DWORD* pcbSizeOut)
|
||||||
|
{
|
||||||
|
ATLASSERT(m_hTheme != NULL);
|
||||||
|
return ::GetThemeTimingFunction(m_hTheme, iTimingFunctionId, pTimingFunction, cbSize, pcbSizeOut);
|
||||||
|
}
|
||||||
|
#endif // (_WIN32_WINNT >= 0x0602)
|
||||||
};
|
};
|
||||||
|
|
||||||
__declspec(selectany) int CTheme::m_nIsThemingSupported = -1;
|
__declspec(selectany) int CTheme::m_nIsThemingSupported = -1;
|
||||||
|
@ -493,17 +462,17 @@ inline bool AtlDrawThemeClientEdge(HTHEME hTheme, HWND hWnd, HRGN hRgnUpdate = N
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Get border size
|
// Get border size
|
||||||
int cxBorder = GetSystemMetrics(SM_CXBORDER);
|
int cxBorder = ::GetSystemMetrics(SM_CXBORDER);
|
||||||
int cyBorder = GetSystemMetrics(SM_CYBORDER);
|
int cyBorder = ::GetSystemMetrics(SM_CYBORDER);
|
||||||
if(SUCCEEDED(::GetThemeInt(hTheme, nPartID, nStateID, TMT_SIZINGBORDERWIDTH, &cxBorder)))
|
if(SUCCEEDED(::GetThemeInt(hTheme, nPartID, nStateID, TMT_SIZINGBORDERWIDTH, &cxBorder)))
|
||||||
cyBorder = cxBorder;
|
cyBorder = cxBorder;
|
||||||
|
|
||||||
RECT rect;
|
RECT rect = {};
|
||||||
::GetWindowRect(hWnd, &rect);
|
::GetWindowRect(hWnd, &rect);
|
||||||
|
|
||||||
// Remove the client edge from the update region
|
// Remove the client edge from the update region
|
||||||
int cxEdge = GetSystemMetrics(SM_CXEDGE);
|
int cxEdge = ::GetSystemMetrics(SM_CXEDGE);
|
||||||
int cyEdge = GetSystemMetrics(SM_CYEDGE);
|
int cyEdge = ::GetSystemMetrics(SM_CYEDGE);
|
||||||
::InflateRect(&rect, -cxEdge, -cyEdge);
|
::InflateRect(&rect, -cxEdge, -cyEdge);
|
||||||
CRgn rgn;
|
CRgn rgn;
|
||||||
rgn.CreateRectRgnIndirect(&rect);
|
rgn.CreateRectRgnIndirect(&rect);
|
||||||
|
@ -522,15 +491,10 @@ inline bool AtlDrawThemeClientEdge(HTHEME hTheme, HWND hWnd, HRGN hRgnUpdate = N
|
||||||
::DrawThemeBackground(hTheme, dc, nPartID, nStateID, &rect, NULL);
|
::DrawThemeBackground(hTheme, dc, nPartID, nStateID, &rect, NULL);
|
||||||
|
|
||||||
// Use background brush too, since theme border might not cover everything
|
// Use background brush too, since theme border might not cover everything
|
||||||
if(cxBorder < cxEdge && cyBorder < cyEdge)
|
if((cxBorder < cxEdge) && (cyBorder < cyEdge))
|
||||||
{
|
{
|
||||||
if(hBrush == NULL)
|
if(hBrush == NULL)
|
||||||
// need conditional code because types don't match in winuser.h
|
|
||||||
#ifdef _WIN64
|
|
||||||
hBrush = (HBRUSH)::GetClassLongPtr(hWnd, GCLP_HBRBACKGROUND);
|
hBrush = (HBRUSH)::GetClassLongPtr(hWnd, GCLP_HBRBACKGROUND);
|
||||||
#else
|
|
||||||
hBrush = (HBRUSH)UlongToPtr(::GetClassLongPtr(hWnd, GCLP_HBRBACKGROUND));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
::InflateRect(&rect, cxBorder - cxEdge, cyBorder - cyEdge);
|
::InflateRect(&rect, cxBorder - cxEdge, cyBorder - cyEdge);
|
||||||
dc.FillRect(&rect, hBrush);
|
dc.FillRect(&rect, hBrush);
|
||||||
|
@ -580,7 +544,7 @@ public:
|
||||||
if(m_lpstrThemeClassList == NULL)
|
if(m_lpstrThemeClassList == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
SecureHelper::strcpyW_x(m_lpstrThemeClassList, cchLen, lpstrThemeClassList);
|
ATL::Checked::wcscpy_s(m_lpstrThemeClassList, cchLen, lpstrThemeClassList);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -591,7 +555,7 @@ public:
|
||||||
if(cchListBuffer < cchLen)
|
if(cchListBuffer < cchLen)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
SecureHelper::strcpyW_x(lpstrThemeClassList, cchListBuffer, m_lpstrThemeClassList);
|
ATL::Checked::wcscpy_s(lpstrThemeClassList, cchListBuffer, m_lpstrThemeClassList);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -608,6 +572,7 @@ public:
|
||||||
m_dwExtendedStyle = dwExtendedStyle;
|
m_dwExtendedStyle = dwExtendedStyle;
|
||||||
else
|
else
|
||||||
m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask);
|
m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask);
|
||||||
|
|
||||||
return dwPrevStyle;
|
return dwPrevStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -624,7 +589,8 @@ public:
|
||||||
ATLASSERT(m_lpstrThemeClassList != NULL);
|
ATLASSERT(m_lpstrThemeClassList != NULL);
|
||||||
if(m_lpstrThemeClassList == NULL)
|
if(m_lpstrThemeClassList == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
CloseThemeData();
|
this->CloseThemeData();
|
||||||
|
|
||||||
return TBase::OpenThemeData(pT->m_hWnd, m_lpstrThemeClassList);
|
return TBase::OpenThemeData(pT->m_hWnd, m_lpstrThemeClassList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -632,12 +598,13 @@ public:
|
||||||
{
|
{
|
||||||
if(!SetThemeClassList(pszClassList))
|
if(!SetThemeClassList(pszClassList))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return OpenThemeData();
|
return OpenThemeData();
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT SetWindowTheme(LPCWSTR pszSubAppName, LPCWSTR pszSubIDList)
|
HRESULT SetWindowTheme(LPCWSTR pszSubAppName, LPCWSTR pszSubIDList)
|
||||||
{
|
{
|
||||||
if(!IsThemingSupported())
|
if(!this->IsThemingSupported())
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
|
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
|
@ -647,7 +614,7 @@ public:
|
||||||
|
|
||||||
HTHEME GetWindowTheme() const
|
HTHEME GetWindowTheme() const
|
||||||
{
|
{
|
||||||
if(!IsThemingSupported())
|
if(!this->IsThemingSupported())
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
const T* pT = static_cast<const T*>(this);
|
const T* pT = static_cast<const T*>(this);
|
||||||
|
@ -657,7 +624,7 @@ public:
|
||||||
|
|
||||||
HRESULT EnableThemeDialogTexture(DWORD dwFlags)
|
HRESULT EnableThemeDialogTexture(DWORD dwFlags)
|
||||||
{
|
{
|
||||||
if(!IsThemingSupported())
|
if(!this->IsThemingSupported())
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
|
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
|
@ -667,7 +634,7 @@ public:
|
||||||
|
|
||||||
BOOL IsThemeDialogTextureEnabled() const
|
BOOL IsThemeDialogTextureEnabled() const
|
||||||
{
|
{
|
||||||
if(!IsThemingSupported())
|
if(!this->IsThemingSupported())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
const T* pT = static_cast<const T*>(this);
|
const T* pT = static_cast<const T*>(this);
|
||||||
|
@ -677,22 +644,18 @@ public:
|
||||||
|
|
||||||
HRESULT DrawThemeParentBackground(HDC hDC, const RECT* pRect = NULL)
|
HRESULT DrawThemeParentBackground(HDC hDC, const RECT* pRect = NULL)
|
||||||
{
|
{
|
||||||
if(!IsThemingSupported())
|
if(!this->IsThemingSupported())
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
|
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||||
#ifdef _WTL_NEW_UXTHEME
|
|
||||||
return ::DrawThemeParentBackground(pT->m_hWnd, hDC, pRect);
|
return ::DrawThemeParentBackground(pT->m_hWnd, hDC, pRect);
|
||||||
#else
|
|
||||||
return ::DrawThemeParentBackground(pT->m_hWnd, hDC, (RECT*)pRect);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WTL_NEW_UXTHEME
|
#if (_WIN32_WINNT >= 0x0600)
|
||||||
HRESULT SetWindowThemeAttribute(WINDOWTHEMEATTRIBUTETYPE type, PVOID pvAttribute, DWORD cbAttribute)
|
HRESULT SetWindowThemeAttribute(WINDOWTHEMEATTRIBUTETYPE type, PVOID pvAttribute, DWORD cbAttribute)
|
||||||
{
|
{
|
||||||
if(!IsThemingSupported())
|
if(!this->IsThemingSupported())
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
|
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
|
@ -702,7 +665,7 @@ public:
|
||||||
|
|
||||||
HRESULT SetWindowThemeNonClientAttributes(DWORD dwAttributes, DWORD dwMask)
|
HRESULT SetWindowThemeNonClientAttributes(DWORD dwAttributes, DWORD dwMask)
|
||||||
{
|
{
|
||||||
if(!IsThemingSupported())
|
if(!this->IsThemingSupported())
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
|
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
|
@ -713,14 +676,14 @@ public:
|
||||||
|
|
||||||
HRESULT DrawThemeParentBackgroundEx(HDC hDC, DWORD dwFlags, const RECT* lpRect = NULL)
|
HRESULT DrawThemeParentBackgroundEx(HDC hDC, DWORD dwFlags, const RECT* lpRect = NULL)
|
||||||
{
|
{
|
||||||
if(!IsThemingSupported())
|
if(!this->IsThemingSupported())
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
|
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||||
return ::DrawThemeParentBackgroundEx(pT->m_hWnd, hDC, dwFlags, lpRect);
|
return ::DrawThemeParentBackgroundEx(pT->m_hWnd, hDC, dwFlags, lpRect);
|
||||||
}
|
}
|
||||||
#endif // _WTL_NEW_UXTHEME
|
#endif // (_WIN32_WINNT >= 0x0600)
|
||||||
|
|
||||||
// Message map and handlers
|
// Message map and handlers
|
||||||
// Note: If you handle any of these messages in your derived class,
|
// Note: If you handle any of these messages in your derived class,
|
||||||
|
@ -736,22 +699,25 @@ public:
|
||||||
{
|
{
|
||||||
if(m_lpstrThemeClassList != NULL)
|
if(m_lpstrThemeClassList != NULL)
|
||||||
OpenThemeData();
|
OpenThemeData();
|
||||||
|
|
||||||
bHandled = FALSE;
|
bHandled = FALSE;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
|
LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
CloseThemeData();
|
this->CloseThemeData();
|
||||||
|
|
||||||
bHandled = FALSE;
|
bHandled = FALSE;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT OnThemeChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
|
LRESULT OnThemeChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
CloseThemeData();
|
this->CloseThemeData();
|
||||||
if(m_lpstrThemeClassList != NULL)
|
if(m_lpstrThemeClassList != NULL)
|
||||||
OpenThemeData();
|
this->OpenThemeData();
|
||||||
|
|
||||||
bHandled = FALSE;
|
bHandled = FALSE;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -762,20 +728,21 @@ public:
|
||||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||||
LRESULT lRet = 0;
|
LRESULT lRet = 0;
|
||||||
bHandled = FALSE;
|
bHandled = FALSE;
|
||||||
if(IsThemingSupported() && ((pT->GetExStyle() & WS_EX_CLIENTEDGE) != 0))
|
if(this->IsThemingSupported() && ((pT->GetExStyle() & WS_EX_CLIENTEDGE) != 0))
|
||||||
{
|
{
|
||||||
if((m_dwExtendedStyle & THEME_EX_3DCLIENTEDGE) != 0)
|
if((m_dwExtendedStyle & THEME_EX_3DCLIENTEDGE) != 0)
|
||||||
{
|
{
|
||||||
lRet = ::DefWindowProc(pT->m_hWnd, uMsg, wParam, lParam);
|
lRet = ::DefWindowProc(pT->m_hWnd, uMsg, wParam, lParam);
|
||||||
bHandled = TRUE;
|
bHandled = TRUE;
|
||||||
}
|
}
|
||||||
else if((m_hTheme != NULL) && ((m_dwExtendedStyle & THEME_EX_THEMECLIENTEDGE) != 0))
|
else if((this->m_hTheme != NULL) && ((m_dwExtendedStyle & THEME_EX_THEMECLIENTEDGE) != 0))
|
||||||
{
|
{
|
||||||
HRGN hRgn = (wParam != 1) ? (HRGN)wParam : NULL;
|
HRGN hRgn = (wParam != 1) ? (HRGN)wParam : NULL;
|
||||||
if(pT->DrawThemeClientEdge(hRgn))
|
if(pT->DrawThemeClientEdge(hRgn))
|
||||||
bHandled = TRUE;
|
bHandled = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return lRet;
|
return lRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -783,14 +750,14 @@ public:
|
||||||
bool DrawThemeClientEdge(HRGN hRgnUpdate)
|
bool DrawThemeClientEdge(HRGN hRgnUpdate)
|
||||||
{
|
{
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
return AtlDrawThemeClientEdge(m_hTheme, pT->m_hWnd, hRgnUpdate, NULL, 0, 0);
|
return AtlDrawThemeClientEdge(this->m_hTheme, pT->m_hWnd, hRgnUpdate, NULL, 0, 0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Buffered Paint and Animation
|
// Buffered Paint and Animation
|
||||||
|
|
||||||
#ifdef _WTL_NEW_UXTHEME
|
#if (_WIN32_WINNT >= 0x0600)
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// CBufferedPaintBase - Buffered Paint support for othe classes
|
// CBufferedPaintBase - Buffered Paint support for othe classes
|
||||||
|
@ -955,7 +922,7 @@ public:
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
if(wParam != NULL)
|
if(wParam != NULL)
|
||||||
{
|
{
|
||||||
RECT rect = { 0 };
|
RECT rect = {};
|
||||||
pT->GetClientRect(&rect);
|
pT->GetClientRect(&rect);
|
||||||
pT->DoPaint((HDC)wParam, rect);
|
pT->DoPaint((HDC)wParam, rect);
|
||||||
}
|
}
|
||||||
|
@ -1051,6 +1018,11 @@ public:
|
||||||
{
|
{
|
||||||
return (::BufferedPaintRenderAnimation(hWnd, hDC) != FALSE);
|
return (::BufferedPaintRenderAnimation(hWnd, hDC) != FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static HRESULT StopAllAnimations(HWND hWnd)
|
||||||
|
{
|
||||||
|
return ::BufferedPaintStopAllAnimations(hWnd);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1125,7 +1097,7 @@ public:
|
||||||
T* pT = static_cast<T*>(this);
|
T* pT = static_cast<T*>(this);
|
||||||
if(wParam != NULL)
|
if(wParam != NULL)
|
||||||
{
|
{
|
||||||
RECT rect = { 0 };
|
RECT rect = {};
|
||||||
pT->GetClientRect(&rect);
|
pT->GetClientRect(&rect);
|
||||||
pT->DoPaint((HDC)wParam, rect, m_NewState);
|
pT->DoPaint((HDC)wParam, rect, m_NewState);
|
||||||
}
|
}
|
||||||
|
@ -1211,8 +1183,8 @@ public:
|
||||||
END_MSG_MAP()
|
END_MSG_MAP()
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _WTL_NEW_UXTHEME
|
#endif // (_WIN32_WINNT >= 0x0600)
|
||||||
|
|
||||||
}; // namespace WTL
|
} // namespace WTL
|
||||||
|
|
||||||
#endif // __ATLTHEME_H__
|
#endif // __ATLTHEME_H__
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
// Windows Template Library - WTL version 8.1
|
// Windows Template Library - WTL version 10.0
|
||||||
// Copyright (C) Microsoft Corporation. All rights reserved.
|
// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved.
|
||||||
//
|
//
|
||||||
// This file is a part of the Windows Template Library.
|
// This file is a part of the Windows Template Library.
|
||||||
// The use and distribution terms for this software are covered by the
|
// The use and distribution terms for this software are covered by the
|
||||||
// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php)
|
// Microsoft Public License (http://opensource.org/licenses/MS-PL)
|
||||||
// which can be found in the file CPL.TXT at the root of this distribution.
|
// which can be found in the file MS-PL.txt at the root folder.
|
||||||
// By using this software in any fashion, you are agreeing to be bound by
|
|
||||||
// the terms of this license. You must not remove this notice, or
|
|
||||||
// any other, from this software.
|
|
||||||
|
|
||||||
#ifndef __ATLUSER_H__
|
#ifndef __ATLUSER_H__
|
||||||
#define __ATLUSER_H__
|
#define __ATLUSER_H__
|
||||||
|
@ -57,7 +54,7 @@ namespace WTL
|
||||||
|
|
||||||
inline int AtlMessageBox(HWND hWndOwner, ATL::_U_STRINGorID message, ATL::_U_STRINGorID title = (LPCTSTR)NULL, UINT uType = MB_OK | MB_ICONINFORMATION)
|
inline int AtlMessageBox(HWND hWndOwner, ATL::_U_STRINGorID message, ATL::_U_STRINGorID title = (LPCTSTR)NULL, UINT uType = MB_OK | MB_ICONINFORMATION)
|
||||||
{
|
{
|
||||||
ATLASSERT(hWndOwner == NULL || ::IsWindow(hWndOwner));
|
ATLASSERT((hWndOwner == NULL) || ::IsWindow(hWndOwner));
|
||||||
|
|
||||||
LPTSTR lpstrMessage = NULL;
|
LPTSTR lpstrMessage = NULL;
|
||||||
if(IS_INTRESOURCE(message.m_lpstr))
|
if(IS_INTRESOURCE(message.m_lpstr))
|
||||||
|
@ -81,7 +78,7 @@ inline int AtlMessageBox(HWND hWndOwner, ATL::_U_STRINGorID message, ATL::_U_STR
|
||||||
}
|
}
|
||||||
|
|
||||||
LPTSTR lpstrTitle = NULL;
|
LPTSTR lpstrTitle = NULL;
|
||||||
if(IS_INTRESOURCE(title.m_lpstr) && LOWORD(title.m_lpstr) != 0)
|
if(IS_INTRESOURCE(title.m_lpstr) && (LOWORD(title.m_lpstr) != 0))
|
||||||
{
|
{
|
||||||
for(int nLen = 256; ; nLen *= 2)
|
for(int nLen = 256; ; nLen *= 2)
|
||||||
{
|
{
|
||||||
|
@ -113,19 +110,6 @@ inline int AtlMessageBox(HWND hWndOwner, ATL::_U_STRINGorID message, ATL::_U_STR
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// CMenu
|
// CMenu
|
||||||
|
|
||||||
#if (WINVER >= 0x0500)
|
|
||||||
#ifndef MII_SIZEOF_STRUCT
|
|
||||||
#define MII_SIZEOF_STRUCT(structname, member) (((int)((LPBYTE)(&((structname*)0)->member) - ((LPBYTE)((structname*)0)))) + sizeof(((structname*)0)->member))
|
|
||||||
#endif
|
|
||||||
#define MENUITEMINFO_SIZE_VERSION_400A MII_SIZEOF_STRUCT(MENUITEMINFOA, cch)
|
|
||||||
#define MENUITEMINFO_SIZE_VERSION_400W MII_SIZEOF_STRUCT(MENUITEMINFOW, cch)
|
|
||||||
#ifdef UNICODE
|
|
||||||
#define MENUITEMINFO_SIZE_VERSION_400 MENUITEMINFO_SIZE_VERSION_400W
|
|
||||||
#else
|
|
||||||
#define MENUITEMINFO_SIZE_VERSION_400 MENUITEMINFO_SIZE_VERSION_400A
|
|
||||||
#endif // !UNICODE
|
|
||||||
#endif // (WINVER >= 0x0500)
|
|
||||||
|
|
||||||
class CMenuItemInfo : public MENUITEMINFO
|
class CMenuItemInfo : public MENUITEMINFO
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -133,14 +117,6 @@ public:
|
||||||
{
|
{
|
||||||
memset(this, 0, sizeof(MENUITEMINFO));
|
memset(this, 0, sizeof(MENUITEMINFO));
|
||||||
cbSize = sizeof(MENUITEMINFO);
|
cbSize = sizeof(MENUITEMINFO);
|
||||||
#if (WINVER >= 0x0500)
|
|
||||||
// adjust struct size if running on older version of Windows
|
|
||||||
if(AtlIsOldWindows())
|
|
||||||
{
|
|
||||||
ATLASSERT(cbSize > MENUITEMINFO_SIZE_VERSION_400); // must be
|
|
||||||
cbSize = MENUITEMINFO_SIZE_VERSION_400;
|
|
||||||
}
|
|
||||||
#endif // (WINVER >= 0x0500)
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -164,7 +140,7 @@ public:
|
||||||
|
|
||||||
~CMenuT()
|
~CMenuT()
|
||||||
{
|
{
|
||||||
if(t_bManaged && m_hMenu != NULL)
|
if(t_bManaged && (m_hMenu != NULL))
|
||||||
DestroyMenu();
|
DestroyMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,7 +153,7 @@ public:
|
||||||
void Attach(HMENU hMenuNew)
|
void Attach(HMENU hMenuNew)
|
||||||
{
|
{
|
||||||
ATLASSERT(::IsMenu(hMenuNew));
|
ATLASSERT(::IsMenu(hMenuNew));
|
||||||
if(t_bManaged && m_hMenu != NULL && m_hMenu != hMenuNew)
|
if(t_bManaged && (m_hMenu != NULL) && (m_hMenu != hMenuNew))
|
||||||
::DestroyMenu(m_hMenu);
|
::DestroyMenu(m_hMenu);
|
||||||
m_hMenu = hMenuNew;
|
m_hMenu = hMenuNew;
|
||||||
}
|
}
|
||||||
|
@ -220,14 +196,12 @@ public:
|
||||||
return (m_hMenu != NULL) ? TRUE : FALSE;
|
return (m_hMenu != NULL) ? TRUE : FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
BOOL LoadMenuIndirect(const void* lpMenuTemplate)
|
BOOL LoadMenuIndirect(const void* lpMenuTemplate)
|
||||||
{
|
{
|
||||||
ATLASSERT(m_hMenu == NULL);
|
ATLASSERT(m_hMenu == NULL);
|
||||||
m_hMenu = ::LoadMenuIndirect(lpMenuTemplate);
|
m_hMenu = ::LoadMenuIndirect(lpMenuTemplate);
|
||||||
return (m_hMenu != NULL) ? TRUE : FALSE;
|
return (m_hMenu != NULL) ? TRUE : FALSE;
|
||||||
}
|
}
|
||||||
#endif // !_WIN32_WCE
|
|
||||||
|
|
||||||
BOOL DestroyMenu()
|
BOOL DestroyMenu()
|
||||||
{
|
{
|
||||||
|
@ -249,27 +223,17 @@ public:
|
||||||
BOOL TrackPopupMenu(UINT nFlags, int x, int y, HWND hWnd, LPCRECT lpRect = NULL)
|
BOOL TrackPopupMenu(UINT nFlags, int x, int y, HWND hWnd, LPCRECT lpRect = NULL)
|
||||||
{
|
{
|
||||||
ATLASSERT(::IsMenu(m_hMenu));
|
ATLASSERT(::IsMenu(m_hMenu));
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
#if (WINVER >= 0x0500)
|
|
||||||
x = _FixTrackMenuPopupX(x, y);
|
x = _FixTrackMenuPopupX(x, y);
|
||||||
#endif // !(WINVER >= 0x0500)
|
|
||||||
return ::TrackPopupMenu(m_hMenu, nFlags, x, y, 0, hWnd, lpRect);
|
return ::TrackPopupMenu(m_hMenu, nFlags, x, y, 0, hWnd, lpRect);
|
||||||
#else // CE specific
|
|
||||||
lpRect;
|
|
||||||
return ::TrackPopupMenuEx(m_hMenu, nFlags, x, y, hWnd, NULL);
|
|
||||||
#endif // _WIN32_WCE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL TrackPopupMenuEx(UINT uFlags, int x, int y, HWND hWnd, LPTPMPARAMS lptpm = NULL)
|
BOOL TrackPopupMenuEx(UINT uFlags, int x, int y, HWND hWnd, LPTPMPARAMS lptpm = NULL)
|
||||||
{
|
{
|
||||||
ATLASSERT(::IsMenu(m_hMenu));
|
ATLASSERT(::IsMenu(m_hMenu));
|
||||||
#if (WINVER >= 0x0500) && !defined(_WIN32_WCE)
|
|
||||||
x = _FixTrackMenuPopupX(x, y);
|
x = _FixTrackMenuPopupX(x, y);
|
||||||
#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE)
|
|
||||||
return ::TrackPopupMenuEx(m_hMenu, uFlags, x, y, hWnd, lptpm);
|
return ::TrackPopupMenuEx(m_hMenu, uFlags, x, y, hWnd, lptpm);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (WINVER >= 0x0500) && !defined(_WIN32_WCE)
|
|
||||||
// helper that fixes popup menu X position when it's off-screen
|
// helper that fixes popup menu X position when it's off-screen
|
||||||
static int _FixTrackMenuPopupX(int x, int y)
|
static int _FixTrackMenuPopupX(int x, int y)
|
||||||
{
|
{
|
||||||
|
@ -280,8 +244,7 @@ public:
|
||||||
HMONITOR hMonitorNear = ::MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST);
|
HMONITOR hMonitorNear = ::MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST);
|
||||||
if(hMonitorNear != NULL)
|
if(hMonitorNear != NULL)
|
||||||
{
|
{
|
||||||
MONITORINFO mi = { 0 };
|
MONITORINFO mi = { sizeof(MONITORINFO) };
|
||||||
mi.cbSize = sizeof(MONITORINFO);
|
|
||||||
if(::GetMonitorInfo(hMonitorNear, &mi) != FALSE)
|
if(::GetMonitorInfo(hMonitorNear, &mi) != FALSE)
|
||||||
{
|
{
|
||||||
if(x < mi.rcWork.left)
|
if(x < mi.rcWork.left)
|
||||||
|
@ -306,7 +269,6 @@ public:
|
||||||
ATLASSERT(::IsMenu(m_hMenu));
|
ATLASSERT(::IsMenu(m_hMenu));
|
||||||
return ::SetMenuInfo(m_hMenu, lpMenuInfo);
|
return ::SetMenuInfo(m_hMenu, lpMenuInfo);
|
||||||
}
|
}
|
||||||
#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE)
|
|
||||||
|
|
||||||
// Menu Item Operations
|
// Menu Item Operations
|
||||||
BOOL AppendMenu(UINT nFlags, UINT_PTR nIDNewItem = 0, LPCTSTR lpszNewItem = NULL)
|
BOOL AppendMenu(UINT nFlags, UINT_PTR nIDNewItem = 0, LPCTSTR lpszNewItem = NULL)
|
||||||
|
@ -322,7 +284,6 @@ public:
|
||||||
return ::AppendMenu(m_hMenu, nFlags | MF_POPUP, (UINT_PTR)hSubMenu, lpszNewItem);
|
return ::AppendMenu(m_hMenu, nFlags | MF_POPUP, (UINT_PTR)hSubMenu, lpszNewItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
BOOL AppendMenu(UINT nFlags, UINT_PTR nIDNewItem, HBITMAP hBmp)
|
BOOL AppendMenu(UINT nFlags, UINT_PTR nIDNewItem, HBITMAP hBmp)
|
||||||
{
|
{
|
||||||
ATLASSERT(::IsMenu(m_hMenu));
|
ATLASSERT(::IsMenu(m_hMenu));
|
||||||
|
@ -335,7 +296,6 @@ public:
|
||||||
ATLASSERT(::IsMenu(hSubMenu));
|
ATLASSERT(::IsMenu(hSubMenu));
|
||||||
return ::AppendMenu(m_hMenu, nFlags | (MF_BITMAP | MF_POPUP), (UINT_PTR)hSubMenu, (LPCTSTR)hBmp);
|
return ::AppendMenu(m_hMenu, nFlags | (MF_BITMAP | MF_POPUP), (UINT_PTR)hSubMenu, (LPCTSTR)hBmp);
|
||||||
}
|
}
|
||||||
#endif // !_WIN32_WCE
|
|
||||||
|
|
||||||
UINT CheckMenuItem(UINT nIDCheckItem, UINT nCheck)
|
UINT CheckMenuItem(UINT nIDCheckItem, UINT nCheck)
|
||||||
{
|
{
|
||||||
|
@ -349,7 +309,6 @@ public:
|
||||||
return ::EnableMenuItem(m_hMenu, nIDEnableItem, nEnable);
|
return ::EnableMenuItem(m_hMenu, nIDEnableItem, nEnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
BOOL HiliteMenuItem(HWND hWnd, UINT uIDHiliteItem, UINT uHilite)
|
BOOL HiliteMenuItem(HWND hWnd, UINT uIDHiliteItem, UINT uHilite)
|
||||||
{
|
{
|
||||||
ATLASSERT(::IsMenu(m_hMenu));
|
ATLASSERT(::IsMenu(m_hMenu));
|
||||||
|
@ -386,7 +345,6 @@ public:
|
||||||
return ::GetMenuString(m_hMenu, nIDItem, NULL, 0, nFlags);
|
return ::GetMenuString(m_hMenu, nIDItem, NULL, 0, nFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _ATL_NO_COM
|
|
||||||
BOOL GetMenuString(UINT nIDItem, BSTR& bstrText, UINT nFlags) const
|
BOOL GetMenuString(UINT nIDItem, BSTR& bstrText, UINT nFlags) const
|
||||||
{
|
{
|
||||||
USES_CONVERSION;
|
USES_CONVERSION;
|
||||||
|
@ -401,7 +359,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
nLen++; // increment to include terminating NULL char
|
nLen++; // increment to include terminating NULL char
|
||||||
CTempBuffer<TCHAR, _WTL_STACK_ALLOC_THRESHOLD> buff;
|
ATL::CTempBuffer<TCHAR, _WTL_STACK_ALLOC_THRESHOLD> buff;
|
||||||
LPTSTR lpszText = buff.Allocate(nLen);
|
LPTSTR lpszText = buff.Allocate(nLen);
|
||||||
if(lpszText == NULL)
|
if(lpszText == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -412,42 +370,9 @@ public:
|
||||||
bstrText = ::SysAllocString(T2OLE(lpszText));
|
bstrText = ::SysAllocString(T2OLE(lpszText));
|
||||||
return (bstrText != NULL) ? TRUE : FALSE;
|
return (bstrText != NULL) ? TRUE : FALSE;
|
||||||
}
|
}
|
||||||
#endif // !_ATL_NO_COM
|
|
||||||
|
|
||||||
#elif (_ATL_VER >= 0x0800)
|
#ifdef __ATLSTR_H__
|
||||||
int GetMenuItemCount() const
|
int GetMenuString(UINT nIDItem, ATL::CString& strText, UINT nFlags) const
|
||||||
{
|
|
||||||
ATLASSERT(::IsMenu(m_hMenu));
|
|
||||||
return ATL::GetMenuItemCount(m_hMenu);
|
|
||||||
}
|
|
||||||
|
|
||||||
UINT GetMenuItemID(int nPos) const
|
|
||||||
{
|
|
||||||
ATLASSERT(::IsMenu(m_hMenu));
|
|
||||||
return ATL::GetMenuItemID(m_hMenu, nPos);
|
|
||||||
}
|
|
||||||
|
|
||||||
UINT GetMenuState(UINT nID, UINT nFlags) const
|
|
||||||
{
|
|
||||||
ATLASSERT(::IsMenu(m_hMenu));
|
|
||||||
return ATL::GetMenuState(m_hMenu, nID, nFlags);
|
|
||||||
}
|
|
||||||
|
|
||||||
int GetMenuString(UINT nIDItem, LPTSTR lpString, int nMaxCount, UINT nFlags) const
|
|
||||||
{
|
|
||||||
ATLASSERT(::IsMenu(m_hMenu));
|
|
||||||
return ATL::GetMenuString(m_hMenu, nIDItem, lpString, nMaxCount, nFlags);
|
|
||||||
}
|
|
||||||
|
|
||||||
int GetMenuStringLen(UINT nIDItem, UINT nFlags) const
|
|
||||||
{
|
|
||||||
ATLASSERT(::IsMenu(m_hMenu));
|
|
||||||
return ATL::GetMenuString(m_hMenu, nIDItem, NULL, 0, nFlags);
|
|
||||||
}
|
|
||||||
#endif // (_ATL_VER >= 0x0800)
|
|
||||||
|
|
||||||
#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__)
|
|
||||||
int GetMenuString(UINT nIDItem, _CSTRING_NS::CString& strText, UINT nFlags) const
|
|
||||||
{
|
{
|
||||||
ATLASSERT(::IsMenu(m_hMenu));
|
ATLASSERT(::IsMenu(m_hMenu));
|
||||||
|
|
||||||
|
@ -463,7 +388,7 @@ public:
|
||||||
strText.ReleaseBuffer();
|
strText.ReleaseBuffer();
|
||||||
return nRet;
|
return nRet;
|
||||||
}
|
}
|
||||||
#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__)
|
#endif // __ATLSTR_H__
|
||||||
|
|
||||||
CMenuHandle GetSubMenu(int nPos) const
|
CMenuHandle GetSubMenu(int nPos) const
|
||||||
{
|
{
|
||||||
|
@ -484,7 +409,6 @@ public:
|
||||||
return ::InsertMenu(m_hMenu, nPosition, nFlags | MF_POPUP, (UINT_PTR)hSubMenu, lpszNewItem);
|
return ::InsertMenu(m_hMenu, nPosition, nFlags | MF_POPUP, (UINT_PTR)hSubMenu, lpszNewItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
BOOL InsertMenu(UINT nPosition, UINT nFlags, UINT_PTR nIDNewItem, HBITMAP hBmp)
|
BOOL InsertMenu(UINT nPosition, UINT nFlags, UINT_PTR nIDNewItem, HBITMAP hBmp)
|
||||||
{
|
{
|
||||||
ATLASSERT(::IsMenu(m_hMenu));
|
ATLASSERT(::IsMenu(m_hMenu));
|
||||||
|
@ -523,7 +447,6 @@ public:
|
||||||
ATLASSERT(::IsMenu(hSubMenu));
|
ATLASSERT(::IsMenu(hSubMenu));
|
||||||
return ::ModifyMenu(m_hMenu, nPosition, nFlags | (MF_BITMAP | MF_POPUP), (UINT_PTR)hSubMenu, (LPCTSTR)hBmp);
|
return ::ModifyMenu(m_hMenu, nPosition, nFlags | (MF_BITMAP | MF_POPUP), (UINT_PTR)hSubMenu, (LPCTSTR)hBmp);
|
||||||
}
|
}
|
||||||
#endif // !_WIN32_WCE
|
|
||||||
|
|
||||||
BOOL RemoveMenu(UINT nPosition, UINT nFlags)
|
BOOL RemoveMenu(UINT nPosition, UINT nFlags)
|
||||||
{
|
{
|
||||||
|
@ -531,13 +454,11 @@ public:
|
||||||
return ::RemoveMenu(m_hMenu, nPosition, nFlags);
|
return ::RemoveMenu(m_hMenu, nPosition, nFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
BOOL SetMenuItemBitmaps(UINT nPosition, UINT nFlags, HBITMAP hBmpUnchecked, HBITMAP hBmpChecked)
|
BOOL SetMenuItemBitmaps(UINT nPosition, UINT nFlags, HBITMAP hBmpUnchecked, HBITMAP hBmpChecked)
|
||||||
{
|
{
|
||||||
ATLASSERT(::IsMenu(m_hMenu));
|
ATLASSERT(::IsMenu(m_hMenu));
|
||||||
return ::SetMenuItemBitmaps(m_hMenu, nPosition, nFlags, hBmpUnchecked, hBmpChecked);
|
return ::SetMenuItemBitmaps(m_hMenu, nPosition, nFlags, hBmpUnchecked, hBmpChecked);
|
||||||
}
|
}
|
||||||
#endif // !_WIN32_WCE
|
|
||||||
|
|
||||||
BOOL CheckMenuRadioItem(UINT nIDFirst, UINT nIDLast, UINT nIDItem, UINT nFlags)
|
BOOL CheckMenuRadioItem(UINT nIDFirst, UINT nIDLast, UINT nIDItem, UINT nFlags)
|
||||||
{
|
{
|
||||||
|
@ -557,7 +478,6 @@ public:
|
||||||
return (BOOL)::SetMenuItemInfo(m_hMenu, uItem, bByPosition, lpmii);
|
return (BOOL)::SetMenuItemInfo(m_hMenu, uItem, bByPosition, lpmii);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
BOOL InsertMenuItem(UINT uItem, BOOL bByPosition, LPMENUITEMINFO lpmii)
|
BOOL InsertMenuItem(UINT uItem, BOOL bByPosition, LPMENUITEMINFO lpmii)
|
||||||
{
|
{
|
||||||
ATLASSERT(::IsMenu(m_hMenu));
|
ATLASSERT(::IsMenu(m_hMenu));
|
||||||
|
@ -600,7 +520,6 @@ public:
|
||||||
ATLASSERT(::IsMenu(m_hMenu));
|
ATLASSERT(::IsMenu(m_hMenu));
|
||||||
return ::GetMenuContextHelpId(m_hMenu);
|
return ::GetMenuContextHelpId(m_hMenu);
|
||||||
}
|
}
|
||||||
#endif // !_WIN32_WCE
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -619,7 +538,7 @@ public:
|
||||||
|
|
||||||
~CAcceleratorT()
|
~CAcceleratorT()
|
||||||
{
|
{
|
||||||
if(t_bManaged && m_hAccel != NULL)
|
if(t_bManaged && (m_hAccel != NULL))
|
||||||
::DestroyAcceleratorTable(m_hAccel);
|
::DestroyAcceleratorTable(m_hAccel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -631,7 +550,7 @@ public:
|
||||||
|
|
||||||
void Attach(HACCEL hAccel)
|
void Attach(HACCEL hAccel)
|
||||||
{
|
{
|
||||||
if(t_bManaged && m_hAccel != NULL)
|
if(t_bManaged && (m_hAccel != NULL))
|
||||||
::DestroyAcceleratorTable(m_hAccel);
|
::DestroyAcceleratorTable(m_hAccel);
|
||||||
m_hAccel = hAccel;
|
m_hAccel = hAccel;
|
||||||
}
|
}
|
||||||
|
@ -673,7 +592,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Operations
|
// Operations
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
int CopyAcceleratorTable(LPACCEL lpAccelDst, int cEntries)
|
int CopyAcceleratorTable(LPACCEL lpAccelDst, int cEntries)
|
||||||
{
|
{
|
||||||
ATLASSERT(m_hAccel != NULL);
|
ATLASSERT(m_hAccel != NULL);
|
||||||
|
@ -686,7 +604,6 @@ public:
|
||||||
ATLASSERT(m_hAccel != NULL);
|
ATLASSERT(m_hAccel != NULL);
|
||||||
return ::CopyAcceleratorTable(m_hAccel, NULL, 0);
|
return ::CopyAcceleratorTable(m_hAccel, NULL, 0);
|
||||||
}
|
}
|
||||||
#endif // !_WIN32_WCE
|
|
||||||
|
|
||||||
BOOL TranslateAccelerator(HWND hWnd, LPMSG pMsg)
|
BOOL TranslateAccelerator(HWND hWnd, LPMSG pMsg)
|
||||||
{
|
{
|
||||||
|
@ -716,7 +633,7 @@ public:
|
||||||
|
|
||||||
~CIconT()
|
~CIconT()
|
||||||
{
|
{
|
||||||
if(t_bManaged && m_hIcon != NULL)
|
if(t_bManaged && (m_hIcon != NULL))
|
||||||
::DestroyIcon(m_hIcon);
|
::DestroyIcon(m_hIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -728,7 +645,7 @@ public:
|
||||||
|
|
||||||
void Attach(HICON hIcon)
|
void Attach(HICON hIcon)
|
||||||
{
|
{
|
||||||
if(t_bManaged && m_hIcon != NULL)
|
if(t_bManaged && (m_hIcon != NULL))
|
||||||
::DestroyIcon(m_hIcon);
|
::DestroyIcon(m_hIcon);
|
||||||
m_hIcon = hIcon;
|
m_hIcon = hIcon;
|
||||||
}
|
}
|
||||||
|
@ -759,7 +676,6 @@ public:
|
||||||
return m_hIcon;
|
return m_hIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
HICON LoadOEMIcon(LPCTSTR lpstrIconName)
|
HICON LoadOEMIcon(LPCTSTR lpstrIconName)
|
||||||
{
|
{
|
||||||
ATLASSERT(m_hIcon == NULL);
|
ATLASSERT(m_hIcon == NULL);
|
||||||
|
@ -793,7 +709,6 @@ public:
|
||||||
m_hIcon = ::CreateIconFromResourceEx(pbBits, cbBits, TRUE, dwVersion, cxDesired, cyDesired, uFlags);
|
m_hIcon = ::CreateIconFromResourceEx(pbBits, cbBits, TRUE, dwVersion, cxDesired, cyDesired, uFlags);
|
||||||
return m_hIcon;
|
return m_hIcon;
|
||||||
}
|
}
|
||||||
#endif // !_WIN32_WCE
|
|
||||||
|
|
||||||
HICON CreateIconIndirect(PICONINFO pIconInfo)
|
HICON CreateIconIndirect(PICONINFO pIconInfo)
|
||||||
{
|
{
|
||||||
|
@ -803,7 +718,6 @@ public:
|
||||||
return m_hIcon;
|
return m_hIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
HICON ExtractIcon(LPCTSTR lpszExeFileName, UINT nIconIndex)
|
HICON ExtractIcon(LPCTSTR lpszExeFileName, UINT nIconIndex)
|
||||||
{
|
{
|
||||||
ATLASSERT(m_hIcon == NULL);
|
ATLASSERT(m_hIcon == NULL);
|
||||||
|
@ -820,7 +734,6 @@ public:
|
||||||
m_hIcon = ::ExtractAssociatedIcon(hInst, lpIconPath, lpiIcon);
|
m_hIcon = ::ExtractAssociatedIcon(hInst, lpIconPath, lpiIcon);
|
||||||
return m_hIcon;
|
return m_hIcon;
|
||||||
}
|
}
|
||||||
#endif // !_WIN32_WCE
|
|
||||||
|
|
||||||
BOOL DestroyIcon()
|
BOOL DestroyIcon()
|
||||||
{
|
{
|
||||||
|
@ -832,7 +745,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Operations
|
// Operations
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
HICON CopyIcon()
|
HICON CopyIcon()
|
||||||
{
|
{
|
||||||
ATLASSERT(m_hIcon != NULL);
|
ATLASSERT(m_hIcon != NULL);
|
||||||
|
@ -844,26 +756,17 @@ public:
|
||||||
ATLASSERT(m_hIcon != NULL);
|
ATLASSERT(m_hIcon != NULL);
|
||||||
return ::DuplicateIcon(NULL, m_hIcon);
|
return ::DuplicateIcon(NULL, m_hIcon);
|
||||||
}
|
}
|
||||||
#endif // !_WIN32_WCE
|
|
||||||
|
|
||||||
BOOL DrawIcon(HDC hDC, int x, int y)
|
BOOL DrawIcon(HDC hDC, int x, int y)
|
||||||
{
|
{
|
||||||
ATLASSERT(m_hIcon != NULL);
|
ATLASSERT(m_hIcon != NULL);
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
return ::DrawIcon(hDC, x, y, m_hIcon);
|
return ::DrawIcon(hDC, x, y, m_hIcon);
|
||||||
#else // CE specific
|
|
||||||
return ::DrawIconEx(hDC, x, y, m_hIcon, 0, 0, 0, NULL, DI_NORMAL);
|
|
||||||
#endif // _WIN32_WCE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL DrawIcon(HDC hDC, POINT pt)
|
BOOL DrawIcon(HDC hDC, POINT pt)
|
||||||
{
|
{
|
||||||
ATLASSERT(m_hIcon != NULL);
|
ATLASSERT(m_hIcon != NULL);
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
return ::DrawIcon(hDC, pt.x, pt.y, m_hIcon);
|
return ::DrawIcon(hDC, pt.x, pt.y, m_hIcon);
|
||||||
#else // CE specific
|
|
||||||
return ::DrawIconEx(hDC, pt.x, pt.y, m_hIcon, 0, 0, 0, NULL, DI_NORMAL);
|
|
||||||
#endif // _WIN32_WCE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL DrawIconEx(HDC hDC, int x, int y, int cxWidth, int cyWidth, UINT uStepIfAniCur = 0, HBRUSH hbrFlickerFreeDraw = NULL, UINT uFlags = DI_NORMAL)
|
BOOL DrawIconEx(HDC hDC, int x, int y, int cxWidth, int cyWidth, UINT uStepIfAniCur = 0, HBRUSH hbrFlickerFreeDraw = NULL, UINT uFlags = DI_NORMAL)
|
||||||
|
@ -878,7 +781,6 @@ public:
|
||||||
return ::DrawIconEx(hDC, pt.x, pt.y, m_hIcon, size.cx, size.cy, uStepIfAniCur, hbrFlickerFreeDraw, uFlags);
|
return ::DrawIconEx(hDC, pt.x, pt.y, m_hIcon, size.cx, size.cy, uStepIfAniCur, hbrFlickerFreeDraw, uFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
BOOL GetIconInfo(PICONINFO pIconInfo) const
|
BOOL GetIconInfo(PICONINFO pIconInfo) const
|
||||||
{
|
{
|
||||||
ATLASSERT(m_hIcon != NULL);
|
ATLASSERT(m_hIcon != NULL);
|
||||||
|
@ -925,22 +827,19 @@ public:
|
||||||
return ::LoadIconWithScaleDown(NULL, (LPCWSTR)lpstrIconName, cx, cy, &m_hIcon);
|
return ::LoadIconWithScaleDown(NULL, (LPCWSTR)lpstrIconName, cx, cy, &m_hIcon);
|
||||||
}
|
}
|
||||||
#endif // defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN)
|
#endif // defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN)
|
||||||
#endif // !_WIN32_WCE
|
|
||||||
|
|
||||||
// Helper
|
// Helper
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
static bool IsOEMIcon(LPCTSTR lpstrIconName)
|
static bool IsOEMIcon(LPCTSTR lpstrIconName)
|
||||||
{
|
{
|
||||||
#if (WINVER >= 0x0600)
|
#if (WINVER >= 0x0600)
|
||||||
return (lpstrIconName == IDI_APPLICATION || lpstrIconName == IDI_ASTERISK || lpstrIconName == IDI_EXCLAMATION ||
|
return ((lpstrIconName == IDI_APPLICATION) || (lpstrIconName == IDI_ASTERISK) || (lpstrIconName == IDI_EXCLAMATION) ||
|
||||||
lpstrIconName == IDI_HAND || lpstrIconName == IDI_QUESTION || lpstrIconName == IDI_WINLOGO ||
|
(lpstrIconName == IDI_HAND) || (lpstrIconName == IDI_QUESTION) || (lpstrIconName == IDI_WINLOGO) ||
|
||||||
lpstrIconName == IDI_SHIELD);
|
(lpstrIconName == IDI_SHIELD));
|
||||||
#else // !(WINVER >= 0x0600)
|
#else // !(WINVER >= 0x0600)
|
||||||
return (lpstrIconName == IDI_APPLICATION || lpstrIconName == IDI_ASTERISK || lpstrIconName == IDI_EXCLAMATION ||
|
return ((lpstrIconName == IDI_APPLICATION) || (lpstrIconName == IDI_ASTERISK) || (lpstrIconName == IDI_EXCLAMATION) ||
|
||||||
lpstrIconName == IDI_HAND || lpstrIconName == IDI_QUESTION || lpstrIconName == IDI_WINLOGO);
|
(lpstrIconName == IDI_HAND) || (lpstrIconName == IDI_QUESTION) || (lpstrIconName == IDI_WINLOGO));
|
||||||
#endif // !(WINVER >= 0x0600)
|
#endif // !(WINVER >= 0x0600)
|
||||||
}
|
}
|
||||||
#endif // !_WIN32_WCE
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef CIconT<false> CIconHandle;
|
typedef CIconT<false> CIconHandle;
|
||||||
|
@ -967,7 +866,7 @@ public:
|
||||||
|
|
||||||
~CCursorT()
|
~CCursorT()
|
||||||
{
|
{
|
||||||
if(t_bManaged && m_hCursor != NULL)
|
if(t_bManaged && (m_hCursor != NULL))
|
||||||
DestroyCursor();
|
DestroyCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -979,7 +878,7 @@ public:
|
||||||
|
|
||||||
void Attach(HCURSOR hCursor)
|
void Attach(HCURSOR hCursor)
|
||||||
{
|
{
|
||||||
if(t_bManaged && m_hCursor != NULL)
|
if(t_bManaged && (m_hCursor != NULL))
|
||||||
DestroyCursor();
|
DestroyCursor();
|
||||||
m_hCursor = hCursor;
|
m_hCursor = hCursor;
|
||||||
}
|
}
|
||||||
|
@ -1006,20 +905,12 @@ public:
|
||||||
HCURSOR LoadSysCursor(LPCTSTR lpstrCursorName)
|
HCURSOR LoadSysCursor(LPCTSTR lpstrCursorName)
|
||||||
{
|
{
|
||||||
ATLASSERT(m_hCursor == NULL);
|
ATLASSERT(m_hCursor == NULL);
|
||||||
#if (WINVER >= 0x0500)
|
ATLASSERT((lpstrCursorName == IDC_ARROW) || (lpstrCursorName == IDC_IBEAM) || (lpstrCursorName == IDC_WAIT) ||
|
||||||
ATLASSERT(lpstrCursorName == IDC_ARROW || lpstrCursorName == IDC_IBEAM || lpstrCursorName == IDC_WAIT ||
|
(lpstrCursorName == IDC_CROSS) || (lpstrCursorName == IDC_UPARROW) || (lpstrCursorName == IDC_SIZE) ||
|
||||||
lpstrCursorName == IDC_CROSS || lpstrCursorName == IDC_UPARROW || lpstrCursorName == IDC_SIZE ||
|
(lpstrCursorName == IDC_ICON) || (lpstrCursorName == IDC_SIZENWSE) || (lpstrCursorName == IDC_SIZENESW) ||
|
||||||
lpstrCursorName == IDC_ICON || lpstrCursorName == IDC_SIZENWSE || lpstrCursorName == IDC_SIZENESW ||
|
(lpstrCursorName == IDC_SIZEWE) || (lpstrCursorName == IDC_SIZENS) || (lpstrCursorName == IDC_SIZEALL) ||
|
||||||
lpstrCursorName == IDC_SIZEWE || lpstrCursorName == IDC_SIZENS || lpstrCursorName == IDC_SIZEALL ||
|
(lpstrCursorName == IDC_NO) || (lpstrCursorName == IDC_APPSTARTING) || (lpstrCursorName == IDC_HELP) ||
|
||||||
lpstrCursorName == IDC_NO || lpstrCursorName == IDC_APPSTARTING || lpstrCursorName == IDC_HELP ||
|
(lpstrCursorName == IDC_HAND));
|
||||||
lpstrCursorName == IDC_HAND);
|
|
||||||
#else // !(WINVER >= 0x0500)
|
|
||||||
ATLASSERT(lpstrCursorName == IDC_ARROW || lpstrCursorName == IDC_IBEAM || lpstrCursorName == IDC_WAIT ||
|
|
||||||
lpstrCursorName == IDC_CROSS || lpstrCursorName == IDC_UPARROW || lpstrCursorName == IDC_SIZE ||
|
|
||||||
lpstrCursorName == IDC_ICON || lpstrCursorName == IDC_SIZENWSE || lpstrCursorName == IDC_SIZENESW ||
|
|
||||||
lpstrCursorName == IDC_SIZEWE || lpstrCursorName == IDC_SIZENS || lpstrCursorName == IDC_SIZEALL ||
|
|
||||||
lpstrCursorName == IDC_NO || lpstrCursorName == IDC_APPSTARTING || lpstrCursorName == IDC_HELP);
|
|
||||||
#endif // !(WINVER >= 0x0500)
|
|
||||||
m_hCursor = ::LoadCursor(NULL, lpstrCursorName);
|
m_hCursor = ::LoadCursor(NULL, lpstrCursorName);
|
||||||
return m_hCursor;
|
return m_hCursor;
|
||||||
}
|
}
|
||||||
|
@ -1037,7 +928,6 @@ public:
|
||||||
return m_hCursor;
|
return m_hCursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
HCURSOR LoadCursorFromFile(LPCTSTR pstrFilename)
|
HCURSOR LoadCursorFromFile(LPCTSTR pstrFilename)
|
||||||
{
|
{
|
||||||
ATLASSERT(m_hCursor == NULL);
|
ATLASSERT(m_hCursor == NULL);
|
||||||
|
@ -1045,18 +935,14 @@ public:
|
||||||
m_hCursor = ::LoadCursorFromFile(pstrFilename);
|
m_hCursor = ::LoadCursorFromFile(pstrFilename);
|
||||||
return m_hCursor;
|
return m_hCursor;
|
||||||
}
|
}
|
||||||
#endif // !_WIN32_WCE
|
|
||||||
|
|
||||||
#if !defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP)))
|
|
||||||
HCURSOR CreateCursor(int xHotSpot, int yHotSpot, int nWidth, int nHeight, CONST VOID *pvANDPlane, CONST VOID *pvXORPlane)
|
HCURSOR CreateCursor(int xHotSpot, int yHotSpot, int nWidth, int nHeight, CONST VOID *pvANDPlane, CONST VOID *pvXORPlane)
|
||||||
{
|
{
|
||||||
ATLASSERT(m_hCursor == NULL);
|
ATLASSERT(m_hCursor == NULL);
|
||||||
m_hCursor = ::CreateCursor(ModuleHelper::GetResourceInstance(), xHotSpot, yHotSpot, nWidth, nHeight, pvANDPlane, pvXORPlane);
|
m_hCursor = ::CreateCursor(ModuleHelper::GetResourceInstance(), xHotSpot, yHotSpot, nWidth, nHeight, pvANDPlane, pvXORPlane);
|
||||||
return m_hCursor;
|
return m_hCursor;
|
||||||
}
|
}
|
||||||
#endif // !defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP)))
|
|
||||||
|
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
HCURSOR CreateCursorFromResource(PBYTE pBits, DWORD dwResSize, DWORD dwVersion = 0x00030000)
|
HCURSOR CreateCursorFromResource(PBYTE pBits, DWORD dwResSize, DWORD dwVersion = 0x00030000)
|
||||||
{
|
{
|
||||||
ATLASSERT(m_hCursor == NULL);
|
ATLASSERT(m_hCursor == NULL);
|
||||||
|
@ -1073,39 +959,29 @@ public:
|
||||||
m_hCursor = (HCURSOR)::CreateIconFromResourceEx(pbBits, cbBits, FALSE, dwVersion, cxDesired, cyDesired, uFlags);
|
m_hCursor = (HCURSOR)::CreateIconFromResourceEx(pbBits, cbBits, FALSE, dwVersion, cxDesired, cyDesired, uFlags);
|
||||||
return m_hCursor;
|
return m_hCursor;
|
||||||
}
|
}
|
||||||
#endif // !_WIN32_WCE
|
|
||||||
|
|
||||||
BOOL DestroyCursor()
|
BOOL DestroyCursor()
|
||||||
{
|
{
|
||||||
ATLASSERT(m_hCursor != NULL);
|
ATLASSERT(m_hCursor != NULL);
|
||||||
#if !defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP)))
|
|
||||||
BOOL bRet = ::DestroyCursor(m_hCursor);
|
BOOL bRet = ::DestroyCursor(m_hCursor);
|
||||||
if(bRet != FALSE)
|
if(bRet != FALSE)
|
||||||
m_hCursor = NULL;
|
m_hCursor = NULL;
|
||||||
return bRet;
|
return bRet;
|
||||||
#else // !(!defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))))
|
|
||||||
ATLTRACE2(atlTraceUI, 0, _T("Warning: This version of Windows CE does not have ::DestroyCursor()\n"));
|
|
||||||
return FALSE;
|
|
||||||
#endif // !(!defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Operations
|
// Operations
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
HCURSOR CopyCursor()
|
HCURSOR CopyCursor()
|
||||||
{
|
{
|
||||||
ATLASSERT(m_hCursor != NULL);
|
ATLASSERT(m_hCursor != NULL);
|
||||||
return (HCURSOR)::CopyIcon((HICON)m_hCursor);
|
return (HCURSOR)::CopyIcon((HICON)m_hCursor);
|
||||||
}
|
}
|
||||||
#endif // !_WIN32_WCE
|
|
||||||
|
|
||||||
#if (WINVER >= 0x0500) && !defined(_WIN32_WCE)
|
|
||||||
BOOL GetCursorInfo(LPCURSORINFO pCursorInfo)
|
BOOL GetCursorInfo(LPCURSORINFO pCursorInfo)
|
||||||
{
|
{
|
||||||
ATLASSERT(m_hCursor != NULL);
|
ATLASSERT(m_hCursor != NULL);
|
||||||
ATLASSERT(pCursorInfo != NULL);
|
ATLASSERT(pCursorInfo != NULL);
|
||||||
return ::GetCursorInfo(pCursorInfo);
|
return ::GetCursorInfo(pCursorInfo);
|
||||||
}
|
}
|
||||||
#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef CCursorT<false> CCursorHandle;
|
typedef CCursorT<false> CCursorHandle;
|
||||||
|
@ -1152,13 +1028,12 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _WIN32_WCE
|
bool LoadEx(ATL::_U_STRINGorID ID, ATL::_U_STRINGorID Type, WORD wLanguage)
|
||||||
bool LoadEx(ATL::_U_STRINGorID Type, ATL::_U_STRINGorID ID, WORD wLanguage)
|
|
||||||
{
|
{
|
||||||
ATLASSERT(m_hResource == NULL);
|
ATLASSERT(m_hResource == NULL);
|
||||||
ATLASSERT(m_hGlobal == NULL);
|
ATLASSERT(m_hGlobal == NULL);
|
||||||
|
|
||||||
m_hResource = ::FindResourceEx(ModuleHelper::GetResourceInstance(), ID.m_lpstr, Type.m_lpstr, wLanguage);
|
m_hResource = ::FindResourceEx(ModuleHelper::GetResourceInstance(), Type.m_lpstr, ID.m_lpstr, wLanguage);
|
||||||
if(m_hResource == NULL)
|
if(m_hResource == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -1171,7 +1046,6 @@ public:
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif // !_WIN32_WCE
|
|
||||||
|
|
||||||
// Misc. operations
|
// Misc. operations
|
||||||
DWORD GetSize() const
|
DWORD GetSize() const
|
||||||
|
@ -1238,8 +1112,8 @@ inline HBITMAP AtlLoadBitmap(ATL::_U_STRINGorID bitmap)
|
||||||
inline HBITMAP AtlLoadSysBitmap(ATL::_U_STRINGorID bitmap)
|
inline HBITMAP AtlLoadSysBitmap(ATL::_U_STRINGorID bitmap)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
WORD wID = (WORD)bitmap.m_lpstr;
|
WORD wID = LOWORD(bitmap.m_lpstr);
|
||||||
ATLASSERT(wID >= 32734 && wID <= 32767);
|
ATLASSERT((wID >= 32734) && (wID <= 32767));
|
||||||
#endif // _DEBUG
|
#endif // _DEBUG
|
||||||
return ::LoadBitmap(NULL, bitmap.m_lpstr);
|
return ::LoadBitmap(NULL, bitmap.m_lpstr);
|
||||||
}
|
}
|
||||||
|
@ -1252,20 +1126,12 @@ inline HCURSOR AtlLoadCursor(ATL::_U_STRINGorID cursor)
|
||||||
|
|
||||||
inline HCURSOR AtlLoadSysCursor(LPCTSTR lpCursorName)
|
inline HCURSOR AtlLoadSysCursor(LPCTSTR lpCursorName)
|
||||||
{
|
{
|
||||||
#if (WINVER >= 0x0500)
|
ATLASSERT((lpCursorName == IDC_ARROW) || (lpCursorName == IDC_IBEAM) || (lpCursorName == IDC_WAIT) ||
|
||||||
ATLASSERT(lpCursorName == IDC_ARROW || lpCursorName == IDC_IBEAM || lpCursorName == IDC_WAIT ||
|
(lpCursorName == IDC_CROSS) || (lpCursorName == IDC_UPARROW) || (lpCursorName == IDC_SIZE) ||
|
||||||
lpCursorName == IDC_CROSS || lpCursorName == IDC_UPARROW || lpCursorName == IDC_SIZE ||
|
(lpCursorName == IDC_ICON) || (lpCursorName == IDC_SIZENWSE) || (lpCursorName == IDC_SIZENESW) ||
|
||||||
lpCursorName == IDC_ICON || lpCursorName == IDC_SIZENWSE || lpCursorName == IDC_SIZENESW ||
|
(lpCursorName == IDC_SIZEWE) || (lpCursorName == IDC_SIZENS) || (lpCursorName == IDC_SIZEALL) ||
|
||||||
lpCursorName == IDC_SIZEWE || lpCursorName == IDC_SIZENS || lpCursorName == IDC_SIZEALL ||
|
(lpCursorName == IDC_NO) || (lpCursorName == IDC_APPSTARTING) || (lpCursorName == IDC_HELP) ||
|
||||||
lpCursorName == IDC_NO || lpCursorName == IDC_APPSTARTING || lpCursorName == IDC_HELP ||
|
(lpCursorName == IDC_HAND));
|
||||||
lpCursorName == IDC_HAND);
|
|
||||||
#else // !(WINVER >= 0x0500)
|
|
||||||
ATLASSERT(lpCursorName == IDC_ARROW || lpCursorName == IDC_IBEAM || lpCursorName == IDC_WAIT ||
|
|
||||||
lpCursorName == IDC_CROSS || lpCursorName == IDC_UPARROW || lpCursorName == IDC_SIZE ||
|
|
||||||
lpCursorName == IDC_ICON || lpCursorName == IDC_SIZENWSE || lpCursorName == IDC_SIZENESW ||
|
|
||||||
lpCursorName == IDC_SIZEWE || lpCursorName == IDC_SIZENS || lpCursorName == IDC_SIZEALL ||
|
|
||||||
lpCursorName == IDC_NO || lpCursorName == IDC_APPSTARTING || lpCursorName == IDC_HELP);
|
|
||||||
#endif // !(WINVER >= 0x0500)
|
|
||||||
return ::LoadCursor(NULL, lpCursorName);
|
return ::LoadCursor(NULL, lpCursorName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1274,20 +1140,18 @@ inline HICON AtlLoadIcon(ATL::_U_STRINGorID icon)
|
||||||
return ::LoadIcon(ModuleHelper::GetResourceInstance(), icon.m_lpstr);
|
return ::LoadIcon(ModuleHelper::GetResourceInstance(), icon.m_lpstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
inline HICON AtlLoadSysIcon(LPCTSTR lpIconName)
|
inline HICON AtlLoadSysIcon(LPCTSTR lpIconName)
|
||||||
{
|
{
|
||||||
#if (WINVER >= 0x0600)
|
#if (WINVER >= 0x0600)
|
||||||
ATLASSERT(lpIconName == IDI_APPLICATION || lpIconName == IDI_ASTERISK || lpIconName == IDI_EXCLAMATION ||
|
ATLASSERT((lpIconName == IDI_APPLICATION) || (lpIconName == IDI_ASTERISK) || (lpIconName == IDI_EXCLAMATION) ||
|
||||||
lpIconName == IDI_HAND || lpIconName == IDI_QUESTION || lpIconName == IDI_WINLOGO ||
|
(lpIconName == IDI_HAND) || (lpIconName == IDI_QUESTION) || (lpIconName == IDI_WINLOGO) ||
|
||||||
lpIconName == IDI_SHIELD);
|
(lpIconName == IDI_SHIELD));
|
||||||
#else // !(WINVER >= 0x0600)
|
#else // !(WINVER >= 0x0600)
|
||||||
ATLASSERT(lpIconName == IDI_APPLICATION || lpIconName == IDI_ASTERISK || lpIconName == IDI_EXCLAMATION ||
|
ATLASSERT((lpIconName == IDI_APPLICATION) || (lpIconName == IDI_ASTERISK) || (lpIconName == IDI_EXCLAMATION) ||
|
||||||
lpIconName == IDI_HAND || lpIconName == IDI_QUESTION || lpIconName == IDI_WINLOGO);
|
(lpIconName == IDI_HAND) || (lpIconName == IDI_QUESTION) || (lpIconName == IDI_WINLOGO));
|
||||||
#endif // !(WINVER >= 0x0600)
|
#endif // !(WINVER >= 0x0600)
|
||||||
return ::LoadIcon(NULL, lpIconName);
|
return ::LoadIcon(NULL, lpIconName);
|
||||||
}
|
}
|
||||||
#endif // !_WIN32_WCE
|
|
||||||
|
|
||||||
inline HBITMAP AtlLoadBitmapImage(ATL::_U_STRINGorID bitmap, UINT fuLoad = LR_DEFAULTCOLOR)
|
inline HBITMAP AtlLoadBitmapImage(ATL::_U_STRINGorID bitmap, UINT fuLoad = LR_DEFAULTCOLOR)
|
||||||
{
|
{
|
||||||
|
@ -1307,7 +1171,7 @@ inline HICON AtlLoadIconImage(ATL::_U_STRINGorID icon, UINT fuLoad = LR_DEFAULTC
|
||||||
#ifdef OEMRESOURCE
|
#ifdef OEMRESOURCE
|
||||||
inline HBITMAP AtlLoadSysBitmapImage(WORD wBitmapID, UINT fuLoad = LR_DEFAULTCOLOR)
|
inline HBITMAP AtlLoadSysBitmapImage(WORD wBitmapID, UINT fuLoad = LR_DEFAULTCOLOR)
|
||||||
{
|
{
|
||||||
ATLASSERT(wBitmapID >= 32734 && wBitmapID <= 32767);
|
ATLASSERT((wBitmapID >= 32734) && (wBitmapID <= 32767));
|
||||||
ATLASSERT((fuLoad & LR_LOADFROMFILE) == 0); // this one doesn't load from a file
|
ATLASSERT((fuLoad & LR_LOADFROMFILE) == 0); // this one doesn't load from a file
|
||||||
return (HBITMAP)::LoadImage(NULL, MAKEINTRESOURCE(wBitmapID), IMAGE_BITMAP, 0, 0, fuLoad);
|
return (HBITMAP)::LoadImage(NULL, MAKEINTRESOURCE(wBitmapID), IMAGE_BITMAP, 0, 0, fuLoad);
|
||||||
}
|
}
|
||||||
|
@ -1316,8 +1180,8 @@ inline HBITMAP AtlLoadSysBitmapImage(WORD wBitmapID, UINT fuLoad = LR_DEFAULTCOL
|
||||||
inline HCURSOR AtlLoadSysCursorImage(ATL::_U_STRINGorID cursor, UINT fuLoad = LR_DEFAULTCOLOR | LR_DEFAULTSIZE, int cxDesired = 0, int cyDesired = 0)
|
inline HCURSOR AtlLoadSysCursorImage(ATL::_U_STRINGorID cursor, UINT fuLoad = LR_DEFAULTCOLOR | LR_DEFAULTSIZE, int cxDesired = 0, int cyDesired = 0)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
WORD wID = (WORD)cursor.m_lpstr;
|
WORD wID = LOWORD(cursor.m_lpstr);
|
||||||
ATLASSERT((wID >= 32512 && wID <= 32516) || (wID >= 32640 && wID <= 32648) || (wID == 32650) || (wID == 32651));
|
ATLASSERT(((wID >= 32512) && (wID <= 32516)) || ((wID >= 32640) && (wID <= 32648)) || (wID == 32650) || (wID == 32651));
|
||||||
ATLASSERT((fuLoad & LR_LOADFROMFILE) == 0); // this one doesn't load from a file
|
ATLASSERT((fuLoad & LR_LOADFROMFILE) == 0); // this one doesn't load from a file
|
||||||
#endif // _DEBUG
|
#endif // _DEBUG
|
||||||
return (HCURSOR)::LoadImage(NULL, cursor.m_lpstr, IMAGE_CURSOR, cxDesired, cyDesired, fuLoad);
|
return (HCURSOR)::LoadImage(NULL, cursor.m_lpstr, IMAGE_CURSOR, cxDesired, cyDesired, fuLoad);
|
||||||
|
@ -1326,37 +1190,13 @@ inline HCURSOR AtlLoadSysCursorImage(ATL::_U_STRINGorID cursor, UINT fuLoad = LR
|
||||||
inline HICON AtlLoadSysIconImage(ATL::_U_STRINGorID icon, UINT fuLoad = LR_DEFAULTCOLOR | LR_DEFAULTSIZE, int cxDesired = 0, int cyDesired = 0)
|
inline HICON AtlLoadSysIconImage(ATL::_U_STRINGorID icon, UINT fuLoad = LR_DEFAULTCOLOR | LR_DEFAULTSIZE, int cxDesired = 0, int cyDesired = 0)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
WORD wID = (WORD)icon.m_lpstr;
|
WORD wID = LOWORD(icon.m_lpstr);
|
||||||
ATLASSERT(wID >= 32512 && wID <= 32517);
|
ATLASSERT((wID >= 32512) && (wID <= 32517));
|
||||||
ATLASSERT((fuLoad & LR_LOADFROMFILE) == 0); // this one doesn't load from a file
|
ATLASSERT((fuLoad & LR_LOADFROMFILE) == 0); // this one doesn't load from a file
|
||||||
#endif // _DEBUG
|
#endif // _DEBUG
|
||||||
return (HICON)::LoadImage(NULL, icon.m_lpstr, IMAGE_ICON, cxDesired, cyDesired, fuLoad);
|
return (HICON)::LoadImage(NULL, icon.m_lpstr, IMAGE_ICON, cxDesired, cyDesired, fuLoad);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (_ATL_VER < 0x0700)
|
|
||||||
inline int AtlLoadString(UINT uID, LPTSTR lpBuffer, int nBufferMax)
|
|
||||||
{
|
|
||||||
return ::LoadString(ModuleHelper::GetResourceInstance(), uID, lpBuffer, nBufferMax);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
|
|
||||||
using ATL::AtlLoadString;
|
|
||||||
|
|
||||||
#endif // (_ATL_VER < 0x0700)
|
|
||||||
|
|
||||||
#ifdef _WIN32_WCE // CE only direct access to the resource
|
|
||||||
inline LPCTSTR AtlLoadString(UINT uID)
|
|
||||||
{
|
|
||||||
LPCTSTR s = (LPCTSTR)::LoadString(ModuleHelper::GetResourceInstance(), uID, NULL, 0);
|
|
||||||
#ifdef DEBUG // Check for null-termination
|
|
||||||
if(s != NULL)
|
|
||||||
// Note: RC -n <file.rc> compiles null-terminated resource strings
|
|
||||||
ATLASSERT(s[*((WORD*)s -1) - 1] == L'\0');
|
|
||||||
#endif
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
#endif // _WIN32_WCE
|
|
||||||
|
|
||||||
inline bool AtlLoadString(UINT uID, BSTR& bstrText)
|
inline bool AtlLoadString(UINT uID, BSTR& bstrText)
|
||||||
{
|
{
|
||||||
USES_CONVERSION;
|
USES_CONVERSION;
|
||||||
|
@ -1386,6 +1226,6 @@ inline bool AtlLoadString(UINT uID, BSTR& bstrText)
|
||||||
return (bstrText != NULL) ? true : false;
|
return (bstrText != NULL) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}; // namespace WTL
|
} // namespace WTL
|
||||||
|
|
||||||
#endif // __ATLUSER_H__
|
#endif // __ATLUSER_H__
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,13 +1,10 @@
|
||||||
// Windows Template Library - WTL version 8.1
|
// Windows Template Library - WTL version 10.0
|
||||||
// Copyright (C) Microsoft Corporation. All rights reserved.
|
// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved.
|
||||||
//
|
//
|
||||||
// This file is a part of the Windows Template Library.
|
// This file is a part of the Windows Template Library.
|
||||||
// The use and distribution terms for this software are covered by the
|
// The use and distribution terms for this software are covered by the
|
||||||
// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php)
|
// Microsoft Public License (http://opensource.org/licenses/MS-PL)
|
||||||
// which can be found in the file CPL.TXT at the root of this distribution.
|
// which can be found in the file MS-PL.txt at the root folder.
|
||||||
// By using this software in any fashion, you are agreeing to be bound by
|
|
||||||
// the terms of this license. You must not remove this notice, or
|
|
||||||
// any other, from this software.
|
|
||||||
|
|
||||||
#ifndef __ATLWINX_H__
|
#ifndef __ATLWINX_H__
|
||||||
#define __ATLWINX_H__
|
#define __ATLWINX_H__
|
||||||
|
@ -18,17 +15,45 @@
|
||||||
#error atlwinx.h requires atlapp.h to be included first
|
#error atlwinx.h requires atlapp.h to be included first
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (_ATL_VER >= 0x0700)
|
#include <atlwin.h>
|
||||||
#include <atlwin.h>
|
|
||||||
#endif // (_ATL_VER >= 0x0700)
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Classes in this file:
|
// Classes in this file:
|
||||||
//
|
//
|
||||||
// _U_RECT
|
// CWindowEx
|
||||||
// _U_MENUorID
|
|
||||||
// _U_STRINGorID
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Additional macros needed for template classes
|
||||||
|
|
||||||
|
#ifndef DECLARE_WND_CLASS_EX2
|
||||||
|
#define DECLARE_WND_CLASS_EX2(WndClassName, EnclosingClass, style, bkgnd) \
|
||||||
|
static ATL::CWndClassInfo& GetWndClassInfo() \
|
||||||
|
{ \
|
||||||
|
static ATL::CWndClassInfo wc = \
|
||||||
|
{ \
|
||||||
|
{ sizeof(WNDCLASSEX), style, EnclosingClass::StartWindowProc, \
|
||||||
|
0, 0, NULL, NULL, NULL, (HBRUSH)(bkgnd + 1), NULL, WndClassName, NULL }, \
|
||||||
|
NULL, NULL, IDC_ARROW, TRUE, 0, _T("") \
|
||||||
|
}; \
|
||||||
|
return wc; \
|
||||||
|
}
|
||||||
|
#endif // DECLARE_WND_CLASS_EX2
|
||||||
|
|
||||||
|
#ifndef DECLARE_WND_SUPERCLASS2
|
||||||
|
#define DECLARE_WND_SUPERCLASS2(WndClassName, EnclosingClass, OrigWndClassName) \
|
||||||
|
static ATL::CWndClassInfo& GetWndClassInfo() \
|
||||||
|
{ \
|
||||||
|
static ATL::CWndClassInfo wc = \
|
||||||
|
{ \
|
||||||
|
{ sizeof(WNDCLASSEX), 0, EnclosingClass::StartWindowProc, \
|
||||||
|
0, 0, NULL, NULL, NULL, NULL, NULL, WndClassName, NULL }, \
|
||||||
|
OrigWndClassName, NULL, NULL, TRUE, 0, _T("") \
|
||||||
|
}; \
|
||||||
|
return wc; \
|
||||||
|
}
|
||||||
|
#endif // DECLARE_WND_SUPERCLASS2
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -88,7 +113,6 @@ inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARA
|
||||||
hWndChild = ((LPNMHDR)lParam)->hwndFrom;
|
hWndChild = ((LPNMHDR)lParam)->hwndFrom;
|
||||||
idFrom = ((LPNMHDR)lParam)->idFrom;
|
idFrom = ((LPNMHDR)lParam)->idFrom;
|
||||||
break;
|
break;
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
case WM_PARENTNOTIFY:
|
case WM_PARENTNOTIFY:
|
||||||
switch(LOWORD(wParam))
|
switch(LOWORD(wParam))
|
||||||
{
|
{
|
||||||
|
@ -103,7 +127,6 @@ inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARA
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif // !_WIN32_WCE
|
|
||||||
case WM_DRAWITEM:
|
case WM_DRAWITEM:
|
||||||
if(wParam) // not from a menu
|
if(wParam) // not from a menu
|
||||||
{
|
{
|
||||||
|
@ -136,9 +159,6 @@ inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARA
|
||||||
case WM_CHARTOITEM:
|
case WM_CHARTOITEM:
|
||||||
case WM_HSCROLL:
|
case WM_HSCROLL:
|
||||||
case WM_VSCROLL:
|
case WM_VSCROLL:
|
||||||
hWndChild = (HWND)lParam;
|
|
||||||
idFrom = (UINT_PTR)::GetDlgCtrlID(hWndChild);
|
|
||||||
break;
|
|
||||||
case WM_CTLCOLORBTN:
|
case WM_CTLCOLORBTN:
|
||||||
case WM_CTLCOLORDLG:
|
case WM_CTLCOLORDLG:
|
||||||
case WM_CTLCOLOREDIT:
|
case WM_CTLCOLOREDIT:
|
||||||
|
@ -181,14 +201,14 @@ inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARA
|
||||||
return lResult;
|
return lResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
}; // namespace WTL
|
} // namespace WTL
|
||||||
|
|
||||||
// Try to prevent problems with WM_CTLCOLOR* messages when
|
// Try to prevent problems with WM_CTLCOLOR* messages when
|
||||||
// the message wasn't really handled
|
// the message wasn't really handled
|
||||||
#define REFLECT_NOTIFICATIONS_EX() \
|
#define REFLECT_NOTIFICATIONS_EX() \
|
||||||
{ \
|
{ \
|
||||||
bHandled = TRUE; \
|
bHandled = TRUE; \
|
||||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
lResult = this->ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||||
if((lResult == 0) && (uMsg >= WM_CTLCOLORMSGBOX) && (uMsg <= WM_CTLCOLORSTATIC)) \
|
if((lResult == 0) && (uMsg >= WM_CTLCOLORMSGBOX) && (uMsg <= WM_CTLCOLORSTATIC)) \
|
||||||
bHandled = FALSE; \
|
bHandled = FALSE; \
|
||||||
if(bHandled) \
|
if(bHandled) \
|
||||||
|
@ -198,7 +218,7 @@ inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARA
|
||||||
#define REFLECT_NOTIFICATIONS_MSG_FILTERED(uMsgFilter) \
|
#define REFLECT_NOTIFICATIONS_MSG_FILTERED(uMsgFilter) \
|
||||||
{ \
|
{ \
|
||||||
bHandled = TRUE; \
|
bHandled = TRUE; \
|
||||||
lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, uMsgFilter, 0, NULL); \
|
lResult = WTL::WtlReflectNotificationsFiltered(this->m_hWnd, uMsg, wParam, lParam, bHandled, uMsgFilter, 0, NULL); \
|
||||||
if(bHandled) \
|
if(bHandled) \
|
||||||
return TRUE; \
|
return TRUE; \
|
||||||
}
|
}
|
||||||
|
@ -206,7 +226,7 @@ inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARA
|
||||||
#define REFLECT_NOTIFICATIONS_ID_FILTERED(idFromFilter) \
|
#define REFLECT_NOTIFICATIONS_ID_FILTERED(idFromFilter) \
|
||||||
{ \
|
{ \
|
||||||
bHandled = TRUE; \
|
bHandled = TRUE; \
|
||||||
lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, WM_NULL, idFromFilter, NULL); \
|
lResult = WTL::WtlReflectNotificationsFiltered(this->m_hWnd, uMsg, wParam, lParam, bHandled, WM_NULL, idFromFilter, NULL); \
|
||||||
if(bHandled) \
|
if(bHandled) \
|
||||||
return TRUE; \
|
return TRUE; \
|
||||||
}
|
}
|
||||||
|
@ -214,7 +234,7 @@ inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARA
|
||||||
#define REFLECT_NOTIFICATIONS_HWND_FILTERED(hWndChildFilter) \
|
#define REFLECT_NOTIFICATIONS_HWND_FILTERED(hWndChildFilter) \
|
||||||
{ \
|
{ \
|
||||||
bHandled = TRUE; \
|
bHandled = TRUE; \
|
||||||
lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, WM_NULL, 0, hWndChildFilter); \
|
lResult = WTL::WtlReflectNotificationsFiltered(this->m_hWnd, uMsg, wParam, lParam, bHandled, WM_NULL, 0, hWndChildFilter); \
|
||||||
if(bHandled) \
|
if(bHandled) \
|
||||||
return TRUE; \
|
return TRUE; \
|
||||||
}
|
}
|
||||||
|
@ -222,7 +242,7 @@ inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARA
|
||||||
#define REFLECT_NOTIFICATIONS_MSG_ID_FILTERED(uMsgFilter, idFromFilter) \
|
#define REFLECT_NOTIFICATIONS_MSG_ID_FILTERED(uMsgFilter, idFromFilter) \
|
||||||
{ \
|
{ \
|
||||||
bHandled = TRUE; \
|
bHandled = TRUE; \
|
||||||
lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, uMsgFilter, idFromFilter, NULL); \
|
lResult = WTL::WtlReflectNotificationsFiltered(this->m_hWnd, uMsg, wParam, lParam, bHandled, uMsgFilter, idFromFilter, NULL); \
|
||||||
if(bHandled) \
|
if(bHandled) \
|
||||||
return TRUE; \
|
return TRUE; \
|
||||||
}
|
}
|
||||||
|
@ -230,296 +250,374 @@ inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARA
|
||||||
#define REFLECT_NOTIFICATIONS_MSG_HWND_FILTERED(uMsgFilter, hWndChildFilter) \
|
#define REFLECT_NOTIFICATIONS_MSG_HWND_FILTERED(uMsgFilter, hWndChildFilter) \
|
||||||
{ \
|
{ \
|
||||||
bHandled = TRUE; \
|
bHandled = TRUE; \
|
||||||
lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, uMsgFilter, 0, hWndChildFilter); \
|
lResult = WTL::WtlReflectNotificationsFiltered(this->m_hWnd, uMsg, wParam, lParam, bHandled, uMsgFilter, 0, hWndChildFilter); \
|
||||||
if(bHandled) \
|
if(bHandled) \
|
||||||
return TRUE; \
|
return TRUE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define REFLECT_COMMAND(id, code) \
|
#define REFLECT_COMMAND(id, code) \
|
||||||
if(uMsg == WM_COMMAND && id == LOWORD(wParam) && code == HIWORD(wParam)) \
|
if((uMsg == WM_COMMAND) && (id == LOWORD(wParam)) && (code == HIWORD(wParam))) \
|
||||||
{ \
|
{ \
|
||||||
bHandled = TRUE; \
|
bHandled = TRUE; \
|
||||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
lResult = this->ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||||
if(bHandled) \
|
if(bHandled) \
|
||||||
return TRUE; \
|
return TRUE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define REFLECT_COMMAND_ID(id) \
|
#define REFLECT_COMMAND_ID(id) \
|
||||||
if(uMsg == WM_COMMAND && id == LOWORD(wParam)) \
|
if((uMsg == WM_COMMAND) && (id == LOWORD(wParam))) \
|
||||||
{ \
|
{ \
|
||||||
bHandled = TRUE; \
|
bHandled = TRUE; \
|
||||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
lResult = this->ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||||
if(bHandled) \
|
if(bHandled) \
|
||||||
return TRUE; \
|
return TRUE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define REFLECT_COMMAND_CODE(code) \
|
#define REFLECT_COMMAND_CODE(code) \
|
||||||
if(uMsg == WM_COMMAND && code == HIWORD(wParam)) \
|
if((uMsg == WM_COMMAND) && (code == HIWORD(wParam))) \
|
||||||
{ \
|
{ \
|
||||||
bHandled = TRUE; \
|
bHandled = TRUE; \
|
||||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
lResult = this->ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||||
if(bHandled) \
|
if(bHandled) \
|
||||||
return TRUE; \
|
return TRUE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define REFLECT_COMMAND_RANGE(idFirst, idLast) \
|
#define REFLECT_COMMAND_RANGE(idFirst, idLast) \
|
||||||
if(uMsg == WM_COMMAND && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \
|
if((uMsg == WM_COMMAND) && (LOWORD(wParam) >= idFirst) && (LOWORD(wParam) <= idLast)) \
|
||||||
{ \
|
{ \
|
||||||
bHandled = TRUE; \
|
bHandled = TRUE; \
|
||||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
lResult = this->ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||||
if(bHandled) \
|
if(bHandled) \
|
||||||
return TRUE; \
|
return TRUE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define REFLECT_COMMAND_RANGE_CODE(idFirst, idLast, code) \
|
#define REFLECT_COMMAND_RANGE_CODE(idFirst, idLast, code) \
|
||||||
if(uMsg == WM_COMMAND && code == HIWORD(wParam) && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \
|
if((uMsg == WM_COMMAND) && (code == HIWORD(wParam)) && (LOWORD(wParam) >= idFirst) && (LOWORD(wParam) <= idLast)) \
|
||||||
{ \
|
{ \
|
||||||
bHandled = TRUE; \
|
bHandled = TRUE; \
|
||||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
lResult = this->ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||||
if(bHandled) \
|
if(bHandled) \
|
||||||
return TRUE; \
|
return TRUE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define REFLECT_NOTIFY(id, cd) \
|
#define REFLECT_NOTIFY(id, cd) \
|
||||||
if(uMsg == WM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom && cd == ((LPNMHDR)lParam)->code) \
|
if((uMsg == WM_NOTIFY) && (id == ((LPNMHDR)lParam)->idFrom) && (cd == ((LPNMHDR)lParam)->code)) \
|
||||||
{ \
|
{ \
|
||||||
bHandled = TRUE; \
|
bHandled = TRUE; \
|
||||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
lResult = this->ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||||
if(bHandled) \
|
if(bHandled) \
|
||||||
return TRUE; \
|
return TRUE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define REFLECT_NOTIFY_ID(id) \
|
#define REFLECT_NOTIFY_ID(id) \
|
||||||
if(uMsg == WM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom) \
|
if((uMsg == WM_NOTIFY) && (id == ((LPNMHDR)lParam)->idFrom)) \
|
||||||
{ \
|
{ \
|
||||||
bHandled = TRUE; \
|
bHandled = TRUE; \
|
||||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
lResult = this->ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||||
if(bHandled) \
|
if(bHandled) \
|
||||||
return TRUE; \
|
return TRUE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define REFLECT_NOTIFY_CODE(cd) \
|
#define REFLECT_NOTIFY_CODE(cd) \
|
||||||
if(uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \
|
if((uMsg == WM_NOTIFY) && (cd == ((LPNMHDR)lParam)->code)) \
|
||||||
{ \
|
{ \
|
||||||
bHandled = TRUE; \
|
bHandled = TRUE; \
|
||||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
lResult = this->ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||||
if(bHandled) \
|
if(bHandled) \
|
||||||
return TRUE; \
|
return TRUE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define REFLECT_NOTIFY_RANGE(idFirst, idLast) \
|
#define REFLECT_NOTIFY_RANGE(idFirst, idLast) \
|
||||||
if(uMsg == WM_NOTIFY && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \
|
if((uMsg == WM_NOTIFY) && (((LPNMHDR)lParam)->idFrom >= idFirst) && (((LPNMHDR)lParam)->idFrom <= idLast)) \
|
||||||
{ \
|
{ \
|
||||||
bHandled = TRUE; \
|
bHandled = TRUE; \
|
||||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
lResult = this->ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||||
if(bHandled) \
|
if(bHandled) \
|
||||||
return TRUE; \
|
return TRUE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define REFLECT_NOTIFY_RANGE_CODE(idFirst, idLast, cd) \
|
#define REFLECT_NOTIFY_RANGE_CODE(idFirst, idLast, cd) \
|
||||||
if(uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \
|
if((uMsg == WM_NOTIFY) && (cd == ((LPNMHDR)lParam)->code) && (((LPNMHDR)lParam)->idFrom >= idFirst) && (((LPNMHDR)lParam)->idFrom <= idLast)) \
|
||||||
{ \
|
{ \
|
||||||
bHandled = TRUE; \
|
bHandled = TRUE; \
|
||||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
lResult = this->ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||||
if(bHandled) \
|
if(bHandled) \
|
||||||
return TRUE; \
|
return TRUE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Reflected message handler macros for message maps (for ATL 3.0)
|
// GetClassLong/SetClassLong redefinition to avoid problems with class members
|
||||||
|
|
||||||
#if (_ATL_VER < 0x0700)
|
#ifdef SetClassLongPtrA
|
||||||
|
#undef SetClassLongPtrA
|
||||||
|
inline LONG_PTR SetClassLongPtrA(HWND hWnd, int nIndex, LONG_PTR dwNewLong)
|
||||||
|
{
|
||||||
|
return ::SetClassLongA(hWnd, nIndex, LONG(dwNewLong));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#define REFLECTED_COMMAND_HANDLER(id, code, func) \
|
#ifdef SetClassLongPtrW
|
||||||
if(uMsg == OCM_COMMAND && id == LOWORD(wParam) && code == HIWORD(wParam)) \
|
#undef SetClassLongPtrW
|
||||||
{ \
|
inline LONG_PTR SetClassLongPtrW(HWND hWnd, int nIndex, LONG_PTR dwNewLong)
|
||||||
bHandled = TRUE; \
|
{
|
||||||
lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \
|
return ::SetClassLongW(hWnd, nIndex, LONG(dwNewLong));
|
||||||
if(bHandled) \
|
}
|
||||||
return TRUE; \
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
#define REFLECTED_COMMAND_ID_HANDLER(id, func) \
|
#ifdef GetClassLongPtrA
|
||||||
if(uMsg == OCM_COMMAND && id == LOWORD(wParam)) \
|
#undef GetClassLongPtrA
|
||||||
{ \
|
inline LONG_PTR GetClassLongPtrA(HWND hWnd, int nIndex)
|
||||||
bHandled = TRUE; \
|
{
|
||||||
lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \
|
return ::GetClassLongA(hWnd, nIndex);
|
||||||
if(bHandled) \
|
}
|
||||||
return TRUE; \
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
#define REFLECTED_COMMAND_CODE_HANDLER(code, func) \
|
#ifdef GetClassLongPtrW
|
||||||
if(uMsg == OCM_COMMAND && code == HIWORD(wParam)) \
|
#undef GetClassLongPtrW
|
||||||
{ \
|
inline LONG_PTR GetClassLongPtrW(HWND hWnd, int nIndex)
|
||||||
bHandled = TRUE; \
|
{
|
||||||
lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \
|
return ::GetClassLongW(hWnd, nIndex);
|
||||||
if(bHandled) \
|
}
|
||||||
return TRUE; \
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
#define REFLECTED_COMMAND_RANGE_HANDLER(idFirst, idLast, func) \
|
|
||||||
if(uMsg == OCM_COMMAND && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \
|
|
||||||
{ \
|
|
||||||
bHandled = TRUE; \
|
|
||||||
lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \
|
|
||||||
if(bHandled) \
|
|
||||||
return TRUE; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define REFLECTED_COMMAND_RANGE_CODE_HANDLER(idFirst, idLast, code, func) \
|
|
||||||
if(uMsg == OCM_COMMAND && code == HIWORD(wParam) && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \
|
|
||||||
{ \
|
|
||||||
bHandled = TRUE; \
|
|
||||||
lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \
|
|
||||||
if(bHandled) \
|
|
||||||
return TRUE; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define REFLECTED_NOTIFY_HANDLER(id, cd, func) \
|
|
||||||
if(uMsg == OCM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom && cd == ((LPNMHDR)lParam)->code) \
|
|
||||||
{ \
|
|
||||||
bHandled = TRUE; \
|
|
||||||
lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \
|
|
||||||
if(bHandled) \
|
|
||||||
return TRUE; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define REFLECTED_NOTIFY_ID_HANDLER(id, func) \
|
|
||||||
if(uMsg == OCM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom) \
|
|
||||||
{ \
|
|
||||||
bHandled = TRUE; \
|
|
||||||
lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \
|
|
||||||
if(bHandled) \
|
|
||||||
return TRUE; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define REFLECTED_NOTIFY_CODE_HANDLER(cd, func) \
|
|
||||||
if(uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \
|
|
||||||
{ \
|
|
||||||
bHandled = TRUE; \
|
|
||||||
lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \
|
|
||||||
if(bHandled) \
|
|
||||||
return TRUE; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define REFLECTED_NOTIFY_RANGE_HANDLER(idFirst, idLast, func) \
|
|
||||||
if(uMsg == OCM_NOTIFY && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \
|
|
||||||
{ \
|
|
||||||
bHandled = TRUE; \
|
|
||||||
lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \
|
|
||||||
if(bHandled) \
|
|
||||||
return TRUE; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define REFLECTED_NOTIFY_RANGE_CODE_HANDLER(idFirst, idLast, cd, func) \
|
|
||||||
if(uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \
|
|
||||||
{ \
|
|
||||||
bHandled = TRUE; \
|
|
||||||
lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \
|
|
||||||
if(bHandled) \
|
|
||||||
return TRUE; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // (_ATL_VER < 0x0700)
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Dual argument helper classes (for ATL 3.0)
|
// CWindowEx - extension of ATL::CWindow
|
||||||
|
|
||||||
#if (_ATL_VER < 0x0700)
|
|
||||||
|
|
||||||
namespace ATL
|
|
||||||
{
|
|
||||||
|
|
||||||
class _U_RECT
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
_U_RECT(LPRECT lpRect) : m_lpRect(lpRect)
|
|
||||||
{ }
|
|
||||||
_U_RECT(RECT& rc) : m_lpRect(&rc)
|
|
||||||
{ }
|
|
||||||
LPRECT m_lpRect;
|
|
||||||
};
|
|
||||||
|
|
||||||
class _U_MENUorID
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
_U_MENUorID(HMENU hMenu) : m_hMenu(hMenu)
|
|
||||||
{ }
|
|
||||||
_U_MENUorID(UINT nID) : m_hMenu((HMENU)LongToHandle(nID))
|
|
||||||
{ }
|
|
||||||
HMENU m_hMenu;
|
|
||||||
};
|
|
||||||
|
|
||||||
class _U_STRINGorID
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
_U_STRINGorID(LPCTSTR lpString) : m_lpstr(lpString)
|
|
||||||
{ }
|
|
||||||
_U_STRINGorID(UINT nID) : m_lpstr(MAKEINTRESOURCE(nID))
|
|
||||||
{ }
|
|
||||||
LPCTSTR m_lpstr;
|
|
||||||
};
|
|
||||||
|
|
||||||
}; // namespace ATL
|
|
||||||
|
|
||||||
#endif // (_ATL_VER < 0x0700)
|
|
||||||
|
|
||||||
|
|
||||||
namespace WTL
|
namespace WTL
|
||||||
{
|
{
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
class CWindowEx : public ATL::CWindow
|
||||||
// Forward notifications support for message maps (for ATL 3.0)
|
|
||||||
|
|
||||||
#if (_ATL_VER < 0x0700)
|
|
||||||
|
|
||||||
// forward notifications support
|
|
||||||
#define FORWARD_NOTIFICATIONS() \
|
|
||||||
{ \
|
|
||||||
bHandled = TRUE; \
|
|
||||||
lResult = WTL::Atl3ForwardNotifications(m_hWnd, uMsg, wParam, lParam, bHandled); \
|
|
||||||
if(bHandled) \
|
|
||||||
return TRUE; \
|
|
||||||
}
|
|
||||||
|
|
||||||
static LRESULT Atl3ForwardNotifications(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
|
||||||
{
|
{
|
||||||
LRESULT lResult = 0;
|
public:
|
||||||
switch(uMsg)
|
CWindowEx(HWND hWnd = NULL) : ATL::CWindow(hWnd)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
CWindowEx& operator =(HWND hWnd)
|
||||||
{
|
{
|
||||||
case WM_COMMAND:
|
m_hWnd = hWnd;
|
||||||
case WM_NOTIFY:
|
return *this;
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
case WM_PARENTNOTIFY:
|
|
||||||
#endif // !_WIN32_WCE
|
|
||||||
case WM_DRAWITEM:
|
|
||||||
case WM_MEASUREITEM:
|
|
||||||
case WM_COMPAREITEM:
|
|
||||||
case WM_DELETEITEM:
|
|
||||||
case WM_VKEYTOITEM:
|
|
||||||
case WM_CHARTOITEM:
|
|
||||||
case WM_HSCROLL:
|
|
||||||
case WM_VSCROLL:
|
|
||||||
case WM_CTLCOLORBTN:
|
|
||||||
case WM_CTLCOLORDLG:
|
|
||||||
case WM_CTLCOLOREDIT:
|
|
||||||
case WM_CTLCOLORLISTBOX:
|
|
||||||
case WM_CTLCOLORMSGBOX:
|
|
||||||
case WM_CTLCOLORSCROLLBAR:
|
|
||||||
case WM_CTLCOLORSTATIC:
|
|
||||||
lResult = ::SendMessage(::GetParent(hWnd), uMsg, wParam, lParam);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
bHandled = FALSE;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return lResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // (_ATL_VER < 0x0700)
|
operator HWND() const
|
||||||
|
{
|
||||||
|
return m_hWnd;
|
||||||
|
}
|
||||||
|
|
||||||
}; // namespace WTL
|
// Methods
|
||||||
|
BOOL PrintWindow(HDC hDC, UINT uFlags = 0)
|
||||||
|
{
|
||||||
|
ATLASSERT(::IsWindow(m_hWnd));
|
||||||
|
return ::PrintWindow(m_hWnd, hDC, uFlags);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL DragDetect(POINT pt)
|
||||||
|
{
|
||||||
|
ATLASSERT(::IsWindow(m_hWnd));
|
||||||
|
return ::DragDetect(m_hWnd, pt);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL DragDetect()
|
||||||
|
{
|
||||||
|
ATLASSERT(::IsWindow(m_hWnd));
|
||||||
|
|
||||||
|
POINT pt = {};
|
||||||
|
::GetCursorPos(&pt);
|
||||||
|
return ::DragDetect(m_hWnd, pt);
|
||||||
|
}
|
||||||
|
|
||||||
|
CWindowEx GetAncestor(UINT uFlags) const
|
||||||
|
{
|
||||||
|
ATLASSERT(::IsWindow(m_hWnd));
|
||||||
|
return CWindowEx(::GetAncestor(m_hWnd, uFlags));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Note: Does not work properly on Vista Aero and above
|
||||||
|
BOOL AnimateWindow(DWORD dwFlags, DWORD dwTime = 200)
|
||||||
|
{
|
||||||
|
ATLASSERT(::IsWindow(m_hWnd));
|
||||||
|
return ::AnimateWindow(m_hWnd, dwTime, dwFlags);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL FlashWindowEx(DWORD dwFlags, UINT uCount, DWORD dwTimeout = 0)
|
||||||
|
{
|
||||||
|
ATLASSERT(::IsWindow(m_hWnd));
|
||||||
|
|
||||||
|
FLASHWINFO fi = { sizeof(FLASHWINFO) };
|
||||||
|
fi.hwnd = m_hWnd;
|
||||||
|
fi.dwFlags = dwFlags;
|
||||||
|
fi.uCount = uCount;
|
||||||
|
fi.dwTimeout = dwTimeout;
|
||||||
|
return ::FlashWindowEx(&fi);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL StopFlashWindowEx()
|
||||||
|
{
|
||||||
|
ATLASSERT(::IsWindow(m_hWnd));
|
||||||
|
|
||||||
|
FLASHWINFO fi = { sizeof(FLASHWINFO) };
|
||||||
|
fi.hwnd = m_hWnd;
|
||||||
|
fi.dwFlags = FLASHW_STOP;
|
||||||
|
return ::FlashWindowEx(&fi);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Class long properties
|
||||||
|
DWORD GetClassLong(int nIndex) const
|
||||||
|
{
|
||||||
|
ATLASSERT(::IsWindow(m_hWnd));
|
||||||
|
return ::GetClassLong(m_hWnd, nIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD SetClassLong(int nIndex, LONG dwNewLong)
|
||||||
|
{
|
||||||
|
ATLASSERT(::IsWindow(m_hWnd));
|
||||||
|
return ::SetClassLong(m_hWnd, nIndex, dwNewLong);
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONG_PTR GetClassLongPtr(int nIndex) const
|
||||||
|
{
|
||||||
|
ATLASSERT(::IsWindow(m_hWnd));
|
||||||
|
return ::GetClassLongPtr(m_hWnd, nIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONG_PTR SetClassLongPtr(int nIndex, LONG_PTR dwNewLong)
|
||||||
|
{
|
||||||
|
ATLASSERT(::IsWindow(m_hWnd));
|
||||||
|
return ::SetClassLongPtr(m_hWnd, nIndex, dwNewLong);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Layered windows
|
||||||
|
BOOL SetLayeredWindowAttributes(COLORREF crlKey, BYTE byteAlpha, DWORD dwFlags)
|
||||||
|
{
|
||||||
|
ATLASSERT(::IsWindow(m_hWnd));
|
||||||
|
ATLASSERT((GetExStyle() & WS_EX_LAYERED) != 0);
|
||||||
|
|
||||||
|
return ::SetLayeredWindowAttributes(m_hWnd, crlKey, byteAlpha, dwFlags);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL UpdateLayeredWindow(HDC hdcDst, LPPOINT pptDst, LPSIZE psize, HDC hdcSrc, LPPOINT pptSrc, COLORREF crlKey, BLENDFUNCTION* pblend, DWORD dwFlags)
|
||||||
|
{
|
||||||
|
ATLASSERT(::IsWindow(m_hWnd));
|
||||||
|
ATLASSERT((GetExStyle() & WS_EX_LAYERED) != 0);
|
||||||
|
|
||||||
|
return ::UpdateLayeredWindow(m_hWnd, hdcDst, pptDst, psize, hdcSrc, pptSrc, crlKey, pblend, dwFlags);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL UpdateLayeredWindow(LPPOINT pptDst = NULL)
|
||||||
|
{
|
||||||
|
ATLASSERT(::IsWindow(m_hWnd));
|
||||||
|
ATLASSERT((GetExStyle() & WS_EX_LAYERED) != 0);
|
||||||
|
|
||||||
|
return ::UpdateLayeredWindow(m_hWnd, NULL, pptDst, NULL, NULL, NULL, CLR_NONE, NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL GetLayeredWindowAttributes(COLORREF* pcrlKey, BYTE* pbyteAlpha, DWORD* pdwFlags) const
|
||||||
|
{
|
||||||
|
ATLASSERT(::IsWindow(m_hWnd));
|
||||||
|
ATLASSERT((GetExStyle() & WS_EX_LAYERED) != 0);
|
||||||
|
|
||||||
|
return ::GetLayeredWindowAttributes(m_hWnd, pcrlKey, pbyteAlpha, pdwFlags);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mouse tracking
|
||||||
|
BOOL StartTrackMouseLeave()
|
||||||
|
{
|
||||||
|
ATLASSERT(::IsWindow(m_hWnd));
|
||||||
|
|
||||||
|
TRACKMOUSEEVENT tme = {};
|
||||||
|
tme.cbSize = sizeof(TRACKMOUSEEVENT);
|
||||||
|
tme.dwFlags = TME_LEAVE;
|
||||||
|
tme.hwndTrack = m_hWnd;
|
||||||
|
return ::TrackMouseEvent(&tme);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL StartTrackMouse(DWORD dwFlags, DWORD dwHoverTime = HOVER_DEFAULT)
|
||||||
|
{
|
||||||
|
ATLASSERT(::IsWindow(m_hWnd));
|
||||||
|
|
||||||
|
TRACKMOUSEEVENT tme = {};
|
||||||
|
tme.cbSize = sizeof(TRACKMOUSEEVENT);
|
||||||
|
tme.dwFlags = dwFlags;
|
||||||
|
tme.hwndTrack = m_hWnd;
|
||||||
|
tme.dwHoverTime = dwHoverTime;
|
||||||
|
return ::TrackMouseEvent(&tme);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CancelTrackMouse(DWORD dwType)
|
||||||
|
{
|
||||||
|
ATLASSERT(::IsWindow(m_hWnd));
|
||||||
|
|
||||||
|
TRACKMOUSEEVENT tme = {};
|
||||||
|
tme.cbSize = sizeof(TRACKMOUSEEVENT);
|
||||||
|
tme.dwFlags = TME_CANCEL | dwType;
|
||||||
|
tme.hwndTrack = m_hWnd;
|
||||||
|
return ::TrackMouseEvent(&tme);
|
||||||
|
}
|
||||||
|
|
||||||
|
// CString support
|
||||||
|
#ifdef __ATLSTR_H__
|
||||||
|
int GetWindowText(ATL::CString& strText) const
|
||||||
|
{
|
||||||
|
int nLength = GetWindowTextLength();
|
||||||
|
LPTSTR pszText = strText.GetBuffer(nLength + 1);
|
||||||
|
nLength = ::GetWindowText(m_hWnd, pszText, nLength + 1);
|
||||||
|
strText.ReleaseBuffer(nLength);
|
||||||
|
|
||||||
|
return nLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
UINT GetDlgItemText(int nID, ATL::CString& strText) const
|
||||||
|
{
|
||||||
|
ATLASSERT(::IsWindow(m_hWnd));
|
||||||
|
|
||||||
|
HWND hItem = GetDlgItem(nID);
|
||||||
|
if(hItem != NULL)
|
||||||
|
{
|
||||||
|
int nLength = ::GetWindowTextLength(hItem);
|
||||||
|
LPTSTR pszText = strText.GetBuffer(nLength + 1);
|
||||||
|
nLength = ::GetWindowText(hItem, pszText, nLength + 1);
|
||||||
|
strText.ReleaseBuffer(nLength);
|
||||||
|
|
||||||
|
return nLength;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strText.Empty();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // __ATLSTR_H__
|
||||||
|
|
||||||
|
// Dialog window only
|
||||||
|
UINT DlgGetDefID() const
|
||||||
|
{
|
||||||
|
ATLASSERT(::IsWindow(m_hWnd));
|
||||||
|
|
||||||
|
LRESULT lRet = ::SendMessage(m_hWnd, DM_GETDEFID, 0, 0L);
|
||||||
|
UINT uID = 0U;
|
||||||
|
if(HIWORD(lRet) == DC_HASDEFID)
|
||||||
|
uID = LOWORD(lRet);
|
||||||
|
|
||||||
|
return uID;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DlgSetDefID(UINT uID)
|
||||||
|
{
|
||||||
|
ATLASSERT(::IsWindow(m_hWnd));
|
||||||
|
|
||||||
|
::SendMessage(m_hWnd, DM_SETDEFID, uID, 0L);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DlgReposition()
|
||||||
|
{
|
||||||
|
ATLASSERT(::IsWindow(m_hWnd));
|
||||||
|
|
||||||
|
::SendMessage(m_hWnd, DM_REPOSITION, 0, 0L);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace WTL
|
||||||
|
|
||||||
#endif // __ATLWINX_H__
|
#endif // __ATLWINX_H__
|
||||||
|
|
Loading…
Reference in New Issue