Repository navigation
Expand file tree
/
Copy pathP2PmsgNodeDlg.cpp
More file actions
144 lines (121 loc) · 3.57 KB
/
Copy pathP2PmsgNodeDlg.cpp
File metadata and controls
144 lines (121 loc) · 3.57 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
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
// Copyright © 2011, 2026 Ivyware Pty Ltd, Khrustal & Mann
// MELBOURNE, VICTORIA, AUSTRALIA, 3000
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
// implied. See the License for the specific language governing
// permissions and limitations under the License.
//
//
// Implementation for CP2PmsgNodeDlg
//
#include "stdafx.h"
#include "TargetcoreMFC.h"
#include "P2PmsgNodeDlg.h"
#include "afxdialogex.h"
#include "CDialog_Ext.h"
#include "resource.h"
// CP2PmsgNodeDlg dialog
IMPLEMENT_DYNAMIC(CP2PmsgNodeDlg, CDialogEx)
CP2PmsgNodeDlg::CP2PmsgNodeDlg ( P2PmsgMgr *pP2PmsgMgr
, CWnd* pParent /*=NULL*/)
: CDialogEx(IDD_P2PmsgNodeDlg, pParent)
{
m_pP2PmsgMgr = pP2PmsgMgr;
}
CP2PmsgNodeDlg::~CP2PmsgNodeDlg()
{
}
///////////////////////////////////////////////////////////////////////
// Operations
BOOL
CP2PmsgNodeDlg::AttachP2PmsgItem ( P2PmsgMgr *pP2PmsgMgr )
{
P2Pos nP2PosRoot = pP2PmsgMgr->GetP2Pos();
m_wndP2PmsgTreeCtrl.Connect ( pP2PmsgMgr, nP2PosRoot, m_hWnd );
return TRUE;
}
///////////////////////////////////////////////////////////////////////
// Property exposure
CString&
CP2PmsgNodeDlg::GetSelectedNodePath ( )
{
return m_strSelectedItem;
}
P3PmsgObject&
CP2PmsgNodeDlg::GetSelectedObject ( )
{
return m_oSelectedObject;
}
///////////////////////////////////////////////////////////////////////
// MFC Virtual Overrides
void
CP2PmsgNodeDlg::DoDataExchange(CDataExchange* pDX)
{
MANAGE_RESOURCE_STATE;
CDialogEx::DoDataExchange(pDX);
DDX_Control ( pDX, IDC_TREE_P2PmsgMgr, m_wndP2PmsgTreeCtrl);
}
//
// OnInitDialog MFC Virtual override
//
BOOL
CP2PmsgNodeDlg::OnInitDialog ( )
{
// Compliments Class Wizard
MANAGE_RESOURCE_STATE;
__super::OnInitDialog();
// Establish icon
// NOTES: Extreme left side of title bar
CDialog_SetIconFromApp ( *this );
if ( m_pP2PmsgMgr )
AttachP2PmsgItem ( m_pP2PmsgMgr );
// Create views
/*CRect rectDummy;
rectDummy.SetRectEmpty();
const DWORD dwViewStyle = WS_CHILD | WS_VISIBLE | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
if (!m_wndP2PeventTreeCtrl.Create(dwViewStyle, rectDummy, this, 2))
{
TRACE0("Failed to create Class View\n");
return -1; // fail to create
}*/
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//
// Resource management override
//
INT_PTR
CP2PmsgNodeDlg::DoModal()
{
MANAGE_RESOURCE_STATE;
return __super::DoModal();
}
///////////////////////////////////////////////////////////////////////////////
// MFC Message handlers
BEGIN_MESSAGE_MAP(CP2PmsgNodeDlg, CDialogEx)
END_MESSAGE_MAP()
void
CP2PmsgNodeDlg::OnOK()
{
// Isolate selected item
HTREEITEM hItem = m_wndP2PmsgTreeCtrl.GetSelectedItem ( );
if ( hItem )
{
P2Pos posItem = m_wndP2PmsgTreeCtrl.GetItemData ( hItem );
if ( posItem )
m_strSelectedItem = m_wndP2PmsgTreeCtrl.GetItemPath ( hItem );
if ( posItem )
m_oSelectedObject = m_pP2PmsgMgr->P2Pos2Object(posItem);
}
// Delegate
__super::OnOK ( );
}
// CP2PmsgNodeDlg message handlers