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

📄 dockingframework.cpp

📁 These listed libraries are written in WTL. But it s really hard to mix both MFC & WTL together. Obvi
💻 CPP
字号:
#include "stdafx.h"
#include "DockingFramework.h"

namespace WTL
{
#include "Docking\dockimpl.cpp"
}

CComModule _Module;

IMPLEMENT_DYNAMIC(CDockingFrameWnd, CFrameWnd)
IMPLEMENT_DYNAMIC(CDockingMDIFrameWnd, CMDIFrameWnd)
IMPLEMENT_DYNAMIC(CDockingControlBar, CWnd)

BEGIN_MESSAGE_MAP(CDockingControlBar, CWnd)
	ON_WM_SIZE()
	ON_WM_SETFOCUS()
	ON_WM_NCCREATE()
END_MESSAGE_MAP()

CDockingControlBar::CDockingControlBar()
: m_pWndParentFrame(NULL)
{
}

// virtual
BOOL CDockingControlBar::PreCreateWindow(CREATESTRUCT& cs)
{
	// Workaround to avoid MFC assertion
	cs.style |= WS_CHILDWINDOW;
	BOOL blResult = __super::PreCreateWindow(cs);

	cs.style &= ~WS_CHILDWINDOW;
	cs.style |= (WS_OVERLAPPEDWINDOW | WS_POPUP);
	cs.dwExStyle |= WS_EX_TOOLWINDOW;

	// A control bar never has a menu
	ASSERT(FALSE == IsMenu(cs.hMenu));
	m_wndWTLPeer.m_nCtrlID = (UINT) cs.hMenu;
	cs.hMenu = NULL;

	return blResult;
}

BOOL CDockingControlBar::OnNcCreate(LPCREATESTRUCT lpCreateStruct)
{
	// Keep the parent for later use
	CWnd* pParent = CWnd::FromHandlePermanent(lpCreateStruct->hwndParent);
	if(pParent->IsKindOf(RUNTIME_CLASS(CDockingMDIFrameWnd)))
	{
		m_pWndParentFrame = & static_cast<CDockingMDIFrameWnd*>(pParent)->m_wndWTLPeer;
	}
	else
	{
		ASSERT_KINDOF(CDockingFrameWnd, pParent);
		m_pWndParentFrame = & static_cast<CDockingFrameWnd*>(pParent)->m_wndWTLPeer;
	}

	// mimic CDockingWindowBaseImpl::Create
	m_wndWTLPeer.m_docker = WTLClass::CDocker(lpCreateStruct->hwndParent);

	// add this control bar to the list
	m_pWndParentFrame->AddControlBar(&this->m_wndWTLPeer);

	return __super::OnNcCreate(lpCreateStruct);
}

// virtual
void CDockingControlBar::PostNcDestroy()
{
	m_pWndParentFrame->RemoveControlBar(&this->m_wndWTLPeer);
	__super::PostNcDestroy();
}

void CDockingControlBar::OnSize(UINT nType, int cx, int cy)
{
	if(SIZE_MINIMIZED != nType)
	{
		RepositionBars(0, 0xffff, AFX_IDW_PANE_FIRST);
	}
}

void CDockingControlBar::OnSetFocus(CWnd* pOldWnd)
{
	HWND hWndChild = ::GetDlgItem(m_hWnd, AFX_IDW_PANE_FIRST);
	if(NULL != hWndChild)
	{
		::SetFocus(hWndChild);
	}
}

⌨️ 快捷键说明

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