⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wrapwin.cpp

📁 miXo is a buzz machine (www.buzzmachines.com) - a plugin for the freely available jeskola buzz track
💻 CPP
字号:
// WrapWin.cpp: implementation of the CWrapWin class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "mixer.h"
#include "WrapWin.h"

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

const CWinRect CWrapWin::scm_BtnRect(2,2,8,8);

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

CWrapWin::CWrapWin() : CAbWin(),m_pcChildWin(NULL),m_hButton(0),m_dwOldStyle(0),
	m_dwStyle(WS_VISIBLE|WS_CAPTION|WS_CHILD|WS_CLIPSIBLINGS),m_bIsMoveable(false)
{
}

CWrapWin::CWrapWin(const CWrapWin &c) : CAbWin(c),m_pcChildWin(NULL),
	m_hButton(c.m_hButton),m_dwOldStyle(c.m_dwOldStyle),
	m_dwStyle(c.m_dwStyle),m_bIsMoveable(c.m_bIsMoveable)
{
	if(c.m_pcChildWin)
		m_pcChildWin=c.m_pcChildWin->New();
}
CWrapWin::CWrapWin(const CWrapChild *pcChild,const char *szMod) 
: CAbWin(szMod),m_pcChildWin(NULL),m_hButton(0),m_dwOldStyle(0),
	m_dwStyle(WS_VISIBLE|WS_CAPTION|WS_CHILD|WS_CLIPSIBLINGS),m_bIsMoveable(false)
{
	if(pcChild)
		m_pcChildWin=pcChild->New();
}
CWrapWin::~CWrapWin()
{
	CWrapWin::DeInit();
	if(m_pcChildWin)
		delete m_pcChildWin;
}
const char *CWrapWin::GetTitle() const
{
	if(m_pcChildWin)
		return m_pcChildWin->GetChildTitle();
	else
		return "WrapWin";
}
void CWrapWin::Init(HWND hPar)
{
	assert(m_pcChildWin);
	CAbWin::Init(hPar);
}
void CWrapWin::PostCreate()
{
	assert(m_pcChildWin);
	CAbWin::PostCreate();
	if(!IsMoveable()) 
	{
		m_pcChildWin->CreateChild(GetWndHandle(),GetClientRect());
		if(m_dwOldStyle == 0) {
			m_hButton=CreateWindow("BUTTON","",WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON|BS_NOTIFY,  // styles 
				scm_BtnRect.X(),scm_BtnRect.Y(),scm_BtnRect.Wd(),scm_BtnRect.Ht(),
				GetWndHandle(),NULL,GetModule(),NULL);
		}
	}
}
void CWrapWin::DeInit()
{
	if(m_hButton)
	{
		::DestroyWindow(m_hButton);
		m_hButton=0;
	}
	CAbWin::DeInit();
}
void CWrapWin::SetChildData(const CWrapChild *pc)
{
	assert(pc);
	assert(m_pcChildWin);
	m_pcChildWin->SetChildData(pc);
	/*
	m_pcChildWin->SetHandle(m_pcChildWin->GetHandle());
	m_pcChildWin->SetPointer(m_pcChildWin->GetPointer());
	m_pcChildWin->SetName(m_pcChildWin->GetName());
	*/
}
LRESULT CWrapWin::WindowProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
	assert(GetWndHandle());
	switch(uMsg) {
	case WM_PARENTNOTIFY:
		if((LOWORD(wParam) == WM_LBUTTONDOWN) && m_hButton && (m_dwOldStyle == 0) 
			&& (!IsMoveable()) )
		{
			POINTS pt=MAKEPOINTS(lParam);
			if(scm_BtnRect.IsPtInside(pt.x,pt.y)) 
			{
//				if(MakeWindowMoveable())
//					return 1;
			}
		}
		break;
	}
	return CAbWin::WindowProc(hWnd,uMsg,wParam,lParam);
}
bool CWrapWin::MakeWindowMoveable()
{
	//TODO:Deactivate others here
	assert(m_pcChildWin);
	SetMoveable(true);
	if(m_pcChildWin->MakeChildMoveable()) {
//		m_dwOldStyle=::GetWindowLong(GetWndHandle(),GWL_STYLE);
		m_dwOldStyle=m_dwStyle;
		m_dwStyle=WS_VISIBLE|WS_CAPTION|WS_CHILD;
		m_pcChildWin->SetParent(GetParHandle());
		m_pcChildWin->ShowWindow(SW_HIDE);
//		::SetWindowLong(GetWndHandle(),GWL_STYLE,m_dwStyle);
		DeInit();
		Init(GetParHandle());
		Create();
//		assert(GetWndHandle());
		m_pcChildWin->SetParent(GetWndHandle());
		m_pcChildWin->ShowWindow(SW_SHOW);
		//		SetExWinStyle(WS_EX_TOOLWINDOW); 
		
		//		m_dwOldStyle=::SetWindowLong(GetWndHandle(),GWL_STYLE,
		//			WS_VISIBLE|WS_BORDER|WS_CAPTION|WS_POPUP);
		//			(WS_GROUP|WS_VISIBLE|WS_CHILD));
		//			(WS_BORDER|WS_CAPTION|WS_THICKFRAME|WS_VISIBLE|WS_POPUP|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX));
		//		if(::SetWindowPos(GetWndHandle(),GetParHandle(),0,0,0,0,SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_DRAWFRAME) == 0)
		//			throw CAbException(::GetLastError(),__FILE__,__LINE__);
		return true;
	}
	SetMoveable(false);
	return false;
}

⌨️ 快捷键说明

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