Merge pull request #1891 from oddMLan/3rdparty_wtl
Some code cleanup/fixes
This commit is contained in:
commit
5085b82f2c
|
@ -39,18 +39,18 @@
|
|||
<ClInclude Include="atlctrlx.h" />
|
||||
<ClInclude Include="atlddx.h" />
|
||||
<ClInclude Include="atldlgs.h" />
|
||||
<ClInclude Include="atldwm.h" />
|
||||
<ClInclude Include="atlfind.h" />
|
||||
<ClInclude Include="atlframe.h" />
|
||||
<ClInclude Include="atlgdi.h" />
|
||||
<ClInclude Include="atlmisc.h" />
|
||||
<ClInclude Include="atlprint.h" />
|
||||
<ClInclude Include="atlres.h" />
|
||||
<ClInclude Include="atlresce.h" />
|
||||
<ClInclude Include="atlribbon.h" />
|
||||
<ClInclude Include="atlscrl.h" />
|
||||
<ClInclude Include="atlsplit.h" />
|
||||
<ClInclude Include="atltheme.h" />
|
||||
<ClInclude Include="atluser.h" />
|
||||
<ClInclude Include="atlwince.h" />
|
||||
<ClInclude Include="atlwinx.h" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -28,6 +28,9 @@
|
|||
<ClInclude Include="atldlgs.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="atldwm.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="atlfind.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -46,7 +49,7 @@
|
|||
<ClInclude Include="atlres.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="atlresce.h">
|
||||
<ClInclude Include="atlribbon.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="atlscrl.h">
|
||||
|
@ -61,9 +64,6 @@
|
|||
<ClInclude Include="atluser.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="atlwince.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="atlwinx.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</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
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
// Windows Template Library - WTL version 10.0
|
||||
// Copyright (C) Microsoft Corporation, WTL Team. 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.
|
||||
// Microsoft Public License (http://opensource.org/licenses/MS-PL)
|
||||
// which can be found in the file MS-PL.txt at the root folder.
|
||||
|
||||
#ifndef __ATLDDX_H__
|
||||
#define __ATLDDX_H__
|
||||
|
@ -18,13 +15,7 @@
|
|||
#error atlddx.h requires atlapp.h to be included first
|
||||
#endif
|
||||
|
||||
#if defined(_ATL_USE_DDX_FLOAT) && defined(_ATL_MIN_CRT)
|
||||
#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
|
||||
#include <float.h>
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -44,94 +35,92 @@ namespace WTL
|
|||
#define BEGIN_DDX_MAP(thisClass) \
|
||||
BOOL DoDataExchange(BOOL bSaveAndValidate = FALSE, UINT nCtlID = (UINT)-1) \
|
||||
{ \
|
||||
bSaveAndValidate; \
|
||||
nCtlID;
|
||||
(bSaveAndValidate); \
|
||||
(nCtlID);
|
||||
|
||||
#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)) \
|
||||
return FALSE; \
|
||||
}
|
||||
|
||||
#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)) \
|
||||
return FALSE; \
|
||||
}
|
||||
|
||||
#define DDX_INT(nID, var) \
|
||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
||||
if((nCtlID == (UINT)-1) || (nCtlID == nID)) \
|
||||
{ \
|
||||
if(!DDX_Int(nID, var, TRUE, bSaveAndValidate)) \
|
||||
return FALSE; \
|
||||
}
|
||||
|
||||
#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)) \
|
||||
return FALSE; \
|
||||
}
|
||||
|
||||
#define DDX_UINT(nID, var) \
|
||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
||||
if((nCtlID == (UINT)-1) || (nCtlID == nID)) \
|
||||
{ \
|
||||
if(!DDX_Int(nID, var, FALSE, bSaveAndValidate)) \
|
||||
return FALSE; \
|
||||
}
|
||||
|
||||
#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)) \
|
||||
return FALSE; \
|
||||
}
|
||||
|
||||
#ifdef _ATL_USE_DDX_FLOAT
|
||||
#define DDX_FLOAT(nID, var) \
|
||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
||||
if((nCtlID == (UINT)-1) || (nCtlID == nID)) \
|
||||
{ \
|
||||
if(!DDX_Float(nID, var, bSaveAndValidate)) \
|
||||
return FALSE; \
|
||||
}
|
||||
|
||||
#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)) \
|
||||
return FALSE; \
|
||||
}
|
||||
#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)) \
|
||||
return FALSE; \
|
||||
}
|
||||
|
||||
#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)) \
|
||||
return FALSE; \
|
||||
}
|
||||
#endif // _ATL_USE_DDX_FLOAT
|
||||
|
||||
#define DDX_CONTROL(nID, obj) \
|
||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
||||
if((nCtlID == (UINT)-1) || (nCtlID == nID)) \
|
||||
DDX_Control(nID, obj, bSaveAndValidate);
|
||||
|
||||
#define DDX_CONTROL_HANDLE(nID, obj) \
|
||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
||||
if((nCtlID == (UINT)-1) || (nCtlID == nID)) \
|
||||
DDX_Control_Handle(nID, obj, bSaveAndValidate);
|
||||
|
||||
#define DDX_CHECK(nID, var) \
|
||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
||||
if((nCtlID == (UINT)-1) || (nCtlID == nID)) \
|
||||
DDX_Check(nID, var, bSaveAndValidate);
|
||||
|
||||
#define DDX_RADIO(nID, var) \
|
||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
||||
if((nCtlID == (UINT)-1) || (nCtlID == nID)) \
|
||||
DDX_Radio(nID, var, bSaveAndValidate);
|
||||
|
||||
#define END_DDX_MAP() \
|
||||
|
@ -140,10 +129,9 @@ namespace WTL
|
|||
|
||||
// DDX support for Tab, Combo, ListBox and ListView selection index
|
||||
// Note: Specialized versions require atlctrls.h to be included first
|
||||
#if (_MSC_VER >= 1300)
|
||||
|
||||
#define DDX_INDEX(CtrlClass, nID, var) \
|
||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
||||
if((nCtlID == (UINT)-1) || (nCtlID == nID)) \
|
||||
DDX_Index<CtrlClass>(nID, var, bSaveAndValidate);
|
||||
|
||||
#ifdef __ATLCTRLS_H__
|
||||
|
@ -153,8 +141,6 @@ namespace WTL
|
|||
#define DDX_LISTVIEW_INDEX(nID, var) DDX_INDEX(WTL::CListViewCtrl, nID, var)
|
||||
#endif // __ATLCTRLS_H__
|
||||
|
||||
#endif // (_MSC_VER >= 1300)
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// CWinDataExchange - provides support for DDX
|
||||
|
@ -228,7 +214,7 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
ATLASSERT(!bValidate || lstrlen(lpstrText) <= nLength);
|
||||
ATLASSERT(!bValidate || (lstrlen(lpstrText) <= nLength));
|
||||
bSuccess = pT->SetDlgItemText(nID, lpstrText);
|
||||
}
|
||||
|
||||
|
@ -264,7 +250,7 @@ public:
|
|||
{
|
||||
USES_CONVERSION;
|
||||
LPTSTR lpstrText = OLE2T(bstrText);
|
||||
ATLASSERT(!bValidate || lstrlen(lpstrText) <= nLength);
|
||||
ATLASSERT(!bValidate || (lstrlen(lpstrText) <= nLength));
|
||||
bSuccess = pT->SetDlgItemText(nID, lpstrText);
|
||||
}
|
||||
|
||||
|
@ -300,7 +286,7 @@ public:
|
|||
{
|
||||
USES_CONVERSION;
|
||||
LPTSTR lpstrText = OLE2T(bstrText);
|
||||
ATLASSERT(!bValidate || lstrlen(lpstrText) <= nLength);
|
||||
ATLASSERT(!bValidate || (lstrlen(lpstrText) <= nLength));
|
||||
bSuccess = pT->SetDlgItemText(nID, lpstrText);
|
||||
}
|
||||
|
||||
|
@ -323,8 +309,8 @@ public:
|
|||
return bSuccess;
|
||||
}
|
||||
|
||||
#if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__)
|
||||
BOOL DDX_Text(UINT nID, _CSTRING_NS::CString& strText, int /*cbSize*/, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0)
|
||||
#ifdef __ATLSTR_H__
|
||||
BOOL DDX_Text(UINT nID, ATL::CString& strText, int /*cbSize*/, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
BOOL bSuccess = TRUE;
|
||||
|
@ -366,7 +352,7 @@ public:
|
|||
}
|
||||
return bSuccess;
|
||||
}
|
||||
#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__)
|
||||
#endif // __ATLSTR_H__
|
||||
|
||||
// Numeric exchange
|
||||
template <class Type>
|
||||
|
@ -381,7 +367,7 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
ATLASSERT(!bValidate || nVal >= nMin && nVal <= nMax);
|
||||
ATLASSERT(!bValidate || ((nVal >= nMin) && (nVal <= nMax)));
|
||||
bSuccess = pT->SetDlgItemInt(nID, nVal, bSigned);
|
||||
}
|
||||
|
||||
|
@ -392,7 +378,7 @@ public:
|
|||
else if(bSave && bValidate) // validation
|
||||
{
|
||||
ATLASSERT(nMin != nMax);
|
||||
if(nVal < nMin || nVal > nMax)
|
||||
if((nVal < nMin) || (nVal > nMax))
|
||||
{
|
||||
_XData data = { ddxDataInt };
|
||||
data.intData.nVal = (long)nVal;
|
||||
|
@ -406,18 +392,17 @@ public:
|
|||
}
|
||||
|
||||
// Float exchange
|
||||
#ifdef _ATL_USE_DDX_FLOAT
|
||||
static BOOL _AtlSimpleFloatParse(LPCTSTR lpszText, double& d)
|
||||
{
|
||||
ATLASSERT(lpszText != NULL);
|
||||
while (*lpszText == _T(' ') || *lpszText == _T('\t'))
|
||||
while ((*lpszText == _T(' ')) || (*lpszText == _T('\t')))
|
||||
lpszText++;
|
||||
|
||||
TCHAR chFirst = lpszText[0];
|
||||
d = _tcstod(lpszText, (LPTSTR*)&lpszText);
|
||||
if (d == 0.0 && chFirst != _T('0'))
|
||||
if ((d == 0.0) && (chFirst != _T('0')))
|
||||
return FALSE; // could not convert
|
||||
while (*lpszText == _T(' ') || *lpszText == _T('\t'))
|
||||
while ((*lpszText == _T(' ')) || (*lpszText == _T('\t')))
|
||||
lpszText++;
|
||||
|
||||
if (*lpszText != _T('\0'))
|
||||
|
@ -431,7 +416,7 @@ public:
|
|||
T* pT = static_cast<T*>(this);
|
||||
BOOL bSuccess = TRUE;
|
||||
const int cchBuff = 32;
|
||||
TCHAR szBuff[cchBuff] = { 0 };
|
||||
TCHAR szBuff[cchBuff] = {};
|
||||
|
||||
if(bSave)
|
||||
{
|
||||
|
@ -444,8 +429,8 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
ATLASSERT(!bValidate || nVal >= nMin && nVal <= nMax);
|
||||
SecureHelper::sprintf_x(szBuff, cchBuff, _T("%.*g"), nPrecision, nVal);
|
||||
ATLASSERT(!bValidate || ((nVal >= nMin) && (nVal <= nMax)));
|
||||
_stprintf_s(szBuff, cchBuff, _T("%.*g"), nPrecision, nVal);
|
||||
bSuccess = pT->SetDlgItemText(nID, szBuff);
|
||||
}
|
||||
|
||||
|
@ -456,7 +441,7 @@ public:
|
|||
else if(bSave && bValidate) // validation
|
||||
{
|
||||
ATLASSERT(nMin != nMax);
|
||||
if(nVal < nMin || nVal > nMax)
|
||||
if((nVal < nMin) || (nVal > nMax))
|
||||
{
|
||||
_XData data = { ddxDataFloat };
|
||||
data.floatData.nVal = (double)nVal;
|
||||
|
@ -474,7 +459,7 @@ public:
|
|||
T* pT = static_cast<T*>(this);
|
||||
BOOL bSuccess = TRUE;
|
||||
const int cchBuff = 32;
|
||||
TCHAR szBuff[cchBuff] = { 0 };
|
||||
TCHAR szBuff[cchBuff] = {};
|
||||
|
||||
if(bSave)
|
||||
{
|
||||
|
@ -487,8 +472,8 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
ATLASSERT(!bValidate || nVal >= nMin && nVal <= nMax);
|
||||
SecureHelper::sprintf_x(szBuff, cchBuff, _T("%.*g"), nPrecision, nVal);
|
||||
ATLASSERT(!bValidate || ((nVal >= nMin) && (nVal <= nMax)));
|
||||
_stprintf_s(szBuff, cchBuff, _T("%.*g"), nPrecision, nVal);
|
||||
bSuccess = pT->SetDlgItemText(nID, szBuff);
|
||||
}
|
||||
|
||||
|
@ -499,7 +484,7 @@ public:
|
|||
else if(bSave && bValidate) // validation
|
||||
{
|
||||
ATLASSERT(nMin != nMax);
|
||||
if(nVal < nMin || nVal > nMax)
|
||||
if((nVal < nMin) || (nVal > nMax))
|
||||
{
|
||||
_XData data = { ddxDataFloat };
|
||||
data.floatData.nVal = nVal;
|
||||
|
@ -511,13 +496,12 @@ public:
|
|||
}
|
||||
return bSuccess;
|
||||
}
|
||||
#endif // _ATL_USE_DDX_FLOAT
|
||||
|
||||
// Full control subclassing (for CWindowImpl derived controls)
|
||||
template <class TControl>
|
||||
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);
|
||||
ctrl.SubclassWindow(pT->GetDlgItem(nID));
|
||||
|
@ -528,7 +512,7 @@ public:
|
|||
template <class TControl>
|
||||
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);
|
||||
ctrl = pT->GetDlgItem(nID);
|
||||
|
@ -543,11 +527,11 @@ public:
|
|||
if(bSave)
|
||||
{
|
||||
nValue = (int)::SendMessage(hWndCtrl, BM_GETCHECK, 0, 0L);
|
||||
ATLASSERT(nValue >= 0 && nValue <= 2);
|
||||
ATLASSERT((nValue >= 0) && (nValue <= 2));
|
||||
}
|
||||
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);
|
||||
nValue = 0; // default to off
|
||||
|
@ -611,11 +595,10 @@ public:
|
|||
}
|
||||
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
|
||||
#if (_MSC_VER >= 1300)
|
||||
template <class TCtrl>
|
||||
INT _getSel(TCtrl& tCtrl)
|
||||
{
|
||||
|
@ -660,7 +643,6 @@ public:
|
|||
else
|
||||
_setSel(ctrl, nVal);
|
||||
}
|
||||
#endif // (_MSC_VER >= 1300)
|
||||
|
||||
// Overrideables
|
||||
void OnDataExchangeError(UINT nCtrlID, BOOL /*bSave*/)
|
||||
|
@ -680,6 +662,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
}; // namespace WTL
|
||||
} // namespace WTL
|
||||
|
||||
#endif // __ATLDDX_H__
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,23 +1,16 @@
|
|||
// Windows Template Library - WTL version 8.1
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
// Windows Template Library - WTL version 10.0
|
||||
// Copyright (C) Microsoft Corporation, WTL Team. 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.
|
||||
// Microsoft Public License (http://opensource.org/licenses/MS-PL)
|
||||
// which can be found in the file MS-PL.txt at the root folder.
|
||||
|
||||
#ifndef __ATLDWM_H__
|
||||
#define __ATLDWM_H__
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
#error atldwm.h is not supported on Windows CE
|
||||
#endif
|
||||
|
||||
#ifndef __ATLAPP_H__
|
||||
#error atldwm.h requires atlapp.h to be included first
|
||||
#endif
|
||||
|
@ -28,11 +21,11 @@
|
|||
|
||||
#if (_WIN32_WINNT < 0x0600)
|
||||
#error atldwm.h requires _WIN32_WINNT >= 0x0600
|
||||
#endif // (_WIN32_WINNT < 0x0600)
|
||||
#endif
|
||||
|
||||
#ifndef _DWMAPI_H_
|
||||
#include <dwmapi.h>
|
||||
#endif // _DWMAPI_H_
|
||||
#include <dwmapi.h>
|
||||
#endif
|
||||
#pragma comment(lib, "dwmapi.lib")
|
||||
|
||||
// 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,
|
||||
// and add dwmapi.dll in the Linker.Input.Delay Loaded DLLs section of the
|
||||
// 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:
|
||||
|
@ -106,32 +96,42 @@ public:
|
|||
// Operations
|
||||
BOOL DwmIsCompositionEnabled() const
|
||||
{
|
||||
if(!IsDwmSupported()) return FALSE;
|
||||
if(!IsDwmSupported())
|
||||
return FALSE;
|
||||
|
||||
BOOL bRes = FALSE;
|
||||
return SUCCEEDED(::DwmIsCompositionEnabled(&bRes)) && bRes;
|
||||
return (SUCCEEDED(::DwmIsCompositionEnabled(&bRes)) && bRes) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
BOOL DwmEnableComposition(UINT fEnable)
|
||||
{
|
||||
if(!IsDwmSupported()) return FALSE;
|
||||
return SUCCEEDED(::DwmEnableComposition(fEnable));
|
||||
if(!IsDwmSupported())
|
||||
return FALSE;
|
||||
|
||||
return SUCCEEDED(::DwmEnableComposition(fEnable)) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
BOOL DwmEnableMMCSS(BOOL fEnableMMCSS)
|
||||
{
|
||||
if(!IsDwmSupported()) return FALSE;
|
||||
return SUCCEEDED(::DwmEnableMMCSS(fEnableMMCSS));
|
||||
if(!IsDwmSupported())
|
||||
return FALSE;
|
||||
|
||||
return SUCCEEDED(::DwmEnableMMCSS(fEnableMMCSS)) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
HRESULT DwmGetColorizationColor(DWORD* pcrColorization, BOOL* pfOpaqueBlend)
|
||||
{
|
||||
if(!IsDwmSupported()) return E_NOTIMPL;
|
||||
if(!IsDwmSupported())
|
||||
return E_NOTIMPL;
|
||||
|
||||
return ::DwmGetColorizationColor(pcrColorization, pfOpaqueBlend);
|
||||
}
|
||||
|
||||
HRESULT DwmFlush()
|
||||
{
|
||||
if(!IsDwmSupported()) return E_NOTIMPL;
|
||||
if(!IsDwmSupported())
|
||||
return E_NOTIMPL;
|
||||
|
||||
return ::DwmFlush();
|
||||
}
|
||||
};
|
||||
|
@ -148,7 +148,9 @@ class CDwmImpl : public TBase
|
|||
public:
|
||||
HRESULT DwmEnableBlurBehindWindow(const DWM_BLURBEHIND* pBB)
|
||||
{
|
||||
if(!IsDwmSupported()) return E_NOTIMPL;
|
||||
if(!this->IsDwmSupported())
|
||||
return E_NOTIMPL;
|
||||
|
||||
T* pT = static_cast<T*>(this);
|
||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||
return ::DwmEnableBlurBehindWindow(pT->m_hWnd, pBB);
|
||||
|
@ -156,7 +158,9 @@ public:
|
|||
|
||||
HRESULT DwmExtendFrameIntoClientArea(const MARGINS* pMargins)
|
||||
{
|
||||
if(!IsDwmSupported()) return E_NOTIMPL;
|
||||
if(!this->IsDwmSupported())
|
||||
return E_NOTIMPL;
|
||||
|
||||
T* pT = static_cast<T*>(this);
|
||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||
return ::DwmExtendFrameIntoClientArea(pT->m_hWnd, pMargins);
|
||||
|
@ -170,7 +174,9 @@ public:
|
|||
|
||||
HRESULT DwmGetCompositionTimingInfo(DWM_TIMING_INFO* pTimingInfo)
|
||||
{
|
||||
if(!IsDwmSupported()) return E_NOTIMPL;
|
||||
if(!this->IsDwmSupported())
|
||||
return E_NOTIMPL;
|
||||
|
||||
T* pT = static_cast<T*>(this);
|
||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||
return ::DwmGetCompositionTimingInfo(pT->m_hWnd, pTimingInfo);
|
||||
|
@ -178,7 +184,9 @@ public:
|
|||
|
||||
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);
|
||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||
return ::DwmGetWindowAttribute(pT->m_hWnd, dwAttribute, pvAttribute, cbAttribute);
|
||||
|
@ -186,7 +194,9 @@ public:
|
|||
|
||||
HRESULT DwmModifyPreviousDxFrameDuration(INT cRefreshes, BOOL fRelative)
|
||||
{
|
||||
if(!IsDwmSupported()) return E_NOTIMPL;
|
||||
if(!this->IsDwmSupported())
|
||||
return E_NOTIMPL;
|
||||
|
||||
T* pT = static_cast<T*>(this);
|
||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||
return ::DwmModifyPreviousDxFrameDuration(pT->m_hWnd, cRefreshes, fRelative);
|
||||
|
@ -194,7 +204,9 @@ public:
|
|||
|
||||
HRESULT DwmSetDxFrameDuration(INT cRefreshes)
|
||||
{
|
||||
if(!IsDwmSupported()) return E_NOTIMPL;
|
||||
if(!this->IsDwmSupported())
|
||||
return E_NOTIMPL;
|
||||
|
||||
T* pT = static_cast<T*>(this);
|
||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||
return ::DwmSetDxFrameDuration(pT->m_hWnd, cRefreshes);
|
||||
|
@ -202,7 +214,9 @@ public:
|
|||
|
||||
HRESULT DwmSetPresentParameters(DWM_PRESENT_PARAMETERS* pPresentParams)
|
||||
{
|
||||
if(!IsDwmSupported()) return E_NOTIMPL;
|
||||
if(!this->IsDwmSupported())
|
||||
return E_NOTIMPL;
|
||||
|
||||
T* pT = static_cast<T*>(this);
|
||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||
return ::DwmSetPresentParameters(pT->m_hWnd, pPresentParams);
|
||||
|
@ -210,7 +224,9 @@ public:
|
|||
|
||||
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);
|
||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||
return ::DwmSetWindowAttribute(pT->m_hWnd, dwAttribute, pvAttribute, cbAttribute);
|
||||
|
@ -218,7 +234,9 @@ public:
|
|||
|
||||
HRESULT DwmAttachMilContent()
|
||||
{
|
||||
if(!IsDwmSupported()) return E_NOTIMPL;
|
||||
if(!this->IsDwmSupported())
|
||||
return E_NOTIMPL;
|
||||
|
||||
T* pT = static_cast<T*>(this);
|
||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||
return ::DwmAttachMilContent(pT->m_hWnd);
|
||||
|
@ -226,7 +244,9 @@ public:
|
|||
|
||||
HRESULT DwmDetachMilContent()
|
||||
{
|
||||
if(!IsDwmSupported()) return E_NOTIMPL;
|
||||
if(!this->IsDwmSupported())
|
||||
return E_NOTIMPL;
|
||||
|
||||
T* pT = static_cast<T*>(this);
|
||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||
return ::DwmDetachMilContent(pT->m_hWnd);
|
||||
|
@ -242,7 +262,7 @@ public:
|
|||
|
||||
CDwmWindowT< TBase >& operator =(HWND hWnd)
|
||||
{
|
||||
m_hWnd = hWnd;
|
||||
this->m_hWnd = hWnd;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
@ -262,12 +282,11 @@ public:
|
|||
|
||||
// Constructor
|
||||
CDwmThumbnailT(HTHUMBNAIL hThumbnail = NULL) : m_hThumbnail(hThumbnail)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
~CDwmThumbnailT()
|
||||
{
|
||||
if(t_bManaged && m_hThumbnail != NULL)
|
||||
if(t_bManaged && (m_hThumbnail != NULL))
|
||||
Unregister();
|
||||
}
|
||||
|
||||
|
@ -280,7 +299,7 @@ public:
|
|||
|
||||
void Attach(HTHUMBNAIL hThumbnailNew)
|
||||
{
|
||||
if(t_bManaged && m_hThumbnail != NULL && m_hThumbnail != hThumbnailNew)
|
||||
if(t_bManaged && (m_hThumbnail != NULL) && (m_hThumbnail != hThumbnailNew))
|
||||
Unregister();
|
||||
m_hThumbnail = hThumbnailNew;
|
||||
}
|
||||
|
@ -297,16 +316,24 @@ public:
|
|||
ATLASSERT(::IsWindow(hwndDestination));
|
||||
ATLASSERT(::IsWindow(hwndSource));
|
||||
ATLASSERT(m_hThumbnail==NULL);
|
||||
if(!IsDwmSupported()) return E_NOTIMPL;
|
||||
|
||||
if(!this->IsDwmSupported())
|
||||
return E_NOTIMPL;
|
||||
|
||||
return ::DwmRegisterThumbnail(hwndDestination, hwndSource, &m_hThumbnail);
|
||||
}
|
||||
|
||||
HRESULT Unregister()
|
||||
{
|
||||
if(!IsDwmSupported()) return E_NOTIMPL;
|
||||
if(m_hThumbnail == NULL) return S_FALSE;
|
||||
if(!this->IsDwmSupported())
|
||||
return E_NOTIMPL;
|
||||
if(m_hThumbnail == NULL)
|
||||
return S_FALSE;
|
||||
|
||||
HRESULT Hr = ::DwmUnregisterThumbnail(m_hThumbnail);
|
||||
if(SUCCEEDED(Hr)) m_hThumbnail = NULL;
|
||||
if(SUCCEEDED(Hr))
|
||||
m_hThumbnail = NULL;
|
||||
|
||||
return Hr;
|
||||
}
|
||||
|
||||
|
@ -316,7 +343,9 @@ public:
|
|||
|
||||
HRESULT UpdateProperties(const DWM_THUMBNAIL_PROPERTIES* ptnProperties)
|
||||
{
|
||||
if(!IsDwmSupported()) return E_NOTIMPL;
|
||||
if(!this->IsDwmSupported())
|
||||
return E_NOTIMPL;
|
||||
|
||||
ATLASSERT(m_hThumbnail != NULL);
|
||||
return ::DwmUpdateThumbnailProperties(m_hThumbnail, ptnProperties);
|
||||
}
|
||||
|
@ -324,7 +353,9 @@ public:
|
|||
// Attributes
|
||||
HRESULT QuerySourceSize(PSIZE pSize)
|
||||
{
|
||||
if(!IsDwmSupported()) return E_NOTIMPL;
|
||||
if(!this->IsDwmSupported())
|
||||
return E_NOTIMPL;
|
||||
|
||||
ATLASSERT(m_hThumbnail != NULL);
|
||||
return ::DwmQueryThumbnailSourceSize(m_hThumbnail, pSize);
|
||||
}
|
||||
|
@ -340,10 +371,9 @@ typedef CDwmThumbnailT<false, CDwm> CDwmThumbnailHandle;
|
|||
// CAeroControlImpl - Base class for controls on Glass
|
||||
|
||||
template <class T, class TBase = ATL::CWindow, class TWinTraits = ATL::CControlWinTraits>
|
||||
class CAeroControlImpl :
|
||||
public CThemeImpl<T>,
|
||||
public CBufferedPaintImpl<T>,
|
||||
public ATL::CWindowImpl<T, TBase, TWinTraits>
|
||||
class CAeroControlImpl : public CThemeImpl<T>,
|
||||
public CBufferedPaintImpl<T>,
|
||||
public ATL::CWindowImpl<T, TBase, TWinTraits>
|
||||
{
|
||||
public:
|
||||
typedef CThemeImpl<T> _themeClass;
|
||||
|
@ -352,7 +382,7 @@ public:
|
|||
|
||||
CAeroControlImpl()
|
||||
{
|
||||
m_PaintParams.dwFlags = BPPF_ERASE;
|
||||
this->m_PaintParams.dwFlags = BPPF_ERASE;
|
||||
}
|
||||
|
||||
static LPCWSTR GetThemeName()
|
||||
|
@ -377,13 +407,16 @@ public:
|
|||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
pT->Init();
|
||||
|
||||
bHandled = FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT OnActivate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
|
||||
{
|
||||
if(IsThemingSupported()) Invalidate(FALSE);
|
||||
if(this->IsThemingSupported())
|
||||
this->Invalidate(FALSE);
|
||||
|
||||
bHandled = FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
@ -391,23 +424,26 @@ public:
|
|||
// Operations
|
||||
BOOL SubclassWindow(HWND hWnd)
|
||||
{
|
||||
ATLASSERT(m_hWnd == NULL);
|
||||
ATLASSERT(this->m_hWnd == NULL);
|
||||
ATLASSERT(::IsWindow(hWnd));
|
||||
BOOL bRet = _windowClass::SubclassWindow(hWnd);
|
||||
if(bRet) {
|
||||
if(bRet)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
pT->Init();
|
||||
}
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
// Implementation
|
||||
LRESULT DefWindowProc()
|
||||
{
|
||||
const _ATL_MSG* pMsg = m_pCurrentMsg;
|
||||
const ATL::_ATL_MSG* pMsg = this->m_pCurrentMsg;
|
||||
LRESULT lRes = 0;
|
||||
if(pMsg != NULL)
|
||||
lRes = DefWindowProc(pMsg->message, pMsg->wParam, pMsg->lParam);
|
||||
|
||||
return lRes;
|
||||
}
|
||||
|
||||
|
@ -415,7 +451,9 @@ public:
|
|||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -423,12 +461,12 @@ public:
|
|||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
HDC hDCPaint = NULL;
|
||||
RECT rcClient = { 0 };
|
||||
GetClientRect(&rcClient);
|
||||
m_BufferedPaint.Begin(hDC, &rcClient, m_dwFormat, &m_PaintParams, &hDCPaint);
|
||||
RECT rcClient = {};
|
||||
this->GetClientRect(&rcClient);
|
||||
this->m_BufferedPaint.Begin(hDC, &rcClient, this->m_dwFormat, &this->m_PaintParams, &hDCPaint);
|
||||
ATLASSERT(hDCPaint != NULL);
|
||||
pT->DoAeroPaint(hDCPaint, rcClient, rcPaint);
|
||||
m_BufferedPaint.End();
|
||||
this->m_BufferedPaint.End();
|
||||
}
|
||||
|
||||
void DoPaint(HDC /*hdc*/, RECT& /*rcClient*/)
|
||||
|
@ -440,22 +478,21 @@ public:
|
|||
void Init()
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
SetThemeClassList(pT->GetThemeName());
|
||||
if(m_lpstrThemeClassList != NULL)
|
||||
OpenThemeData();
|
||||
(void)pT; // avoid level 4 warning
|
||||
this->SetThemeClassList(pT->GetThemeName());
|
||||
if(this->m_lpstrThemeClassList != NULL)
|
||||
this->OpenThemeData();
|
||||
}
|
||||
|
||||
void DoAeroPaint(HDC hDC, RECT& /*rcClient*/, RECT& rcPaint)
|
||||
{
|
||||
DefWindowProc(WM_PAINT, (WPARAM) hDC, 0L);
|
||||
m_BufferedPaint.MakeOpaque(&rcPaint);
|
||||
this->m_BufferedPaint.MakeOpaque(&rcPaint);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // __ATLTHEME_H__
|
||||
|
||||
|
||||
}; // namespace WTL
|
||||
|
||||
} // namespace WTL
|
||||
|
||||
#endif // __ATLDWM_H__
|
||||
|
|
|
@ -1,23 +1,16 @@
|
|||
// Windows Template Library - WTL version 8.1
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
// Windows Template Library - WTL version 10.0
|
||||
// Copyright (C) Microsoft Corporation, WTL Team. 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.
|
||||
// Microsoft Public License (http://opensource.org/licenses/MS-PL)
|
||||
// which can be found in the file MS-PL.txt at the root folder.
|
||||
|
||||
#ifndef __ATLFIND_H__
|
||||
#define __ATLFIND_H__
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
#error atlfind.h is not supported on Windows CE
|
||||
#endif
|
||||
|
||||
#ifndef __ATLCTRLS_H__
|
||||
#error atlfind.h requires atlctrls.h to be included first
|
||||
#endif
|
||||
|
@ -26,8 +19,8 @@
|
|||
#error atlfind.h requires atldlgs.h to be included first
|
||||
#endif
|
||||
|
||||
#if !((defined(__ATLMISC_H__) && defined(_WTL_USE_CSTRING)) || defined(__ATLSTR_H__))
|
||||
#error atlfind.h requires CString (either from ATL's atlstr.h or WTL's atlmisc.h with _WTL_USE_CSTRING)
|
||||
#ifndef __ATLSTR_H__
|
||||
#error atlfind.h requires CString
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -53,13 +46,6 @@ protected:
|
|||
// Typedefs
|
||||
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
|
||||
enum TranslationTextItem
|
||||
{
|
||||
|
@ -70,6 +56,13 @@ protected:
|
|||
};
|
||||
|
||||
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
|
||||
CEditFindReplaceImplBase() :
|
||||
m_pFindReplaceDialog(NULL),
|
||||
|
@ -86,25 +79,12 @@ public:
|
|||
// Message Handlers
|
||||
BEGIN_MSG_MAP(thisClass)
|
||||
ALT_MSG_MAP(1)
|
||||
MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
|
||||
MESSAGE_HANDLER(TFindReplaceDialog::GetFindReplaceMsg(), OnFindReplaceCmd)
|
||||
COMMAND_ID_HANDLER(ID_EDIT_FIND, OnEditFind)
|
||||
COMMAND_ID_HANDLER(ID_EDIT_REPEAT, OnEditRepeat)
|
||||
COMMAND_ID_HANDLER(ID_EDIT_REPLACE, OnEditReplace)
|
||||
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*/)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
|
@ -207,7 +187,8 @@ public:
|
|||
{
|
||||
// You can override all of this in a derived class
|
||||
|
||||
TFindReplaceDialog* findReplaceDialog = new TFindReplaceDialog();
|
||||
TFindReplaceDialog* findReplaceDialog = NULL;
|
||||
ATLTRY(findReplaceDialog = new TFindReplaceDialog());
|
||||
if(findReplaceDialog == NULL)
|
||||
{
|
||||
::MessageBeep(MB_ICONHAND);
|
||||
|
@ -241,30 +222,29 @@ public:
|
|||
// (CEdit::GetSel uses int&, and CRichEditCtrlT::GetSel uses LONG&)
|
||||
::SendMessage(pT->m_hWnd, EM_GETSEL, (WPARAM)&nStartChar, (LPARAM)&nEndChar);
|
||||
POINT point = pT->PosFromChar(nStartChar);
|
||||
::ClientToScreen(pT->GetParent(), &point);
|
||||
CRect rect;
|
||||
pT->ClientToScreen(&point);
|
||||
RECT 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
|
||||
{
|
||||
int nVertExt = GetSystemMetrics(SM_CYSCREEN);
|
||||
if(point.y + rect.Height() < nVertExt)
|
||||
rect.OffsetRect(0, 40 + point.y - rect.top);
|
||||
if((point.y + (rect.bottom - rect.top)) < nVertExt)
|
||||
::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;
|
||||
|
||||
if(m_bFindDown)
|
||||
dwFlags |= FR_DOWN;
|
||||
if(m_bMatchCase)
|
||||
|
@ -296,12 +276,12 @@ public:
|
|||
|
||||
ATLASSERT(m_pFindReplaceDialog == NULL);
|
||||
|
||||
_CSTRING_NS::CString findNext;
|
||||
ATL::CString findNext;
|
||||
pT->GetSelText(findNext);
|
||||
// if selection is empty or spans multiple lines use old find text
|
||||
if(findNext.IsEmpty() || (findNext.FindOneOf(_T("\n\r")) != -1))
|
||||
findNext = m_sFindNext;
|
||||
_CSTRING_NS::CString replaceWith = m_sReplaceWith;
|
||||
ATL::CString replaceWith = m_sReplaceWith;
|
||||
DWORD dwFlags = pT->GetFindReplaceDialogFlags();
|
||||
|
||||
m_pFindReplaceDialog = pT->CreateFindReplaceDialog(bFindOnly,
|
||||
|
@ -325,11 +305,11 @@ public:
|
|||
return FALSE;
|
||||
|
||||
// length is the same, check contents
|
||||
_CSTRING_NS::CString selectedText;
|
||||
ATL::CString selectedText;
|
||||
pT->GetSelText(selectedText);
|
||||
|
||||
return (bMatchCase && selectedText.Compare(lpszCompare) == 0) ||
|
||||
(!bMatchCase && selectedText.CompareNoCase(lpszCompare) == 0);
|
||||
return (bMatchCase && (selectedText.Compare(lpszCompare) == 0)) ||
|
||||
(!bMatchCase && (selectedText.CompareNoCase(lpszCompare) == 0));
|
||||
}
|
||||
|
||||
void TextNotFound(LPCTSTR lpszFind)
|
||||
|
@ -339,9 +319,9 @@ public:
|
|||
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)
|
||||
{
|
||||
case eText_OnReplaceAllMessage:
|
||||
|
@ -445,12 +425,11 @@ public:
|
|||
|
||||
::SetCursor(m_hOldCursor);
|
||||
|
||||
_CSTRING_NS::CString message = pT->GetTranslationText(eText_OnReplaceAllMessage);
|
||||
ATL::CString message = pT->GetTranslationText(eText_OnReplaceAllMessage);
|
||||
if(message.GetLength() > 0)
|
||||
{
|
||||
_CSTRING_NS::CString formattedMessage;
|
||||
formattedMessage.Format(message,
|
||||
replaceCount, m_sFindNext, m_sReplaceWith);
|
||||
ATL::CString formattedMessage;
|
||||
formattedMessage.Format(message, replaceCount, (LPCTSTR)m_sFindNext, (LPCTSTR)m_sReplaceWith);
|
||||
if(m_pFindReplaceDialog != NULL)
|
||||
{
|
||||
m_pFindReplaceDialog->MessageBox(formattedMessage,
|
||||
|
@ -469,10 +448,10 @@ public:
|
|||
void OnTextNotFound(LPCTSTR lpszFind)
|
||||
{
|
||||
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)
|
||||
{
|
||||
_CSTRING_NS::CString formattedMessage;
|
||||
ATL::CString formattedMessage;
|
||||
formattedMessage.Format(message, lpszFind);
|
||||
if(m_pFindReplaceDialog != NULL)
|
||||
{
|
||||
|
@ -523,29 +502,7 @@ protected:
|
|||
typedef CEditFindReplaceImpl<T, TFindReplaceDialog> thisClass;
|
||||
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:
|
||||
// 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
|
||||
BEGIN_MSG_MAP(thisClass)
|
||||
ALT_MSG_MAP(1)
|
||||
|
@ -573,14 +530,14 @@ public:
|
|||
int iDir = bFindDown ? +1 : -1;
|
||||
|
||||
// can't find a match before the first character
|
||||
if(nStart == 0 && iDir < 0)
|
||||
if((nStart == 0) && (iDir < 0))
|
||||
return FALSE;
|
||||
|
||||
LPCTSTR lpszText = pT->LockBuffer();
|
||||
|
||||
bool isDBCS = false;
|
||||
#ifdef _MBCS
|
||||
CPINFO info = { 0 };
|
||||
CPINFO info = {};
|
||||
::GetCPInfo(::GetOEMCP(), &info);
|
||||
isDBCS = (info.MaxCharSize > 1);
|
||||
#endif
|
||||
|
@ -590,7 +547,7 @@ public:
|
|||
// always go back one for search backwards
|
||||
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
|
||||
#ifndef _UNICODE
|
||||
|
@ -602,9 +559,9 @@ public:
|
|||
|
||||
// handle search with nStart past end of buffer
|
||||
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)
|
||||
{
|
||||
|
@ -621,7 +578,7 @@ public:
|
|||
// single-byte character set is easy and fast
|
||||
nStart = nLen - nLenFind;
|
||||
}
|
||||
ATLASSERT(nStart + nLenFind - 1 <= nLen);
|
||||
ATLASSERT((nStart + nLenFind - 1) <= nLen);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -655,9 +612,9 @@ public:
|
|||
while(lpsz <= lpszStop)
|
||||
{
|
||||
#ifndef _UNICODE
|
||||
if(!bMatchCase || (*lpsz == *lpszFind && (!::IsDBCSLeadByte(*lpsz) || lpsz[1] == lpszFind[1])))
|
||||
if(!bMatchCase || ((*lpsz == *lpszFind) && (!::IsDBCSLeadByte(*lpsz) || (lpsz[1] == lpszFind[1]))))
|
||||
#else
|
||||
if(!bMatchCase || (*lpsz == *lpszFind && lpsz[1] == lpszFind[1]))
|
||||
if(!bMatchCase || ((*lpsz == *lpszFind) && (lpsz[1] == lpszFind[1])))
|
||||
#endif
|
||||
{
|
||||
LPTSTR lpch = (LPTSTR)(lpsz + nLenFind);
|
||||
|
@ -686,7 +643,7 @@ public:
|
|||
else
|
||||
{
|
||||
// single-byte string search
|
||||
UINT nCompare;
|
||||
UINT nCompare = 0;
|
||||
if(iDir < 0)
|
||||
nCompare = (UINT)(lpsz - lpszText) + 1;
|
||||
else
|
||||
|
@ -695,7 +652,7 @@ public:
|
|||
while(nCompare > 0)
|
||||
{
|
||||
ATLASSERT(lpsz >= lpszText);
|
||||
ATLASSERT(lpsz + nLenFind - 1 <= lpszText + nLen - 1);
|
||||
ATLASSERT((lpsz + nLenFind - 1) <= (lpszText + nLen - 1));
|
||||
|
||||
LPSTR lpch = (LPSTR)(lpsz + nLenFind);
|
||||
char chSave = *lpch;
|
||||
|
@ -726,35 +683,20 @@ public:
|
|||
LPCTSTR LockBuffer() const
|
||||
{
|
||||
const T* pT = static_cast<const T*>(this);
|
||||
|
||||
ATLASSERT(pT->m_hWnd != NULL);
|
||||
|
||||
BOOL useShadowBuffer = pT->UseShadowBuffer();
|
||||
if(useShadowBuffer)
|
||||
#ifndef _UNICODE
|
||||
// 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())
|
||||
{
|
||||
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;
|
||||
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);
|
||||
}
|
||||
#endif // !_UNICODE
|
||||
|
||||
HLOCAL hLocal = pT->GetHandle();
|
||||
ATLASSERT(hLocal != NULL);
|
||||
|
@ -767,23 +709,18 @@ public:
|
|||
void UnlockBuffer() const
|
||||
{
|
||||
const T* pT = static_cast<const T*>(this);
|
||||
|
||||
ATLASSERT(pT->m_hWnd != NULL);
|
||||
|
||||
BOOL useShadowBuffer = pT->UseShadowBuffer();
|
||||
if(!useShadowBuffer)
|
||||
{
|
||||
HLOCAL hLocal = pT->GetHandle();
|
||||
ATLASSERT(hLocal != NULL);
|
||||
::LocalUnlock(hLocal);
|
||||
}
|
||||
HLOCAL hLocal = pT->GetHandle();
|
||||
ATLASSERT(hLocal != NULL);
|
||||
::LocalUnlock(hLocal);
|
||||
}
|
||||
|
||||
UINT GetBufferLength() const
|
||||
{
|
||||
const T* pT = static_cast<const T*>(this);
|
||||
|
||||
ATLASSERT(pT->m_hWnd != NULL);
|
||||
|
||||
UINT nLen = 0;
|
||||
LPCTSTR lpszText = pT->LockBuffer();
|
||||
if(lpszText != NULL)
|
||||
|
@ -797,12 +734,12 @@ public:
|
|||
{
|
||||
LPCTSTR lpsz = lpszText + nIndex;
|
||||
LPCTSTR lpszStop = lpszText + nLen;
|
||||
while(lpsz < lpszStop && *lpsz != _T('\r'))
|
||||
while((lpsz < lpszStop) && (*lpsz != _T('\r')))
|
||||
++lpsz;
|
||||
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);
|
||||
|
||||
|
@ -811,90 +748,12 @@ public:
|
|||
ATLASSERT((UINT)nEndChar <= pT->GetBufferLength());
|
||||
LPCTSTR lpszText = pT->LockBuffer();
|
||||
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);
|
||||
pT->UnlockBuffer();
|
||||
|
||||
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);
|
||||
|
||||
ATLASSERT(lpszFind != NULL);
|
||||
FINDTEXTEX ft = { 0 };
|
||||
FINDTEXTEX ft = {};
|
||||
|
||||
pT->GetSel(ft.chrg);
|
||||
if(m_bFirstSearch)
|
||||
if(this->m_bFirstSearch)
|
||||
{
|
||||
if(bFindDown)
|
||||
m_nInitialSearchPos = ft.chrg.cpMin;
|
||||
this->m_nInitialSearchPos = ft.chrg.cpMin;
|
||||
else
|
||||
m_nInitialSearchPos = ft.chrg.cpMax;
|
||||
m_bFirstSearch = FALSE;
|
||||
this->m_nInitialSearchPos = ft.chrg.cpMax;
|
||||
this->m_bFirstSearch = FALSE;
|
||||
}
|
||||
|
||||
#if (_RICHEDIT_VER >= 0x0200)
|
||||
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
|
||||
{
|
||||
|
@ -962,18 +816,18 @@ public:
|
|||
else
|
||||
{
|
||||
// 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;
|
||||
dwFlags |= bWholeWord ? FR_WHOLEWORD : 0;
|
||||
|
||||
ft.chrg.cpMax = pT->GetTextLength() + m_nInitialSearchPos;
|
||||
ft.chrg.cpMax = pT->GetTextLength() + this->m_nInitialSearchPos;
|
||||
|
||||
if(bFindDown)
|
||||
{
|
||||
if(m_nInitialSearchPos >= 0)
|
||||
if(this->m_nInitialSearchPos >= 0)
|
||||
ft.chrg.cpMax = pT->GetTextLength();
|
||||
|
||||
dwFlags |= FR_DOWN;
|
||||
|
@ -981,7 +835,7 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
if(m_nInitialSearchPos >= 0)
|
||||
if(this->m_nInitialSearchPos >= 0)
|
||||
ft.chrg.cpMax = 0;
|
||||
|
||||
dwFlags &= ~FR_DOWN;
|
||||
|
@ -989,26 +843,25 @@ public:
|
|||
}
|
||||
|
||||
BOOL bRet = FALSE;
|
||||
|
||||
if(pT->FindAndSelect(dwFlags, ft) != -1)
|
||||
{
|
||||
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
|
||||
// of the buffer and we haven't already been here
|
||||
if(bFindDown)
|
||||
{
|
||||
ft.chrg.cpMin = 0;
|
||||
ft.chrg.cpMax = m_nInitialSearchPos;
|
||||
ft.chrg.cpMax = this->m_nInitialSearchPos;
|
||||
}
|
||||
else
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
@ -1027,6 +880,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
}; // namespace WTL
|
||||
} // namespace WTL
|
||||
|
||||
#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
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
// Windows Template Library - WTL version 10.0
|
||||
// Copyright (C) Microsoft Corporation, WTL Team. 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.
|
||||
// Microsoft Public License (http://opensource.org/licenses/MS-PL)
|
||||
// which can be found in the file MS-PL.txt at the root folder.
|
||||
|
||||
#ifndef __ATLPRINT_H__
|
||||
#define __ATLPRINT_H__
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
#error atlprint.h is not supported on Windows CE
|
||||
#endif
|
||||
|
||||
#ifndef __ATLAPP_H__
|
||||
#error atlprint.h requires atlapp.h to be included first
|
||||
#endif
|
||||
|
@ -26,6 +19,8 @@
|
|||
#error atlprint.h requires atlwin.h to be included first
|
||||
#endif
|
||||
|
||||
#include <winspool.h>
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// 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<6> { public: typedef PRINTER_INFO_6 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<9> { public: typedef PRINTER_INFO_9 infotype; };
|
||||
#endif // _ATL_USE_NEW_PRINTER_INFO
|
||||
|
||||
|
||||
template <unsigned int t_nInfo>
|
||||
|
@ -195,26 +187,18 @@ public:
|
|||
bool OpenDefaultPrinter(const DEVMODE* pDevMode = NULL)
|
||||
{
|
||||
ClosePrinter();
|
||||
const int cchBuff = 512;
|
||||
TCHAR buffer[cchBuff];
|
||||
buffer[0] = 0;
|
||||
::GetProfileString(_T("windows"), _T("device"), _T(",,,"), buffer, cchBuff);
|
||||
int nLen = lstrlen(buffer);
|
||||
if (nLen != 0)
|
||||
|
||||
DWORD cchBuff = 0;
|
||||
::GetDefaultPrinter(NULL, &cchBuff);
|
||||
TCHAR* pszBuff = new TCHAR[cchBuff];
|
||||
BOOL bRet = ::GetDefaultPrinter(pszBuff, &cchBuff);
|
||||
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 };
|
||||
::OpenPrinter(buffer, &m_hPrinter, (pDevMode == NULL) ? NULL : &pdefs);
|
||||
::OpenPrinter(pszBuff, &m_hPrinter, (pDevMode == NULL) ? NULL : &pdefs);
|
||||
}
|
||||
delete [] pszBuff;
|
||||
|
||||
return m_hPrinter != NULL;
|
||||
}
|
||||
|
||||
|
@ -237,31 +221,43 @@ public:
|
|||
|
||||
HANDLE CopyToHDEVNAMES() const
|
||||
{
|
||||
HANDLE h = NULL;
|
||||
HANDLE hDevNames = NULL;
|
||||
CPrinterInfo<5> pinfon5;
|
||||
CPrinterInfo<2> pinfon2;
|
||||
LPTSTR lpszPrinterName = NULL;
|
||||
LPTSTR lpszPortName = NULL;
|
||||
// Some printers fail for PRINTER_INFO_5 in some situations
|
||||
if (pinfon5.GetPrinterInfo(m_hPrinter))
|
||||
lpszPrinterName = pinfon5.m_pi->pPrinterName;
|
||||
else if (pinfon2.GetPrinterInfo(m_hPrinter))
|
||||
lpszPrinterName = pinfon2.m_pi->pPrinterName;
|
||||
if (lpszPrinterName != NULL)
|
||||
if(pinfon5.GetPrinterInfo(m_hPrinter))
|
||||
{
|
||||
int nLen = sizeof(DEVNAMES) + (lstrlen(lpszPrinterName) + 1) * sizeof(TCHAR);
|
||||
h = ::GlobalAlloc(GMEM_MOVEABLE, nLen);
|
||||
BYTE* pv = (BYTE*)::GlobalLock(h);
|
||||
lpszPrinterName = pinfon5.m_pi->pPrinterName;
|
||||
lpszPortName = pinfon5.m_pi->pPortName;
|
||||
}
|
||||
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;
|
||||
if (pv != NULL)
|
||||
if(pv != NULL)
|
||||
{
|
||||
memset(pv, 0, nLen);
|
||||
pdev->wDeviceOffset = sizeof(DEVNAMES) / sizeof(TCHAR);
|
||||
pv = pv + sizeof(DEVNAMES); // now points to end
|
||||
SecureHelper::strcpy_x((LPTSTR)pv, lstrlen(lpszPrinterName) + 1, lpszPrinterName);
|
||||
::GlobalUnlock(h);
|
||||
ATL::Checked::tcscpy_s((LPTSTR)pv, lstrlen(lpszPrinterName) + 1, lpszPrinterName);
|
||||
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
|
||||
|
@ -381,7 +377,7 @@ public:
|
|||
if (h != NULL)
|
||||
{
|
||||
void* p = ::GlobalLock(h);
|
||||
SecureHelper::memcpy_x(p, nSize, pdm, nSize);
|
||||
ATL::Checked::memcpy_s(p, nSize, pdm, nSize);
|
||||
::GlobalUnlock(h);
|
||||
}
|
||||
Attach(h);
|
||||
|
@ -409,7 +405,7 @@ public:
|
|||
if (h != NULL)
|
||||
{
|
||||
void* p = ::GlobalLock(h);
|
||||
SecureHelper::memcpy_x(p, nSize, m_pDevMode, nSize);
|
||||
ATL::Checked::memcpy_s(p, nSize, m_pDevMode, nSize);
|
||||
::GlobalUnlock(h);
|
||||
}
|
||||
return h;
|
||||
|
@ -421,7 +417,7 @@ public:
|
|||
{
|
||||
bool bRet = false;
|
||||
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);
|
||||
if(pdm != NULL)
|
||||
{
|
||||
|
@ -443,7 +439,7 @@ public:
|
|||
|
||||
bool bRet = false;
|
||||
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);
|
||||
if(pdm != NULL)
|
||||
{
|
||||
|
@ -535,6 +531,9 @@ public:
|
|||
class ATL_NO_VTABLE CPrintJobInfo : public IPrintJobInfo
|
||||
{
|
||||
public:
|
||||
CPrintJobInfo() : m_nPJState(0)
|
||||
{ }
|
||||
|
||||
virtual void BeginPrintJob(HDC /*hDC*/) // allocate handles needed, etc
|
||||
{
|
||||
}
|
||||
|
@ -585,8 +584,10 @@ public:
|
|||
unsigned long m_nEndPage;
|
||||
|
||||
// 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()
|
||||
{
|
||||
|
@ -629,7 +630,7 @@ public:
|
|||
|
||||
// Create a thread and return
|
||||
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);
|
||||
#else
|
||||
HANDLE hThread = ::CreateThread(NULL, 0, StartProc, (void*)this, 0, &dwThreadID);
|
||||
|
@ -715,8 +716,11 @@ public:
|
|||
DEVMODE* m_pCurDevMode;
|
||||
SIZE m_sizeCurPhysOffset;
|
||||
|
||||
// Implementation - data
|
||||
int m_nCurPage;
|
||||
|
||||
// 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.cy = 0;
|
||||
|
@ -773,6 +777,11 @@ public:
|
|||
|
||||
CEnhMetaFileInfo emfinfo(m_meta);
|
||||
ENHMETAHEADER* pmh = emfinfo.GetEnhMetaFileHeader();
|
||||
if(pmh == NULL)
|
||||
{
|
||||
ATLASSERT(FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
// Compute whether we are OK vertically or horizontally
|
||||
int x2 = pmh->szlDevice.cx;
|
||||
|
@ -806,15 +815,18 @@ public:
|
|||
{
|
||||
CEnhMetaFileInfo emfinfo(m_meta);
|
||||
ENHMETAHEADER* pmh = emfinfo.GetEnhMetaFileHeader();
|
||||
if(pmh == NULL)
|
||||
{
|
||||
ATLASSERT(FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
dc.OffsetWindowOrg(-nOffsetX, -nOffsetY);
|
||||
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
|
||||
{
|
||||
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 };
|
||||
|
||||
// Constructor
|
||||
CPrintPreviewWindowImpl() : m_nMaxPage(0), m_nMinPage(0)
|
||||
CPrintPreviewWindowImpl() : m_nMinPage(0), m_nMaxPage(0)
|
||||
{ }
|
||||
|
||||
// Operations
|
||||
|
@ -847,7 +859,7 @@ public:
|
|||
if (m_nCurPage == m_nMaxPage)
|
||||
return false;
|
||||
SetPage(m_nCurPage + 1);
|
||||
Invalidate();
|
||||
this->Invalidate();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -858,7 +870,7 @@ public:
|
|||
if (m_nCurPage == 0)
|
||||
return false;
|
||||
SetPage(m_nCurPage - 1);
|
||||
Invalidate();
|
||||
this->Invalidate();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -877,7 +889,7 @@ public:
|
|||
LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
RECT rc = { 0 };
|
||||
RECT rc = {};
|
||||
|
||||
if(wParam != NULL)
|
||||
{
|
||||
|
@ -886,7 +898,7 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
CPaintDC dc(m_hWnd);
|
||||
CPaintDC dc(this->m_hWnd);
|
||||
pT->DoPrePaint(dc.m_hDC, rc);
|
||||
pT->DoPaint(dc.m_hDC, rc);
|
||||
}
|
||||
|
@ -897,11 +909,11 @@ public:
|
|||
// Painting helper
|
||||
void DoPrePaint(CDCHandle dc, RECT& rc)
|
||||
{
|
||||
RECT rcClient = { 0 };
|
||||
GetClientRect(&rcClient);
|
||||
RECT rcClient = {};
|
||||
this->GetClientRect(&rcClient);
|
||||
RECT rcArea = rcClient;
|
||||
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);
|
||||
if (rcArea.left > rcArea.right)
|
||||
rcArea.right = rcArea.left;
|
||||
|
@ -944,7 +956,7 @@ public:
|
|||
|
||||
CZoomPrintPreviewWindowImpl()
|
||||
{
|
||||
SetScrollExtendedStyle(SCRL_DISABLENOSCROLL);
|
||||
this->SetScrollExtendedStyle(SCRL_DISABLENOSCROLL);
|
||||
InitZoom();
|
||||
}
|
||||
|
||||
|
@ -952,9 +964,9 @@ public:
|
|||
void InitZoom()
|
||||
{
|
||||
m_bSized = false;
|
||||
m_nZoomMode = ZOOMMODE_OFF;
|
||||
m_fZoomScaleMin = 1.0;
|
||||
m_fZoomScale = 1.0;
|
||||
this->m_nZoomMode = ZOOMMODE_OFF;
|
||||
this->m_fZoomScaleMin = 1.0;
|
||||
this->m_fZoomScale = 1.0;
|
||||
}
|
||||
|
||||
BEGIN_MSG_MAP(CZoomPrintPreviewWindowImpl)
|
||||
|
@ -962,9 +974,7 @@ public:
|
|||
MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl< T >::OnVScroll)
|
||||
MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl< T >::OnHScroll)
|
||||
MESSAGE_HANDLER(WM_MOUSEWHEEL, CScrollImpl< T >::OnMouseWheel)
|
||||
#if !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400))
|
||||
MESSAGE_HANDLER(m_uMsgMouseWheel, CScrollImpl< T >::OnMouseWheel)
|
||||
#endif // !((_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400))
|
||||
MESSAGE_HANDLER(WM_MOUSEHWHEEL, CScrollImpl< T >::OnMouseHWheel)
|
||||
MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl< T >::OnSettingChange)
|
||||
MESSAGE_HANDLER(WM_LBUTTONDOWN, CZoomScrollImpl< T >::OnLButtonDown)
|
||||
MESSAGE_HANDLER(WM_MOUSEMOVE, CZoomScrollImpl< T >::OnMouseMove)
|
||||
|
@ -992,14 +1002,14 @@ public:
|
|||
LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
SIZE sizeClient = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)};
|
||||
POINT ptOffset = m_ptOffset;
|
||||
SIZE sizeAll = m_sizeAll;
|
||||
SetScrollSize(sizeClient);
|
||||
POINT ptOffset = this->m_ptOffset;
|
||||
SIZE sizeAll = this->m_sizeAll;
|
||||
this->SetScrollSize(sizeClient);
|
||||
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)
|
||||
ptOffset.y = ::MulDiv(ptOffset.y, m_sizeAll.cy, sizeAll.cy);
|
||||
SetScrollOffset(ptOffset);
|
||||
ptOffset.y = ::MulDiv(ptOffset.y, this->m_sizeAll.cy, sizeAll.cy);
|
||||
this->SetScrollOffset(ptOffset);
|
||||
CScrollImpl< T >::OnSize(uMsg, wParam, lParam, bHandled);
|
||||
if(!m_bSized)
|
||||
{
|
||||
|
@ -1019,7 +1029,7 @@ public:
|
|||
LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
RECT rc = { 0 };
|
||||
RECT rc = {};
|
||||
|
||||
if(wParam != NULL)
|
||||
{
|
||||
|
@ -1027,11 +1037,11 @@ public:
|
|||
int nMapModeSav = dc.GetMapMode();
|
||||
dc.SetMapMode(MM_ANISOTROPIC);
|
||||
SIZE szWindowExt = { 0, 0 };
|
||||
dc.SetWindowExt(m_sizeLogAll, &szWindowExt);
|
||||
dc.SetWindowExt(this->m_sizeLogAll, &szWindowExt);
|
||||
SIZE szViewportExt = { 0, 0 };
|
||||
dc.SetViewportExt(m_sizeAll, &szViewportExt);
|
||||
dc.SetViewportExt(this->m_sizeAll, &szViewportExt);
|
||||
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->DoPaint(dc, rc);
|
||||
|
@ -1060,17 +1070,17 @@ public:
|
|||
|
||||
void DoPrePaint(CDCHandle dc, RECT& rc)
|
||||
{
|
||||
RECT rcClient;
|
||||
GetClientRect(&rcClient);
|
||||
RECT rcClient = {};
|
||||
this->GetClientRect(&rcClient);
|
||||
RECT rcArea = rcClient;
|
||||
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);
|
||||
if (rcArea.left > rcArea.right)
|
||||
rcArea.right = rcArea.left;
|
||||
if (rcArea.top > rcArea.bottom)
|
||||
rcArea.bottom = rcArea.top;
|
||||
GetPageRect(rcArea, &rc);
|
||||
this->GetPageRect(rcArea, &rc);
|
||||
HBRUSH hbrOld = dc.SelectBrush(::GetSysColorBrush(COLOR_BTNSHADOW));
|
||||
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);
|
||||
|
@ -1086,13 +1096,19 @@ public:
|
|||
|
||||
void DoPaint(CDCHandle dc, RECT& rc)
|
||||
{
|
||||
CEnhMetaFileInfo emfinfo(m_meta);
|
||||
CEnhMetaFileInfo emfinfo(this->m_meta);
|
||||
ENHMETAHEADER* pmh = emfinfo.GetEnhMetaFileHeader();
|
||||
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);
|
||||
if(pmh == NULL)
|
||||
{
|
||||
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.PlayMetaFile(m_meta, &rc);
|
||||
dc.PlayMetaFile(this->m_meta, &rc);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1104,6 +1120,6 @@ public:
|
|||
|
||||
#endif // __ATLSCRL_H__
|
||||
|
||||
}; // namespace WTL
|
||||
} // namespace WTL
|
||||
|
||||
#endif // __ATLPRINT_H__
|
||||
|
|
|
@ -1,46 +1,37 @@
|
|||
// Windows Template Library - WTL version 8.1
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
// Windows Template Library - WTL version 10.0
|
||||
// Copyright (C) Microsoft Corporation, WTL Team. 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.
|
||||
// Microsoft Public License (http://opensource.org/licenses/MS-PL)
|
||||
// which can be found in the file MS-PL.txt at the root folder.
|
||||
|
||||
#ifndef __ATLRES_H__
|
||||
#define __ATLRES_H__
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined(_WIN32_WCE) && !defined(__ATLRESCE_H__)
|
||||
#error Use atlresCE.h instead of atlres.h for Windows CE
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef RC_INVOKED
|
||||
#ifndef _INC_WINDOWS
|
||||
|
||||
#define _INC_WINDOWS
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
#define VS_VERSION_INFO 1
|
||||
#define VS_VERSION_INFO 1
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#define APSTUDIO_HIDDEN_SYMBOLS // Ignore following symbols
|
||||
#endif // APSTUDIO_INVOKED
|
||||
#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
|
||||
#ifndef WINVER
|
||||
#define WINVER 0x0500
|
||||
#endif // !WINVER
|
||||
|
||||
#include <winresrc.h>
|
||||
#include <winresrc.h>
|
||||
|
||||
// operation messages sent to DLGINIT
|
||||
#define LB_ADDSTRING (WM_USER+1)
|
||||
#define CB_ADDSTRING (WM_USER+3)
|
||||
#endif // !_WIN32_WCE
|
||||
#define LB_ADDSTRING (WM_USER+1)
|
||||
#define CB_ADDSTRING (WM_USER+3)
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#undef APSTUDIO_HIDDEN_SYMBOLS
|
||||
|
@ -150,6 +141,9 @@
|
|||
#define ID_EDIT_SELECT_ALL 0xE12A
|
||||
#define ID_EDIT_UNDO 0xE12B
|
||||
#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
|
||||
#define ID_WINDOW_NEW 0xE130
|
||||
|
@ -184,6 +178,8 @@
|
|||
#define ID_NEXT_PANE 0xE150
|
||||
#define ID_PREV_PANE 0xE151
|
||||
#define ID_PANE_CLOSE 0xE152
|
||||
#define ID_PANE_NEXT ID_NEXT_PANE
|
||||
#define ID_PANE_PREVIOUS ID_PREV_PANE
|
||||
|
||||
// Format
|
||||
#define ID_FORMAT_FONT 0xE160
|
||||
|
@ -217,7 +213,7 @@
|
|||
#define ID_VIEW_TOOLBAR 0xE800
|
||||
#define ID_VIEW_STATUS_BAR 0xE801
|
||||
#define ID_VIEW_REFRESH 0xE803
|
||||
#define ID_VIEW_RIBBON 0xE804 // Ribbon
|
||||
#define ID_VIEW_RIBBON 0xE804
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// 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
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
// Windows Template Library - WTL version 10.0
|
||||
// Copyright (C) Microsoft Corporation, WTL Team. 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.
|
||||
// Microsoft Public License (http://opensource.org/licenses/MS-PL)
|
||||
// which can be found in the file MS-PL.txt at the root folder.
|
||||
|
||||
#ifndef __ATLSPLIT_H__
|
||||
#define __ATLSPLIT_H__
|
||||
|
@ -26,9 +23,9 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Classes in this file:
|
||||
//
|
||||
// CSplitterImpl<T, t_bVertical>
|
||||
// CSplitterWindowImpl<T, t_bVertical, TBase, TWinTraits>
|
||||
// CSplitterWindowT<t_bVertical>
|
||||
// CSplitterImpl<T>
|
||||
// CSplitterWindowImpl<T, TBase, TWinTraits>
|
||||
// CSplitterWindowT<t_bVertical> - CSplitterWindow, CHorSplitterWindow
|
||||
|
||||
|
||||
namespace WTL
|
||||
|
@ -50,61 +47,52 @@ namespace WTL
|
|||
#define SPLIT_RIGHTALIGNED 0x00000004
|
||||
#define SPLIT_BOTTOMALIGNED SPLIT_RIGHTALIGNED
|
||||
#define SPLIT_GRADIENTBAR 0x00000008
|
||||
#define SPLIT_FLATBAR 0x00000020
|
||||
#define SPLIT_FIXEDBARSIZE 0x00000010
|
||||
|
||||
// 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
|
||||
{
|
||||
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];
|
||||
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_cxySplitBar; // splitter bar width/height
|
||||
static HCURSOR m_hCursor;
|
||||
HCURSOR m_hCursor;
|
||||
int m_cxyMin; // minimum pane size
|
||||
int m_cxyBarEdge; // splitter bar edge
|
||||
bool m_bFullDrag;
|
||||
int m_cxyDragOffset;
|
||||
int m_cxyDragOffset; // internal
|
||||
int m_nProportionalPos;
|
||||
bool m_bUpdateProportionalPos;
|
||||
DWORD m_dwExtendedStyle; // splitter specific extended styles
|
||||
int m_nSinglePane; // single pane mode
|
||||
DWORD m_dwExtendedStyle; // splitter specific extended styles
|
||||
int m_nSinglePane; // single pane mode
|
||||
int m_xySplitterDefPos; // default position
|
||||
bool m_bProportionalDefPos; // porportinal def pos
|
||||
|
||||
// Constructor
|
||||
CSplitterImpl() :
|
||||
m_xySplitterPos(-1), m_nDefActivePane(SPLIT_PANE_NONE),
|
||||
m_cxySplitBar(4), m_cxyMin(0), m_cxyBarEdge(0), m_bFullDrag(true),
|
||||
m_cxyDragOffset(0), m_nProportionalPos(0), m_bUpdateProportionalPos(true),
|
||||
m_dwExtendedStyle(SPLIT_PROPORTIONAL),
|
||||
m_nSinglePane(SPLIT_PANE_NONE)
|
||||
CSplitterImpl(bool bVertical = true) :
|
||||
m_bVertical(bVertical), m_xySplitterPos(-1), m_xySplitterPosNew(-1), m_hWndFocusSave(NULL),
|
||||
m_nDefActivePane(SPLIT_PANE_NONE), m_cxySplitBar(4), m_hCursor(NULL), m_cxyMin(0), m_cxyBarEdge(0),
|
||||
m_bFullDrag(true), m_cxyDragOffset(0), m_nProportionalPos(0), m_bUpdateProportionalPos(true),
|
||||
m_dwExtendedStyle(SPLIT_PROPORTIONAL), m_nSinglePane(SPLIT_PANE_NONE),
|
||||
m_xySplitterDefPos(-1), m_bProportionalDefPos(false)
|
||||
{
|
||||
m_hWndPane[SPLIT_PANE_LEFT] = NULL;
|
||||
m_hWndPane[SPLIT_PANE_RIGHT] = NULL;
|
||||
|
||||
::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
|
||||
|
@ -137,17 +125,33 @@ public:
|
|||
|
||||
bool SetSplitterPos(int xyPos = -1, bool bUpdate = true)
|
||||
{
|
||||
if(xyPos == -1) // -1 == middle
|
||||
if(xyPos == -1) // -1 == default position
|
||||
{
|
||||
if(t_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;
|
||||
if(m_bProportionalDefPos)
|
||||
{
|
||||
ATLASSERT((m_xySplitterDefPos >= 0) && (m_xySplitterDefPos <= m_nPropMax));
|
||||
|
||||
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
|
||||
int cxyMax = 0;
|
||||
if(t_bVertical)
|
||||
if(m_bVertical)
|
||||
cxyMax = m_rcSplitter.right - m_rcSplitter.left;
|
||||
else
|
||||
cxyMax = m_rcSplitter.bottom - m_rcSplitter.top;
|
||||
|
@ -179,9 +183,14 @@ public:
|
|||
return bRet;
|
||||
}
|
||||
|
||||
int GetSplitterPos() const
|
||||
{
|
||||
return m_xySplitterPos;
|
||||
}
|
||||
|
||||
void SetSplitterPosPct(int nPct, bool bUpdate = true)
|
||||
{
|
||||
ATLASSERT(nPct >= 0 && nPct <= 100);
|
||||
ATLASSERT((nPct >= 0) && (nPct <= 100));
|
||||
|
||||
m_nProportionalPos = ::MulDiv(nPct, m_nPropMax, 100);
|
||||
UpdateProportionalPos();
|
||||
|
@ -190,20 +199,21 @@ public:
|
|||
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)
|
||||
{
|
||||
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))
|
||||
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)))
|
||||
return false;
|
||||
|
||||
if(nPane != SPLIT_PANE_NONE)
|
||||
{
|
||||
if(!::IsWindowVisible(m_hWndPane[nPane]))
|
||||
if(::IsWindowVisible(m_hWndPane[nPane]) == FALSE)
|
||||
::ShowWindow(m_hWndPane[nPane], SW_SHOW);
|
||||
int nOtherPane = (nPane == SPLIT_PANE_LEFT) ? SPLIT_PANE_RIGHT : SPLIT_PANE_LEFT;
|
||||
::ShowWindow(m_hWndPane[nOtherPane], SW_HIDE);
|
||||
|
@ -218,6 +228,7 @@ public:
|
|||
|
||||
m_nSinglePane = nPane;
|
||||
UpdateSplitterLayout();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -238,55 +249,73 @@ public:
|
|||
m_dwExtendedStyle = dwExtendedStyle;
|
||||
else
|
||||
m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask);
|
||||
|
||||
#ifdef _DEBUG
|
||||
if(IsProportional() && IsRightAligned())
|
||||
ATLTRACE2(atlTraceUI, 0, _T("CSplitterImpl::SetSplitterExtendedStyle - SPLIT_PROPORTIONAL and SPLIT_RIGHTALIGNED are mutually exclusive, defaulting to SPLIT_PROPORTIONAL.\n"));
|
||||
#endif // _DEBUG
|
||||
|
||||
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
|
||||
void SetSplitterPanes(HWND hWndLeftTop, HWND hWndRightBottom, bool bUpdate = true)
|
||||
{
|
||||
m_hWndPane[SPLIT_PANE_LEFT] = hWndLeftTop;
|
||||
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)
|
||||
UpdateSplitterLayout();
|
||||
}
|
||||
|
||||
bool SetSplitterPane(int nPane, HWND hWnd, bool bUpdate = true)
|
||||
{
|
||||
ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT);
|
||||
|
||||
if(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;
|
||||
|
||||
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)
|
||||
UpdateSplitterLayout();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
|
||||
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]);
|
||||
m_nDefActivePane = nPane;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -298,13 +327,14 @@ public:
|
|||
{
|
||||
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;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nRet;
|
||||
}
|
||||
|
||||
|
@ -326,16 +356,18 @@ public:
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return SetActivePane(nPane);
|
||||
}
|
||||
|
||||
bool SetDefaultActivePane(int nPane)
|
||||
{
|
||||
ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT);
|
||||
|
||||
if(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;
|
||||
|
||||
m_nDefActivePane = nPane;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -349,6 +381,7 @@ public:
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false; // not found
|
||||
}
|
||||
|
||||
|
@ -360,7 +393,7 @@ public:
|
|||
void DrawSplitter(CDCHandle dc)
|
||||
{
|
||||
ATLASSERT(dc.m_hDC != NULL);
|
||||
if(m_nSinglePane == SPLIT_PANE_NONE && m_xySplitterPos == -1)
|
||||
if((m_nSinglePane == SPLIT_PANE_NONE) && (m_xySplitterPos == -1))
|
||||
return;
|
||||
|
||||
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
|
||||
void DrawSplitterBar(CDCHandle dc)
|
||||
{
|
||||
RECT rect = { 0 };
|
||||
RECT rect = {};
|
||||
if(GetSplitterBarRect(&rect))
|
||||
{
|
||||
dc.FillRect(&rect, COLOR_3DFACE);
|
||||
|
||||
#if (!defined(_WIN32_WCE) || (_WIN32_WCE >= 420))
|
||||
if((m_dwExtendedStyle & SPLIT_GRADIENTBAR) != 0)
|
||||
if((m_dwExtendedStyle & SPLIT_FLATBAR) != 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;
|
||||
if(t_bVertical)
|
||||
if(m_bVertical)
|
||||
rect2.left = (rect.left + rect.right) / 2 - 1;
|
||||
else
|
||||
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
|
||||
T* pT = static_cast<T*>(this);
|
||||
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
|
||||
void DrawSplitterPane(CDCHandle dc, int nPane)
|
||||
{
|
||||
RECT rect = { 0 };
|
||||
RECT rect = {};
|
||||
if(GetSplitterPaneRect(nPane, &rect))
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
|
@ -426,9 +528,7 @@ public:
|
|||
BEGIN_MSG_MAP(CSplitterImpl)
|
||||
MESSAGE_HANDLER(WM_CREATE, OnCreate)
|
||||
MESSAGE_HANDLER(WM_PAINT, OnPaint)
|
||||
#ifndef _WIN32_WCE
|
||||
MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint)
|
||||
#endif // !_WIN32_WCE
|
||||
if(IsInteractive())
|
||||
{
|
||||
MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor)
|
||||
|
@ -437,39 +537,48 @@ public:
|
|||
MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp)
|
||||
MESSAGE_HANDLER(WM_LBUTTONDBLCLK, OnLButtonDoubleClick)
|
||||
MESSAGE_HANDLER(WM_CAPTURECHANGED, OnCaptureChanged)
|
||||
MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown)
|
||||
}
|
||||
MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
|
||||
#ifndef _WIN32_WCE
|
||||
MESSAGE_HANDLER(WM_MOUSEACTIVATE, OnMouseActivate)
|
||||
#endif // !_WIN32_WCE
|
||||
MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange)
|
||||
END_MSG_MAP()
|
||||
|
||||
LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
pT->GetSystemSettings(false);
|
||||
pT->Init();
|
||||
|
||||
bHandled = FALSE;
|
||||
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);
|
||||
|
||||
// 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();
|
||||
|
||||
// do painting
|
||||
CPaintDC dc(pT->m_hWnd);
|
||||
pT->DrawSplitter(dc.m_hDC);
|
||||
if(wParam != NULL)
|
||||
{
|
||||
pT->DrawSplitter((HDC)wParam);
|
||||
}
|
||||
else
|
||||
{
|
||||
CPaintDC dc(pT->m_hWnd);
|
||||
pT->DrawSplitter(dc.m_hDC);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT OnSetCursor(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
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();
|
||||
POINT ptPos = { GET_X_LPARAM(dwPos), GET_Y_LPARAM(dwPos) };
|
||||
|
@ -482,20 +591,20 @@ public:
|
|||
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);
|
||||
int xPos = GET_X_LPARAM(lParam);
|
||||
int yPos = GET_Y_LPARAM(lParam);
|
||||
if((wParam & MK_LBUTTON) && ::GetCapture() == pT->m_hWnd)
|
||||
if(::GetCapture() == pT->m_hWnd)
|
||||
{
|
||||
int xyNewSplitPos = 0;
|
||||
if(t_bVertical)
|
||||
if(m_bVertical)
|
||||
xyNewSplitPos = xPos - m_rcSplitter.left - m_cxyDragOffset;
|
||||
else
|
||||
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;
|
||||
|
||||
if(m_xySplitterPos != xyNewSplitPos)
|
||||
|
@ -525,27 +634,40 @@ public:
|
|||
|
||||
LRESULT OnLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
int xPos = GET_X_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();
|
||||
m_hWndFocusSave = pT->SetFocus();
|
||||
::SetCursor(m_hCursor);
|
||||
if(!m_bFullDrag)
|
||||
DrawGhostBar();
|
||||
if(t_bVertical)
|
||||
if(m_bVertical)
|
||||
m_cxyDragOffset = xPos - m_rcSplitter.left - m_xySplitterPos;
|
||||
else
|
||||
m_cxyDragOffset = yPos - m_rcSplitter.top - m_xySplitterPos;
|
||||
}
|
||||
else if((::GetCapture() == pT->m_hWnd) && !IsOverSplitterBar(xPos, yPos))
|
||||
{
|
||||
::ReleaseCapture();
|
||||
}
|
||||
|
||||
bHandled = FALSE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
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;
|
||||
return 1;
|
||||
}
|
||||
|
@ -553,60 +675,130 @@ public:
|
|||
LRESULT OnLButtonDoubleClick(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
pT->SetSplitterPos(); // middle
|
||||
pT->SetSplitterPos(); // default
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT OnCaptureChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
if(!m_bFullDrag)
|
||||
{
|
||||
DrawGhostBar();
|
||||
|
||||
if((m_xySplitterPosNew != -1) && (!m_bFullDrag || (m_xySplitterPos != m_xySplitterPosNew)))
|
||||
{
|
||||
m_xySplitterPos = m_xySplitterPosNew;
|
||||
m_xySplitterPosNew = -1;
|
||||
UpdateSplitterLayout();
|
||||
T* pT = static_cast<T*>(this);
|
||||
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;
|
||||
}
|
||||
|
||||
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)
|
||||
::SetFocus(m_hWndPane[m_nDefActivePane]);
|
||||
}
|
||||
else
|
||||
{
|
||||
::SetFocus(m_hWndPane[m_nSinglePane]);
|
||||
if(m_nSinglePane == SPLIT_PANE_NONE)
|
||||
{
|
||||
if((m_nDefActivePane == SPLIT_PANE_LEFT) || (m_nDefActivePane == SPLIT_PANE_RIGHT))
|
||||
::SetFocus(m_hWndPane[m_nDefActivePane]);
|
||||
}
|
||||
else
|
||||
{
|
||||
::SetFocus(m_hWndPane[m_nSinglePane]);
|
||||
}
|
||||
}
|
||||
|
||||
bHandled = FALSE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
LRESULT OnMouseActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
LRESULT lRet = pT->DefWindowProc(uMsg, wParam, lParam);
|
||||
if(lRet == MA_ACTIVATE || lRet == MA_ACTIVATEANDEAT)
|
||||
if((lRet == MA_ACTIVATE) || (lRet == MA_ACTIVATEANDEAT))
|
||||
{
|
||||
DWORD dwPos = ::GetMessagePos();
|
||||
POINT pt = { GET_X_LPARAM(dwPos), GET_Y_LPARAM(dwPos) };
|
||||
pT->ScreenToClient(&pt);
|
||||
RECT rcPane = { 0 };
|
||||
RECT rcPane = {};
|
||||
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;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return lRet;
|
||||
}
|
||||
#endif // !_WIN32_WCE
|
||||
|
||||
LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
|
@ -617,13 +809,21 @@ public:
|
|||
}
|
||||
|
||||
// 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()
|
||||
{
|
||||
if(m_nSinglePane == SPLIT_PANE_NONE && m_xySplitterPos == -1)
|
||||
if((m_nSinglePane == SPLIT_PANE_NONE) && (m_xySplitterPos == -1))
|
||||
return;
|
||||
|
||||
T* pT = static_cast<T*>(this);
|
||||
RECT rect = { 0 };
|
||||
RECT rect = {};
|
||||
if(m_nSinglePane == SPLIT_PANE_NONE)
|
||||
{
|
||||
if(GetSplitterBarRect(&rect))
|
||||
|
@ -655,10 +855,10 @@ public:
|
|||
bool GetSplitterBarRect(LPRECT lpRect) const
|
||||
{
|
||||
ATLASSERT(lpRect != NULL);
|
||||
if(m_nSinglePane != SPLIT_PANE_NONE || m_xySplitterPos == -1)
|
||||
if((m_nSinglePane != SPLIT_PANE_NONE) || (m_xySplitterPos == -1))
|
||||
return false;
|
||||
|
||||
if(t_bVertical)
|
||||
if(m_bVertical)
|
||||
{
|
||||
lpRect->left = m_rcSplitter.left + m_xySplitterPos;
|
||||
lpRect->top = m_rcSplitter.top;
|
||||
|
@ -678,7 +878,7 @@ public:
|
|||
|
||||
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);
|
||||
bool bRet = true;
|
||||
if(m_nSinglePane != SPLIT_PANE_NONE)
|
||||
|
@ -690,7 +890,7 @@ public:
|
|||
}
|
||||
else if(nPane == SPLIT_PANE_LEFT)
|
||||
{
|
||||
if(t_bVertical)
|
||||
if(m_bVertical)
|
||||
{
|
||||
lpRect->left = m_rcSplitter.left;
|
||||
lpRect->top = m_rcSplitter.top;
|
||||
|
@ -707,7 +907,7 @@ public:
|
|||
}
|
||||
else if(nPane == SPLIT_PANE_RIGHT)
|
||||
{
|
||||
if(t_bVertical)
|
||||
if(m_bVertical)
|
||||
{
|
||||
lpRect->left = m_rcSplitter.left + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge;
|
||||
lpRect->top = m_rcSplitter.top;
|
||||
|
@ -726,44 +926,46 @@ public:
|
|||
{
|
||||
bRet = false;
|
||||
}
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
bool IsOverSplitterRect(int x, int y) const
|
||||
{
|
||||
// -1 == don't check
|
||||
return ((x == -1 || (x >= m_rcSplitter.left && x <= m_rcSplitter.right)) &&
|
||||
(y == -1 || (y >= m_rcSplitter.top && y <= m_rcSplitter.bottom)));
|
||||
return (((x == -1) || ((x >= m_rcSplitter.left) && (x <= m_rcSplitter.right))) &&
|
||||
((y == -1) || ((y >= m_rcSplitter.top) && (y <= m_rcSplitter.bottom))));
|
||||
}
|
||||
|
||||
bool IsOverSplitterBar(int x, int y) const
|
||||
{
|
||||
if(m_nSinglePane != SPLIT_PANE_NONE)
|
||||
return false;
|
||||
if(m_xySplitterPos == -1 || !IsOverSplitterRect(x, y))
|
||||
if((m_xySplitterPos == -1) || !IsOverSplitterRect(x, y))
|
||||
return false;
|
||||
int xy = t_bVertical ? x : y;
|
||||
int xyOff = t_bVertical ? m_rcSplitter.left : m_rcSplitter.top;
|
||||
return ((xy >= (xyOff + m_xySplitterPos)) && (xy < xyOff + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge));
|
||||
int xy = m_bVertical ? x : y;
|
||||
int xyOff = m_bVertical ? m_rcSplitter.left : m_rcSplitter.top;
|
||||
|
||||
return ((xy >= (xyOff + m_xySplitterPos)) && (xy < (xyOff + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge)));
|
||||
}
|
||||
|
||||
void DrawGhostBar()
|
||||
{
|
||||
RECT rect = { 0 };
|
||||
RECT rect = {};
|
||||
if(GetSplitterBarRect(&rect))
|
||||
{
|
||||
// convert client to window coordinates
|
||||
T* pT = static_cast<T*>(this);
|
||||
RECT rcWnd = { 0 };
|
||||
RECT rcWnd = {};
|
||||
pT->GetWindowRect(&rcWnd);
|
||||
::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rcWnd, 2);
|
||||
::OffsetRect(&rect, -rcWnd.left, -rcWnd.top);
|
||||
|
||||
// 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)
|
||||
{
|
||||
CWindowDC dc(pT->m_hWnd);
|
||||
CBrushHandle brushOld = dc.SelectBrush(brush);
|
||||
dc.PatBlt(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, PATINVERT);
|
||||
dc.SelectBrush(brushOld);
|
||||
|
@ -775,28 +977,22 @@ public:
|
|||
{
|
||||
if((m_dwExtendedStyle & SPLIT_FIXEDBARSIZE) == 0)
|
||||
{
|
||||
#ifndef _WIN32_WCE
|
||||
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
|
||||
m_cxySplitBar = ::GetSystemMetrics(m_bVertical ? SM_CXSIZEFRAME : SM_CYSIZEFRAME);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
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);
|
||||
#endif // !_WIN32_WCE
|
||||
|
||||
if(bUpdate)
|
||||
UpdateSplitterLayout();
|
||||
|
@ -809,7 +1005,7 @@ public:
|
|||
|
||||
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)
|
||||
m_nProportionalPos = ::MulDiv(m_xySplitterPos, m_nPropMax, cxyTotal);
|
||||
else
|
||||
|
@ -819,7 +1015,7 @@ public:
|
|||
|
||||
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)
|
||||
{
|
||||
int xyNewPos = ::MulDiv(m_nProportionalPos, cxyTotal, m_nPropMax);
|
||||
|
@ -836,7 +1032,7 @@ public:
|
|||
|
||||
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)
|
||||
m_nProportionalPos = cxyTotal - m_xySplitterPos;
|
||||
else
|
||||
|
@ -846,7 +1042,7 @@ public:
|
|||
|
||||
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)
|
||||
{
|
||||
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
|
||||
|
||||
template <class T, bool t_bVertical = true, class TBase = ATL::CWindow, class TWinTraits = ATL::CControlWinTraits>
|
||||
class ATL_NO_VTABLE CSplitterWindowImpl : public ATL::CWindowImpl< T, TBase, TWinTraits >, public CSplitterImpl< T , t_bVertical >
|
||||
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 >
|
||||
{
|
||||
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)
|
||||
MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground)
|
||||
MESSAGE_HANDLER(WM_SIZE, OnSize)
|
||||
CHAIN_MSG_MAP(_baseClass)
|
||||
CHAIN_MSG_MAP(CSplitterImpl< T >)
|
||||
FORWARD_NOTIFICATIONS()
|
||||
END_MSG_MAP()
|
||||
|
||||
|
@ -891,7 +1100,7 @@ public:
|
|||
LRESULT OnSize(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled)
|
||||
{
|
||||
if(wParam != SIZE_MINIMIZED)
|
||||
SetSplitterRect();
|
||||
this->SetSplitterRect();
|
||||
|
||||
bHandled = FALSE;
|
||||
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>
|
||||
class CSplitterWindowT : public CSplitterWindowImpl<CSplitterWindowT<t_bVertical>, t_bVertical>
|
||||
class CSplitterWindowT : public CSplitterWindowImpl<CSplitterWindowT<t_bVertical> >
|
||||
{
|
||||
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<false> CHorSplitterWindow;
|
||||
|
||||
}; // namespace WTL
|
||||
} // namespace WTL
|
||||
|
||||
#endif // __ATLSPLIT_H__
|
||||
|
|
|
@ -1,23 +1,16 @@
|
|||
// Windows Template Library - WTL version 8.1
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
// Windows Template Library - WTL version 10.0
|
||||
// Copyright (C) Microsoft Corporation, WTL Team. 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.
|
||||
// Microsoft Public License (http://opensource.org/licenses/MS-PL)
|
||||
// which can be found in the file MS-PL.txt at the root folder.
|
||||
|
||||
#ifndef __ATLTHEME_H__
|
||||
#define __ATLTHEME_H__
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
#error atltheme.h is not supported on Windows CE
|
||||
#endif
|
||||
|
||||
#ifndef __ATLAPP_H__
|
||||
#error atltheme.h requires atlapp.h to be included first
|
||||
#endif
|
||||
|
@ -26,22 +19,7 @@
|
|||
#error atltheme.h requires atlwin.h to be included first
|
||||
#endif
|
||||
|
||||
#if (_WIN32_WINNT < 0x0501)
|
||||
#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")
|
||||
#include <vssym32.h>
|
||||
|
||||
// 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
|
||||
|
@ -61,18 +39,6 @@
|
|||
// 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
|
||||
// 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);
|
||||
}
|
||||
|
||||
// Missing in original uxtheme.h
|
||||
#ifdef DTBG_CLIPRECT
|
||||
HRESULT DrawThemeBackgroundEx(HDC hDC, int nPartID, int nStateID, LPCRECT pRect, const DTBGOPTS* pOptions = NULL)
|
||||
{
|
||||
ATLASSERT(m_hTheme != NULL);
|
||||
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)
|
||||
{
|
||||
|
@ -221,7 +190,7 @@ public:
|
|||
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);
|
||||
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
|
||||
{
|
||||
ATLASSERT(m_hTheme != NULL);
|
||||
#ifdef _WTL_NEW_UXTHEME
|
||||
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
|
||||
|
@ -326,23 +290,13 @@ public:
|
|||
HRESULT GetThemeFont(int nPartID, HDC hDC, int nStateID, int nPropID, LOGFONTW* pFont) const
|
||||
{
|
||||
ATLASSERT(m_hTheme != NULL);
|
||||
#ifdef _WTL_NEW_UXTHEME
|
||||
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
|
||||
{
|
||||
ATLASSERT(m_hTheme != NULL);
|
||||
#ifdef _WTL_NEW_UXTHEME
|
||||
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
|
||||
|
@ -402,12 +356,7 @@ public:
|
|||
HRESULT GetThemeSysFont(int nFontID, LOGFONTW* plf) const
|
||||
{
|
||||
ATLASSERT(m_hTheme != NULL);
|
||||
#ifdef _WTL_NEW_UXTHEME
|
||||
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
|
||||
|
@ -422,7 +371,6 @@ public:
|
|||
return ::GetThemeSysInt(m_hTheme, nIntID, pnValue);
|
||||
}
|
||||
|
||||
#ifdef _WTL_NEW_UXTHEME
|
||||
HTHEME OpenThemeDataEx(HWND hWnd, LPCWSTR pszClassList, DWORD dwFlags)
|
||||
{
|
||||
if(!IsThemingSupported())
|
||||
|
@ -433,6 +381,7 @@ public:
|
|||
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)
|
||||
{
|
||||
ATLASSERT(m_hTheme != NULL);
|
||||
|
@ -444,7 +393,7 @@ public:
|
|||
ATLASSERT(m_hTheme != NULL);
|
||||
return ::GetThemeTransitionDuration(m_hTheme, nPartID, nFromStateID, nToStateID, nPropID, &dwDuration);
|
||||
}
|
||||
#endif // _WTL_NEW_UXTHEME
|
||||
#endif // (_WIN32_WINNT >= 0x0600)
|
||||
|
||||
#if (_WIN32_WINNT >= 0x0600)
|
||||
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);
|
||||
}
|
||||
#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;
|
||||
|
@ -493,17 +462,17 @@ inline bool AtlDrawThemeClientEdge(HTHEME hTheme, HWND hWnd, HRGN hRgnUpdate = N
|
|||
return false;
|
||||
|
||||
// Get border size
|
||||
int cxBorder = GetSystemMetrics(SM_CXBORDER);
|
||||
int cyBorder = GetSystemMetrics(SM_CYBORDER);
|
||||
int cxBorder = ::GetSystemMetrics(SM_CXBORDER);
|
||||
int cyBorder = ::GetSystemMetrics(SM_CYBORDER);
|
||||
if(SUCCEEDED(::GetThemeInt(hTheme, nPartID, nStateID, TMT_SIZINGBORDERWIDTH, &cxBorder)))
|
||||
cyBorder = cxBorder;
|
||||
|
||||
RECT rect;
|
||||
RECT rect = {};
|
||||
::GetWindowRect(hWnd, &rect);
|
||||
|
||||
// Remove the client edge from the update region
|
||||
int cxEdge = GetSystemMetrics(SM_CXEDGE);
|
||||
int cyEdge = GetSystemMetrics(SM_CYEDGE);
|
||||
int cxEdge = ::GetSystemMetrics(SM_CXEDGE);
|
||||
int cyEdge = ::GetSystemMetrics(SM_CYEDGE);
|
||||
::InflateRect(&rect, -cxEdge, -cyEdge);
|
||||
CRgn rgn;
|
||||
rgn.CreateRectRgnIndirect(&rect);
|
||||
|
@ -522,15 +491,10 @@ inline bool AtlDrawThemeClientEdge(HTHEME hTheme, HWND hWnd, HRGN hRgnUpdate = N
|
|||
::DrawThemeBackground(hTheme, dc, nPartID, nStateID, &rect, NULL);
|
||||
|
||||
// Use background brush too, since theme border might not cover everything
|
||||
if(cxBorder < cxEdge && cyBorder < cyEdge)
|
||||
if((cxBorder < cxEdge) && (cyBorder < cyEdge))
|
||||
{
|
||||
if(hBrush == NULL)
|
||||
// need conditional code because types don't match in winuser.h
|
||||
#ifdef _WIN64
|
||||
hBrush = (HBRUSH)::GetClassLongPtr(hWnd, GCLP_HBRBACKGROUND);
|
||||
#else
|
||||
hBrush = (HBRUSH)UlongToPtr(::GetClassLongPtr(hWnd, GCLP_HBRBACKGROUND));
|
||||
#endif
|
||||
|
||||
::InflateRect(&rect, cxBorder - cxEdge, cyBorder - cyEdge);
|
||||
dc.FillRect(&rect, hBrush);
|
||||
|
@ -580,7 +544,7 @@ public:
|
|||
if(m_lpstrThemeClassList == NULL)
|
||||
return false;
|
||||
|
||||
SecureHelper::strcpyW_x(m_lpstrThemeClassList, cchLen, lpstrThemeClassList);
|
||||
ATL::Checked::wcscpy_s(m_lpstrThemeClassList, cchLen, lpstrThemeClassList);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -591,7 +555,7 @@ public:
|
|||
if(cchListBuffer < cchLen)
|
||||
return false;
|
||||
|
||||
SecureHelper::strcpyW_x(lpstrThemeClassList, cchListBuffer, m_lpstrThemeClassList);
|
||||
ATL::Checked::wcscpy_s(lpstrThemeClassList, cchListBuffer, m_lpstrThemeClassList);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -608,6 +572,7 @@ public:
|
|||
m_dwExtendedStyle = dwExtendedStyle;
|
||||
else
|
||||
m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask);
|
||||
|
||||
return dwPrevStyle;
|
||||
}
|
||||
|
||||
|
@ -624,7 +589,8 @@ public:
|
|||
ATLASSERT(m_lpstrThemeClassList != NULL);
|
||||
if(m_lpstrThemeClassList == NULL)
|
||||
return NULL;
|
||||
CloseThemeData();
|
||||
this->CloseThemeData();
|
||||
|
||||
return TBase::OpenThemeData(pT->m_hWnd, m_lpstrThemeClassList);
|
||||
}
|
||||
|
||||
|
@ -632,12 +598,13 @@ public:
|
|||
{
|
||||
if(!SetThemeClassList(pszClassList))
|
||||
return NULL;
|
||||
|
||||
return OpenThemeData();
|
||||
}
|
||||
|
||||
HRESULT SetWindowTheme(LPCWSTR pszSubAppName, LPCWSTR pszSubIDList)
|
||||
{
|
||||
if(!IsThemingSupported())
|
||||
if(!this->IsThemingSupported())
|
||||
return S_FALSE;
|
||||
|
||||
T* pT = static_cast<T*>(this);
|
||||
|
@ -647,7 +614,7 @@ public:
|
|||
|
||||
HTHEME GetWindowTheme() const
|
||||
{
|
||||
if(!IsThemingSupported())
|
||||
if(!this->IsThemingSupported())
|
||||
return NULL;
|
||||
|
||||
const T* pT = static_cast<const T*>(this);
|
||||
|
@ -657,7 +624,7 @@ public:
|
|||
|
||||
HRESULT EnableThemeDialogTexture(DWORD dwFlags)
|
||||
{
|
||||
if(!IsThemingSupported())
|
||||
if(!this->IsThemingSupported())
|
||||
return S_FALSE;
|
||||
|
||||
T* pT = static_cast<T*>(this);
|
||||
|
@ -667,7 +634,7 @@ public:
|
|||
|
||||
BOOL IsThemeDialogTextureEnabled() const
|
||||
{
|
||||
if(!IsThemingSupported())
|
||||
if(!this->IsThemingSupported())
|
||||
return FALSE;
|
||||
|
||||
const T* pT = static_cast<const T*>(this);
|
||||
|
@ -677,22 +644,18 @@ public:
|
|||
|
||||
HRESULT DrawThemeParentBackground(HDC hDC, const RECT* pRect = NULL)
|
||||
{
|
||||
if(!IsThemingSupported())
|
||||
if(!this->IsThemingSupported())
|
||||
return S_FALSE;
|
||||
|
||||
T* pT = static_cast<T*>(this);
|
||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||
#ifdef _WTL_NEW_UXTHEME
|
||||
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)
|
||||
{
|
||||
if(!IsThemingSupported())
|
||||
if(!this->IsThemingSupported())
|
||||
return S_FALSE;
|
||||
|
||||
T* pT = static_cast<T*>(this);
|
||||
|
@ -702,7 +665,7 @@ public:
|
|||
|
||||
HRESULT SetWindowThemeNonClientAttributes(DWORD dwAttributes, DWORD dwMask)
|
||||
{
|
||||
if(!IsThemingSupported())
|
||||
if(!this->IsThemingSupported())
|
||||
return S_FALSE;
|
||||
|
||||
T* pT = static_cast<T*>(this);
|
||||
|
@ -713,14 +676,14 @@ public:
|
|||
|
||||
HRESULT DrawThemeParentBackgroundEx(HDC hDC, DWORD dwFlags, const RECT* lpRect = NULL)
|
||||
{
|
||||
if(!IsThemingSupported())
|
||||
if(!this->IsThemingSupported())
|
||||
return S_FALSE;
|
||||
|
||||
T* pT = static_cast<T*>(this);
|
||||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||
return ::DrawThemeParentBackgroundEx(pT->m_hWnd, hDC, dwFlags, lpRect);
|
||||
}
|
||||
#endif // _WTL_NEW_UXTHEME
|
||||
#endif // (_WIN32_WINNT >= 0x0600)
|
||||
|
||||
// Message map and handlers
|
||||
// Note: If you handle any of these messages in your derived class,
|
||||
|
@ -736,22 +699,25 @@ public:
|
|||
{
|
||||
if(m_lpstrThemeClassList != NULL)
|
||||
OpenThemeData();
|
||||
|
||||
bHandled = FALSE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
|
||||
{
|
||||
CloseThemeData();
|
||||
this->CloseThemeData();
|
||||
|
||||
bHandled = FALSE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
LRESULT OnThemeChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
|
||||
{
|
||||
CloseThemeData();
|
||||
this->CloseThemeData();
|
||||
if(m_lpstrThemeClassList != NULL)
|
||||
OpenThemeData();
|
||||
this->OpenThemeData();
|
||||
|
||||
bHandled = FALSE;
|
||||
return 1;
|
||||
}
|
||||
|
@ -762,20 +728,21 @@ public:
|
|||
ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||
LRESULT lRet = 0;
|
||||
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)
|
||||
{
|
||||
lRet = ::DefWindowProc(pT->m_hWnd, uMsg, wParam, lParam);
|
||||
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;
|
||||
if(pT->DrawThemeClientEdge(hRgn))
|
||||
bHandled = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return lRet;
|
||||
}
|
||||
|
||||
|
@ -783,14 +750,14 @@ public:
|
|||
bool DrawThemeClientEdge(HRGN hRgnUpdate)
|
||||
{
|
||||
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
|
||||
|
||||
#ifdef _WTL_NEW_UXTHEME
|
||||
#if (_WIN32_WINNT >= 0x0600)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// CBufferedPaintBase - Buffered Paint support for othe classes
|
||||
|
@ -955,7 +922,7 @@ public:
|
|||
T* pT = static_cast<T*>(this);
|
||||
if(wParam != NULL)
|
||||
{
|
||||
RECT rect = { 0 };
|
||||
RECT rect = {};
|
||||
pT->GetClientRect(&rect);
|
||||
pT->DoPaint((HDC)wParam, rect);
|
||||
}
|
||||
|
@ -1051,6 +1018,11 @@ public:
|
|||
{
|
||||
return (::BufferedPaintRenderAnimation(hWnd, hDC) != FALSE);
|
||||
}
|
||||
|
||||
static HRESULT StopAllAnimations(HWND hWnd)
|
||||
{
|
||||
return ::BufferedPaintStopAllAnimations(hWnd);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -1125,7 +1097,7 @@ public:
|
|||
T* pT = static_cast<T*>(this);
|
||||
if(wParam != NULL)
|
||||
{
|
||||
RECT rect = { 0 };
|
||||
RECT rect = {};
|
||||
pT->GetClientRect(&rect);
|
||||
pT->DoPaint((HDC)wParam, rect, m_NewState);
|
||||
}
|
||||
|
@ -1211,8 +1183,8 @@ public:
|
|||
END_MSG_MAP()
|
||||
};
|
||||
|
||||
#endif // _WTL_NEW_UXTHEME
|
||||
#endif // (_WIN32_WINNT >= 0x0600)
|
||||
|
||||
}; // namespace WTL
|
||||
} // namespace WTL
|
||||
|
||||
#endif // __ATLTHEME_H__
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
// Windows Template Library - WTL version 8.1
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
// Windows Template Library - WTL version 10.0
|
||||
// Copyright (C) Microsoft Corporation, WTL Team. 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.
|
||||
// Microsoft Public License (http://opensource.org/licenses/MS-PL)
|
||||
// which can be found in the file MS-PL.txt at the root folder.
|
||||
|
||||
#ifndef __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)
|
||||
{
|
||||
ATLASSERT(hWndOwner == NULL || ::IsWindow(hWndOwner));
|
||||
ATLASSERT((hWndOwner == NULL) || ::IsWindow(hWndOwner));
|
||||
|
||||
LPTSTR lpstrMessage = NULL;
|
||||
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;
|
||||
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)
|
||||
{
|
||||
|
@ -113,19 +110,6 @@ inline int AtlMessageBox(HWND hWndOwner, ATL::_U_STRINGorID message, ATL::_U_STR
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// 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
|
||||
{
|
||||
public:
|
||||
|
@ -133,14 +117,6 @@ public:
|
|||
{
|
||||
memset(this, 0, 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()
|
||||
{
|
||||
if(t_bManaged && m_hMenu != NULL)
|
||||
if(t_bManaged && (m_hMenu != NULL))
|
||||
DestroyMenu();
|
||||
}
|
||||
|
||||
|
@ -177,7 +153,7 @@ public:
|
|||
void Attach(HMENU 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);
|
||||
m_hMenu = hMenuNew;
|
||||
}
|
||||
|
@ -220,14 +196,12 @@ public:
|
|||
return (m_hMenu != NULL) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
BOOL LoadMenuIndirect(const void* lpMenuTemplate)
|
||||
{
|
||||
ATLASSERT(m_hMenu == NULL);
|
||||
m_hMenu = ::LoadMenuIndirect(lpMenuTemplate);
|
||||
return (m_hMenu != NULL) ? TRUE : FALSE;
|
||||
}
|
||||
#endif // !_WIN32_WCE
|
||||
|
||||
BOOL DestroyMenu()
|
||||
{
|
||||
|
@ -249,27 +223,17 @@ public:
|
|||
BOOL TrackPopupMenu(UINT nFlags, int x, int y, HWND hWnd, LPCRECT lpRect = NULL)
|
||||
{
|
||||
ATLASSERT(::IsMenu(m_hMenu));
|
||||
#ifndef _WIN32_WCE
|
||||
#if (WINVER >= 0x0500)
|
||||
x = _FixTrackMenuPopupX(x, y);
|
||||
#endif // !(WINVER >= 0x0500)
|
||||
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)
|
||||
{
|
||||
ATLASSERT(::IsMenu(m_hMenu));
|
||||
#if (WINVER >= 0x0500) && !defined(_WIN32_WCE)
|
||||
x = _FixTrackMenuPopupX(x, y);
|
||||
#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE)
|
||||
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
|
||||
static int _FixTrackMenuPopupX(int x, int y)
|
||||
{
|
||||
|
@ -280,8 +244,7 @@ public:
|
|||
HMONITOR hMonitorNear = ::MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST);
|
||||
if(hMonitorNear != NULL)
|
||||
{
|
||||
MONITORINFO mi = { 0 };
|
||||
mi.cbSize = sizeof(MONITORINFO);
|
||||
MONITORINFO mi = { sizeof(MONITORINFO) };
|
||||
if(::GetMonitorInfo(hMonitorNear, &mi) != FALSE)
|
||||
{
|
||||
if(x < mi.rcWork.left)
|
||||
|
@ -306,7 +269,6 @@ public:
|
|||
ATLASSERT(::IsMenu(m_hMenu));
|
||||
return ::SetMenuInfo(m_hMenu, lpMenuInfo);
|
||||
}
|
||||
#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE)
|
||||
|
||||
// Menu Item Operations
|
||||
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);
|
||||
}
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
BOOL AppendMenu(UINT nFlags, UINT_PTR nIDNewItem, HBITMAP hBmp)
|
||||
{
|
||||
ATLASSERT(::IsMenu(m_hMenu));
|
||||
|
@ -335,7 +296,6 @@ public:
|
|||
ATLASSERT(::IsMenu(hSubMenu));
|
||||
return ::AppendMenu(m_hMenu, nFlags | (MF_BITMAP | MF_POPUP), (UINT_PTR)hSubMenu, (LPCTSTR)hBmp);
|
||||
}
|
||||
#endif // !_WIN32_WCE
|
||||
|
||||
UINT CheckMenuItem(UINT nIDCheckItem, UINT nCheck)
|
||||
{
|
||||
|
@ -349,7 +309,6 @@ public:
|
|||
return ::EnableMenuItem(m_hMenu, nIDEnableItem, nEnable);
|
||||
}
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
BOOL HiliteMenuItem(HWND hWnd, UINT uIDHiliteItem, UINT uHilite)
|
||||
{
|
||||
ATLASSERT(::IsMenu(m_hMenu));
|
||||
|
@ -386,7 +345,6 @@ public:
|
|||
return ::GetMenuString(m_hMenu, nIDItem, NULL, 0, nFlags);
|
||||
}
|
||||
|
||||
#ifndef _ATL_NO_COM
|
||||
BOOL GetMenuString(UINT nIDItem, BSTR& bstrText, UINT nFlags) const
|
||||
{
|
||||
USES_CONVERSION;
|
||||
|
@ -401,7 +359,7 @@ public:
|
|||
}
|
||||
|
||||
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);
|
||||
if(lpszText == NULL)
|
||||
return FALSE;
|
||||
|
@ -412,42 +370,9 @@ public:
|
|||
bstrText = ::SysAllocString(T2OLE(lpszText));
|
||||
return (bstrText != NULL) ? TRUE : FALSE;
|
||||
}
|
||||
#endif // !_ATL_NO_COM
|
||||
|
||||
#elif (_ATL_VER >= 0x0800)
|
||||
int GetMenuItemCount() 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
|
||||
#ifdef __ATLSTR_H__
|
||||
int GetMenuString(UINT nIDItem, ATL::CString& strText, UINT nFlags) const
|
||||
{
|
||||
ATLASSERT(::IsMenu(m_hMenu));
|
||||
|
||||
|
@ -463,7 +388,7 @@ public:
|
|||
strText.ReleaseBuffer();
|
||||
return nRet;
|
||||
}
|
||||
#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__)
|
||||
#endif // __ATLSTR_H__
|
||||
|
||||
CMenuHandle GetSubMenu(int nPos) const
|
||||
{
|
||||
|
@ -484,7 +409,6 @@ public:
|
|||
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)
|
||||
{
|
||||
ATLASSERT(::IsMenu(m_hMenu));
|
||||
|
@ -523,7 +447,6 @@ public:
|
|||
ATLASSERT(::IsMenu(hSubMenu));
|
||||
return ::ModifyMenu(m_hMenu, nPosition, nFlags | (MF_BITMAP | MF_POPUP), (UINT_PTR)hSubMenu, (LPCTSTR)hBmp);
|
||||
}
|
||||
#endif // !_WIN32_WCE
|
||||
|
||||
BOOL RemoveMenu(UINT nPosition, UINT nFlags)
|
||||
{
|
||||
|
@ -531,13 +454,11 @@ public:
|
|||
return ::RemoveMenu(m_hMenu, nPosition, nFlags);
|
||||
}
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
BOOL SetMenuItemBitmaps(UINT nPosition, UINT nFlags, HBITMAP hBmpUnchecked, HBITMAP hBmpChecked)
|
||||
{
|
||||
ATLASSERT(::IsMenu(m_hMenu));
|
||||
return ::SetMenuItemBitmaps(m_hMenu, nPosition, nFlags, hBmpUnchecked, hBmpChecked);
|
||||
}
|
||||
#endif // !_WIN32_WCE
|
||||
|
||||
BOOL CheckMenuRadioItem(UINT nIDFirst, UINT nIDLast, UINT nIDItem, UINT nFlags)
|
||||
{
|
||||
|
@ -557,7 +478,6 @@ public:
|
|||
return (BOOL)::SetMenuItemInfo(m_hMenu, uItem, bByPosition, lpmii);
|
||||
}
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
BOOL InsertMenuItem(UINT uItem, BOOL bByPosition, LPMENUITEMINFO lpmii)
|
||||
{
|
||||
ATLASSERT(::IsMenu(m_hMenu));
|
||||
|
@ -600,7 +520,6 @@ public:
|
|||
ATLASSERT(::IsMenu(m_hMenu));
|
||||
return ::GetMenuContextHelpId(m_hMenu);
|
||||
}
|
||||
#endif // !_WIN32_WCE
|
||||
};
|
||||
|
||||
|
||||
|
@ -619,7 +538,7 @@ public:
|
|||
|
||||
~CAcceleratorT()
|
||||
{
|
||||
if(t_bManaged && m_hAccel != NULL)
|
||||
if(t_bManaged && (m_hAccel != NULL))
|
||||
::DestroyAcceleratorTable(m_hAccel);
|
||||
}
|
||||
|
||||
|
@ -631,7 +550,7 @@ public:
|
|||
|
||||
void Attach(HACCEL hAccel)
|
||||
{
|
||||
if(t_bManaged && m_hAccel != NULL)
|
||||
if(t_bManaged && (m_hAccel != NULL))
|
||||
::DestroyAcceleratorTable(m_hAccel);
|
||||
m_hAccel = hAccel;
|
||||
}
|
||||
|
@ -673,7 +592,6 @@ public:
|
|||
}
|
||||
|
||||
// Operations
|
||||
#ifndef _WIN32_WCE
|
||||
int CopyAcceleratorTable(LPACCEL lpAccelDst, int cEntries)
|
||||
{
|
||||
ATLASSERT(m_hAccel != NULL);
|
||||
|
@ -686,7 +604,6 @@ public:
|
|||
ATLASSERT(m_hAccel != NULL);
|
||||
return ::CopyAcceleratorTable(m_hAccel, NULL, 0);
|
||||
}
|
||||
#endif // !_WIN32_WCE
|
||||
|
||||
BOOL TranslateAccelerator(HWND hWnd, LPMSG pMsg)
|
||||
{
|
||||
|
@ -716,7 +633,7 @@ public:
|
|||
|
||||
~CIconT()
|
||||
{
|
||||
if(t_bManaged && m_hIcon != NULL)
|
||||
if(t_bManaged && (m_hIcon != NULL))
|
||||
::DestroyIcon(m_hIcon);
|
||||
}
|
||||
|
||||
|
@ -728,7 +645,7 @@ public:
|
|||
|
||||
void Attach(HICON hIcon)
|
||||
{
|
||||
if(t_bManaged && m_hIcon != NULL)
|
||||
if(t_bManaged && (m_hIcon != NULL))
|
||||
::DestroyIcon(m_hIcon);
|
||||
m_hIcon = hIcon;
|
||||
}
|
||||
|
@ -759,7 +676,6 @@ public:
|
|||
return m_hIcon;
|
||||
}
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
HICON LoadOEMIcon(LPCTSTR lpstrIconName)
|
||||
{
|
||||
ATLASSERT(m_hIcon == NULL);
|
||||
|
@ -793,7 +709,6 @@ public:
|
|||
m_hIcon = ::CreateIconFromResourceEx(pbBits, cbBits, TRUE, dwVersion, cxDesired, cyDesired, uFlags);
|
||||
return m_hIcon;
|
||||
}
|
||||
#endif // !_WIN32_WCE
|
||||
|
||||
HICON CreateIconIndirect(PICONINFO pIconInfo)
|
||||
{
|
||||
|
@ -803,7 +718,6 @@ public:
|
|||
return m_hIcon;
|
||||
}
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
HICON ExtractIcon(LPCTSTR lpszExeFileName, UINT nIconIndex)
|
||||
{
|
||||
ATLASSERT(m_hIcon == NULL);
|
||||
|
@ -820,7 +734,6 @@ public:
|
|||
m_hIcon = ::ExtractAssociatedIcon(hInst, lpIconPath, lpiIcon);
|
||||
return m_hIcon;
|
||||
}
|
||||
#endif // !_WIN32_WCE
|
||||
|
||||
BOOL DestroyIcon()
|
||||
{
|
||||
|
@ -832,7 +745,6 @@ public:
|
|||
}
|
||||
|
||||
// Operations
|
||||
#ifndef _WIN32_WCE
|
||||
HICON CopyIcon()
|
||||
{
|
||||
ATLASSERT(m_hIcon != NULL);
|
||||
|
@ -844,26 +756,17 @@ public:
|
|||
ATLASSERT(m_hIcon != NULL);
|
||||
return ::DuplicateIcon(NULL, m_hIcon);
|
||||
}
|
||||
#endif // !_WIN32_WCE
|
||||
|
||||
BOOL DrawIcon(HDC hDC, int x, int y)
|
||||
{
|
||||
ATLASSERT(m_hIcon != NULL);
|
||||
#ifndef _WIN32_WCE
|
||||
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)
|
||||
{
|
||||
ATLASSERT(m_hIcon != NULL);
|
||||
#ifndef _WIN32_WCE
|
||||
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)
|
||||
|
@ -878,7 +781,6 @@ public:
|
|||
return ::DrawIconEx(hDC, pt.x, pt.y, m_hIcon, size.cx, size.cy, uStepIfAniCur, hbrFlickerFreeDraw, uFlags);
|
||||
}
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
BOOL GetIconInfo(PICONINFO pIconInfo) const
|
||||
{
|
||||
ATLASSERT(m_hIcon != NULL);
|
||||
|
@ -925,22 +827,19 @@ public:
|
|||
return ::LoadIconWithScaleDown(NULL, (LPCWSTR)lpstrIconName, cx, cy, &m_hIcon);
|
||||
}
|
||||
#endif // defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN)
|
||||
#endif // !_WIN32_WCE
|
||||
|
||||
// Helper
|
||||
#ifndef _WIN32_WCE
|
||||
static bool IsOEMIcon(LPCTSTR lpstrIconName)
|
||||
{
|
||||
#if (WINVER >= 0x0600)
|
||||
return (lpstrIconName == IDI_APPLICATION || lpstrIconName == IDI_ASTERISK || lpstrIconName == IDI_EXCLAMATION ||
|
||||
lpstrIconName == IDI_HAND || lpstrIconName == IDI_QUESTION || lpstrIconName == IDI_WINLOGO ||
|
||||
lpstrIconName == IDI_SHIELD);
|
||||
return ((lpstrIconName == IDI_APPLICATION) || (lpstrIconName == IDI_ASTERISK) || (lpstrIconName == IDI_EXCLAMATION) ||
|
||||
(lpstrIconName == IDI_HAND) || (lpstrIconName == IDI_QUESTION) || (lpstrIconName == IDI_WINLOGO) ||
|
||||
(lpstrIconName == IDI_SHIELD));
|
||||
#else // !(WINVER >= 0x0600)
|
||||
return (lpstrIconName == IDI_APPLICATION || lpstrIconName == IDI_ASTERISK || lpstrIconName == IDI_EXCLAMATION ||
|
||||
lpstrIconName == IDI_HAND || lpstrIconName == IDI_QUESTION || lpstrIconName == IDI_WINLOGO);
|
||||
return ((lpstrIconName == IDI_APPLICATION) || (lpstrIconName == IDI_ASTERISK) || (lpstrIconName == IDI_EXCLAMATION) ||
|
||||
(lpstrIconName == IDI_HAND) || (lpstrIconName == IDI_QUESTION) || (lpstrIconName == IDI_WINLOGO));
|
||||
#endif // !(WINVER >= 0x0600)
|
||||
}
|
||||
#endif // !_WIN32_WCE
|
||||
};
|
||||
|
||||
typedef CIconT<false> CIconHandle;
|
||||
|
@ -967,7 +866,7 @@ public:
|
|||
|
||||
~CCursorT()
|
||||
{
|
||||
if(t_bManaged && m_hCursor != NULL)
|
||||
if(t_bManaged && (m_hCursor != NULL))
|
||||
DestroyCursor();
|
||||
}
|
||||
|
||||
|
@ -979,7 +878,7 @@ public:
|
|||
|
||||
void Attach(HCURSOR hCursor)
|
||||
{
|
||||
if(t_bManaged && m_hCursor != NULL)
|
||||
if(t_bManaged && (m_hCursor != NULL))
|
||||
DestroyCursor();
|
||||
m_hCursor = hCursor;
|
||||
}
|
||||
|
@ -1006,20 +905,12 @@ public:
|
|||
HCURSOR LoadSysCursor(LPCTSTR lpstrCursorName)
|
||||
{
|
||||
ATLASSERT(m_hCursor == NULL);
|
||||
#if (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 ||
|
||||
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)
|
||||
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) ||
|
||||
(lpstrCursorName == IDC_HAND));
|
||||
m_hCursor = ::LoadCursor(NULL, lpstrCursorName);
|
||||
return m_hCursor;
|
||||
}
|
||||
|
@ -1037,7 +928,6 @@ public:
|
|||
return m_hCursor;
|
||||
}
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
HCURSOR LoadCursorFromFile(LPCTSTR pstrFilename)
|
||||
{
|
||||
ATLASSERT(m_hCursor == NULL);
|
||||
|
@ -1045,18 +935,14 @@ public:
|
|||
m_hCursor = ::LoadCursorFromFile(pstrFilename);
|
||||
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)
|
||||
{
|
||||
ATLASSERT(m_hCursor == NULL);
|
||||
m_hCursor = ::CreateCursor(ModuleHelper::GetResourceInstance(), xHotSpot, yHotSpot, nWidth, nHeight, pvANDPlane, pvXORPlane);
|
||||
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)
|
||||
{
|
||||
ATLASSERT(m_hCursor == NULL);
|
||||
|
@ -1073,39 +959,29 @@ public:
|
|||
m_hCursor = (HCURSOR)::CreateIconFromResourceEx(pbBits, cbBits, FALSE, dwVersion, cxDesired, cyDesired, uFlags);
|
||||
return m_hCursor;
|
||||
}
|
||||
#endif // !_WIN32_WCE
|
||||
|
||||
BOOL DestroyCursor()
|
||||
{
|
||||
ATLASSERT(m_hCursor != NULL);
|
||||
#if !defined(_WIN32_WCE) || ((_WIN32_WCE >= 0x400) && !(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP)))
|
||||
BOOL bRet = ::DestroyCursor(m_hCursor);
|
||||
if(bRet != FALSE)
|
||||
m_hCursor = NULL;
|
||||
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
|
||||
#ifndef _WIN32_WCE
|
||||
HCURSOR CopyCursor()
|
||||
{
|
||||
ATLASSERT(m_hCursor != NULL);
|
||||
return (HCURSOR)::CopyIcon((HICON)m_hCursor);
|
||||
}
|
||||
#endif // !_WIN32_WCE
|
||||
|
||||
#if (WINVER >= 0x0500) && !defined(_WIN32_WCE)
|
||||
BOOL GetCursorInfo(LPCURSORINFO pCursorInfo)
|
||||
{
|
||||
ATLASSERT(m_hCursor != NULL);
|
||||
ATLASSERT(pCursorInfo != NULL);
|
||||
return ::GetCursorInfo(pCursorInfo);
|
||||
}
|
||||
#endif // (WINVER >= 0x0500) && !defined(_WIN32_WCE)
|
||||
};
|
||||
|
||||
typedef CCursorT<false> CCursorHandle;
|
||||
|
@ -1152,13 +1028,12 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
bool LoadEx(ATL::_U_STRINGorID Type, ATL::_U_STRINGorID ID, WORD wLanguage)
|
||||
bool LoadEx(ATL::_U_STRINGorID ID, ATL::_U_STRINGorID Type, WORD wLanguage)
|
||||
{
|
||||
ATLASSERT(m_hResource == 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)
|
||||
return false;
|
||||
|
||||
|
@ -1171,7 +1046,6 @@ public:
|
|||
|
||||
return true;
|
||||
}
|
||||
#endif // !_WIN32_WCE
|
||||
|
||||
// Misc. operations
|
||||
DWORD GetSize() const
|
||||
|
@ -1238,8 +1112,8 @@ inline HBITMAP AtlLoadBitmap(ATL::_U_STRINGorID bitmap)
|
|||
inline HBITMAP AtlLoadSysBitmap(ATL::_U_STRINGorID bitmap)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
WORD wID = (WORD)bitmap.m_lpstr;
|
||||
ATLASSERT(wID >= 32734 && wID <= 32767);
|
||||
WORD wID = LOWORD(bitmap.m_lpstr);
|
||||
ATLASSERT((wID >= 32734) && (wID <= 32767));
|
||||
#endif // _DEBUG
|
||||
return ::LoadBitmap(NULL, bitmap.m_lpstr);
|
||||
}
|
||||
|
@ -1252,20 +1126,12 @@ inline HCURSOR AtlLoadCursor(ATL::_U_STRINGorID cursor)
|
|||
|
||||
inline HCURSOR AtlLoadSysCursor(LPCTSTR lpCursorName)
|
||||
{
|
||||
#if (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 ||
|
||||
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)
|
||||
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) ||
|
||||
(lpCursorName == IDC_HAND));
|
||||
return ::LoadCursor(NULL, lpCursorName);
|
||||
}
|
||||
|
||||
|
@ -1274,20 +1140,18 @@ inline HICON AtlLoadIcon(ATL::_U_STRINGorID icon)
|
|||
return ::LoadIcon(ModuleHelper::GetResourceInstance(), icon.m_lpstr);
|
||||
}
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
inline HICON AtlLoadSysIcon(LPCTSTR lpIconName)
|
||||
{
|
||||
#if (WINVER >= 0x0600)
|
||||
ATLASSERT(lpIconName == IDI_APPLICATION || lpIconName == IDI_ASTERISK || lpIconName == IDI_EXCLAMATION ||
|
||||
lpIconName == IDI_HAND || lpIconName == IDI_QUESTION || lpIconName == IDI_WINLOGO ||
|
||||
lpIconName == IDI_SHIELD);
|
||||
ATLASSERT((lpIconName == IDI_APPLICATION) || (lpIconName == IDI_ASTERISK) || (lpIconName == IDI_EXCLAMATION) ||
|
||||
(lpIconName == IDI_HAND) || (lpIconName == IDI_QUESTION) || (lpIconName == IDI_WINLOGO) ||
|
||||
(lpIconName == IDI_SHIELD));
|
||||
#else // !(WINVER >= 0x0600)
|
||||
ATLASSERT(lpIconName == IDI_APPLICATION || lpIconName == IDI_ASTERISK || lpIconName == IDI_EXCLAMATION ||
|
||||
lpIconName == IDI_HAND || lpIconName == IDI_QUESTION || lpIconName == IDI_WINLOGO);
|
||||
ATLASSERT((lpIconName == IDI_APPLICATION) || (lpIconName == IDI_ASTERISK) || (lpIconName == IDI_EXCLAMATION) ||
|
||||
(lpIconName == IDI_HAND) || (lpIconName == IDI_QUESTION) || (lpIconName == IDI_WINLOGO));
|
||||
#endif // !(WINVER >= 0x0600)
|
||||
return ::LoadIcon(NULL, lpIconName);
|
||||
}
|
||||
#endif // !_WIN32_WCE
|
||||
|
||||
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
|
||||
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
|
||||
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)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
WORD wID = (WORD)cursor.m_lpstr;
|
||||
ATLASSERT((wID >= 32512 && wID <= 32516) || (wID >= 32640 && wID <= 32648) || (wID == 32650) || (wID == 32651));
|
||||
WORD wID = LOWORD(cursor.m_lpstr);
|
||||
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
|
||||
#endif // _DEBUG
|
||||
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)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
WORD wID = (WORD)icon.m_lpstr;
|
||||
ATLASSERT(wID >= 32512 && wID <= 32517);
|
||||
WORD wID = LOWORD(icon.m_lpstr);
|
||||
ATLASSERT((wID >= 32512) && (wID <= 32517));
|
||||
ATLASSERT((fuLoad & LR_LOADFROMFILE) == 0); // this one doesn't load from a file
|
||||
#endif // _DEBUG
|
||||
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)
|
||||
{
|
||||
USES_CONVERSION;
|
||||
|
@ -1386,6 +1226,6 @@ inline bool AtlLoadString(UINT uID, BSTR& bstrText)
|
|||
return (bstrText != NULL) ? true : false;
|
||||
}
|
||||
|
||||
}; // namespace WTL
|
||||
} // namespace WTL
|
||||
|
||||
#endif // __ATLUSER_H__
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,13 +1,10 @@
|
|||
// Windows Template Library - WTL version 8.1
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
// Windows Template Library - WTL version 10.0
|
||||
// Copyright (C) Microsoft Corporation, WTL Team. 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.
|
||||
// Microsoft Public License (http://opensource.org/licenses/MS-PL)
|
||||
// which can be found in the file MS-PL.txt at the root folder.
|
||||
|
||||
#ifndef __ATLWINX_H__
|
||||
#define __ATLWINX_H__
|
||||
|
@ -18,17 +15,45 @@
|
|||
#error atlwinx.h requires atlapp.h to be included first
|
||||
#endif
|
||||
|
||||
#if (_ATL_VER >= 0x0700)
|
||||
#include <atlwin.h>
|
||||
#endif // (_ATL_VER >= 0x0700)
|
||||
#include <atlwin.h>
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Classes in this file:
|
||||
//
|
||||
// _U_RECT
|
||||
// _U_MENUorID
|
||||
// _U_STRINGorID
|
||||
// CWindowEx
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// 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;
|
||||
idFrom = ((LPNMHDR)lParam)->idFrom;
|
||||
break;
|
||||
#ifndef _WIN32_WCE
|
||||
case WM_PARENTNOTIFY:
|
||||
switch(LOWORD(wParam))
|
||||
{
|
||||
|
@ -103,7 +127,6 @@ inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARA
|
|||
break;
|
||||
}
|
||||
break;
|
||||
#endif // !_WIN32_WCE
|
||||
case WM_DRAWITEM:
|
||||
if(wParam) // not from a menu
|
||||
{
|
||||
|
@ -136,9 +159,6 @@ inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARA
|
|||
case WM_CHARTOITEM:
|
||||
case WM_HSCROLL:
|
||||
case WM_VSCROLL:
|
||||
hWndChild = (HWND)lParam;
|
||||
idFrom = (UINT_PTR)::GetDlgCtrlID(hWndChild);
|
||||
break;
|
||||
case WM_CTLCOLORBTN:
|
||||
case WM_CTLCOLORDLG:
|
||||
case WM_CTLCOLOREDIT:
|
||||
|
@ -181,14 +201,14 @@ inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARA
|
|||
return lResult;
|
||||
}
|
||||
|
||||
}; // namespace WTL
|
||||
} // namespace WTL
|
||||
|
||||
// Try to prevent problems with WM_CTLCOLOR* messages when
|
||||
// the message wasn't really handled
|
||||
#define REFLECT_NOTIFICATIONS_EX() \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
lResult = this->ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
if((lResult == 0) && (uMsg >= WM_CTLCOLORMSGBOX) && (uMsg <= WM_CTLCOLORSTATIC)) \
|
||||
bHandled = FALSE; \
|
||||
if(bHandled) \
|
||||
|
@ -198,7 +218,7 @@ inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARA
|
|||
#define REFLECT_NOTIFICATIONS_MSG_FILTERED(uMsgFilter) \
|
||||
{ \
|
||||
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) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
@ -206,7 +226,7 @@ inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARA
|
|||
#define REFLECT_NOTIFICATIONS_ID_FILTERED(idFromFilter) \
|
||||
{ \
|
||||
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) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
@ -214,7 +234,7 @@ inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARA
|
|||
#define REFLECT_NOTIFICATIONS_HWND_FILTERED(hWndChildFilter) \
|
||||
{ \
|
||||
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) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
@ -222,7 +242,7 @@ inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARA
|
|||
#define REFLECT_NOTIFICATIONS_MSG_ID_FILTERED(uMsgFilter, idFromFilter) \
|
||||
{ \
|
||||
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) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
@ -230,296 +250,374 @@ inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARA
|
|||
#define REFLECT_NOTIFICATIONS_MSG_HWND_FILTERED(uMsgFilter, hWndChildFilter) \
|
||||
{ \
|
||||
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) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#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; \
|
||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
lResult = this->ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECT_COMMAND_ID(id) \
|
||||
if(uMsg == WM_COMMAND && id == LOWORD(wParam)) \
|
||||
if((uMsg == WM_COMMAND) && (id == LOWORD(wParam))) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
lResult = this->ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECT_COMMAND_CODE(code) \
|
||||
if(uMsg == WM_COMMAND && code == HIWORD(wParam)) \
|
||||
if((uMsg == WM_COMMAND) && (code == HIWORD(wParam))) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
lResult = this->ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#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; \
|
||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
lResult = this->ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#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; \
|
||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
lResult = this->ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#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; \
|
||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
lResult = this->ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECT_NOTIFY_ID(id) \
|
||||
if(uMsg == WM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom) \
|
||||
if((uMsg == WM_NOTIFY) && (id == ((LPNMHDR)lParam)->idFrom)) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
lResult = this->ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECT_NOTIFY_CODE(cd) \
|
||||
if(uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \
|
||||
if((uMsg == WM_NOTIFY) && (cd == ((LPNMHDR)lParam)->code)) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
lResult = this->ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#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; \
|
||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
lResult = this->ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#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; \
|
||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
lResult = this->ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
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) \
|
||||
if(uMsg == OCM_COMMAND && id == LOWORD(wParam) && code == HIWORD(wParam)) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
#ifdef SetClassLongPtrW
|
||||
#undef SetClassLongPtrW
|
||||
inline LONG_PTR SetClassLongPtrW(HWND hWnd, int nIndex, LONG_PTR dwNewLong)
|
||||
{
|
||||
return ::SetClassLongW(hWnd, nIndex, LONG(dwNewLong));
|
||||
}
|
||||
#endif
|
||||
|
||||
#define REFLECTED_COMMAND_ID_HANDLER(id, func) \
|
||||
if(uMsg == OCM_COMMAND && id == LOWORD(wParam)) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
#ifdef GetClassLongPtrA
|
||||
#undef GetClassLongPtrA
|
||||
inline LONG_PTR GetClassLongPtrA(HWND hWnd, int nIndex)
|
||||
{
|
||||
return ::GetClassLongA(hWnd, nIndex);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define REFLECTED_COMMAND_CODE_HANDLER(code, func) \
|
||||
if(uMsg == OCM_COMMAND && code == HIWORD(wParam)) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#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)
|
||||
#ifdef GetClassLongPtrW
|
||||
#undef GetClassLongPtrW
|
||||
inline LONG_PTR GetClassLongPtrW(HWND hWnd, int nIndex)
|
||||
{
|
||||
return ::GetClassLongW(hWnd, nIndex);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Dual argument helper classes (for ATL 3.0)
|
||||
|
||||
#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)
|
||||
|
||||
// CWindowEx - extension of ATL::CWindow
|
||||
|
||||
namespace WTL
|
||||
{
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// 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)
|
||||
class CWindowEx : public ATL::CWindow
|
||||
{
|
||||
LRESULT lResult = 0;
|
||||
switch(uMsg)
|
||||
public:
|
||||
CWindowEx(HWND hWnd = NULL) : ATL::CWindow(hWnd)
|
||||
{ }
|
||||
|
||||
CWindowEx& operator =(HWND hWnd)
|
||||
{
|
||||
case WM_COMMAND:
|
||||
case WM_NOTIFY:
|
||||
#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;
|
||||
m_hWnd = hWnd;
|
||||
return *this;
|
||||
}
|
||||
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__
|
||||
|
|
|
@ -20,7 +20,7 @@ void CScanButton::SubclassWindow(CWindow Wnd)
|
|||
m_DisplayCtrl = Wnd.GetDlgItem(m_DisplayCtrlId);
|
||||
m_ScanBtn = Wnd.GetDlgItem(m_ScanBtnId);
|
||||
m_ScanBtnThunk.Init((WNDPROC)ScanButtonProc, this);
|
||||
m_ScanBtnProc = (WNDPROC)m_ScanBtn.SetWindowLongPtrW(GWLP_WNDPROC, (LONG_PTR)m_ScanBtnThunk.GetWNDPROC());
|
||||
m_ScanBtnProc = (WNDPROC)m_ScanBtn.SetWindowLongPtr(GWLP_WNDPROC, (LONG_PTR)m_ScanBtnThunk.GetWNDPROC());
|
||||
DisplayButton();
|
||||
}
|
||||
|
||||
|
|
|
@ -590,7 +590,7 @@ void CCheatList::MenuSetText(HMENU hMenu, int MenuPos, const wchar_t * Title, co
|
|||
return;
|
||||
}
|
||||
|
||||
MENUITEMINFOW MenuInfo = { 0 };
|
||||
MENUITEMINFO MenuInfo = { 0 };
|
||||
wchar_t String[256];
|
||||
MenuInfo.cbSize = sizeof(MENUITEMINFO);
|
||||
MenuInfo.fMask = MIIM_TYPE;
|
||||
|
@ -599,11 +599,11 @@ void CCheatList::MenuSetText(HMENU hMenu, int MenuPos, const wchar_t * Title, co
|
|||
MenuInfo.dwTypeData = String;
|
||||
MenuInfo.cch = 256;
|
||||
|
||||
GetMenuItemInfoW(hMenu, MenuPos, true, &MenuInfo);
|
||||
GetMenuItemInfo(hMenu, MenuPos, true, &MenuInfo);
|
||||
wcscpy(String, Title);
|
||||
if (wcschr(String, '\t') != NULL) { *(wcschr(String, '\t')) = '\0'; }
|
||||
if (ShortCut) { _swprintf(String, L"%s\t%s", String, ShortCut); }
|
||||
SetMenuItemInfoW(hMenu, MenuPos, true, &MenuInfo);
|
||||
SetMenuItemInfo(hMenu, MenuPos, true, &MenuInfo);
|
||||
}
|
||||
|
||||
CEditCheat::CEditCheat(CEnhancementList & Cheats, CCheatList & CheatList) :
|
||||
|
@ -670,7 +670,7 @@ LRESULT CEditCheat::OnEditCheat(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/,
|
|||
}
|
||||
GetDlgItem(IDC_CHEAT_OPTIONS).SetWindowText(Buffer.ToUTF16().c_str());
|
||||
GetDlgItem(IDC_NOTES).SetWindowText(stdstr(m_EditEnhancement->GetNote()).ToUTF16().c_str());
|
||||
GetDlgItem(IDC_ADD).SetWindowTextW(wGS(CHEAT_EDITCHEAT_UPDATE).c_str());
|
||||
GetDlgItem(IDC_ADD).SetWindowText(wGS(CHEAT_EDITCHEAT_UPDATE).c_str());
|
||||
|
||||
SendMessage(WM_COMMAND, MAKELPARAM(IDC_CHEAT_CODES, EN_CHANGE), (LPARAM)(HWND)GetDlgItem(IDC_CHEAT_CODES));
|
||||
RecordCurrentValues();
|
||||
|
|
|
@ -607,7 +607,7 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
|
|||
}
|
||||
if (MenuID >= ID_LANG_START && MenuID < ID_LANG_END)
|
||||
{
|
||||
MENUITEMINFOW menuinfo;
|
||||
MENUITEMINFO menuinfo;
|
||||
wchar_t String[300];
|
||||
|
||||
menuinfo.cbSize = sizeof(MENUITEMINFO);
|
||||
|
@ -615,7 +615,7 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
|
|||
menuinfo.fType = MFT_STRING;
|
||||
menuinfo.dwTypeData = String;
|
||||
menuinfo.cch = sizeof(String);
|
||||
GetMenuItemInfoW((HMENU)m_MenuHandle, MenuID, FALSE, &menuinfo);
|
||||
GetMenuItemInfo((HMENU)m_MenuHandle, MenuID, FALSE, &menuinfo);
|
||||
|
||||
g_Lang->SetLanguage(stdstr().FromUTF16(String).c_str());
|
||||
m_Gui->ResetRomBrowserColomuns();
|
||||
|
|
|
@ -366,13 +366,13 @@ void CMainGui::MakeWindowOnTop(bool OnTop)
|
|||
void CMainGui::Caption(LPCWSTR Caption)
|
||||
{
|
||||
CGuard Guard(m_CS);
|
||||
SetWindowTextW(m_hMainWindow, Caption);
|
||||
SetWindowText(m_hMainWindow, Caption);
|
||||
}
|
||||
|
||||
void CMainGui::Create(const char * WindowTitle)
|
||||
{
|
||||
stdstr_f VersionDisplay("Project64 %s", VER_FILE_VERSION_STR);
|
||||
m_hMainWindow = CreateWindowExW(WS_EX_ACCEPTFILES, VersionDisplay.ToUTF16().c_str(), stdstr(WindowTitle).ToUTF16().c_str(), WS_OVERLAPPED | WS_CLIPCHILDREN |
|
||||
m_hMainWindow = CreateWindowEx(WS_EX_ACCEPTFILES, VersionDisplay.ToUTF16().c_str(), stdstr(WindowTitle).ToUTF16().c_str(), WS_OVERLAPPED | WS_CLIPCHILDREN |
|
||||
WS_CLIPSIBLINGS | WS_SYSMENU | WS_MINIMIZEBOX, 5, 5, 640, 480,
|
||||
NULL, NULL, GetModuleHandle(NULL), this);
|
||||
m_Created = m_hMainWindow != NULL;
|
||||
|
@ -533,10 +533,10 @@ void CMainGui::SetStatusText(int Panel, const wchar_t * Text)
|
|||
Msg[(sizeof(Message[0]) / sizeof(Message[0][0])) - 1] = 0;
|
||||
if (GetCurrentThreadId() == m_ThreadId)
|
||||
{
|
||||
SendMessageW((HWND)m_hStatusWnd, SB_SETTEXTW, Panel, (LPARAM)Msg);
|
||||
SendMessage((HWND)m_hStatusWnd, SB_SETTEXT, Panel, (LPARAM)Msg);
|
||||
}
|
||||
else {
|
||||
PostMessageW((HWND)m_hStatusWnd, SB_SETTEXTW, Panel, (LPARAM)Msg);
|
||||
PostMessage((HWND)m_hStatusWnd, SB_SETTEXT, Panel, (LPARAM)Msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ bool CBaseMenu::AddMenu(HMENU hMenu, MenuItemList Items)
|
|||
String += MenuItem->ShortCut();
|
||||
Text = String;
|
||||
}
|
||||
AppendMenuW(hMenu, uFlags, ItemID, Text.c_str());
|
||||
AppendMenu(hMenu, uFlags, ItemID, Text.c_str());
|
||||
}
|
||||
return true;
|
||||
}
|
|
@ -56,7 +56,7 @@ void CNotificationImp::DisplayWarning(const char * Message) const
|
|||
{
|
||||
Parent = reinterpret_cast<HWND>(m_hWnd->GetWindowHandle());
|
||||
}
|
||||
MessageBoxW(Parent, stdstr(Message).ToUTF16().c_str(), wGS(MSG_MSGBOX_WARNING_TITLE).c_str(), MB_OK | MB_ICONWARNING | MB_SETFOREGROUND);
|
||||
MessageBox(Parent, stdstr(Message).ToUTF16().c_str(), wGS(MSG_MSGBOX_WARNING_TITLE).c_str(), MB_OK | MB_ICONWARNING | MB_SETFOREGROUND);
|
||||
}
|
||||
|
||||
void CNotificationImp::DisplayWarning(LanguageStringID StringID) const
|
||||
|
@ -79,7 +79,7 @@ void CNotificationImp::DisplayError(const char * Message) const
|
|||
{
|
||||
Parent = reinterpret_cast<HWND>(m_hWnd->GetWindowHandle());
|
||||
}
|
||||
MessageBoxW(Parent, stdstr(Message).ToUTF16().c_str(), wGS(MSG_MSGBOX_ERROR_TITLE).c_str(), MB_OK | MB_ICONERROR | MB_SETFOREGROUND);
|
||||
MessageBox(Parent, stdstr(Message).ToUTF16().c_str(), wGS(MSG_MSGBOX_ERROR_TITLE).c_str(), MB_OK | MB_ICONERROR | MB_SETFOREGROUND);
|
||||
}
|
||||
|
||||
void CNotificationImp::DisplayMessage(int DisplayTime, LanguageStringID StringID) const
|
||||
|
@ -140,7 +140,7 @@ bool CNotificationImp::AskYesNoQuestion(const char * Question) const
|
|||
{
|
||||
Parent = reinterpret_cast<HWND>(m_hWnd->GetWindowHandle());
|
||||
}
|
||||
int result = MessageBoxW(Parent, stdstr(Question).ToUTF16().c_str(), wGS(MSG_MSGBOX_WARNING_TITLE).c_str(), MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2 | MB_SETFOREGROUND);
|
||||
int result = MessageBox(Parent, stdstr(Question).ToUTF16().c_str(), wGS(MSG_MSGBOX_WARNING_TITLE).c_str(), MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2 | MB_SETFOREGROUND);
|
||||
return result == IDYES;
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ void CNotificationImp::FatalError(const char * Message) const
|
|||
|
||||
HWND Parent = NULL;
|
||||
if (m_hWnd) { Parent = reinterpret_cast<HWND>(m_hWnd->GetWindowHandle()); }
|
||||
MessageBoxW(Parent, stdstr(Message).ToUTF16().c_str(), L"Error", MB_OK | MB_ICONERROR | MB_SETFOREGROUND);
|
||||
MessageBox(Parent, stdstr(Message).ToUTF16().c_str(), L"Error", MB_OK | MB_ICONERROR | MB_SETFOREGROUND);
|
||||
ExitThread(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -114,11 +114,11 @@ int32_t CRomBrowser::CalcSortPosition(uint32_t lParam)
|
|||
}
|
||||
LastTestPos = TestPos;
|
||||
|
||||
LVITEMW lvItem;
|
||||
LVITEM lvItem;
|
||||
memset(&lvItem, 0, sizeof(lvItem));
|
||||
lvItem.mask = LVIF_PARAM;
|
||||
lvItem.iItem = TestPos;
|
||||
if (!SendMessageW(m_hRomList, LVM_GETITEMW, 0, (LPARAM)&lvItem))
|
||||
if (!SendMessage(m_hRomList, LVM_GETITEM, 0, (LPARAM)&lvItem))
|
||||
{
|
||||
return End;
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ int32_t CRomBrowser::CalcSortPosition(uint32_t lParam)
|
|||
memset(&lvItem, 0, sizeof(lvItem));
|
||||
lvItem.mask = LVIF_PARAM;
|
||||
lvItem.iItem = NewTestPos;
|
||||
if (!SendMessageW(m_hRomList, LVM_GETITEMW, 0, (LPARAM)&lvItem))
|
||||
if (!SendMessage(m_hRomList, LVM_GETITEM, 0, (LPARAM)&lvItem))
|
||||
{
|
||||
return End;
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ int32_t CRomBrowser::CalcSortPosition(uint32_t lParam)
|
|||
memset(&lvItem, 0, sizeof(lvItem));
|
||||
lvItem.mask = LVIF_PARAM;
|
||||
lvItem.iItem = NewTestPos;
|
||||
if (!SendMessageW(m_hRomList, LVM_GETITEMW, 0, (LPARAM)&lvItem)) { return End; }
|
||||
if (!SendMessage(m_hRomList, LVM_GETITEM, 0, (LPARAM)&lvItem)) { return End; }
|
||||
|
||||
Result = RomList_CompareItems(lParam, lvItem.lParam, (uint32_t)&SortFieldInfo);
|
||||
if (Result >= 0)
|
||||
|
@ -235,11 +235,11 @@ int32_t CRomBrowser::CalcSortPosition(uint32_t lParam)
|
|||
SortFieldInfo.Key = index;
|
||||
SortFieldInfo.KeyAscend = UISettingsLoadBoolIndex(RomBrowser_SortAscendingIndex, SortIndex) != 0;
|
||||
|
||||
LVITEMW lvItem;
|
||||
memset(&lvItem, 0, sizeof(LVITEMW));
|
||||
LVITEM lvItem;
|
||||
memset(&lvItem, 0, sizeof(LVITEM));
|
||||
lvItem.mask = LVIF_PARAM;
|
||||
lvItem.iItem = End;
|
||||
if (!SendMessageW(m_hRomList, LVM_GETITEMW, 0, (LPARAM)&lvItem)) { return End; }
|
||||
if (!SendMessage(m_hRomList, LVM_GETITEM, 0, (LPARAM)&lvItem)) { return End; }
|
||||
|
||||
int32_t Result = RomList_CompareItems(lParam, lvItem.lParam, (uint32_t)&SortFieldInfo);
|
||||
if (Result < 0)
|
||||
|
@ -256,14 +256,14 @@ int32_t CRomBrowser::CalcSortPosition(uint32_t lParam)
|
|||
|
||||
void CRomBrowser::RomAddedToList(int32_t ListPos)
|
||||
{
|
||||
LVITEMW lvItem;
|
||||
LVITEM lvItem;
|
||||
memset(&lvItem, 0, sizeof(lvItem));
|
||||
lvItem.mask = LVIF_TEXT | LVIF_PARAM;
|
||||
lvItem.iItem = CalcSortPosition(ListPos);
|
||||
lvItem.lParam = (LPARAM)ListPos;
|
||||
lvItem.pszText = LPSTR_TEXTCALLBACKW;
|
||||
lvItem.pszText = LPSTR_TEXTCALLBACK;
|
||||
|
||||
int32_t index = SendMessageW(m_hRomList, LVM_INSERTITEMW, 0, (LPARAM)&lvItem);
|
||||
int32_t index = SendMessage(m_hRomList, LVM_INSERTITEM, 0, (LPARAM)&lvItem);
|
||||
int32_t iItem = ListView_GetNextItem(m_hRomList, -1, LVNI_SELECTED);
|
||||
|
||||
//if the last rom then highlight the item
|
||||
|
@ -300,7 +300,7 @@ void CRomBrowser::RomListReset(void)
|
|||
|
||||
void CRomBrowser::CreateRomListControl(void)
|
||||
{
|
||||
m_hRomList = CreateWindowW(WC_LISTVIEWW, NULL, WS_TABSTOP | WS_VISIBLE | WS_CHILD | LVS_OWNERDRAWFIXED | LVS_SINGLESEL | LVS_REPORT, 0, 0, 0, 0, m_MainWindow, (HMENU)IDC_ROMLIST, GetModuleHandle(NULL), NULL);
|
||||
m_hRomList = CreateWindow(WC_LISTVIEW, NULL, WS_TABSTOP | WS_VISIBLE | WS_CHILD | LVS_OWNERDRAWFIXED | LVS_SINGLESEL | LVS_REPORT, 0, 0, 0, 0, m_MainWindow, (HMENU)IDC_ROMLIST, GetModuleHandle(NULL), NULL);
|
||||
ResetRomBrowserColomuns();
|
||||
LoadRomList();
|
||||
}
|
||||
|
@ -335,7 +335,7 @@ void CRomBrowser::HighLightLastRom(void)
|
|||
//Make sure Rom browser is visible
|
||||
if (!RomBrowserVisible()) { return; }
|
||||
|
||||
LVITEMW lvItem;
|
||||
LVITEM lvItem;
|
||||
lvItem.mask = LVIF_PARAM;
|
||||
|
||||
int32_t ItemCount = ListView_GetItemCount(m_hRomList);
|
||||
|
@ -343,7 +343,7 @@ void CRomBrowser::HighLightLastRom(void)
|
|||
{
|
||||
//Get The next item
|
||||
lvItem.iItem = index;
|
||||
if (!SendMessageW(m_hRomList, LVM_GETITEMW, 0, (LPARAM)&lvItem)) { return; }
|
||||
if (!SendMessage(m_hRomList, LVM_GETITEM, 0, (LPARAM)&lvItem)) { return; }
|
||||
|
||||
//Get the rom info for that item
|
||||
if (lvItem.lParam < 0 || lvItem.lParam >= (LPARAM)m_RomInfo.size())
|
||||
|
@ -369,7 +369,7 @@ void CRomBrowser::HighLightLastRom(void)
|
|||
|
||||
void CRomBrowser::MenuSetText(HMENU hMenu, int32_t MenuPos, const wchar_t * Title, char * ShortCut)
|
||||
{
|
||||
MENUITEMINFOW MenuInfo;
|
||||
MENUITEMINFO MenuInfo;
|
||||
wchar_t String[256];
|
||||
|
||||
if (Title == NULL || wcslen(Title) == 0) { return; }
|
||||
|
@ -382,17 +382,17 @@ void CRomBrowser::MenuSetText(HMENU hMenu, int32_t MenuPos, const wchar_t * Titl
|
|||
MenuInfo.dwTypeData = String;
|
||||
MenuInfo.cch = 256;
|
||||
|
||||
GetMenuItemInfoW(hMenu, MenuPos, TRUE, &MenuInfo);
|
||||
GetMenuItemInfo(hMenu, MenuPos, TRUE, &MenuInfo);
|
||||
wcscpy(String, Title);
|
||||
if (wcschr(String, '\t') != NULL) { *(wcschr(String, '\t')) = '\0'; }
|
||||
if (ShortCut) { swprintf(String, sizeof(String) / sizeof(String[0]), L"%s\t%s", String, stdstr(ShortCut).ToUTF16().c_str()); }
|
||||
SetMenuItemInfoW(hMenu, MenuPos, TRUE, &MenuInfo);
|
||||
SetMenuItemInfo(hMenu, MenuPos, TRUE, &MenuInfo);
|
||||
}
|
||||
|
||||
void CRomBrowser::ResetRomBrowserColomuns(void)
|
||||
{
|
||||
size_t Coloumn, index;
|
||||
LV_COLUMNW lvColumn;
|
||||
LV_COLUMN lvColumn;
|
||||
wchar_t szString[300];
|
||||
|
||||
GetFieldInfo(m_Fields);
|
||||
|
@ -425,7 +425,7 @@ void CRomBrowser::ResetRomBrowserColomuns(void)
|
|||
m_FieldType[Coloumn] = m_Fields[index].ID();
|
||||
lvColumn.cx = m_Fields[index].ColWidth();
|
||||
wcsncpy(szString, wGS(m_Fields[index].LangID()).c_str(), sizeof(szString) / sizeof(szString[0]));
|
||||
SendMessage(m_hRomList, LVM_INSERTCOLUMNW, (WPARAM)(int32_t)(Coloumn), (LPARAM)(const LV_COLUMNW *)(&lvColumn));
|
||||
SendMessage(m_hRomList, LVM_INSERTCOLUMN, (WPARAM)(int32_t)(Coloumn), (LPARAM)(const LV_COLUMN *)(&lvColumn));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -481,14 +481,14 @@ bool CRomBrowser::RomListDrawItem(int32_t idCtrl, uint32_t lParam)
|
|||
|
||||
RECT rcItem, rcDraw;
|
||||
wchar_t String[300];
|
||||
LVITEMW lvItem;
|
||||
LVITEM lvItem;
|
||||
HBRUSH hBrush = (HBRUSH)(COLOR_WINDOW + 1);
|
||||
LV_COLUMN lvc;
|
||||
int32_t nColumn;
|
||||
|
||||
lvItem.mask = LVIF_PARAM;
|
||||
lvItem.iItem = ditem->itemID;
|
||||
if (!SendMessageW(m_hRomList, LVM_GETITEMW, 0, (LPARAM)&lvItem)) { return false; }
|
||||
if (!SendMessage(m_hRomList, LVM_GETITEM, 0, (LPARAM)&lvItem)) { return false; }
|
||||
lvItem.state = ListView_GetItemState(m_hRomList, ditem->itemID, -1);
|
||||
bool bSelected = (lvItem.state & LVIS_SELECTED) != 0;
|
||||
|
||||
|
@ -527,7 +527,7 @@ bool CRomBrowser::RomListDrawItem(int32_t idCtrl, uint32_t lParam)
|
|||
lvItem.iSubItem = 0;
|
||||
lvItem.cchTextMax = sizeof(String) / sizeof(String[0]);
|
||||
lvItem.pszText = String;
|
||||
SendMessageW(m_hRomList, LVM_GETITEMTEXTW, (WPARAM)ditem->itemID, (LPARAM)&lvItem);
|
||||
SendMessage(m_hRomList, LVM_GETITEMTEXT, (WPARAM)ditem->itemID, (LPARAM)&lvItem);
|
||||
|
||||
memcpy(&rcDraw, &rcItem, sizeof(RECT));
|
||||
rcDraw.right -= 3;
|
||||
|
@ -541,7 +541,7 @@ bool CRomBrowser::RomListDrawItem(int32_t idCtrl, uint32_t lParam)
|
|||
text = stdstr(pRomInfo->FileName).ToUTF16();
|
||||
}
|
||||
|
||||
DrawTextW(ditem->hDC, text.c_str(), text.length(), &rcDraw, DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER | DT_WORD_ELLIPSIS);
|
||||
DrawText(ditem->hDC, text.c_str(), text.length(), &rcDraw, DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER | DT_WORD_ELLIPSIS);
|
||||
|
||||
memset(&lvc, 0, sizeof(lvc));
|
||||
lvc.mask = LVCF_FMT | LVCF_WIDTH;
|
||||
|
@ -553,7 +553,7 @@ bool CRomBrowser::RomListDrawItem(int32_t idCtrl, uint32_t lParam)
|
|||
lvItem.iSubItem = nColumn;
|
||||
lvItem.cchTextMax = sizeof(String) / sizeof(String[0]);
|
||||
lvItem.pszText = String;
|
||||
SendMessageW(m_hRomList, LVM_GETITEMTEXTW, ditem->itemID, (LPARAM)&lvItem);
|
||||
SendMessage(m_hRomList, LVM_GETITEMTEXT, ditem->itemID, (LPARAM)&lvItem);
|
||||
memcpy(&rcDraw, &rcItem, sizeof(RECT));
|
||||
rcDraw.right -= 3;
|
||||
text = String;
|
||||
|
@ -566,7 +566,7 @@ bool CRomBrowser::RomListDrawItem(int32_t idCtrl, uint32_t lParam)
|
|||
text = stdstr(pRomInfo->FileName).ToUTF16();
|
||||
}
|
||||
|
||||
DrawTextW(ditem->hDC, text.c_str(), text.length(), &rcDraw, DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER | DT_WORD_ELLIPSIS);
|
||||
DrawText(ditem->hDC, text.c_str(), text.length(), &rcDraw, DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER | DT_WORD_ELLIPSIS);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -581,7 +581,7 @@ bool CRomBrowser::RomListNotify(int32_t idCtrl, uint32_t pnmh)
|
|||
case LVN_COLUMNCLICK: RomList_ColoumnSortList(pnmh); break;
|
||||
case NM_RETURN: RomList_OpenRom(pnmh); break;
|
||||
case NM_DBLCLK: RomList_OpenRom(pnmh); break;
|
||||
case LVN_GETDISPINFOW: RomList_GetDispInfo(pnmh); break;
|
||||
case LVN_GETDISPINFO: RomList_GetDispInfo(pnmh); break;
|
||||
case NM_RCLICK: RomList_PopupMenu(pnmh); break;
|
||||
case NM_CLICK:
|
||||
{
|
||||
|
@ -687,7 +687,7 @@ int32_t CALLBACK CRomBrowser::RomList_CompareItems(uint32_t lParam1, uint32_t lP
|
|||
|
||||
void CRomBrowser::RomList_GetDispInfo(uint32_t pnmh)
|
||||
{
|
||||
LV_DISPINFOW * lpdi = (LV_DISPINFOW *)pnmh;
|
||||
LV_DISPINFO * lpdi = (LV_DISPINFO *)pnmh;
|
||||
if (lpdi->item.lParam < 0 || lpdi->item.lParam >= (LPARAM)m_RomInfo.size())
|
||||
{
|
||||
return;
|
||||
|
@ -795,7 +795,7 @@ void CRomBrowser::RomList_OpenRom(uint32_t /*pnmh*/)
|
|||
memset(&lvItem, 0, sizeof(LV_ITEM));
|
||||
lvItem.mask = LVIF_PARAM;
|
||||
lvItem.iItem = iItem;
|
||||
if (!SendMessageW(m_hRomList, LVM_GETITEMW, 0, (LPARAM)&lvItem)) { return; }
|
||||
if (!SendMessage(m_hRomList, LVM_GETITEM, 0, (LPARAM)&lvItem)) { return; }
|
||||
if (lvItem.lParam < 0 || lvItem.lParam >= (LPARAM)m_RomInfo.size())
|
||||
{
|
||||
return;
|
||||
|
@ -821,7 +821,7 @@ void CRomBrowser::RomList_PopupMenu(uint32_t /*pnmh*/)
|
|||
memset(&lvItem, 0, sizeof(LV_ITEM));
|
||||
lvItem.mask = LVIF_PARAM;
|
||||
lvItem.iItem = iItem;
|
||||
if (!SendMessageW(m_hRomList, LVM_GETITEMW, 0, (LPARAM)&lvItem)) { return; }
|
||||
if (!SendMessage(m_hRomList, LVM_GETITEM, 0, (LPARAM)&lvItem)) { return; }
|
||||
if (lvItem.lParam < 0 || lvItem.lParam >= (LPARAM)m_RomInfo.size())
|
||||
{
|
||||
return;
|
||||
|
@ -878,7 +878,7 @@ void CRomBrowser::RomList_PopupMenu(uint32_t /*pnmh*/)
|
|||
if (GfxMenu)
|
||||
{
|
||||
MENUITEMINFO lpmii;
|
||||
InsertMenuW(hPopupMenu, 7, MF_POPUP | MF_BYPOSITION, (uint32_t)GfxMenu, wGS(POPUP_GFX_PLUGIN).c_str());
|
||||
InsertMenu(hPopupMenu, 7, MF_POPUP | MF_BYPOSITION, (uint32_t)GfxMenu, wGS(POPUP_GFX_PLUGIN).c_str());
|
||||
lpmii.cbSize = sizeof(MENUITEMINFO);
|
||||
lpmii.fMask = MIIM_STATE;
|
||||
lpmii.fState = 0;
|
||||
|
@ -962,7 +962,7 @@ int32_t CALLBACK CRomBrowser::SelectRomDirCallBack(HWND hwnd, uint32_t uMsg, uin
|
|||
if (lpData)
|
||||
{
|
||||
SendMessage(hwnd, BFFM_SETSELECTION, TRUE, lpData);
|
||||
SetWindowTextW(hwnd, wGS(DIR_SELECT_ROM).c_str());
|
||||
SetWindowText(hwnd, wGS(DIR_SELECT_ROM).c_str());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -973,7 +973,7 @@ void CRomBrowser::SelectRomDir(void)
|
|||
{
|
||||
wchar_t SelectedDir[MAX_PATH];
|
||||
LPITEMIDLIST pidl;
|
||||
BROWSEINFOW bi;
|
||||
BROWSEINFO bi;
|
||||
|
||||
std::wstring title = wGS(SELECT_ROM_DIR);
|
||||
|
||||
|
@ -987,7 +987,7 @@ void CRomBrowser::SelectRomDir(void)
|
|||
bi.lpfn = (BFFCALLBACK)SelectRomDirCallBack;
|
||||
bi.lParam = (uint32_t)RomDir.c_str();
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "2");
|
||||
if ((pidl = SHBrowseForFolderW(&bi)) != NULL)
|
||||
if ((pidl = SHBrowseForFolder(&bi)) != NULL)
|
||||
{
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "3");
|
||||
char Directory[_MAX_PATH];
|
||||
|
|
|
@ -73,7 +73,7 @@ void RomInformation::DisplayInformation(HWND hParent) const
|
|||
{
|
||||
if (m_FileName.length() == 0) { return; }
|
||||
|
||||
DialogBoxParamW(GetModuleHandle(NULL), MAKEINTRESOURCEW(IDD_Rom_Information), hParent, (DLGPROC)RomInfoProc, (DWORD)this);
|
||||
DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_Rom_Information), hParent, (DLGPROC)RomInfoProc, (DWORD)this);
|
||||
}
|
||||
|
||||
DWORD CALLBACK RomInfoProc(HWND hDlg, DWORD uMsg, DWORD wParam, DWORD lParam)
|
||||
|
@ -88,56 +88,56 @@ DWORD CALLBACK RomInfoProc(HWND hDlg, DWORD uMsg, DWORD wParam, DWORD lParam)
|
|||
|
||||
if (_this->m_pDiskInfo == NULL)
|
||||
{
|
||||
SetWindowTextW(hDlg, wGS(INFO_TITLE).c_str());
|
||||
SetWindowText(hDlg, wGS(INFO_TITLE).c_str());
|
||||
|
||||
SetDlgItemTextW(hDlg, IDC_ROM_NAME, wGS(INFO_ROM_NAME_TEXT).c_str());
|
||||
SetDlgItemTextW(hDlg, IDC_FILE_NAME, wGS(INFO_FILE_NAME_TEXT).c_str());
|
||||
SetDlgItemTextW(hDlg, IDC_LOCATION, wGS(INFO_LOCATION_TEXT).c_str());
|
||||
SetDlgItemTextW(hDlg, IDC_ROM_MD5, wGS(INFO_MD5_TEXT).c_str());
|
||||
SetDlgItemTextW(hDlg, IDC_ROM_SIZE, wGS(INFO_SIZE_TEXT).c_str());
|
||||
SetDlgItemTextW(hDlg, IDC_CART_ID, wGS(INFO_CART_ID_TEXT).c_str());
|
||||
SetDlgItemTextW(hDlg, IDC_MANUFACTURER, wGS(INFO_MANUFACTURER_TEXT).c_str());
|
||||
SetDlgItemTextW(hDlg, IDC_COUNTRY, wGS(INFO_COUNTRY_TEXT).c_str());
|
||||
SetDlgItemTextW(hDlg, IDC_CRC1, wGS(INFO_CRC1_TEXT).c_str());
|
||||
SetDlgItemTextW(hDlg, IDC_CRC2, wGS(INFO_CRC2_TEXT).c_str());
|
||||
SetDlgItemTextW(hDlg, IDC_CIC_CHIP, wGS(INFO_CIC_CHIP_TEXT).c_str());
|
||||
SetDlgItemTextW(hDlg, IDC_CLOSE_BUTTON, wGS(BOTTOM_CLOSE).c_str());
|
||||
SetDlgItemText(hDlg, IDC_ROM_NAME, wGS(INFO_ROM_NAME_TEXT).c_str());
|
||||
SetDlgItemText(hDlg, IDC_FILE_NAME, wGS(INFO_FILE_NAME_TEXT).c_str());
|
||||
SetDlgItemText(hDlg, IDC_LOCATION, wGS(INFO_LOCATION_TEXT).c_str());
|
||||
SetDlgItemText(hDlg, IDC_ROM_MD5, wGS(INFO_MD5_TEXT).c_str());
|
||||
SetDlgItemText(hDlg, IDC_ROM_SIZE, wGS(INFO_SIZE_TEXT).c_str());
|
||||
SetDlgItemText(hDlg, IDC_CART_ID, wGS(INFO_CART_ID_TEXT).c_str());
|
||||
SetDlgItemText(hDlg, IDC_MANUFACTURER, wGS(INFO_MANUFACTURER_TEXT).c_str());
|
||||
SetDlgItemText(hDlg, IDC_COUNTRY, wGS(INFO_COUNTRY_TEXT).c_str());
|
||||
SetDlgItemText(hDlg, IDC_CRC1, wGS(INFO_CRC1_TEXT).c_str());
|
||||
SetDlgItemText(hDlg, IDC_CRC2, wGS(INFO_CRC2_TEXT).c_str());
|
||||
SetDlgItemText(hDlg, IDC_CIC_CHIP, wGS(INFO_CIC_CHIP_TEXT).c_str());
|
||||
SetDlgItemText(hDlg, IDC_CLOSE_BUTTON, wGS(BOTTOM_CLOSE).c_str());
|
||||
|
||||
SetDlgItemTextW(hDlg, IDC_INFO_ROMNAME, stdstr(_this->m_pRomInfo->GetRomName()).ToUTF16(stdstr::CODEPAGE_932).c_str());
|
||||
SetDlgItemText(hDlg, IDC_INFO_ROMNAME, stdstr(_this->m_pRomInfo->GetRomName()).ToUTF16(stdstr::CODEPAGE_932).c_str());
|
||||
|
||||
SetDlgItemTextW(hDlg, IDC_INFO_FILENAME, stdstr(CPath(_this->m_pRomInfo->GetFileName()).GetNameExtension()).ToUTF16(CP_ACP).c_str());
|
||||
SetDlgItemTextW(hDlg, IDC_INFO_LOCATION, stdstr(CPath(_this->m_pRomInfo->GetFileName()).GetDriveDirectory()).ToUTF16(CP_ACP).c_str());
|
||||
SetDlgItemText(hDlg, IDC_INFO_FILENAME, stdstr(CPath(_this->m_pRomInfo->GetFileName()).GetNameExtension()).ToUTF16(CP_ACP).c_str());
|
||||
SetDlgItemText(hDlg, IDC_INFO_LOCATION, stdstr(CPath(_this->m_pRomInfo->GetFileName()).GetDriveDirectory()).ToUTF16(CP_ACP).c_str());
|
||||
|
||||
SetDlgItemTextW(hDlg, IDC_INFO_MD5, stdstr(_this->m_pRomInfo->GetRomMD5()).ToUTF16().c_str());
|
||||
SetDlgItemTextW(hDlg, IDC_INFO_ROMSIZE, stdstr_f("%.1f MBit", (float)_this->m_pRomInfo->GetRomSize() / 0x20000).ToUTF16().c_str());
|
||||
SetDlgItemText(hDlg, IDC_INFO_MD5, stdstr(_this->m_pRomInfo->GetRomMD5()).ToUTF16().c_str());
|
||||
SetDlgItemText(hDlg, IDC_INFO_ROMSIZE, stdstr_f("%.1f MBit", (float)_this->m_pRomInfo->GetRomSize() / 0x20000).ToUTF16().c_str());
|
||||
|
||||
BYTE * RomHeader = _this->m_pRomInfo->GetRomAddress();
|
||||
SetDlgItemTextW(hDlg, IDC_INFO_CARTID, stdstr_f("%c%c", RomHeader[0x3F], RomHeader[0x3E]).ToUTF16().c_str());
|
||||
SetDlgItemText(hDlg, IDC_INFO_CARTID, stdstr_f("%c%c", RomHeader[0x3F], RomHeader[0x3E]).ToUTF16().c_str());
|
||||
|
||||
switch (RomHeader[0x38])
|
||||
{
|
||||
case 'N': SetDlgItemTextW(hDlg, IDC_INFO_MANUFACTURER, L"Nintendo"); break;
|
||||
case 0: SetDlgItemTextW(hDlg, IDC_INFO_MANUFACTURER, L"None"); break;
|
||||
default: SetDlgItemTextW(hDlg, IDC_INFO_MANUFACTURER, L"(Unknown)"); break;
|
||||
case 'N': SetDlgItemText(hDlg, IDC_INFO_MANUFACTURER, L"Nintendo"); break;
|
||||
case 0: SetDlgItemText(hDlg, IDC_INFO_MANUFACTURER, L"None"); break;
|
||||
default: SetDlgItemText(hDlg, IDC_INFO_MANUFACTURER, L"(Unknown)"); break;
|
||||
}
|
||||
|
||||
switch (RomHeader[0x3D])
|
||||
{
|
||||
case Country_NTSC_BETA: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Beta"); break;
|
||||
case Country_Asian_NTSC: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"NTSC"); break;
|
||||
case Country_Germany: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Germany"); break;
|
||||
case Country_NorthAmerica: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"America"); break;
|
||||
case Country_French: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"France"); break;
|
||||
case Country_Italian: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Italy"); break;
|
||||
case Country_Japan: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Japan"); break;
|
||||
case Country_Europe: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Europe"); break;
|
||||
case Country_Spanish: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Spain"); break;
|
||||
case Country_Australia: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Australia"); break;
|
||||
case Country_EuropeanX_PAL: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"PAL"); break;
|
||||
case Country_EuropeanY_PAL: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"PAL"); break;
|
||||
case Country_Unknown: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"None"); break;
|
||||
case Country_NTSC_BETA: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, L"Beta"); break;
|
||||
case Country_Asian_NTSC: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, L"NTSC"); break;
|
||||
case Country_Germany: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, L"Germany"); break;
|
||||
case Country_NorthAmerica: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, L"America"); break;
|
||||
case Country_French: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, L"France"); break;
|
||||
case Country_Italian: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, L"Italy"); break;
|
||||
case Country_Japan: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, L"Japan"); break;
|
||||
case Country_Europe: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, L"Europe"); break;
|
||||
case Country_Spanish: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, L"Spain"); break;
|
||||
case Country_Australia: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, L"Australia"); break;
|
||||
case Country_EuropeanX_PAL: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, L"PAL"); break;
|
||||
case Country_EuropeanY_PAL: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, L"PAL"); break;
|
||||
case Country_Unknown: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, L"None"); break;
|
||||
default:
|
||||
SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, stdstr_f(" Unknown %c (%02X)", RomHeader[0x3D], RomHeader[0x3D]).ToUTF16().c_str());
|
||||
SetDlgItemText(hDlg, IDC_INFO_COUNTRY, stdstr_f(" Unknown %c (%02X)", RomHeader[0x3D], RomHeader[0x3D]).ToUTF16().c_str());
|
||||
}
|
||||
|
||||
switch (_this->m_pRomInfo->CicChipID())
|
||||
|
@ -145,12 +145,12 @@ DWORD CALLBACK RomInfoProc(HWND hDlg, DWORD uMsg, DWORD wParam, DWORD lParam)
|
|||
case CIC_NUS_8303:
|
||||
case CIC_NUS_DDUS:
|
||||
case CIC_NUS_DDTL:
|
||||
SetDlgItemTextW(hDlg, IDC_INFO_CRC1, stdstr_f("0x%08X", (*(uint16_t *)(RomHeader + 0x608) << 16) | *(uint16_t *)(RomHeader + 0x60C)).ToUTF16().c_str());
|
||||
SetDlgItemTextW(hDlg, IDC_INFO_CRC2, stdstr_f("0x%08X", (*(uint16_t *)(RomHeader + 0x638) << 16) | *(uint16_t *)(RomHeader + 0x63C)).ToUTF16().c_str());
|
||||
SetDlgItemText(hDlg, IDC_INFO_CRC1, stdstr_f("0x%08X", (*(uint16_t *)(RomHeader + 0x608) << 16) | *(uint16_t *)(RomHeader + 0x60C)).ToUTF16().c_str());
|
||||
SetDlgItemText(hDlg, IDC_INFO_CRC2, stdstr_f("0x%08X", (*(uint16_t *)(RomHeader + 0x638) << 16) | *(uint16_t *)(RomHeader + 0x63C)).ToUTF16().c_str());
|
||||
break;
|
||||
default:
|
||||
SetDlgItemTextW(hDlg, IDC_INFO_CRC1, stdstr_f("0x%08X", *(uint32_t *)(RomHeader + 0x10)).ToUTF16().c_str());
|
||||
SetDlgItemTextW(hDlg, IDC_INFO_CRC2, stdstr_f("0x%08X", *(DWORD *)(RomHeader + 0x14)).ToUTF16().c_str());
|
||||
SetDlgItemText(hDlg, IDC_INFO_CRC1, stdstr_f("0x%08X", *(uint32_t *)(RomHeader + 0x10)).ToUTF16().c_str());
|
||||
SetDlgItemText(hDlg, IDC_INFO_CRC2, stdstr_f("0x%08X", *(DWORD *)(RomHeader + 0x14)).ToUTF16().c_str());
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -164,63 +164,63 @@ DWORD CALLBACK RomInfoProc(HWND hDlg, DWORD uMsg, DWORD wParam, DWORD lParam)
|
|||
case CIC_NUS_DDTL: CicChip = L"CIC-NUS-????"; break;
|
||||
default: CicChip = stdstr_f("CIC-NUS-610%d", _this->m_pRomInfo->CicChipID()).ToUTF16(); break;
|
||||
}
|
||||
SetDlgItemTextW(hDlg, IDC_INFO_CIC, CicChip.c_str());
|
||||
SetDlgItemText(hDlg, IDC_INFO_CIC, CicChip.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
SetWindowTextW(hDlg, wGS(INFO_TITLE).c_str());
|
||||
SetWindowText(hDlg, wGS(INFO_TITLE).c_str());
|
||||
|
||||
SetDlgItemTextW(hDlg, IDC_ROM_NAME, wGS(INFO_ROM_NAME_TEXT).c_str());
|
||||
SetDlgItemTextW(hDlg, IDC_FILE_NAME, wGS(INFO_FILE_NAME_TEXT).c_str());
|
||||
SetDlgItemTextW(hDlg, IDC_LOCATION, wGS(INFO_LOCATION_TEXT).c_str());
|
||||
//SetDlgItemTextW(hDlg, IDC_ROM_MD5, wGS(INFO_MD5_TEXT).c_str());
|
||||
//SetDlgItemTextW(hDlg, IDC_ROM_SIZE, wGS(INFO_SIZE_TEXT).c_str());
|
||||
SetDlgItemTextW(hDlg, IDC_CART_ID, wGS(INFO_CART_ID_TEXT).c_str());
|
||||
//SetDlgItemTextW(hDlg, IDC_MANUFACTURER, wGS(INFO_MANUFACTURER_TEXT).c_str());
|
||||
SetDlgItemTextW(hDlg, IDC_COUNTRY, wGS(INFO_COUNTRY_TEXT).c_str());
|
||||
//SetDlgItemTextW(hDlg, IDC_CRC1, wGS(INFO_CRC1_TEXT).c_str());
|
||||
//SetDlgItemTextW(hDlg, IDC_CRC2, wGS(INFO_CRC2_TEXT).c_str());
|
||||
//SetDlgItemTextW(hDlg, IDC_CIC_CHIP, wGS(INFO_CIC_CHIP_TEXT).c_str());
|
||||
SetDlgItemTextW(hDlg, IDC_CLOSE_BUTTON, wGS(BOTTOM_CLOSE).c_str());
|
||||
SetDlgItemText(hDlg, IDC_ROM_NAME, wGS(INFO_ROM_NAME_TEXT).c_str());
|
||||
SetDlgItemText(hDlg, IDC_FILE_NAME, wGS(INFO_FILE_NAME_TEXT).c_str());
|
||||
SetDlgItemText(hDlg, IDC_LOCATION, wGS(INFO_LOCATION_TEXT).c_str());
|
||||
//SetDlgItemText(hDlg, IDC_ROM_MD5, wGS(INFO_MD5_TEXT).c_str());
|
||||
//SetDlgItemText(hDlg, IDC_ROM_SIZE, wGS(INFO_SIZE_TEXT).c_str());
|
||||
SetDlgItemText(hDlg, IDC_CART_ID, wGS(INFO_CART_ID_TEXT).c_str());
|
||||
//SetDlgItemText(hDlg, IDC_MANUFACTURER, wGS(INFO_MANUFACTURER_TEXT).c_str());
|
||||
SetDlgItemText(hDlg, IDC_COUNTRY, wGS(INFO_COUNTRY_TEXT).c_str());
|
||||
//SetDlgItemText(hDlg, IDC_CRC1, wGS(INFO_CRC1_TEXT).c_str());
|
||||
//SetDlgItemText(hDlg, IDC_CRC2, wGS(INFO_CRC2_TEXT).c_str());
|
||||
//SetDlgItemText(hDlg, IDC_CIC_CHIP, wGS(INFO_CIC_CHIP_TEXT).c_str());
|
||||
SetDlgItemText(hDlg, IDC_CLOSE_BUTTON, wGS(BOTTOM_CLOSE).c_str());
|
||||
|
||||
SetDlgItemTextW(hDlg, IDC_INFO_ROMNAME, _this->m_pDiskInfo->GetRomName().ToUTF16(stdstr::CODEPAGE_932).c_str());
|
||||
SetDlgItemText(hDlg, IDC_INFO_ROMNAME, _this->m_pDiskInfo->GetRomName().ToUTF16(stdstr::CODEPAGE_932).c_str());
|
||||
|
||||
SetDlgItemTextW(hDlg, IDC_INFO_FILENAME, stdstr(CPath(_this->m_pDiskInfo->GetFileName()).GetNameExtension()).ToUTF16(CP_ACP).c_str());
|
||||
SetDlgItemTextW(hDlg, IDC_INFO_LOCATION, stdstr(CPath(_this->m_pDiskInfo->GetFileName()).GetDriveDirectory()).ToUTF16(CP_ACP).c_str());
|
||||
SetDlgItemText(hDlg, IDC_INFO_FILENAME, stdstr(CPath(_this->m_pDiskInfo->GetFileName()).GetNameExtension()).ToUTF16(CP_ACP).c_str());
|
||||
SetDlgItemText(hDlg, IDC_INFO_LOCATION, stdstr(CPath(_this->m_pDiskInfo->GetFileName()).GetDriveDirectory()).ToUTF16(CP_ACP).c_str());
|
||||
|
||||
//SetDlgItemTextW(hDlg, IDC_INFO_MD5, _this->m_pRomInfo->GetRomMD5().ToUTF16().c_str());
|
||||
//SetDlgItemTextW(hDlg, IDC_INFO_ROMSIZE, stdstr_f("%.1f MBit", (float)_this->m_pDiskInfo->GetRomSize() / 0x20000).ToUTF16().c_str());
|
||||
//SetDlgItemText(hDlg, IDC_INFO_MD5, _this->m_pRomInfo->GetRomMD5().ToUTF16().c_str());
|
||||
//SetDlgItemText(hDlg, IDC_INFO_ROMSIZE, stdstr_f("%.1f MBit", (float)_this->m_pDiskInfo->GetRomSize() / 0x20000).ToUTF16().c_str());
|
||||
|
||||
BYTE * DiskHeader = _this->m_pDiskInfo->GetDiskAddressID();
|
||||
SetDlgItemTextW(hDlg, IDC_INFO_CARTID, stdstr_f("%c%c", DiskHeader[0x02], DiskHeader[0x01]).ToUTF16().c_str());
|
||||
SetDlgItemText(hDlg, IDC_INFO_CARTID, stdstr_f("%c%c", DiskHeader[0x02], DiskHeader[0x01]).ToUTF16().c_str());
|
||||
|
||||
/*switch (DiskHeader[0x00])
|
||||
{
|
||||
case 'N': SetDlgItemTextW(hDlg, IDC_INFO_MANUFACTURER, L"Nintendo"); break;
|
||||
case 0: SetDlgItemTextW(hDlg, IDC_INFO_MANUFACTURER, L"None"); break;
|
||||
default: SetDlgItemTextW(hDlg, IDC_INFO_MANUFACTURER, L"(Unknown)"); break;
|
||||
case 'N': SetDlgItemText(hDlg, IDC_INFO_MANUFACTURER, L"Nintendo"); break;
|
||||
case 0: SetDlgItemText(hDlg, IDC_INFO_MANUFACTURER, L"None"); break;
|
||||
default: SetDlgItemText(hDlg, IDC_INFO_MANUFACTURER, L"(Unknown)"); break;
|
||||
}*/
|
||||
|
||||
switch (DiskHeader[0x00])
|
||||
{
|
||||
case Country_NTSC_BETA: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Beta"); break;
|
||||
case Country_Asian_NTSC: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"NTSC"); break;
|
||||
case Country_Germany: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Germany"); break;
|
||||
case Country_NorthAmerica: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"America"); break;
|
||||
case Country_French: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"France"); break;
|
||||
case Country_Italian: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Italy"); break;
|
||||
case Country_Japan: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Japan"); break;
|
||||
case Country_Europe: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Europe"); break;
|
||||
case Country_Spanish: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Spain"); break;
|
||||
case Country_Australia: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"Australia"); break;
|
||||
case Country_EuropeanX_PAL: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"PAL"); break;
|
||||
case Country_EuropeanY_PAL: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"PAL"); break;
|
||||
case Country_Unknown: SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, L"None"); break;
|
||||
case Country_NTSC_BETA: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, L"Beta"); break;
|
||||
case Country_Asian_NTSC: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, L"NTSC"); break;
|
||||
case Country_Germany: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, L"Germany"); break;
|
||||
case Country_NorthAmerica: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, L"America"); break;
|
||||
case Country_French: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, L"France"); break;
|
||||
case Country_Italian: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, L"Italy"); break;
|
||||
case Country_Japan: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, L"Japan"); break;
|
||||
case Country_Europe: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, L"Europe"); break;
|
||||
case Country_Spanish: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, L"Spain"); break;
|
||||
case Country_Australia: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, L"Australia"); break;
|
||||
case Country_EuropeanX_PAL: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, L"PAL"); break;
|
||||
case Country_EuropeanY_PAL: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, L"PAL"); break;
|
||||
case Country_Unknown: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, L"None"); break;
|
||||
default:
|
||||
SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, stdstr_f(" Unknown %c (%02X)", DiskHeader[0x03], DiskHeader[0x03]).ToUTF16().c_str());
|
||||
SetDlgItemText(hDlg, IDC_INFO_COUNTRY, stdstr_f(" Unknown %c (%02X)", DiskHeader[0x03], DiskHeader[0x03]).ToUTF16().c_str());
|
||||
}
|
||||
SetDlgItemTextW(hDlg, IDC_INFO_CRC1, stdstr_f("0x%08X", (_this->m_pDiskInfo->CalculateCrc())).ToUTF16().c_str());
|
||||
SetDlgItemTextW(hDlg, IDC_INFO_CRC2, stdstr_f("0x%08X", (~_this->m_pDiskInfo->CalculateCrc())).ToUTF16().c_str());
|
||||
SetDlgItemText(hDlg, IDC_INFO_CRC1, stdstr_f("0x%08X", (_this->m_pDiskInfo->CalculateCrc())).ToUTF16().c_str());
|
||||
SetDlgItemText(hDlg, IDC_INFO_CRC2, stdstr_f("0x%08X", (~_this->m_pDiskInfo->CalculateCrc())).ToUTF16().c_str());
|
||||
/*
|
||||
std::wstring CicChip;
|
||||
switch (_this->m_pRomInfo->CicChipID())
|
||||
|
@ -231,7 +231,7 @@ DWORD CALLBACK RomInfoProc(HWND hDlg, DWORD uMsg, DWORD wParam, DWORD lParam)
|
|||
case CIC_NUS_DDUS: CicChip = L"CIC-NUS-????"; break;
|
||||
default: CicChip = stdstr_f("CIC-NUS-610%d", _this->m_pRomInfo->CicChipID()).ToUTF16(); break;
|
||||
}
|
||||
SetDlgItemTextW(hDlg, IDC_INFO_CIC, CicChip.c_str());
|
||||
SetDlgItemText(hDlg, IDC_INFO_CIC, CicChip.c_str());
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,11 +46,11 @@ m_InUpdateSettings(false)
|
|||
m_TextureSelected.Attach(GetDlgItem(IDC_TEXTURE_OTHER));
|
||||
|
||||
//Set Text language for the dialog box
|
||||
::SetWindowTextW(m_PluginGroup.m_hWnd, wGS(DIR_PLUGIN).c_str());
|
||||
::SetWindowTextW(m_AutoSaveGroup.m_hWnd, wGS(DIR_AUTO_SAVE).c_str());
|
||||
::SetWindowTextW(m_InstantSaveGroup.m_hWnd, wGS(DIR_INSTANT_SAVE).c_str());
|
||||
::SetWindowTextW(m_ScreenShotGroup.m_hWnd, wGS(DIR_SCREEN_SHOT).c_str());
|
||||
::SetWindowTextW(m_TextureGroup.m_hWnd, wGS(DIR_TEXTURE).c_str());
|
||||
::SetWindowText(m_PluginGroup.m_hWnd, wGS(DIR_PLUGIN).c_str());
|
||||
::SetWindowText(m_AutoSaveGroup.m_hWnd, wGS(DIR_AUTO_SAVE).c_str());
|
||||
::SetWindowText(m_InstantSaveGroup.m_hWnd, wGS(DIR_INSTANT_SAVE).c_str());
|
||||
::SetWindowText(m_ScreenShotGroup.m_hWnd, wGS(DIR_SCREEN_SHOT).c_str());
|
||||
::SetWindowText(m_TextureGroup.m_hWnd, wGS(DIR_TEXTURE).c_str());
|
||||
|
||||
UpdatePageSettings();
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ void COptionsDirectoriesPage::SelectDirectory(LanguageStringID Title, CModifiedE
|
|||
{
|
||||
wchar_t Buffer[MAX_PATH], Directory[MAX_PATH];
|
||||
LPITEMIDLIST pidl;
|
||||
BROWSEINFOW bi;
|
||||
BROWSEINFO bi;
|
||||
|
||||
stdstr InitialDir = EditBox.GetWindowText();
|
||||
std::wstring wTitle = wGS(Title);
|
||||
|
@ -86,9 +86,9 @@ void COptionsDirectoriesPage::SelectDirectory(LanguageStringID Title, CModifiedE
|
|||
bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;
|
||||
bi.lpfn = (BFFCALLBACK)SelectDirCallBack;
|
||||
bi.lParam = (DWORD)InitialDir.c_str();
|
||||
if ((pidl = SHBrowseForFolderW(&bi)) != NULL)
|
||||
if ((pidl = SHBrowseForFolder(&bi)) != NULL)
|
||||
{
|
||||
if (SHGetPathFromIDListW(pidl, Directory))
|
||||
if (SHGetPathFromIDList(pidl, Directory))
|
||||
{
|
||||
stdstr path;
|
||||
CPath SelectedDir(path.FromUTF16(Directory), "");
|
||||
|
|
|
@ -60,12 +60,12 @@ void COptionsGameBrowserPage::UpdateFieldList(const ROMBROWSER_FIELDS_LIST & Fie
|
|||
int Pos = Fields[i].Pos();
|
||||
if (Pos < 0)
|
||||
{
|
||||
m_Avaliable.SetItemData(m_Avaliable.AddStringW(wGS(Fields[i].LangID()).c_str()), i);
|
||||
m_Avaliable.SetItemData(m_Avaliable.AddString(wGS(Fields[i].LangID()).c_str()), i);
|
||||
continue;
|
||||
}
|
||||
int listCount = m_Using.GetCount();
|
||||
if (Pos > listCount) { Pos = listCount; }
|
||||
m_Using.SetItemData(m_Using.InsertStringW(Pos, wGS(Fields[i].LangID()).c_str()), i);
|
||||
m_Using.SetItemData(m_Using.InsertString(Pos, wGS(Fields[i].LangID()).c_str()), i);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ void COptionsGameBrowserPage::AddFieldClicked(UINT /*Code*/, int /*id*/, HWND /*
|
|||
m_Avaliable.SetCurSel(index);
|
||||
|
||||
//Add to list
|
||||
index = m_Using.AddStringW(wGS(m_Fields[i].LangID()).c_str());
|
||||
index = m_Using.AddString(wGS(m_Fields[i].LangID()).c_str());
|
||||
m_Using.SetItemData(index, i);
|
||||
m_Using.SetCurSel(index);
|
||||
|
||||
|
@ -139,7 +139,7 @@ void COptionsGameBrowserPage::RemoveFieldClicked(UINT /*Code*/, int /*id*/, HWND
|
|||
m_Using.SetCurSel(index);
|
||||
|
||||
//Add to list
|
||||
index = m_Avaliable.AddStringW(wGS(m_Fields[i].LangID()).c_str());
|
||||
index = m_Avaliable.AddString(wGS(m_Fields[i].LangID()).c_str());
|
||||
m_Avaliable.SetItemData(index, i);
|
||||
m_Avaliable.SetCurSel(index);
|
||||
|
||||
|
@ -158,7 +158,7 @@ void COptionsGameBrowserPage::MoveFieldUpClicked(UINT /*Code*/, int /*id*/, HWND
|
|||
int i = m_Using.GetItemData(index);
|
||||
m_Using.DeleteString(index);
|
||||
|
||||
index = m_Using.InsertStringW(index - 1, wGS(m_Fields[i].LangID()).c_str());
|
||||
index = m_Using.InsertString(index - 1, wGS(m_Fields[i].LangID()).c_str());
|
||||
m_Using.SetItemData(index, i);
|
||||
m_Using.SetCurSel(index);
|
||||
|
||||
|
@ -177,7 +177,7 @@ void COptionsGameBrowserPage::MoveFieldDownClicked(UINT /*Code*/, int /*id*/, HW
|
|||
int i = m_Using.GetItemData(index);
|
||||
m_Using.DeleteString(index);
|
||||
|
||||
index = m_Using.InsertStringW(index + 1, wGS(m_Fields[i].LangID()).c_str());
|
||||
index = m_Using.InsertString(index + 1, wGS(m_Fields[i].LangID()).c_str());
|
||||
m_Using.SetItemData(index, i);
|
||||
m_Using.SetCurSel(index);
|
||||
|
||||
|
|
|
@ -37,9 +37,9 @@ COptionsShortCutsPage::COptionsShortCutsPage(HWND hParent, const RECT & rcDispay
|
|||
|
||||
m_MenuItems.ModifyStyle(0, TVS_SHOWSELALWAYS);
|
||||
|
||||
m_CpuState.SetItemData(m_CpuState.AddStringW(wGS(ACCEL_CPUSTATE_1).c_str()), CMenuShortCutKey::RUNNING_STATE_NOT_RUNNING);
|
||||
m_CpuState.SetItemData(m_CpuState.AddStringW(wGS(ACCEL_CPUSTATE_3).c_str()), CMenuShortCutKey::RUNNING_STATE_WINDOWED);
|
||||
m_CpuState.SetItemData(m_CpuState.AddStringW(wGS(ACCEL_CPUSTATE_4).c_str()), CMenuShortCutKey::RUNNING_STATE_FULLSCREEN);
|
||||
m_CpuState.SetItemData(m_CpuState.AddString(wGS(ACCEL_CPUSTATE_1).c_str()), CMenuShortCutKey::RUNNING_STATE_NOT_RUNNING);
|
||||
m_CpuState.SetItemData(m_CpuState.AddString(wGS(ACCEL_CPUSTATE_3).c_str()), CMenuShortCutKey::RUNNING_STATE_WINDOWED);
|
||||
m_CpuState.SetItemData(m_CpuState.AddString(wGS(ACCEL_CPUSTATE_4).c_str()), CMenuShortCutKey::RUNNING_STATE_FULLSCREEN);
|
||||
m_CpuState.SetCurSel(0);
|
||||
|
||||
int VirtualKeyListSize;
|
||||
|
@ -99,7 +99,7 @@ void COptionsShortCutsPage::OnCpuStateChanged(UINT /*Code*/, int /*id*/, HWND /*
|
|||
|
||||
if (hParent == NULL)
|
||||
{
|
||||
hParent = m_MenuItems.InsertItemW(TVIF_TEXT | TVIF_PARAM, wGS(Item->second.Section()).c_str(), 0, 0, 0, 0, Item->second.Section(), TVI_ROOT, TVI_LAST);
|
||||
hParent = m_MenuItems.InsertItem(TVIF_TEXT | TVIF_PARAM, wGS(Item->second.Section()).c_str(), 0, 0, 0, 0, Item->second.Section(), TVI_ROOT, TVI_LAST);
|
||||
}
|
||||
|
||||
wstring str = wGS(Item->second.Title());
|
||||
|
@ -116,7 +116,7 @@ void COptionsShortCutsPage::OnCpuStateChanged(UINT /*Code*/, int /*id*/, HWND /*
|
|||
pos = str.find(L"...", pos);
|
||||
}
|
||||
|
||||
HTREEITEM hItem = m_MenuItems.InsertItemW(TVIF_TEXT | TVIF_PARAM, str.c_str(), 0, 0, 0, 0, (DWORD_PTR)&Item->second, hParent, TVI_LAST);
|
||||
HTREEITEM hItem = m_MenuItems.InsertItem(TVIF_TEXT | TVIF_PARAM, str.c_str(), 0, 0, 0, 0, (DWORD_PTR)&Item->second, hParent, TVI_LAST);
|
||||
|
||||
const SHORTCUT_KEY_LIST & ShortCutList = Item->second.GetAccelItems();
|
||||
for (SHORTCUT_KEY_LIST::const_iterator ShortCut_item = ShortCutList.begin(); ShortCut_item != ShortCutList.end(); ShortCut_item++)
|
||||
|
|
|
@ -67,7 +67,7 @@ protected:
|
|||
#ifdef _DEBUG
|
||||
m_bModal = false;
|
||||
#endif //_DEBUG
|
||||
m_hWnd = ::CreateDialogParamW(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCEW(static_cast<T*>(this)->IDD), hParent, T::StartDialogProc, NULL);
|
||||
m_hWnd = ::CreateDialogParam(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(static_cast<T*>(this)->IDD), hParent, T::StartDialogProc, NULL);
|
||||
if (m_hWnd == NULL)
|
||||
{
|
||||
return false;
|
||||
|
|
|
@ -37,7 +37,7 @@ void CSettingConfig::Display(void * ParentWindow)
|
|||
#ifdef _DEBUG
|
||||
m_bModal = true;
|
||||
#endif //_DEBUG
|
||||
::DialogBoxParamW(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCEW(IDD), (HWND)ParentWindow, StartDialogProc, NULL);
|
||||
::DialogBoxParam(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDD), (HWND)ParentWindow, StartDialogProc, NULL);
|
||||
}
|
||||
|
||||
if (g_BaseSystem)
|
||||
|
@ -65,8 +65,8 @@ void CSettingConfig::UpdateAdvanced(bool AdvancedMode, HTREEITEM hItem)
|
|||
}
|
||||
else if (AdvancedMode && Page == m_GeneralOptionsPage)
|
||||
{
|
||||
m_PagesTreeList.InsertItemW(TVIF_TEXT | TVIF_PARAM, wGS(m_AdvancedPage->PageTitle()).c_str(), 0, 0, 0, 0, (ULONG)m_AdvancedPage, hItem, TVI_FIRST);
|
||||
m_PagesTreeList.InsertItemW(TVIF_TEXT | TVIF_PARAM, wGS(m_DefaultsPage->PageTitle()).c_str(), 0, 0, 0, 0, (ULONG)m_DefaultsPage, hItem, TVI_FIRST);
|
||||
m_PagesTreeList.InsertItem(TVIF_TEXT | TVIF_PARAM, wGS(m_AdvancedPage->PageTitle()).c_str(), 0, 0, 0, 0, (ULONG)m_AdvancedPage, hItem, TVI_FIRST);
|
||||
m_PagesTreeList.InsertItem(TVIF_TEXT | TVIF_PARAM, wGS(m_DefaultsPage->PageTitle()).c_str(), 0, 0, 0, 0, (ULONG)m_DefaultsPage, hItem, TVI_FIRST);
|
||||
break;
|
||||
}
|
||||
else
|
||||
|
@ -118,7 +118,7 @@ LRESULT CSettingConfig::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*
|
|||
}
|
||||
else
|
||||
{
|
||||
::SetWindowTextW(m_hWnd, wGS(OPTIONS_TITLE).c_str());
|
||||
::SetWindowText(m_hWnd, wGS(OPTIONS_TITLE).c_str());
|
||||
}
|
||||
|
||||
if (UISettingsLoadBool(Setting_PluginPageFirst))
|
||||
|
@ -190,14 +190,14 @@ LRESULT CSettingConfig::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*
|
|||
}
|
||||
if (i == 0)
|
||||
{
|
||||
hSectionItem = m_PagesTreeList.InsertItemW(TVIF_TEXT | TVIF_PARAM, Section->GetPageTitle(), 0, 0, 0, 0, (ULONG)Page, TVI_ROOT, TVI_LAST);
|
||||
hSectionItem = m_PagesTreeList.InsertItem(TVIF_TEXT | TVIF_PARAM, Section->GetPageTitle(), 0, 0, 0, 0, (ULONG)Page, TVI_ROOT, TVI_LAST);
|
||||
continue;
|
||||
}
|
||||
if (hSectionItem == NULL)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
m_PagesTreeList.InsertItemW(TVIF_TEXT | TVIF_PARAM, wGS(Page->PageTitle()).c_str(), 0, 0, 0, 0, (ULONG)Page, hSectionItem, TVI_LAST);
|
||||
m_PagesTreeList.InsertItem(TVIF_TEXT | TVIF_PARAM, wGS(Page->PageTitle()).c_str(), 0, 0, 0, 0, (ULONG)Page, hSectionItem, TVI_LAST);
|
||||
}
|
||||
if (bFirstItem && hSectionItem != NULL)
|
||||
{
|
||||
|
|
|
@ -23,7 +23,7 @@ BOOL CPartialGroupBox::Attach(HWND hWnd)
|
|||
return FALSE;
|
||||
}
|
||||
WNDPROC pProc = m_thunk.GetWNDPROC();
|
||||
WNDPROC pfnWndProc = (WNDPROC)::SetWindowLongPtrW(hWnd, GWLP_WNDPROC, (LONG_PTR)pProc);
|
||||
WNDPROC pfnWndProc = (WNDPROC)::SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)pProc);
|
||||
if (pfnWndProc == NULL)
|
||||
return FALSE;
|
||||
m_pfnSuperWindowProc = pfnWndProc;
|
||||
|
@ -65,10 +65,10 @@ void CPartialGroupBox::OnPaint(HDC /*hDC*/)
|
|||
dc.SelectBrush(GetSysColorBrush(COLOR_BTNFACE));
|
||||
|
||||
wchar_t grptext[500];
|
||||
::GetWindowTextW(m_hWnd, grptext, sizeof(grptext) / sizeof(grptext[0]));
|
||||
::GetWindowText(m_hWnd, grptext, sizeof(grptext) / sizeof(grptext[0]));
|
||||
|
||||
CRect fontsizerect(0, 0, 0, 0);
|
||||
dc.DrawTextW(grptext, -1, fontsizerect, DT_SINGLELINE | DT_LEFT | DT_CALCRECT);
|
||||
dc.DrawText(grptext, -1, fontsizerect, DT_SINGLELINE | DT_LEFT | DT_CALCRECT);
|
||||
|
||||
CRect framerect(controlrect);
|
||||
framerect.top += (fontsizerect.Height()) / 2;
|
||||
|
@ -116,6 +116,6 @@ void CPartialGroupBox::OnPaint(HDC /*hDC*/)
|
|||
dc.SetBkMode(OPAQUE);
|
||||
dc.SetBkColor(GetSysColor(COLOR_BTNFACE));
|
||||
|
||||
dc.DrawTextW(grptext, -1, fontrect, DT_SINGLELINE | DT_LEFT);
|
||||
dc.DrawText(grptext, -1, fontrect, DT_SINGLELINE | DT_LEFT);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ void WelcomeScreen::SelectGameDir(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
|
|||
{
|
||||
wchar_t Buffer[MAX_PATH], Directory[MAX_PATH];
|
||||
LPITEMIDLIST pidl;
|
||||
BROWSEINFOW bi;
|
||||
BROWSEINFO bi;
|
||||
|
||||
stdstr InitialDir = g_Settings->LoadStringVal(RomList_GameDir);
|
||||
std::wstring wTitle = L"Select Game Directory";
|
||||
|
@ -31,9 +31,9 @@ void WelcomeScreen::SelectGameDir(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
|
|||
bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;
|
||||
bi.lpfn = (BFFCALLBACK)SelectDirCallBack;
|
||||
bi.lParam = (DWORD)InitialDir.c_str();
|
||||
if ((pidl = SHBrowseForFolderW(&bi)) != NULL)
|
||||
if ((pidl = SHBrowseForFolder(&bi)) != NULL)
|
||||
{
|
||||
if (SHGetPathFromIDListW(pidl, Directory))
|
||||
if (SHGetPathFromIDList(pidl, Directory))
|
||||
{
|
||||
stdstr path;
|
||||
CPath SelectedDir(path.FromUTF16(Directory), "");
|
||||
|
|
|
@ -159,7 +159,7 @@ void DisplayError(char* Message, ...)
|
|||
vsprintf( Msg, Message, ap );
|
||||
va_end( ap );
|
||||
#ifdef _WIN32
|
||||
MessageBoxA(NULL, Msg, "Error", MB_OK | MB_ICONERROR);
|
||||
MessageBox(NULL, Msg, "Error", MB_OK | MB_ICONERROR);
|
||||
#else
|
||||
fputs(&Msg[0], stderr);
|
||||
#endif
|
||||
|
|
|
@ -184,7 +184,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
ShellExecuteA(NULL,"open",LogFileName.c_str(),NULL,NULL,SW_SHOW);
|
||||
ShellExecute(NULL,"open",LogFileName.c_str(),NULL,NULL,SW_SHOW);
|
||||
ResetCounters();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -99,7 +99,7 @@ void Create_RSP_Commands_Window ( int Child )
|
|||
else
|
||||
{
|
||||
if (IsIconic((HWND)RSPCommandshWnd)) {
|
||||
SendMessage(RSPCommandshWnd, WM_SYSCOMMAND, SC_RESTORE, NULL);
|
||||
SendMessage(RSPCommandshWnd, WM_SYSCOMMAND, SC_RESTORE, 0);
|
||||
}
|
||||
SetForegroundWindow(RSPCommandshWnd);
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ LRESULT CALLBACK RSP_Registers_Proc ( HWND, UINT, WPARAM, LPARAM );
|
|||
HWND RSP_Registers_hDlg, hTab, hStatic, hGPR[32], hCP0[16], hHIDDEN[12],
|
||||
hVECT1[16], hVECT2[16];
|
||||
int InRSPRegisterWindow = FALSE;
|
||||
FARPROC RefreshProc;
|
||||
WNDPROC RefreshProc;
|
||||
|
||||
/*** RSP Registers ***/
|
||||
UWORD32 RSP_GPR[32], RSP_Flags[4];
|
||||
|
@ -86,7 +86,7 @@ void Create_RSP_Register_Window ( int Child ) {
|
|||
(LPVOID)TRUE,0, &ThreadID);
|
||||
} else {
|
||||
if (IsIconic((HWND)RSP_Registers_hDlg)) {
|
||||
SendMessage(RSP_Registers_hDlg, WM_SYSCOMMAND, SC_RESTORE, NULL);
|
||||
SendMessage(RSP_Registers_hDlg, WM_SYSCOMMAND, SC_RESTORE, 0);
|
||||
}
|
||||
SetForegroundWindow(RSP_Registers_hDlg);
|
||||
}
|
||||
|
@ -515,7 +515,7 @@ void SetupRSP_RegistersMain (HWND hDlg) {
|
|||
|
||||
hStatic = CreateWindowEx(0,"STATIC","", WS_CHILD|WS_VISIBLE, 5,6,616,290,hDlg,0,hinstDLL,NULL );
|
||||
#ifdef _M_IX86
|
||||
RefreshProc = (FARPROC)SetWindowLong(hStatic, GWL_WNDPROC, (long)RefreshRSP_RegProc);
|
||||
RefreshProc = (WNDPROC)SetWindowLong(hStatic, GWL_WNDPROC, (long)RefreshRSP_RegProc);
|
||||
#else
|
||||
DebugBreak();
|
||||
#endif
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PrecompiledHeader />
|
||||
<UndefinePreprocessorDefinitions>UNICODE;_UNICODE</UndefinePreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link />
|
||||
<Bscmake>
|
||||
|
|
Loading…
Reference in New Issue