-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPropertyDialog.cpp
102 lines (77 loc) · 2.2 KB
/
PropertyDialog.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
/*************************************************************************************************\
*
* Filename: PropertyDialog.cpp
* Purpose: Implement CPropertyDialog class
* Version: 1.0
* Author: Gavin Clayton
*
* Last Updated: 29/08/2002
*
* Copyright 2002. Gavin Clayton. All Rights Reserved.
*
*
* If changes are made by you to this code, please log them below:
*
*
\*************************************************************************************************/
#include "stdafx.h"
#include "Daggerfall Explorer.h"
#include "PropertyDialog.h"
#define IDC_PROPERTYTREE 100
// CPropertyDialog dialog
IMPLEMENT_DYNAMIC(CPropertyDialog, CDialog)
CPropertyDialog::CPropertyDialog(CWnd* pParent /*=NULL*/)
: CDialog(CPropertyDialog::IDD, pParent)
{
}
CPropertyDialog::~CPropertyDialog()
{
}
void CPropertyDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CPropertyDialog, CDialog)
END_MESSAGE_MAP()
// CPropertyDialog message handlers
BOOL CPropertyDialog::OnInitDialog()
{
CDialog::OnInitDialog();
CRect rc;
DWORD dwStyle;
// PTS_NOTIFY - CPropTree will send notification messages to the parent window
dwStyle = WS_CHILD|WS_VISIBLE|PTS_NOTIFY;
// Create CPropTree control
GetClientRect(rc);
if ( !m_Tree.Create( dwStyle, rc, this, IDC_PROPERTYTREE ) )
return FALSE;
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
CPropTreeItem* CPropertyDialog::InsertStatic( LPCSTR pszName, LPCSTR pszDescription, CPropTreeItem* pRoot )
{
_ASSERT( pszName );
_ASSERT( pszDescription );
_ASSERT( pRoot );
// Create a simple item
CPropTreeItem* pItem;
pItem = m_Tree.InsertItem( new CPropTreeItemStatic(), pRoot );
pItem->SetLabelText( _T(pszName) );
pItem->SetInfoText( _T(pszDescription) );
return pItem;
}
void CPropertyDialog::SetStatic( CPropTreeItem* pItem, LPCSTR pszText )
{
_ASSERT( pItem );
_ASSERT( pszText );
// Set the item text
pItem->SetItemValue( (LPARAM)_T(pszText) );
}
void CPropertyDialog::SetStatic( CPropTreeItem* pItem, int nNumber )
{
_ASSERT( pItem );
// Set the item number
char sz[64];
sprintf( sz, "%d", nNumber );
pItem->SetItemValue( (LPARAM)_T(sz) );
}