-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSouiRealWndHandler.cpp
123 lines (117 loc) · 3.8 KB
/
SouiRealWndHandler.cpp
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
#include "StdAfx.h"
#include "SouiRealWndHandler.h"
#include "RealWndDlg.h"
#include "RealWndDlg_URL.h"
namespace SOUI
{
CSouiRealWndHandler::CSouiRealWndHandler(void)
{
}
CSouiRealWndHandler::~CSouiRealWndHandler(void)
{
}
HWND CSouiRealWndHandler::OnRealWndCreate( SRealWnd *pRealWnd )
{
const SRealWndParam ¶m=pRealWnd->GetRealWndParam();
if(param.m_strClassName==_T("CRealWndDlg"))
{
CRealWndDlg *wndDlg = new CRealWndDlg;
wndDlg->Create(pRealWnd->GetContainer()->GetHostHwnd(), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 0, 0, 0, 0, 0);
//把pbtn的指针放到SRealWnd的Data中保存,以便在窗口destroy时释放pbtn对象。
pRealWnd->SetData(wndDlg);
//返回成功创建后的窗口句柄
return wndDlg->m_hWnd;
}
else if (param.m_strClassName == _T("CRealWndDlg_URL"))
{
CRealWndDlg_URL *wndDlg_url = new CRealWndDlg_URL;
wndDlg_url->Create(pRealWnd->GetContainer()->GetHostHwnd(), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 0, 0, 0, 0, 0);
pRealWnd->SetData(wndDlg_url);
return wndDlg_url->m_hWnd;
}
else if (param.m_strClassName == _T("CRealWndDlg_ABOUT"))
{
SHostWnd *wndDlg_about = new SHostWnd(_T("layout:XML_Readwnd_about"));
wndDlg_about->Create(pRealWnd->GetContainer()->GetHostHwnd(), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 0, 0, 0, 0, 0);
pRealWnd->SetData(wndDlg_about);
return wndDlg_about->m_hWnd;
}
else if (param.m_strClassName == _T("CRealWndDlg_DEPOT"))
{
SHostWnd *wndDlg_depot = new SHostWnd(_T("LAYOUT:XML_Readwnd_depot"));
wndDlg_depot->Create(pRealWnd->GetContainer()->GetHostHwnd(), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 0, 0, 0, 0, 0);
pRealWnd->SetData(wndDlg_depot);
return wndDlg_depot->m_hWnd;
}
else if (param.m_strClassName == _T("CRealWndDlg_SKIN"))
{
SHostWnd *wndDlg_SKIN = new SHostWnd(_T("LAYOUT:XML_Readwnd_skin"));
wndDlg_SKIN->Create(pRealWnd->GetContainer()->GetHostHwnd(), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 0, 0, 0, 0, 0);
pRealWnd->SetData(wndDlg_SKIN);
return wndDlg_SKIN->m_hWnd;
}
else
{
return 0;
}
}
void CSouiRealWndHandler::OnRealWndDestroy( SRealWnd *pRealWnd )
{
const SRealWndParam ¶m=pRealWnd->GetRealWndParam();
if(param.m_strClassName==_T("CRealWndDlg"))
{//销毁真窗口,释放窗口占用的内存
CRealWndDlg *pbtn=(CRealWndDlg*) pRealWnd->GetData();
if(pbtn)
{
pbtn->DestroyWindow();
delete pbtn;
}
}
else if (param.m_strClassName == _T("CRealWndDlg_URL"))
{
CRealWndDlg_URL *pbtn_url = (CRealWndDlg_URL*)pRealWnd->GetData();
if (pbtn_url)
{
pbtn_url->DestroyWindow();
delete pbtn_url;
}
}
else if (param.m_strClassName == _T("CRealWndDlg_ABOUT"))
{
CRealWndDlg_URL *pbtn_about = (CRealWndDlg_URL*)pRealWnd->GetData();
if (pbtn_about)
{
pbtn_about->DestroyWindow();
delete pbtn_about;
}
}
else if (param.m_strClassName == _T("CRealWndDlg_DEPOT"))
{
SHostWnd *pbtn_depot = (SHostWnd*)pRealWnd->GetData();
if (pbtn_depot)
{
pbtn_depot->DestroyWindow();
delete pbtn_depot;
}
}
else if (param.m_strClassName == _T("CRealWndDlg_SKIN"))
{
SHostWnd *pbtn_skin = (SHostWnd*)pRealWnd->GetData();
if (pbtn_skin)
{
pbtn_skin->DestroyWindow();
delete pbtn_skin;
}
}
}
//不处理,返回FALSE
BOOL CSouiRealWndHandler::OnRealWndSize( SRealWnd *pRealWnd )
{
return FALSE;
}
//不处理,返回FALSE
BOOL CSouiRealWndHandler::OnRealWndInit( SRealWnd *pRealWnd )
{
return FALSE;
}
}