Repository navigation
Expand file tree
/
Copy pathcomdetailview.cpp
More file actions
68 lines (53 loc) · 1.87 KB
/
Copy pathcomdetailview.cpp
File metadata and controls
68 lines (53 loc) · 1.87 KB
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
#include "StdAfx.h"
#include "comdetailview.h"
#include "resource.h"
bool ComDetailView::CreateTabControl()
{
auto result = Base::CreateTabControl();
if (!result) {
return false;
}
m_imageList = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 2, 0);
for (auto icon : { IDI_REGISTRY, IDI_TYPELIB }) {
auto hIcon = LoadIcon(_Module.GetResourceInstance(), MAKEINTRESOURCE(icon));
ATLASSERT(hIcon);
m_imageList.AddIcon(hIcon);
}
m_tab.SetImageList(m_imageList);
return true;
}
void ComDetailView::UpdateLayout()
{
RECT rect;
GetClientRect(&rect);
if (m_tab.IsWindow() && m_tab.IsWindowVisible()) {
m_tab.SetWindowPos(nullptr, 0, 0, rect.right - rect.left, m_cyTabHeight, SWP_NOZORDER);
}
if (m_nActivePage != -1) {
::SetWindowPos(GetPageHWND(m_nActivePage), nullptr, 0, m_cyTabHeight, rect.right - rect.left,
(rect.bottom - rect.top) - m_cyTabHeight, SWP_NOZORDER);
}
}
LRESULT ComDetailView::OnSelChanged(UINT, WPARAM, LPARAM lParam, BOOL& /*bHandled*/)
{
RemoveAllPages();
auto pdata = reinterpret_cast<LPOBJECTDATA>(lParam);
if (pdata == nullptr || pdata->guid == GUID_NULL) {
return 0;
}
if (m_regView.Create(*this, rcDefault, nullptr, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
WS_EX_CLIENTEDGE, 0U, pdata)) {
AddPage(m_regView, _T("Registry"), 0, pdata);
}
if (m_typeLibView.Create(*this, rcDefault, nullptr,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE,
0U, pdata)) {
AddPage(m_typeLibView, _T("Type Library"), 1, pdata);
}
const auto nPageCount = GetPageCount();
if (nPageCount > 0) {
SetActivePage(nPageCount - 1);
}
UpdateLayout();
return 0;
}