-
Notifications
You must be signed in to change notification settings - Fork 0
/
PaneChildDlg.h
151 lines (120 loc) · 3.17 KB
/
PaneChildDlg.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#pragma once
// CPaneChildDlg dialog
class CPaneChildDlg : public CDialogEx
{
DECLARE_DYNAMIC(CPaneChildDlg)
public:
CPaneChildDlg(CWnd* pParent = NULL); // standard constructor
virtual ~CPaneChildDlg();
// Dialog Data
enum { IDD = IDD_PANE_DLG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
DECLARE_MESSAGE_MAP()
};
class CTTDragFrameImpl : public CMFCDragFrameImpl
{
public:
CTTDragFrameImpl(CWnd* pParentWnd)
{
m_pWndDummy = new CDockablePaneAdapter();
m_pWndDummy->CreateEx(0, _T(""), pParentWnd, CRect(0, 0, 0, 0), FALSE, -2, WS_CHILD);
i = rand() % 100;
}
virtual ~CTTDragFrameImpl()
{
if (m_pWndDummy)
{
//m_pWndDummy = NULL;
m_pWndDummy->DestroyWindow();
delete m_pWndDummy;
m_pWndDummy = NULL;
}
}
int i = 0;
};
class CTTPaneFrameWnd : public CPaneFrameWnd
{
DECLARE_SERIAL(CTTPaneFrameWnd)
public:
CTTPaneFrameWnd()
{
m_impl = NULL;
}
virtual ~CTTPaneFrameWnd()
{
*&m_dragFrameImpl = m_OrigImpl;
//CTTDragFrameImpl* pttimpl = dynamic_cast<CTTDragFrameImpl*>(&m_dragFrameImpl);
//delete pttimpl;
if (m_impl)
{
delete m_impl;
m_impl = NULL;
//*&m_dragFrameImpl = *m_impl;
//m_impl = NULL;
}
}
virtual BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, CCreateContext* pContext = NULL) override
{
*&m_OrigImpl = m_dragFrameImpl;
m_impl = new CTTDragFrameImpl(pParentWnd);
*&m_dragFrameImpl = *m_impl;
BOOL result = __super::Create(lpszWindowName, dwStyle, rect, pParentWnd, pContext);
return result;
}
void SetMainFrame(CFrameWndEx* pMainFrame){ m_pMainFrame = pMainFrame; }
private:
CMFCDragFrameImpl m_OrigImpl;
CTTDragFrameImpl* m_impl;
CFrameWndEx* m_pMainFrame;
};
/***********************************************************************/
class CDialogPane : public CDockablePane
{
DECLARE_DYNAMIC(CDialogPane)
DECLARE_MESSAGE_MAP()
public:
CDialogPane();
virtual ~CDialogPane();
//virtual BOOL CanFloat() const override { return FALSE; }
CFrameWnd* GetTopLevelFrame() const;
CTTDragFrameImpl* m_customImpl;
void SetMainFrame(CFrameWndEx* pMainFrame){ m_pMainFrame = pMainFrame; }
virtual CPaneFrameWnd* CreateDefaultMiniframe(CRect rectInitial) override
{
ASSERT_VALID(this);
CRect rectVirtual = rectInitial;
CPaneFrameWnd* pMiniFrame =
(CPaneFrameWnd*)m_pMiniFrameRTC->CreateObject();
if (pMiniFrame != NULL)
{
// it must have valid CFrameEx window as parent
CWnd* pParentFrame = m_pMainFrame;
ASSERT_VALID(pParentFrame);
pMiniFrame->SetDockingManager(afxGlobalUtils.GetDockingManager(GetDockSiteFrameWnd()));
if (!pMiniFrame->Create(NULL, WS_POPUP, rectVirtual, pParentFrame))
{
TRACE0("Failed to create miniframe");
delete pMiniFrame;
return NULL;
}
}
else
{
TRACE0("Failed to create miniframe using runtime class information \n");
ASSERT(FALSE);
}
return pMiniFrame;
}
/*CFrameWnd* AFX_CDECL AFXGetParentFrame(const CWnd* pWnd)
{
return m_pMainFrame;
}*/
protected:
afx_msg int OnCreate(LPCREATESTRUCT lp);
afx_msg void OnSize(UINT nType, int cx, int cy);
private:
CMFCDragFrameImpl m_OrigImpl;
CPaneChildDlg m_wndDlg;
CFrameWndEx* m_pMainFrame;
};