wrapchildtrack.cpp

来自「miXo is a buzz machine (www.buzzmachines」· C++ 代码 · 共 86 行

CPP
86
字号
// WrapChildTrack.cpp: implementation of the CWrapChildTrack class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "mixer.h"
#include "WrapChildTrack.h"
#include "TrackWin.h"
#include <assert.h>

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CWrapChildTrack::CWrapChildTrack() 
: m_hWnd(0),m_pcWin(NULL)
{

}
CWrapChildTrack::CWrapChildTrack(CTrackWin*pcWin) 
: CWrapChild(),m_pcWin(pcWin)
{
	assert(pcWin);
	m_hWnd=pcWin->GetWndHandle();
	SetName(pcWin->GetTrackName());	
}
CWrapChildTrack::~CWrapChildTrack()
{

}
void CWrapChildTrack::SetPointer(CAbWin *p) 
{ 
	m_pcWin=reinterpret_cast<CTrackWin*>(p);
}
CAbWin *CWrapChildTrack::GetPointer() const 
{ 
	return reinterpret_cast<CAbWin*>(m_pcWin); 
}

bool CWrapChildTrack::IsEqual(const CWrapChild &c) const
{
//	bool bRet=false;
	if(m_pcWin && (c.GetPointer() != NULL))
		return ((void*)m_pcWin == (void*)c.GetPointer());
	if(m_hWnd && (c.GetHandle() != 0))
		return (m_hWnd == c.GetHandle());
	const char *sz1=GetName().c_str();
	assert(strlen(sz1) > 0);
	const char *sz2=c.GetName().c_str();
	assert(strlen(sz2) > 0);
	if(strcmp(sz1,sz2) == 0)
		return true;
	return false;
}
void CWrapChildTrack::CreateChild(HWND hPar,const CWinRect &r)
{
	assert(m_pcWin);
	m_pcWin->Init(hPar);
	CWinRect cChildRect(r);
	cChildRect.Move(-r.X(),-r.Y());
	m_pcWin->SetWindowRect(cChildRect);
	m_pcWin->Create();
	m_hWnd=m_pcWin->GetWndHandle();
}
void CWrapChildTrack::SetChildData(const CWrapChild *pc)
{
	assert(pc);
	CWrapChild::SetChildData(pc);
	m_hWnd=pc->GetHandle();
	m_pcWin=reinterpret_cast<CTrackWin*>(pc->GetPointer());
}
HWND CWrapChildTrack::SetParent(HWND h)
{
	if(m_hWnd) {
		assert(m_pcWin);
//		CWrapChild::SetParent(h);
		return m_pcWin->SetParHandle(h,true);
	}
	return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?