summaryrefslogtreecommitdiffabout
path: root/HostPropertyPages.cpp
Unidiff
Diffstat (limited to 'HostPropertyPages.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--HostPropertyPages.cpp124
1 files changed, 124 insertions, 0 deletions
diff --git a/HostPropertyPages.cpp b/HostPropertyPages.cpp
new file mode 100644
index 0000000..8583bf8
--- a/dev/null
+++ b/HostPropertyPages.cpp
@@ -0,0 +1,124 @@
1// HostPropertyPages.cpp : implementation file
2//
3
4#include "stdafx.h"
5#include "BigBrother.h"
6#include "HostPropertyPages.h"
7#include "GeneralPage.h"
8#include "SettingsPage.h"
9#include "ActionPage.h"
10#include "BigBrotherDoc.h"
11#include "BigBrotherView.h"
12
13#ifdef _DEBUG
14#define new DEBUG_NEW
15#undef THIS_FILE
16static char THIS_FILE[] = __FILE__;
17#endif
18
19/////////////////////////////////////////////////////////////////////////////
20// CHostPropertyPages
21
22IMPLEMENT_DYNAMIC(CHostPropertyPages, CPropertySheet)
23
24CHostPropertyPages::CHostPropertyPages(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
25 :CPropertySheet(nIDCaption, pParentWnd, iSelectPage), m_Brother(NULL)
26{
27 CreatePages();
28}
29
30CHostPropertyPages::CHostPropertyPages(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
31 :CPropertySheet(pszCaption, pParentWnd, iSelectPage), m_Brother(NULL)
32{
33 CreatePages();
34}
35
36CHostPropertyPages::~CHostPropertyPages()
37{
38 delete m_Action;
39 delete m_Settings;
40 delete m_General;
41}
42
43
44BEGIN_MESSAGE_MAP(CHostPropertyPages, CPropertySheet)
45 //{{AFX_MSG_MAP(CHostPropertyPages)
46 ON_WM_CREATE()
47 ON_WM_DESTROY()
48 ON_BN_CLICKED(IDOK, OnOK)
49 //}}AFX_MSG_MAP
50END_MESSAGE_MAP()
51
52/////////////////////////////////////////////////////////////////////////////
53// CHostPropertyPages message handlers
54
55void CHostPropertyPages::CreatePages()
56{
57 m_General = new CGeneralPage();
58 m_Settings = new CSettingsPage();
59 m_Action = new CActionPage();
60 m_General->m_dad=this;
61 m_Settings->m_dad=this;
62 m_Action->m_dad=this;
63 AddPage(m_General);
64 AddPage(m_Settings);
65 AddPage(m_Action);
66 m_InitialPosition.x=AfxGetApp()->GetProfileInt("PropertiesPosition","left",-1);
67 m_InitialPosition.y=AfxGetApp()->GetProfileInt("PropertiesPosition","top",-1);
68}
69
70void CHostPropertyPages::SetBrother(CBrother* b)
71{
72 if(m_Brother)
73 UpdateBrother();
74 m_Brother=b;
75 m_General->UpdatePage();
76 m_Settings->UpdatePage();
77 m_Action->UpdatePage();
78}
79
80void CHostPropertyPages::UpdateBrother()
81{
82 if(!m_Brother)
83 return;
84 m_General->UpdateBrother();
85 m_Settings->UpdateBrother();
86 m_Action->UpdateBrother();
87 ASSERT(m_Daddy);
88CDocument *pDoc = m_Daddy->GetDocument();
89 if(pDoc);
90 pDoc->UpdateAllViews(NULL);
91 //PostMessage(WM_UPDATETREEBROTHER,0,(LPARAM)m_Brother);
92}
93
94int CHostPropertyPages::OnCreate(LPCREATESTRUCT lpCreateStruct)
95{
96 if (CPropertySheet::OnCreate(lpCreateStruct) == -1)
97 return -1;
98 ModifyStyle(m_Daddy->IsWindowVisible()?0:WS_VISIBLE,WS_POPUP||WS_CLIPSIBLINGS|WS_BORDER|WS_DLGFRAME);
99 ModifyStyleEx(0,WS_EX_TOOLWINDOW|WS_EX_WINDOWEDGE);
100 return 0;
101}
102
103void CHostPropertyPages::OnDestroy()
104{
105 CPropertySheet::OnDestroy();
106CRect rc;
107 GetWindowRect(rc);
108 AfxGetApp()->WriteProfileInt("PropertiesPosition","left",rc.left);
109 AfxGetApp()->WriteProfileInt("PropertiesPosition","top",rc.top);
110}
111
112BOOL CHostPropertyPages::OnInitDialog()
113{
114BOOL rv = CPropertySheet::OnInitDialog();
115 VERIFY(m_OK.SubclassWindow(GetDlgItem(IDOK)->m_hWnd));
116 m_OK.EnableWindow(TRUE);
117 return rv;
118}
119
120void CHostPropertyPages::OnOK()
121{
122 UpdateBrother();
123 AfxGetApp()->GetMainWnd()->SetFocus();
124}