mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-12 15:38:59 +01:00
remove WTL, the last project using it was DSP LLE
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2933 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
0c4d4835ac
commit
edf0be235b
1688
Externals/WTL80/atlapp.h
vendored
1688
Externals/WTL80/atlapp.h
vendored
File diff suppressed because it is too large
Load Diff
2380
Externals/WTL80/atlcrack.h
vendored
2380
Externals/WTL80/atlcrack.h
vendored
File diff suppressed because it is too large
Load Diff
10039
Externals/WTL80/atlctrls.h
vendored
10039
Externals/WTL80/atlctrls.h
vendored
File diff suppressed because it is too large
Load Diff
4161
Externals/WTL80/atlctrlw.h
vendored
4161
Externals/WTL80/atlctrlw.h
vendored
File diff suppressed because it is too large
Load Diff
4827
Externals/WTL80/atlctrlx.h
vendored
4827
Externals/WTL80/atlctrlx.h
vendored
File diff suppressed because it is too large
Load Diff
624
Externals/WTL80/atlddx.h
vendored
624
Externals/WTL80/atlddx.h
vendored
@ -1,624 +0,0 @@
|
||||
// Windows Template Library - WTL version 8.0
|
||||
// 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/osi3.0/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 __ATLDDX_H__
|
||||
#define __ATLDDX_H__
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error ATL requires C++ compilation (use a .cpp suffix)
|
||||
#endif
|
||||
|
||||
#ifndef __ATLAPP_H__
|
||||
#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
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Classes in this file:
|
||||
//
|
||||
// CWinDataExchange<T>
|
||||
|
||||
|
||||
namespace WTL
|
||||
{
|
||||
|
||||
// Constants
|
||||
#define DDX_LOAD FALSE
|
||||
#define DDX_SAVE TRUE
|
||||
|
||||
// DDX map macros
|
||||
#define BEGIN_DDX_MAP(thisClass) \
|
||||
BOOL DoDataExchange(BOOL bSaveAndValidate = FALSE, UINT nCtlID = (UINT)-1) \
|
||||
{ \
|
||||
bSaveAndValidate; \
|
||||
nCtlID;
|
||||
|
||||
#define DDX_TEXT(nID, var) \
|
||||
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(!DDX_Text(nID, var, sizeof(var), bSaveAndValidate, TRUE, len)) \
|
||||
return FALSE; \
|
||||
}
|
||||
|
||||
#define DDX_INT(nID, var) \
|
||||
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(!DDX_Int(nID, var, TRUE, bSaveAndValidate, TRUE, min, max)) \
|
||||
return FALSE; \
|
||||
}
|
||||
|
||||
#define DDX_UINT(nID, var) \
|
||||
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(!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(!DDX_Float(nID, var, bSaveAndValidate)) \
|
||||
return FALSE; \
|
||||
}
|
||||
|
||||
#define DDX_FLOAT_RANGE(nID, var, min, max) \
|
||||
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(!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(!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) \
|
||||
DDX_Control(nID, obj, bSaveAndValidate);
|
||||
|
||||
#define DDX_CONTROL_HANDLE(nID, obj) \
|
||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
||||
DDX_Control_Handle(nID, obj, bSaveAndValidate);
|
||||
|
||||
#define DDX_CHECK(nID, var) \
|
||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
||||
DDX_Check(nID, var, bSaveAndValidate);
|
||||
|
||||
#define DDX_RADIO(nID, var) \
|
||||
if(nCtlID == (UINT)-1 || nCtlID == nID) \
|
||||
DDX_Radio(nID, var, bSaveAndValidate);
|
||||
|
||||
#define END_DDX_MAP() \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// CWinDataExchange - provides support for DDX
|
||||
|
||||
template <class T>
|
||||
class CWinDataExchange
|
||||
{
|
||||
public:
|
||||
// Data exchange method - override in your derived class
|
||||
BOOL DoDataExchange(BOOL /*bSaveAndValidate*/ = FALSE, UINT /*nCtlID*/ = (UINT)-1)
|
||||
{
|
||||
// this one should never be called, override it in
|
||||
// your derived class by implementing DDX map
|
||||
ATLASSERT(FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Helpers for validation error reporting
|
||||
enum _XDataType
|
||||
{
|
||||
ddxDataNull = 0,
|
||||
ddxDataText = 1,
|
||||
ddxDataInt = 2,
|
||||
ddxDataFloat = 3,
|
||||
ddxDataDouble = 4
|
||||
};
|
||||
|
||||
struct _XTextData
|
||||
{
|
||||
int nLength;
|
||||
int nMaxLength;
|
||||
};
|
||||
|
||||
struct _XIntData
|
||||
{
|
||||
long nVal;
|
||||
long nMin;
|
||||
long nMax;
|
||||
};
|
||||
|
||||
struct _XFloatData
|
||||
{
|
||||
double nVal;
|
||||
double nMin;
|
||||
double nMax;
|
||||
};
|
||||
|
||||
struct _XData
|
||||
{
|
||||
_XDataType nDataType;
|
||||
union
|
||||
{
|
||||
_XTextData textData;
|
||||
_XIntData intData;
|
||||
_XFloatData floatData;
|
||||
};
|
||||
};
|
||||
|
||||
// Text exchange
|
||||
BOOL DDX_Text(UINT nID, LPTSTR lpstrText, int cbSize, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
BOOL bSuccess = TRUE;
|
||||
|
||||
if(bSave)
|
||||
{
|
||||
HWND hWndCtrl = pT->GetDlgItem(nID);
|
||||
int nRetLen = ::GetWindowText(hWndCtrl, lpstrText, cbSize / sizeof(TCHAR));
|
||||
if(nRetLen < ::GetWindowTextLength(hWndCtrl))
|
||||
bSuccess = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ATLASSERT(!bValidate || lstrlen(lpstrText) <= nLength);
|
||||
bSuccess = pT->SetDlgItemText(nID, lpstrText);
|
||||
}
|
||||
|
||||
if(!bSuccess)
|
||||
{
|
||||
pT->OnDataExchangeError(nID, bSave);
|
||||
}
|
||||
else if(bSave && bValidate) // validation
|
||||
{
|
||||
ATLASSERT(nLength > 0);
|
||||
if(lstrlen(lpstrText) > nLength)
|
||||
{
|
||||
_XData data = { ddxDataText };
|
||||
data.textData.nLength = lstrlen(lpstrText);
|
||||
data.textData.nMaxLength = nLength;
|
||||
pT->OnDataValidateError(nID, bSave, data);
|
||||
bSuccess = FALSE;
|
||||
}
|
||||
}
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
BOOL DDX_Text(UINT nID, BSTR& bstrText, int /*cbSize*/, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
BOOL bSuccess = TRUE;
|
||||
|
||||
if(bSave)
|
||||
{
|
||||
bSuccess = pT->GetDlgItemText(nID, bstrText);
|
||||
}
|
||||
else
|
||||
{
|
||||
USES_CONVERSION;
|
||||
LPTSTR lpstrText = OLE2T(bstrText);
|
||||
ATLASSERT(!bValidate || lstrlen(lpstrText) <= nLength);
|
||||
bSuccess = pT->SetDlgItemText(nID, lpstrText);
|
||||
}
|
||||
|
||||
if(!bSuccess)
|
||||
{
|
||||
pT->OnDataExchangeError(nID, bSave);
|
||||
}
|
||||
else if(bSave && bValidate) // validation
|
||||
{
|
||||
ATLASSERT(nLength > 0);
|
||||
if((int)::SysStringLen(bstrText) > nLength)
|
||||
{
|
||||
_XData data = { ddxDataText };
|
||||
data.textData.nLength = (int)::SysStringLen(bstrText);
|
||||
data.textData.nMaxLength = nLength;
|
||||
pT->OnDataValidateError(nID, bSave, data);
|
||||
bSuccess = FALSE;
|
||||
}
|
||||
}
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
BOOL DDX_Text(UINT nID, ATL::CComBSTR& bstrText, int /*cbSize*/, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
BOOL bSuccess = TRUE;
|
||||
|
||||
if(bSave)
|
||||
{
|
||||
bSuccess = pT->GetDlgItemText(nID, (BSTR&)bstrText);
|
||||
}
|
||||
else
|
||||
{
|
||||
USES_CONVERSION;
|
||||
LPTSTR lpstrText = OLE2T(bstrText);
|
||||
ATLASSERT(!bValidate || lstrlen(lpstrText) <= nLength);
|
||||
bSuccess = pT->SetDlgItemText(nID, lpstrText);
|
||||
}
|
||||
|
||||
if(!bSuccess)
|
||||
{
|
||||
pT->OnDataExchangeError(nID, bSave);
|
||||
}
|
||||
else if(bSave && bValidate) // validation
|
||||
{
|
||||
ATLASSERT(nLength > 0);
|
||||
if((int)bstrText.Length() > nLength)
|
||||
{
|
||||
_XData data = { ddxDataText };
|
||||
data.textData.nLength = (int)bstrText.Length();
|
||||
data.textData.nMaxLength = nLength;
|
||||
pT->OnDataValidateError(nID, bSave, data);
|
||||
bSuccess = FALSE;
|
||||
}
|
||||
}
|
||||
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)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
BOOL bSuccess = TRUE;
|
||||
|
||||
if(bSave)
|
||||
{
|
||||
HWND hWndCtrl = pT->GetDlgItem(nID);
|
||||
int nLen = ::GetWindowTextLength(hWndCtrl);
|
||||
int nRetLen = -1;
|
||||
LPTSTR lpstr = strText.GetBufferSetLength(nLen);
|
||||
if(lpstr != NULL)
|
||||
{
|
||||
nRetLen = ::GetWindowText(hWndCtrl, lpstr, nLen + 1);
|
||||
strText.ReleaseBuffer();
|
||||
}
|
||||
if(nRetLen < nLen)
|
||||
bSuccess = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
bSuccess = pT->SetDlgItemText(nID, strText);
|
||||
}
|
||||
|
||||
if(!bSuccess)
|
||||
{
|
||||
pT->OnDataExchangeError(nID, bSave);
|
||||
}
|
||||
else if(bSave && bValidate) // validation
|
||||
{
|
||||
ATLASSERT(nLength > 0);
|
||||
if(strText.GetLength() > nLength)
|
||||
{
|
||||
_XData data = { ddxDataText };
|
||||
data.textData.nLength = strText.GetLength();
|
||||
data.textData.nMaxLength = nLength;
|
||||
pT->OnDataValidateError(nID, bSave, data);
|
||||
bSuccess = FALSE;
|
||||
}
|
||||
}
|
||||
return bSuccess;
|
||||
}
|
||||
#endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__)
|
||||
|
||||
// Numeric exchange
|
||||
template <class Type>
|
||||
BOOL DDX_Int(UINT nID, Type& nVal, BOOL bSigned, BOOL bSave, BOOL bValidate = FALSE, Type nMin = 0, Type nMax = 0)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
BOOL bSuccess = TRUE;
|
||||
|
||||
if(bSave)
|
||||
{
|
||||
nVal = (Type)pT->GetDlgItemInt(nID, &bSuccess, bSigned);
|
||||
}
|
||||
else
|
||||
{
|
||||
ATLASSERT(!bValidate || nVal >= nMin && nVal <= nMax);
|
||||
bSuccess = pT->SetDlgItemInt(nID, nVal, bSigned);
|
||||
}
|
||||
|
||||
if(!bSuccess)
|
||||
{
|
||||
pT->OnDataExchangeError(nID, bSave);
|
||||
}
|
||||
else if(bSave && bValidate) // validation
|
||||
{
|
||||
ATLASSERT(nMin != nMax);
|
||||
if(nVal < nMin || nVal > nMax)
|
||||
{
|
||||
_XData data = { ddxDataInt };
|
||||
data.intData.nVal = (long)nVal;
|
||||
data.intData.nMin = (long)nMin;
|
||||
data.intData.nMax = (long)nMax;
|
||||
pT->OnDataValidateError(nID, bSave, data);
|
||||
bSuccess = FALSE;
|
||||
}
|
||||
}
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
// Float exchange
|
||||
#ifdef _ATL_USE_DDX_FLOAT
|
||||
static BOOL _AtlSimpleFloatParse(LPCTSTR lpszText, double& d)
|
||||
{
|
||||
ATLASSERT(lpszText != NULL);
|
||||
while (*lpszText == _T(' ') || *lpszText == _T('\t'))
|
||||
lpszText++;
|
||||
|
||||
TCHAR chFirst = lpszText[0];
|
||||
d = _tcstod(lpszText, (LPTSTR*)&lpszText);
|
||||
if (d == 0.0 && chFirst != _T('0'))
|
||||
return FALSE; // could not convert
|
||||
while (*lpszText == _T(' ') || *lpszText == _T('\t'))
|
||||
lpszText++;
|
||||
|
||||
if (*lpszText != _T('\0'))
|
||||
return FALSE; // not terminated properly
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL DDX_Float(UINT nID, float& nVal, BOOL bSave, BOOL bValidate = FALSE, float nMin = 0.F, float nMax = 0.F, int nPrecision = FLT_DIG)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
BOOL bSuccess = TRUE;
|
||||
const int cchBuff = 32;
|
||||
TCHAR szBuff[cchBuff] = { 0 };
|
||||
|
||||
if(bSave)
|
||||
{
|
||||
pT->GetDlgItemText(nID, szBuff, cchBuff);
|
||||
double d = 0;
|
||||
if(_AtlSimpleFloatParse(szBuff, d))
|
||||
nVal = (float)d;
|
||||
else
|
||||
bSuccess = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ATLASSERT(!bValidate || nVal >= nMin && nVal <= nMax);
|
||||
SecureHelper::sprintf_x(szBuff, cchBuff, _T("%.*g"), nPrecision, nVal);
|
||||
bSuccess = pT->SetDlgItemText(nID, szBuff);
|
||||
}
|
||||
|
||||
if(!bSuccess)
|
||||
{
|
||||
pT->OnDataExchangeError(nID, bSave);
|
||||
}
|
||||
else if(bSave && bValidate) // validation
|
||||
{
|
||||
ATLASSERT(nMin != nMax);
|
||||
if(nVal < nMin || nVal > nMax)
|
||||
{
|
||||
_XData data = { ddxDataFloat };
|
||||
data.floatData.nVal = (double)nVal;
|
||||
data.floatData.nMin = (double)nMin;
|
||||
data.floatData.nMax = (double)nMax;
|
||||
pT->OnDataValidateError(nID, bSave, data);
|
||||
bSuccess = FALSE;
|
||||
}
|
||||
}
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
BOOL DDX_Float(UINT nID, double& nVal, BOOL bSave, BOOL bValidate = FALSE, double nMin = 0., double nMax = 0., int nPrecision = DBL_DIG)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
BOOL bSuccess = TRUE;
|
||||
const int cchBuff = 32;
|
||||
TCHAR szBuff[cchBuff] = { 0 };
|
||||
|
||||
if(bSave)
|
||||
{
|
||||
pT->GetDlgItemText(nID, szBuff, cchBuff);
|
||||
double d = 0;
|
||||
if(_AtlSimpleFloatParse(szBuff, d))
|
||||
nVal = d;
|
||||
else
|
||||
bSuccess = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ATLASSERT(!bValidate || nVal >= nMin && nVal <= nMax);
|
||||
SecureHelper::sprintf_x(szBuff, cchBuff, _T("%.*g"), nPrecision, nVal);
|
||||
bSuccess = pT->SetDlgItemText(nID, szBuff);
|
||||
}
|
||||
|
||||
if(!bSuccess)
|
||||
{
|
||||
pT->OnDataExchangeError(nID, bSave);
|
||||
}
|
||||
else if(bSave && bValidate) // validation
|
||||
{
|
||||
ATLASSERT(nMin != nMax);
|
||||
if(nVal < nMin || nVal > nMax)
|
||||
{
|
||||
_XData data = { ddxDataFloat };
|
||||
data.floatData.nVal = nVal;
|
||||
data.floatData.nMin = nMin;
|
||||
data.floatData.nMax = nMax;
|
||||
pT->OnDataValidateError(nID, bSave, data);
|
||||
bSuccess = FALSE;
|
||||
}
|
||||
}
|
||||
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)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
ctrl.SubclassWindow(pT->GetDlgItem(nID));
|
||||
}
|
||||
}
|
||||
|
||||
// Simple control attaching (for HWND wrapper controls)
|
||||
template <class TControl>
|
||||
void DDX_Control_Handle(UINT nID, TControl& ctrl, BOOL bSave)
|
||||
{
|
||||
if(!bSave && ctrl.m_hWnd == NULL)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
ctrl = pT->GetDlgItem(nID);
|
||||
}
|
||||
}
|
||||
|
||||
// Control state
|
||||
void DDX_Check(UINT nID, int& nValue, BOOL bSave)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
HWND hWndCtrl = pT->GetDlgItem(nID);
|
||||
if(bSave)
|
||||
{
|
||||
nValue = (int)::SendMessage(hWndCtrl, BM_GETCHECK, 0, 0L);
|
||||
ATLASSERT(nValue >= 0 && nValue <= 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
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
|
||||
}
|
||||
::SendMessage(hWndCtrl, BM_SETCHECK, nValue, 0L);
|
||||
}
|
||||
}
|
||||
|
||||
// variant that supports bool (checked/not-checked, no intermediate state)
|
||||
void DDX_Check(UINT nID, bool& bCheck, BOOL bSave)
|
||||
{
|
||||
int nValue = bCheck ? 1 : 0;
|
||||
DDX_Check(nID, nValue, bSave);
|
||||
|
||||
if(bSave)
|
||||
{
|
||||
if(nValue == 2)
|
||||
ATLTRACE2(atlTraceUI, 0, _T("ATL: Warning - checkbox state (%d) out of supported range.\n"), nValue);
|
||||
bCheck = (nValue == 1);
|
||||
}
|
||||
}
|
||||
|
||||
void DDX_Radio(UINT nID, int& nValue, BOOL bSave)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
HWND hWndCtrl = pT->GetDlgItem(nID);
|
||||
ATLASSERT(hWndCtrl != NULL);
|
||||
|
||||
// must be first in a group of auto radio buttons
|
||||
ATLASSERT(::GetWindowLong(hWndCtrl, GWL_STYLE) & WS_GROUP);
|
||||
ATLASSERT(::SendMessage(hWndCtrl, WM_GETDLGCODE, 0, 0L) & DLGC_RADIOBUTTON);
|
||||
|
||||
if(bSave)
|
||||
nValue = -1; // value if none found
|
||||
|
||||
// walk all children in group
|
||||
int nButton = 0;
|
||||
do
|
||||
{
|
||||
if(::SendMessage(hWndCtrl, WM_GETDLGCODE, 0, 0L) & DLGC_RADIOBUTTON)
|
||||
{
|
||||
// control in group is a radio button
|
||||
if(bSave)
|
||||
{
|
||||
if(::SendMessage(hWndCtrl, BM_GETCHECK, 0, 0L) != 0)
|
||||
{
|
||||
ATLASSERT(nValue == -1); // only set once
|
||||
nValue = nButton;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// select button
|
||||
::SendMessage(hWndCtrl, BM_SETCHECK, (nButton == nValue), 0L);
|
||||
}
|
||||
nButton++;
|
||||
}
|
||||
else
|
||||
{
|
||||
ATLTRACE2(atlTraceUI, 0, _T("ATL: Warning - skipping non-radio button in group.\n"));
|
||||
}
|
||||
hWndCtrl = ::GetWindow(hWndCtrl, GW_HWNDNEXT);
|
||||
}
|
||||
while (hWndCtrl != NULL && !(GetWindowLong(hWndCtrl, GWL_STYLE) & WS_GROUP));
|
||||
}
|
||||
|
||||
// Overrideables
|
||||
void OnDataExchangeError(UINT nCtrlID, BOOL /*bSave*/)
|
||||
{
|
||||
// Override to display an error message
|
||||
::MessageBeep((UINT)-1);
|
||||
T* pT = static_cast<T*>(this);
|
||||
::SetFocus(pT->GetDlgItem(nCtrlID));
|
||||
}
|
||||
|
||||
void OnDataValidateError(UINT nCtrlID, BOOL /*bSave*/, _XData& /*data*/)
|
||||
{
|
||||
// Override to display an error message
|
||||
::MessageBeep((UINT)-1);
|
||||
T* pT = static_cast<T*>(this);
|
||||
::SetFocus(pT->GetDlgItem(nCtrlID));
|
||||
}
|
||||
};
|
||||
|
||||
}; // namespace WTL
|
||||
|
||||
#endif // __ATLDDX_H__
|
6212
Externals/WTL80/atldlgs.h
vendored
6212
Externals/WTL80/atldlgs.h
vendored
File diff suppressed because it is too large
Load Diff
1036
Externals/WTL80/atlfind.h
vendored
1036
Externals/WTL80/atlfind.h
vendored
File diff suppressed because it is too large
Load Diff
3465
Externals/WTL80/atlframe.h
vendored
3465
Externals/WTL80/atlframe.h
vendored
File diff suppressed because it is too large
Load Diff
3850
Externals/WTL80/atlgdi.h
vendored
3850
Externals/WTL80/atlgdi.h
vendored
File diff suppressed because it is too large
Load Diff
4021
Externals/WTL80/atlmisc.h
vendored
4021
Externals/WTL80/atlmisc.h
vendored
File diff suppressed because it is too large
Load Diff
1113
Externals/WTL80/atlprint.h
vendored
1113
Externals/WTL80/atlprint.h
vendored
File diff suppressed because it is too large
Load Diff
262
Externals/WTL80/atlres.h
vendored
262
Externals/WTL80/atlres.h
vendored
@ -1,262 +0,0 @@
|
||||
// Windows Template Library - WTL version 8.0
|
||||
// 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/osi3.0/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 __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
|
||||
|
||||
#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
|
||||
|
||||
#include <winresrc.h>
|
||||
|
||||
// operation messages sent to DLGINIT
|
||||
#define LB_ADDSTRING (WM_USER+1)
|
||||
#define CB_ADDSTRING (WM_USER+3)
|
||||
#endif // !_WIN32_WCE
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#undef APSTUDIO_HIDDEN_SYMBOLS
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#ifdef IDC_STATIC
|
||||
#undef IDC_STATIC
|
||||
#endif // IDC_STATIC
|
||||
#define IDC_STATIC (-1)
|
||||
|
||||
#endif // !_INC_WINDOWS
|
||||
#endif // RC_INVOKED
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#define APSTUDIO_HIDDEN_SYMBOLS
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// ATL resource types
|
||||
|
||||
#ifndef RC_INVOKED
|
||||
#define RT_DLGINIT MAKEINTRESOURCE(240)
|
||||
#define RT_TOOLBAR MAKEINTRESOURCE(241)
|
||||
#endif // RC_INVOKED
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#undef APSTUDIO_HIDDEN_SYMBOLS
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Standard window components
|
||||
|
||||
#define ID_SEPARATOR 0 // special separator value
|
||||
#define ID_DEFAULT_PANE 0 // default status bar pane
|
||||
|
||||
#ifndef RC_INVOKED // code only
|
||||
// standard control bars (IDW = window ID)
|
||||
#define ATL_IDW_TOOLBAR 0xE800 // main Toolbar for window
|
||||
#define ATL_IDW_STATUS_BAR 0xE801 // Status bar window
|
||||
#define ATL_IDW_COMMAND_BAR 0xE802 // Command bar window
|
||||
|
||||
// parts of a frame window
|
||||
#define ATL_IDW_CLIENT 0xE900
|
||||
#define ATL_IDW_PANE_FIRST 0xE900 // first pane (256 max)
|
||||
#define ATL_IDW_PANE_LAST 0xE9FF
|
||||
#define ATL_IDW_HSCROLL_FIRST 0xEA00 // first Horz scrollbar (16 max)
|
||||
#define ATL_IDW_VSCROLL_FIRST 0xEA10 // first Vert scrollbar (16 max)
|
||||
|
||||
#define ATL_IDW_SIZE_BOX 0xEA20 // size box for splitters
|
||||
#define ATL_IDW_PANE_SAVE 0xEA21 // to shift ATL_IDW_PANE_FIRST
|
||||
|
||||
// bands for a rebar
|
||||
#define ATL_IDW_BAND_FIRST 0xEB00
|
||||
#define ATL_IDW_BAND_LAST 0xEBFF
|
||||
#endif // !RC_INVOKED
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Standard Commands
|
||||
|
||||
// File commands
|
||||
#define ID_FILE_NEW 0xE100
|
||||
#define ID_FILE_OPEN 0xE101
|
||||
#define ID_FILE_CLOSE 0xE102
|
||||
#define ID_FILE_SAVE 0xE103
|
||||
#define ID_FILE_SAVE_AS 0xE104
|
||||
#define ID_FILE_PAGE_SETUP 0xE105
|
||||
#define ID_FILE_PRINT_SETUP 0xE106
|
||||
#define ID_FILE_PRINT 0xE107
|
||||
#define ID_FILE_PRINT_DIRECT 0xE108
|
||||
#define ID_FILE_PRINT_PREVIEW 0xE109
|
||||
#define ID_FILE_UPDATE 0xE10A
|
||||
#define ID_FILE_SAVE_COPY_AS 0xE10B
|
||||
#define ID_FILE_SEND_MAIL 0xE10C
|
||||
|
||||
#define ID_FILE_MRU_FIRST 0xE110
|
||||
#define ID_FILE_MRU_FILE1 0xE110 // range - 16 max
|
||||
#define ID_FILE_MRU_FILE2 0xE111
|
||||
#define ID_FILE_MRU_FILE3 0xE112
|
||||
#define ID_FILE_MRU_FILE4 0xE113
|
||||
#define ID_FILE_MRU_FILE5 0xE114
|
||||
#define ID_FILE_MRU_FILE6 0xE115
|
||||
#define ID_FILE_MRU_FILE7 0xE116
|
||||
#define ID_FILE_MRU_FILE8 0xE117
|
||||
#define ID_FILE_MRU_FILE9 0xE118
|
||||
#define ID_FILE_MRU_FILE10 0xE119
|
||||
#define ID_FILE_MRU_FILE11 0xE11A
|
||||
#define ID_FILE_MRU_FILE12 0xE11B
|
||||
#define ID_FILE_MRU_FILE13 0xE11C
|
||||
#define ID_FILE_MRU_FILE14 0xE11D
|
||||
#define ID_FILE_MRU_FILE15 0xE11E
|
||||
#define ID_FILE_MRU_FILE16 0xE11F
|
||||
#define ID_FILE_MRU_LAST 0xE11F
|
||||
|
||||
// Edit commands
|
||||
#define ID_EDIT_CLEAR 0xE120
|
||||
#define ID_EDIT_CLEAR_ALL 0xE121
|
||||
#define ID_EDIT_COPY 0xE122
|
||||
#define ID_EDIT_CUT 0xE123
|
||||
#define ID_EDIT_FIND 0xE124
|
||||
#define ID_EDIT_PASTE 0xE125
|
||||
#define ID_EDIT_PASTE_LINK 0xE126
|
||||
#define ID_EDIT_PASTE_SPECIAL 0xE127
|
||||
#define ID_EDIT_REPEAT 0xE128
|
||||
#define ID_EDIT_REPLACE 0xE129
|
||||
#define ID_EDIT_SELECT_ALL 0xE12A
|
||||
#define ID_EDIT_UNDO 0xE12B
|
||||
#define ID_EDIT_REDO 0xE12C
|
||||
|
||||
// Window commands
|
||||
#define ID_WINDOW_NEW 0xE130
|
||||
#define ID_WINDOW_ARRANGE 0xE131
|
||||
#define ID_WINDOW_CASCADE 0xE132
|
||||
#define ID_WINDOW_TILE_HORZ 0xE133
|
||||
#define ID_WINDOW_TILE_VERT 0xE134
|
||||
#define ID_WINDOW_SPLIT 0xE135
|
||||
#ifndef RC_INVOKED // code only
|
||||
#define ATL_IDM_WINDOW_FIRST 0xE130
|
||||
#define ATL_IDM_WINDOW_LAST 0xE13F
|
||||
#define ATL_IDM_FIRST_MDICHILD 0xFF00 // window list starts here
|
||||
#define ATL_IDM_LAST_MDICHILD 0xFFFD
|
||||
#endif // !RC_INVOKED
|
||||
// TabView
|
||||
#define ID_WINDOW_TABFIRST 0xFF00 // = ATL_IDM_FIRST_MDICHILD
|
||||
#define ID_WINDOW_TABLAST 0xFFFD
|
||||
#define ID_WINDOW_SHOWTABLIST 0xFFFE
|
||||
|
||||
// Help and App commands
|
||||
#define ID_APP_ABOUT 0xE140
|
||||
#define ID_APP_EXIT 0xE141
|
||||
#define ID_HELP_INDEX 0xE142
|
||||
#define ID_HELP_FINDER 0xE143
|
||||
#define ID_HELP_USING 0xE144
|
||||
#define ID_CONTEXT_HELP 0xE145 // shift-F1
|
||||
// special commands for processing help
|
||||
#define ID_HELP 0xE146 // first attempt for F1
|
||||
#define ID_DEFAULT_HELP 0xE147 // last attempt
|
||||
|
||||
// Misc
|
||||
#define ID_NEXT_PANE 0xE150
|
||||
#define ID_PREV_PANE 0xE151
|
||||
#define ID_PANE_CLOSE 0xE152
|
||||
|
||||
// Format
|
||||
#define ID_FORMAT_FONT 0xE160
|
||||
|
||||
// Scroll
|
||||
#define ID_SCROLL_UP 0xE170
|
||||
#define ID_SCROLL_DOWN 0xE171
|
||||
#define ID_SCROLL_PAGE_UP 0xE172
|
||||
#define ID_SCROLL_PAGE_DOWN 0xE173
|
||||
#define ID_SCROLL_TOP 0xE174
|
||||
#define ID_SCROLL_BOTTOM 0xE175
|
||||
#define ID_SCROLL_LEFT 0xE176
|
||||
#define ID_SCROLL_RIGHT 0xE177
|
||||
#define ID_SCROLL_PAGE_LEFT 0xE178
|
||||
#define ID_SCROLL_PAGE_RIGHT 0xE179
|
||||
#define ID_SCROLL_ALL_LEFT 0xE17A
|
||||
#define ID_SCROLL_ALL_RIGHT 0xE17B
|
||||
|
||||
// OLE commands
|
||||
#define ID_OLE_INSERT_NEW 0xE200
|
||||
#define ID_OLE_EDIT_LINKS 0xE201
|
||||
#define ID_OLE_EDIT_CONVERT 0xE202
|
||||
#define ID_OLE_EDIT_CHANGE_ICON 0xE203
|
||||
#define ID_OLE_EDIT_PROPERTIES 0xE204
|
||||
#define ID_OLE_VERB_FIRST 0xE210 // range - 16 max
|
||||
#ifndef RC_INVOKED // code only
|
||||
#define ID_OLE_VERB_LAST 0xE21F
|
||||
#endif // !RC_INVOKED
|
||||
|
||||
// View commands (same number used as IDW used for toolbar and status bar)
|
||||
#define ID_VIEW_TOOLBAR 0xE800
|
||||
#define ID_VIEW_STATUS_BAR 0xE801
|
||||
#define ID_VIEW_REFRESH 0xE803
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Standard control IDs
|
||||
|
||||
#ifdef IDC_STATIC
|
||||
#undef IDC_STATIC
|
||||
#endif // IDC_STATIC
|
||||
#define IDC_STATIC (-1) // all static controls
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Standard string error/warnings
|
||||
|
||||
// idle status bar message
|
||||
#define ATL_IDS_IDLEMESSAGE 0xE001
|
||||
|
||||
#ifndef RC_INVOKED // code only
|
||||
#define ATL_IDS_SCFIRST 0xEF00
|
||||
#endif // !RC_INVOKED
|
||||
|
||||
#define ATL_IDS_SCSIZE 0xEF00
|
||||
#define ATL_IDS_SCMOVE 0xEF01
|
||||
#define ATL_IDS_SCMINIMIZE 0xEF02
|
||||
#define ATL_IDS_SCMAXIMIZE 0xEF03
|
||||
#define ATL_IDS_SCNEXTWINDOW 0xEF04
|
||||
#define ATL_IDS_SCPREVWINDOW 0xEF05
|
||||
#define ATL_IDS_SCCLOSE 0xEF06
|
||||
#define ATL_IDS_SCRESTORE 0xEF12
|
||||
#define ATL_IDS_SCTASKLIST 0xEF13
|
||||
|
||||
#define ATL_IDS_MDICHILD 0xEF1F
|
||||
#define ATL_IDS_MRU_FILE 0xEFDA
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Misc. control IDs
|
||||
|
||||
// Property Sheet control id's (determined with Spy++)
|
||||
#define ID_APPLY_NOW 0x3021
|
||||
#define ID_WIZBACK 0x3023
|
||||
#define ID_WIZNEXT 0x3024
|
||||
#define ID_WIZFINISH 0x3025
|
||||
#define ATL_IDC_TAB_CONTROL 0x3020
|
||||
|
||||
#endif // __ATLRES_H__
|
93
Externals/WTL80/atlresce.h
vendored
93
Externals/WTL80/atlresce.h
vendored
@ -1,93 +0,0 @@
|
||||
// Windows Template Library - WTL version 8.0
|
||||
// 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/osi3.0/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__
|
2015
Externals/WTL80/atlscrl.h
vendored
2015
Externals/WTL80/atlscrl.h
vendored
File diff suppressed because it is too large
Load Diff
892
Externals/WTL80/atlsplit.h
vendored
892
Externals/WTL80/atlsplit.h
vendored
@ -1,892 +0,0 @@
|
||||
// Windows Template Library - WTL version 8.0
|
||||
// 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/osi3.0/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 __ATLSPLIT_H__
|
||||
#define __ATLSPLIT_H__
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error ATL requires C++ compilation (use a .cpp suffix)
|
||||
#endif
|
||||
|
||||
#ifndef __ATLAPP_H__
|
||||
#error atlsplit.h requires atlapp.h to be included first
|
||||
#endif
|
||||
|
||||
#ifndef __ATLWIN_H__
|
||||
#error atlsplit.h requires atlwin.h to be included first
|
||||
#endif
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Classes in this file:
|
||||
//
|
||||
// CSplitterImpl<T, t_bVertical>
|
||||
// CSplitterWindowImpl<T, t_bVertical, TBase, TWinTraits>
|
||||
// CSplitterWindowT<t_bVertical>
|
||||
|
||||
|
||||
namespace WTL
|
||||
{
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// CSplitterImpl - Provides splitter support to any window
|
||||
|
||||
// Splitter panes constants
|
||||
#define SPLIT_PANE_LEFT 0
|
||||
#define SPLIT_PANE_RIGHT 1
|
||||
#define SPLIT_PANE_TOP SPLIT_PANE_LEFT
|
||||
#define SPLIT_PANE_BOTTOM SPLIT_PANE_RIGHT
|
||||
#define SPLIT_PANE_NONE -1
|
||||
|
||||
// Splitter extended styles
|
||||
#define SPLIT_PROPORTIONAL 0x00000001
|
||||
#define SPLIT_NONINTERACTIVE 0x00000002
|
||||
#define SPLIT_RIGHTALIGNED 0x00000004
|
||||
#define SPLIT_BOTTOMALIGNED SPLIT_RIGHTALIGNED
|
||||
|
||||
// Note: SPLIT_PROPORTIONAL and SPLIT_RIGHTALIGNED/SPLIT_BOTTOMALIGNED are
|
||||
// mutually exclusive. If both are set, splitter defaults to SPLIT_PROPORTIONAL
|
||||
|
||||
|
||||
template <class T, bool t_bVertical = true>
|
||||
class CSplitterImpl
|
||||
{
|
||||
public:
|
||||
enum { m_nPanesCount = 2, m_nPropMax = 10000 };
|
||||
|
||||
HWND m_hWndPane[m_nPanesCount];
|
||||
RECT m_rcSplitter;
|
||||
int m_xySplitterPos;
|
||||
int m_nDefActivePane;
|
||||
int m_cxySplitBar; // splitter bar width/height
|
||||
static HCURSOR m_hCursor;
|
||||
int m_cxyMin; // minimum pane size
|
||||
int m_cxyBarEdge; // splitter bar edge
|
||||
bool m_bFullDrag;
|
||||
int m_cxyDragOffset;
|
||||
int m_nProportionalPos;
|
||||
bool m_bUpdateProportionalPos;
|
||||
DWORD m_dwExtendedStyle; // splitter specific extended styles
|
||||
int m_nSinglePane; // single pane mode
|
||||
|
||||
// Constructor
|
||||
CSplitterImpl() :
|
||||
m_xySplitterPos(-1), m_nDefActivePane(SPLIT_PANE_NONE),
|
||||
m_cxySplitBar(0), 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_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
|
||||
void SetSplitterRect(LPRECT lpRect = NULL, bool bUpdate = true)
|
||||
{
|
||||
if(lpRect == NULL)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
pT->GetClientRect(&m_rcSplitter);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_rcSplitter = *lpRect;
|
||||
}
|
||||
|
||||
if(IsProportional())
|
||||
UpdateProportionalPos();
|
||||
else if(IsRightAligned())
|
||||
UpdateRightAlignPos();
|
||||
|
||||
if(bUpdate)
|
||||
UpdateSplitterLayout();
|
||||
}
|
||||
|
||||
void GetSplitterRect(LPRECT lpRect) const
|
||||
{
|
||||
ATLASSERT(lpRect != NULL);
|
||||
*lpRect = m_rcSplitter;
|
||||
}
|
||||
|
||||
bool SetSplitterPos(int xyPos = -1, bool bUpdate = true)
|
||||
{
|
||||
if(xyPos == -1) // -1 == middle
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
// Adjust if out of valid range
|
||||
int cxyMax = 0;
|
||||
if(t_bVertical)
|
||||
cxyMax = m_rcSplitter.right - m_rcSplitter.left;
|
||||
else
|
||||
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;
|
||||
|
||||
// Set new position and update if requested
|
||||
bool bRet = (m_xySplitterPos != xyPos);
|
||||
m_xySplitterPos = xyPos;
|
||||
|
||||
if(m_bUpdateProportionalPos)
|
||||
{
|
||||
if(IsProportional())
|
||||
StoreProportionalPos();
|
||||
else if(IsRightAligned())
|
||||
StoreRightAlignPos();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bUpdateProportionalPos = true;
|
||||
}
|
||||
|
||||
if(bUpdate && bRet)
|
||||
UpdateSplitterLayout();
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
void SetSplitterPosPct(int nPct, bool bUpdate = true)
|
||||
{
|
||||
ATLASSERT(nPct >= 0 && nPct <= 100);
|
||||
|
||||
m_nProportionalPos = ::MulDiv(nPct, m_nPropMax, 100);
|
||||
UpdateProportionalPos();
|
||||
|
||||
if(bUpdate)
|
||||
UpdateSplitterLayout();
|
||||
}
|
||||
|
||||
int GetSplitterPos() const
|
||||
{
|
||||
return m_xySplitterPos;
|
||||
}
|
||||
|
||||
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))
|
||||
return false;
|
||||
|
||||
if(nPane != SPLIT_PANE_NONE)
|
||||
{
|
||||
if(!::IsWindowVisible(m_hWndPane[nPane]))
|
||||
::ShowWindow(m_hWndPane[nPane], SW_SHOW);
|
||||
int nOtherPane = (nPane == SPLIT_PANE_LEFT) ? SPLIT_PANE_RIGHT : SPLIT_PANE_LEFT;
|
||||
::ShowWindow(m_hWndPane[nOtherPane], SW_HIDE);
|
||||
if(m_nDefActivePane != nPane)
|
||||
m_nDefActivePane = nPane;
|
||||
}
|
||||
else if(m_nSinglePane != SPLIT_PANE_NONE)
|
||||
{
|
||||
int nOtherPane = (m_nSinglePane == SPLIT_PANE_LEFT) ? SPLIT_PANE_RIGHT : SPLIT_PANE_LEFT;
|
||||
::ShowWindow(m_hWndPane[nOtherPane], SW_SHOW);
|
||||
}
|
||||
|
||||
m_nSinglePane = nPane;
|
||||
UpdateSplitterLayout();
|
||||
return true;
|
||||
}
|
||||
|
||||
int GetSinglePaneMode() const
|
||||
{
|
||||
return m_nSinglePane;
|
||||
}
|
||||
|
||||
DWORD GetSplitterExtendedStyle() const
|
||||
{
|
||||
return m_dwExtendedStyle;
|
||||
}
|
||||
|
||||
DWORD SetSplitterExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0)
|
||||
{
|
||||
DWORD dwPrevStyle = m_dwExtendedStyle;
|
||||
if(dwMask == 0)
|
||||
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;
|
||||
}
|
||||
|
||||
// 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]);
|
||||
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)
|
||||
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]);
|
||||
if(bUpdate)
|
||||
UpdateSplitterLayout();
|
||||
return true;
|
||||
}
|
||||
|
||||
HWND GetSplitterPane(int nPane) const
|
||||
{
|
||||
ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT);
|
||||
|
||||
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);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
int GetActivePane() const
|
||||
{
|
||||
int nRet = SPLIT_PANE_NONE;
|
||||
HWND hWndFocus = ::GetFocus();
|
||||
if(hWndFocus != NULL)
|
||||
{
|
||||
for(int nPane = 0; nPane < m_nPanesCount; nPane++)
|
||||
{
|
||||
if(hWndFocus == m_hWndPane[nPane] || ::IsChild(m_hWndPane[nPane], hWndFocus))
|
||||
{
|
||||
nRet = nPane;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return nRet;
|
||||
}
|
||||
|
||||
bool ActivateNextPane(bool bNext = true)
|
||||
{
|
||||
int nPane = m_nSinglePane;
|
||||
if(nPane == SPLIT_PANE_NONE)
|
||||
{
|
||||
switch(GetActivePane())
|
||||
{
|
||||
case SPLIT_PANE_LEFT:
|
||||
nPane = SPLIT_PANE_RIGHT;
|
||||
break;
|
||||
case SPLIT_PANE_RIGHT:
|
||||
nPane = SPLIT_PANE_LEFT;
|
||||
break;
|
||||
default:
|
||||
nPane = bNext ? SPLIT_PANE_LEFT : SPLIT_PANE_RIGHT;
|
||||
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)
|
||||
return false;
|
||||
m_nDefActivePane = nPane;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SetDefaultActivePane(HWND hWnd)
|
||||
{
|
||||
for(int nPane = 0; nPane < m_nPanesCount; nPane++)
|
||||
{
|
||||
if(hWnd == m_hWndPane[nPane])
|
||||
{
|
||||
m_nDefActivePane = nPane;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false; // not found
|
||||
}
|
||||
|
||||
int GetDefaultActivePane() const
|
||||
{
|
||||
return m_nDefActivePane;
|
||||
}
|
||||
|
||||
void DrawSplitter(CDCHandle dc)
|
||||
{
|
||||
ATLASSERT(dc.m_hDC != NULL);
|
||||
if(m_nSinglePane == SPLIT_PANE_NONE && m_xySplitterPos == -1)
|
||||
return;
|
||||
|
||||
T* pT = static_cast<T*>(this);
|
||||
if(m_nSinglePane == SPLIT_PANE_NONE)
|
||||
{
|
||||
pT->DrawSplitterBar(dc);
|
||||
|
||||
for(int nPane = 0; nPane < m_nPanesCount; nPane++)
|
||||
{
|
||||
if(m_hWndPane[nPane] == NULL)
|
||||
pT->DrawSplitterPane(dc, nPane);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(m_hWndPane[m_nSinglePane] == NULL)
|
||||
pT->DrawSplitterPane(dc, m_nSinglePane);
|
||||
}
|
||||
}
|
||||
|
||||
// Overrideables
|
||||
void DrawSplitterBar(CDCHandle dc)
|
||||
{
|
||||
RECT rect;
|
||||
if(GetSplitterBarRect(&rect))
|
||||
{
|
||||
dc.FillRect(&rect, COLOR_3DFACE);
|
||||
// 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));
|
||||
}
|
||||
}
|
||||
|
||||
// called only if pane is empty
|
||||
void DrawSplitterPane(CDCHandle dc, int nPane)
|
||||
{
|
||||
RECT rect;
|
||||
if(GetSplitterPaneRect(nPane, &rect))
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
if((pT->GetExStyle() & WS_EX_CLIENTEDGE) == 0)
|
||||
dc.DrawEdge(&rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
|
||||
dc.FillRect(&rect, COLOR_APPWORKSPACE);
|
||||
}
|
||||
}
|
||||
|
||||
// Message map and handlers
|
||||
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)
|
||||
MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove)
|
||||
MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
|
||||
MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp)
|
||||
MESSAGE_HANDLER(WM_LBUTTONDBLCLK, OnLButtonDoubleClick)
|
||||
MESSAGE_HANDLER(WM_CAPTURECHANGED, OnCaptureChanged)
|
||||
}
|
||||
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)
|
||||
{
|
||||
GetSystemSettings(false);
|
||||
bHandled = FALSE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
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)
|
||||
pT->SetSplitterPos();
|
||||
// do painting
|
||||
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)
|
||||
{
|
||||
DWORD dwPos = ::GetMessagePos();
|
||||
POINT ptPos = { GET_X_LPARAM(dwPos), GET_Y_LPARAM(dwPos) };
|
||||
pT->ScreenToClient(&ptPos);
|
||||
if(IsOverSplitterBar(ptPos.x, ptPos.y))
|
||||
return 1;
|
||||
}
|
||||
|
||||
bHandled = FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
int xyNewSplitPos = 0;
|
||||
if(t_bVertical)
|
||||
xyNewSplitPos = xPos - m_rcSplitter.left - m_cxyDragOffset;
|
||||
else
|
||||
xyNewSplitPos = yPos - m_rcSplitter.top - m_cxyDragOffset;
|
||||
|
||||
if(xyNewSplitPos == -1) // avoid -1, that means middle
|
||||
xyNewSplitPos = -2;
|
||||
|
||||
if(m_xySplitterPos != xyNewSplitPos)
|
||||
{
|
||||
if(m_bFullDrag)
|
||||
{
|
||||
if(pT->SetSplitterPos(xyNewSplitPos, true))
|
||||
pT->UpdateWindow();
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawGhostBar();
|
||||
pT->SetSplitterPos(xyNewSplitPos, false);
|
||||
DrawGhostBar();
|
||||
}
|
||||
}
|
||||
}
|
||||
else // not dragging, just set cursor
|
||||
{
|
||||
if(IsOverSplitterBar(xPos, yPos))
|
||||
::SetCursor(m_hCursor);
|
||||
bHandled = FALSE;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT OnLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
int xPos = GET_X_LPARAM(lParam);
|
||||
int yPos = GET_Y_LPARAM(lParam);
|
||||
if(IsOverSplitterBar(xPos, yPos))
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
pT->SetCapture();
|
||||
::SetCursor(m_hCursor);
|
||||
if(!m_bFullDrag)
|
||||
DrawGhostBar();
|
||||
if(t_bVertical)
|
||||
m_cxyDragOffset = xPos - m_rcSplitter.left - m_xySplitterPos;
|
||||
else
|
||||
m_cxyDragOffset = yPos - m_rcSplitter.top - m_xySplitterPos;
|
||||
}
|
||||
bHandled = FALSE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
LRESULT OnLButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
|
||||
{
|
||||
::ReleaseCapture();
|
||||
bHandled = FALSE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
LRESULT OnLButtonDoubleClick(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
pT->SetSplitterPos(); // middle
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT OnCaptureChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
if(!m_bFullDrag)
|
||||
{
|
||||
DrawGhostBar();
|
||||
UpdateSplitterLayout();
|
||||
T* pT = static_cast<T*>(this);
|
||||
pT->UpdateWindow();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT OnSetFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM, BOOL& bHandled)
|
||||
{
|
||||
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)
|
||||
{
|
||||
DWORD dwPos = ::GetMessagePos();
|
||||
POINT pt = { GET_X_LPARAM(dwPos), GET_Y_LPARAM(dwPos) };
|
||||
pT->ScreenToClient(&pt);
|
||||
RECT rcPane;
|
||||
for(int nPane = 0; nPane < m_nPanesCount; nPane++)
|
||||
{
|
||||
if(GetSplitterPaneRect(nPane, &rcPane) && ::PtInRect(&rcPane, pt))
|
||||
{
|
||||
m_nDefActivePane = nPane;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return lRet;
|
||||
}
|
||||
#endif // !_WIN32_WCE
|
||||
|
||||
LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
GetSystemSettings(true);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Implementation - internal helpers
|
||||
void UpdateSplitterLayout()
|
||||
{
|
||||
if(m_nSinglePane == SPLIT_PANE_NONE && m_xySplitterPos == -1)
|
||||
return;
|
||||
|
||||
T* pT = static_cast<T*>(this);
|
||||
RECT rect = { 0, 0, 0, 0 };
|
||||
if(m_nSinglePane == SPLIT_PANE_NONE)
|
||||
{
|
||||
if(GetSplitterBarRect(&rect))
|
||||
pT->InvalidateRect(&rect);
|
||||
|
||||
for(int nPane = 0; nPane < m_nPanesCount; nPane++)
|
||||
{
|
||||
if(GetSplitterPaneRect(nPane, &rect))
|
||||
{
|
||||
if(m_hWndPane[nPane] != NULL)
|
||||
::SetWindowPos(m_hWndPane[nPane], NULL, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER);
|
||||
else
|
||||
pT->InvalidateRect(&rect);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(GetSplitterPaneRect(m_nSinglePane, &rect))
|
||||
{
|
||||
if(m_hWndPane[m_nSinglePane] != NULL)
|
||||
::SetWindowPos(m_hWndPane[m_nSinglePane], NULL, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER);
|
||||
else
|
||||
pT->InvalidateRect(&rect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool GetSplitterBarRect(LPRECT lpRect) const
|
||||
{
|
||||
ATLASSERT(lpRect != NULL);
|
||||
if(m_nSinglePane != SPLIT_PANE_NONE || m_xySplitterPos == -1)
|
||||
return false;
|
||||
|
||||
if(t_bVertical)
|
||||
{
|
||||
lpRect->left = m_rcSplitter.left + m_xySplitterPos;
|
||||
lpRect->top = m_rcSplitter.top;
|
||||
lpRect->right = m_rcSplitter.left + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge;
|
||||
lpRect->bottom = m_rcSplitter.bottom;
|
||||
}
|
||||
else
|
||||
{
|
||||
lpRect->left = m_rcSplitter.left;
|
||||
lpRect->top = m_rcSplitter.top + m_xySplitterPos;
|
||||
lpRect->right = m_rcSplitter.right;
|
||||
lpRect->bottom = m_rcSplitter.top + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GetSplitterPaneRect(int nPane, LPRECT lpRect) const
|
||||
{
|
||||
ATLASSERT(nPane == SPLIT_PANE_LEFT || nPane == SPLIT_PANE_RIGHT);
|
||||
ATLASSERT(lpRect != NULL);
|
||||
bool bRet = true;
|
||||
if(m_nSinglePane != SPLIT_PANE_NONE)
|
||||
{
|
||||
if(nPane == m_nSinglePane)
|
||||
*lpRect = m_rcSplitter;
|
||||
else
|
||||
bRet = false;
|
||||
}
|
||||
else if(nPane == SPLIT_PANE_LEFT)
|
||||
{
|
||||
if(t_bVertical)
|
||||
{
|
||||
lpRect->left = m_rcSplitter.left;
|
||||
lpRect->top = m_rcSplitter.top;
|
||||
lpRect->right = m_rcSplitter.left + m_xySplitterPos;
|
||||
lpRect->bottom = m_rcSplitter.bottom;
|
||||
}
|
||||
else
|
||||
{
|
||||
lpRect->left = m_rcSplitter.left;
|
||||
lpRect->top = m_rcSplitter.top;
|
||||
lpRect->right = m_rcSplitter.right;
|
||||
lpRect->bottom = m_rcSplitter.top + m_xySplitterPos;
|
||||
}
|
||||
}
|
||||
else if(nPane == SPLIT_PANE_RIGHT)
|
||||
{
|
||||
if(t_bVertical)
|
||||
{
|
||||
lpRect->left = m_rcSplitter.left + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge;
|
||||
lpRect->top = m_rcSplitter.top;
|
||||
lpRect->right = m_rcSplitter.right;
|
||||
lpRect->bottom = m_rcSplitter.bottom;
|
||||
}
|
||||
else
|
||||
{
|
||||
lpRect->left = m_rcSplitter.left;
|
||||
lpRect->top = m_rcSplitter.top + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge;
|
||||
lpRect->right = m_rcSplitter.right;
|
||||
lpRect->bottom = m_rcSplitter.bottom;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
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)));
|
||||
}
|
||||
|
||||
bool IsOverSplitterBar(int x, int y) const
|
||||
{
|
||||
if(m_nSinglePane != SPLIT_PANE_NONE)
|
||||
return false;
|
||||
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));
|
||||
}
|
||||
|
||||
void DrawGhostBar()
|
||||
{
|
||||
RECT rect = { 0, 0, 0, 0 };
|
||||
if(GetSplitterBarRect(&rect))
|
||||
{
|
||||
// invert the brush pattern (looks just like frame window sizing)
|
||||
T* pT = static_cast<T*>(this);
|
||||
CWindowDC dc(pT->m_hWnd);
|
||||
CBrush brush = CDCHandle::GetHalftoneBrush();
|
||||
if(brush.m_hBrush != NULL)
|
||||
{
|
||||
CBrushHandle brushOld = dc.SelectBrush(brush);
|
||||
dc.PatBlt(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, PATINVERT);
|
||||
dc.SelectBrush(brushOld);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GetSystemSettings(bool bUpdate)
|
||||
{
|
||||
#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
|
||||
|
||||
T* pT = static_cast<T*>(this);
|
||||
if((pT->GetExStyle() & WS_EX_CLIENTEDGE))
|
||||
{
|
||||
m_cxyBarEdge = 2 * ::GetSystemMetrics(t_bVertical ? SM_CXEDGE : SM_CYEDGE);
|
||||
m_cxyMin = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_cxyBarEdge = 0;
|
||||
m_cxyMin = 2 * ::GetSystemMetrics(t_bVertical ? SM_CXEDGE : SM_CYEDGE);
|
||||
}
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
::SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &m_bFullDrag, 0);
|
||||
#endif // !_WIN32_WCE
|
||||
|
||||
if(bUpdate)
|
||||
UpdateSplitterLayout();
|
||||
}
|
||||
|
||||
bool IsProportional() const
|
||||
{
|
||||
return ((m_dwExtendedStyle & SPLIT_PROPORTIONAL) != 0);
|
||||
}
|
||||
|
||||
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);
|
||||
if(cxyTotal > 0)
|
||||
m_nProportionalPos = ::MulDiv(m_xySplitterPos, m_nPropMax, cxyTotal);
|
||||
else
|
||||
m_nProportionalPos = 0;
|
||||
ATLTRACE2(atlTraceUI, 0, _T("CSplitterImpl::StoreProportionalPos - %i\n"), m_nProportionalPos);
|
||||
}
|
||||
|
||||
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);
|
||||
if(cxyTotal > 0)
|
||||
{
|
||||
int xyNewPos = ::MulDiv(m_nProportionalPos, cxyTotal, m_nPropMax);
|
||||
m_bUpdateProportionalPos = false;
|
||||
T* pT = static_cast<T*>(this);
|
||||
pT->SetSplitterPos(xyNewPos, false);
|
||||
}
|
||||
}
|
||||
|
||||
bool IsRightAligned() const
|
||||
{
|
||||
return ((m_dwExtendedStyle & SPLIT_RIGHTALIGNED) != 0);
|
||||
}
|
||||
|
||||
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);
|
||||
if(cxyTotal > 0)
|
||||
m_nProportionalPos = cxyTotal - m_xySplitterPos;
|
||||
else
|
||||
m_nProportionalPos = 0;
|
||||
ATLTRACE2(atlTraceUI, 0, _T("CSplitterImpl::StoreRightAlignPos - %i\n"), m_nProportionalPos);
|
||||
}
|
||||
|
||||
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);
|
||||
if(cxyTotal > 0)
|
||||
{
|
||||
m_bUpdateProportionalPos = false;
|
||||
T* pT = static_cast<T*>(this);
|
||||
pT->SetSplitterPos(cxyTotal - m_nProportionalPos, false);
|
||||
}
|
||||
}
|
||||
|
||||
bool IsInteractive() const
|
||||
{
|
||||
return ((m_dwExtendedStyle & SPLIT_NONINTERACTIVE) == 0);
|
||||
}
|
||||
};
|
||||
|
||||
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 >
|
||||
{
|
||||
public:
|
||||
DECLARE_WND_CLASS_EX(NULL, CS_DBLCLKS, COLOR_WINDOW)
|
||||
|
||||
typedef CSplitterImpl< T , t_bVertical > _baseClass;
|
||||
|
||||
BEGIN_MSG_MAP(CSplitterWindowImpl)
|
||||
MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground)
|
||||
MESSAGE_HANDLER(WM_SIZE, OnSize)
|
||||
CHAIN_MSG_MAP(_baseClass)
|
||||
FORWARD_NOTIFICATIONS()
|
||||
END_MSG_MAP()
|
||||
|
||||
LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
// handled, no background painting needed
|
||||
return 1;
|
||||
}
|
||||
|
||||
LRESULT OnSize(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled)
|
||||
{
|
||||
if(wParam != SIZE_MINIMIZED)
|
||||
SetSplitterRect();
|
||||
|
||||
bHandled = FALSE;
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// CSplitterWindow - Implements a splitter window to be used as is
|
||||
|
||||
template <bool t_bVertical = true>
|
||||
class CSplitterWindowT : public CSplitterWindowImpl<CSplitterWindowT<t_bVertical>, t_bVertical>
|
||||
{
|
||||
public:
|
||||
DECLARE_WND_CLASS_EX(_T("WTL_SplitterWindow"), CS_DBLCLKS, COLOR_WINDOW)
|
||||
};
|
||||
|
||||
typedef CSplitterWindowT<true> CSplitterWindow;
|
||||
typedef CSplitterWindowT<false> CHorSplitterWindow;
|
||||
|
||||
}; // namespace WTL
|
||||
|
||||
#endif // __ATLSPLIT_H__
|
1218
Externals/WTL80/atltheme.h
vendored
1218
Externals/WTL80/atltheme.h
vendored
File diff suppressed because it is too large
Load Diff
1162
Externals/WTL80/atluser.h
vendored
1162
Externals/WTL80/atluser.h
vendored
File diff suppressed because it is too large
Load Diff
3010
Externals/WTL80/atlwince.h
vendored
3010
Externals/WTL80/atlwince.h
vendored
File diff suppressed because it is too large
Load Diff
529
Externals/WTL80/atlwinx.h
vendored
529
Externals/WTL80/atlwinx.h
vendored
@ -1,529 +0,0 @@
|
||||
// Windows Template Library - WTL version 8.0
|
||||
// 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/osi3.0/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 __ATLWINX_H__
|
||||
#define __ATLWINX_H__
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error ATL requires C++ compilation (use a .cpp suffix)
|
||||
#endif
|
||||
|
||||
#ifndef __ATLAPP_H__
|
||||
#error atlwinx.h requires atlapp.h to be included first
|
||||
#endif
|
||||
|
||||
#if (_ATL_VER >= 0x0700)
|
||||
#include <atlwin.h>
|
||||
#endif // (_ATL_VER >= 0x0700)
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Classes in this file:
|
||||
//
|
||||
// _U_RECT
|
||||
// _U_MENUorID
|
||||
// _U_STRINGorID
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Command Chaining Macros
|
||||
|
||||
#define CHAIN_COMMANDS(theChainClass) \
|
||||
if(uMsg == WM_COMMAND) \
|
||||
CHAIN_MSG_MAP(theChainClass)
|
||||
|
||||
#define CHAIN_COMMANDS_ALT(theChainClass, msgMapID) \
|
||||
if(uMsg == WM_COMMAND) \
|
||||
CHAIN_MSG_MAP_ALT(theChainClass, msgMapID)
|
||||
|
||||
#define CHAIN_COMMANDS_MEMBER(theChainMember) \
|
||||
if(uMsg == WM_COMMAND) \
|
||||
CHAIN_MSG_MAP_MEMBER(theChainMember)
|
||||
|
||||
#define CHAIN_COMMANDS_ALT_MEMBER(theChainMember, msgMapID) \
|
||||
if(uMsg == WM_COMMAND) \
|
||||
CHAIN_MSG_MAP_ALT_MEMBER(theChainMember, msgMapID)
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Macros for parent message map to selectively reflect control messages
|
||||
|
||||
// NOTE: ReflectNotifications is a member of ATL's CWindowImplRoot
|
||||
// (and overridden in 2 cases - CContainedWindowT and CAxHostWindow)
|
||||
// Since we can't modify ATL, we'll provide the needed additions
|
||||
// in a separate function (that is not a member of CWindowImplRoot)
|
||||
|
||||
namespace WTL
|
||||
{
|
||||
|
||||
inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled,
|
||||
UINT uMsgFilter = WM_NULL, UINT_PTR idFromFilter = 0, HWND hWndChildFilter = NULL)
|
||||
{
|
||||
if((uMsgFilter != WM_NULL) && (uMsgFilter != uMsg))
|
||||
{
|
||||
// The notification message doesn't match the filter.
|
||||
bHandled = FALSE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
HWND hWndChild = NULL;
|
||||
UINT_PTR idFrom = 0;
|
||||
|
||||
switch(uMsg)
|
||||
{
|
||||
case WM_COMMAND:
|
||||
if(lParam != NULL) // not from a menu
|
||||
{
|
||||
hWndChild = (HWND)lParam;
|
||||
idFrom = (UINT_PTR)LOWORD(wParam);
|
||||
}
|
||||
break;
|
||||
case WM_NOTIFY:
|
||||
hWndChild = ((LPNMHDR)lParam)->hwndFrom;
|
||||
idFrom = ((LPNMHDR)lParam)->idFrom;
|
||||
break;
|
||||
#ifndef _WIN32_WCE
|
||||
case WM_PARENTNOTIFY:
|
||||
switch(LOWORD(wParam))
|
||||
{
|
||||
case WM_CREATE:
|
||||
case WM_DESTROY:
|
||||
hWndChild = (HWND)lParam;
|
||||
idFrom = (UINT_PTR)HIWORD(wParam);
|
||||
break;
|
||||
default:
|
||||
hWndChild = ::GetDlgItem(hWndParent, HIWORD(wParam));
|
||||
idFrom = (UINT_PTR)::GetDlgCtrlID(hWndChild);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#endif // !_WIN32_WCE
|
||||
case WM_DRAWITEM:
|
||||
if(wParam) // not from a menu
|
||||
{
|
||||
hWndChild = ((LPDRAWITEMSTRUCT)lParam)->hwndItem;
|
||||
idFrom = (UINT_PTR)wParam;
|
||||
}
|
||||
break;
|
||||
case WM_MEASUREITEM:
|
||||
if(wParam) // not from a menu
|
||||
{
|
||||
hWndChild = ::GetDlgItem(hWndParent, ((LPMEASUREITEMSTRUCT)lParam)->CtlID);
|
||||
idFrom = (UINT_PTR)wParam;
|
||||
}
|
||||
break;
|
||||
case WM_COMPAREITEM:
|
||||
if(wParam) // not from a menu
|
||||
{
|
||||
hWndChild = ((LPCOMPAREITEMSTRUCT)lParam)->hwndItem;
|
||||
idFrom = (UINT_PTR)wParam;
|
||||
}
|
||||
break;
|
||||
case WM_DELETEITEM:
|
||||
if(wParam) // not from a menu
|
||||
{
|
||||
hWndChild = ((LPDELETEITEMSTRUCT)lParam)->hwndItem;
|
||||
idFrom = (UINT_PTR)wParam;
|
||||
}
|
||||
break;
|
||||
case WM_VKEYTOITEM:
|
||||
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:
|
||||
case WM_CTLCOLORLISTBOX:
|
||||
case WM_CTLCOLORMSGBOX:
|
||||
case WM_CTLCOLORSCROLLBAR:
|
||||
case WM_CTLCOLORSTATIC:
|
||||
hWndChild = (HWND)lParam;
|
||||
idFrom = (UINT_PTR)::GetDlgCtrlID(hWndChild);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if((hWndChild == NULL) ||
|
||||
((hWndChildFilter != NULL) && (hWndChildFilter != hWndChild)))
|
||||
{
|
||||
// Either hWndChild isn't valid, or
|
||||
// hWndChild doesn't match the filter.
|
||||
bHandled = FALSE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if((idFromFilter != 0) && (idFromFilter != idFrom))
|
||||
{
|
||||
// The dialog control id doesn't match the filter.
|
||||
bHandled = FALSE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
ATLASSERT(::IsWindow(hWndChild));
|
||||
LRESULT lResult = ::SendMessage(hWndChild, OCM__BASE + uMsg, wParam, lParam);
|
||||
if((lResult == 0) && (uMsg >= WM_CTLCOLORMSGBOX) && (uMsg <= WM_CTLCOLORSTATIC))
|
||||
{
|
||||
// Try to prevent problems with WM_CTLCOLOR* messages when
|
||||
// the message wasn't really handled
|
||||
bHandled = FALSE;
|
||||
}
|
||||
|
||||
return lResult;
|
||||
}
|
||||
|
||||
}; // 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); \
|
||||
if((lResult == 0) && (uMsg >= WM_CTLCOLORMSGBOX) && (uMsg <= WM_CTLCOLORSTATIC)) \
|
||||
bHandled = FALSE; \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECT_NOTIFICATIONS_MSG_FILTERED(uMsgFilter) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, uMsgFilter, 0, NULL); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECT_NOTIFICATIONS_ID_FILTERED(idFromFilter) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, WM_NULL, idFromFilter, NULL); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECT_NOTIFICATIONS_HWND_FILTERED(hWndChildFilter) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, WM_NULL, 0, hWndChildFilter); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECT_NOTIFICATIONS_MSG_ID_FILTERED(uMsgFilter, idFromFilter) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, uMsgFilter, idFromFilter, NULL); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECT_NOTIFICATIONS_MSG_HWND_FILTERED(uMsgFilter, hWndChildFilter) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = WTL::WtlReflectNotificationsFiltered(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)) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECT_COMMAND_ID(id) \
|
||||
if(uMsg == WM_COMMAND && id == LOWORD(wParam)) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECT_COMMAND_CODE(code) \
|
||||
if(uMsg == WM_COMMAND && code == HIWORD(wParam)) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = 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) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = 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) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = 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) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECT_NOTIFY_ID(id) \
|
||||
if(uMsg == WM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
#define REFLECT_NOTIFY_CODE(cd) \
|
||||
if(uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = 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) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = 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) \
|
||||
{ \
|
||||
bHandled = TRUE; \
|
||||
lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \
|
||||
if(bHandled) \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Reflected message handler macros for message maps (for ATL 3.0)
|
||||
|
||||
#if (_ATL_VER < 0x0700)
|
||||
|
||||
#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; \
|
||||
}
|
||||
|
||||
#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; \
|
||||
}
|
||||
|
||||
#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)
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// 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)
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
LRESULT lResult = 0;
|
||||
switch(uMsg)
|
||||
{
|
||||
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;
|
||||
}
|
||||
return lResult;
|
||||
}
|
||||
|
||||
#endif // (_ATL_VER < 0x0700)
|
||||
|
||||
}; // namespace WTL
|
||||
|
||||
#endif // __ATLWINX_H__
|
Loading…
x
Reference in New Issue
Block a user