author | Michael Krelin <hacker@klever.net> | 2004-07-05 01:53:09 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2004-07-05 01:53:09 (UTC) |
commit | fb8b43dbce8bc310718614384297aeaabb9a3cbb (patch) (unidiff) | |
tree | af9d2c2b71ddffff93a97a02fe26611096b78645 /HostPropertyPages.cpp | |
download | bigbrother-fb8b43dbce8bc310718614384297aeaabb9a3cbb.zip bigbrother-fb8b43dbce8bc310718614384297aeaabb9a3cbb.tar.gz bigbrother-fb8b43dbce8bc310718614384297aeaabb9a3cbb.tar.bz2 |
initial commit into svn repository
git-svn-id: http://svn.klever.net/kin/bigbrother/trunk@1 fe716a7a-6dde-0310-88d9-d003556173a8
-rw-r--r-- | HostPropertyPages.cpp | 124 |
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 | ||
16 | static char THIS_FILE[] = __FILE__; | ||
17 | #endif | ||
18 | |||
19 | ///////////////////////////////////////////////////////////////////////////// | ||
20 | // CHostPropertyPages | ||
21 | |||
22 | IMPLEMENT_DYNAMIC(CHostPropertyPages, CPropertySheet) | ||
23 | |||
24 | CHostPropertyPages::CHostPropertyPages(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage) | ||
25 | :CPropertySheet(nIDCaption, pParentWnd, iSelectPage), m_Brother(NULL) | ||
26 | { | ||
27 | CreatePages(); | ||
28 | } | ||
29 | |||
30 | CHostPropertyPages::CHostPropertyPages(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage) | ||
31 | :CPropertySheet(pszCaption, pParentWnd, iSelectPage), m_Brother(NULL) | ||
32 | { | ||
33 | CreatePages(); | ||
34 | } | ||
35 | |||
36 | CHostPropertyPages::~CHostPropertyPages() | ||
37 | { | ||
38 | delete m_Action; | ||
39 | delete m_Settings; | ||
40 | delete m_General; | ||
41 | } | ||
42 | |||
43 | |||
44 | BEGIN_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 | ||
50 | END_MESSAGE_MAP() | ||
51 | |||
52 | ///////////////////////////////////////////////////////////////////////////// | ||
53 | // CHostPropertyPages message handlers | ||
54 | |||
55 | void 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 | |||
70 | void 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 | |||
80 | void 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); | ||
88 | CDocument *pDoc = m_Daddy->GetDocument(); | ||
89 | if(pDoc); | ||
90 | pDoc->UpdateAllViews(NULL); | ||
91 | //PostMessage(WM_UPDATETREEBROTHER,0,(LPARAM)m_Brother); | ||
92 | } | ||
93 | |||
94 | int 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 | |||
103 | void CHostPropertyPages::OnDestroy() | ||
104 | { | ||
105 | CPropertySheet::OnDestroy(); | ||
106 | CRect rc; | ||
107 | GetWindowRect(rc); | ||
108 | AfxGetApp()->WriteProfileInt("PropertiesPosition","left",rc.left); | ||
109 | AfxGetApp()->WriteProfileInt("PropertiesPosition","top",rc.top); | ||
110 | } | ||
111 | |||
112 | BOOL CHostPropertyPages::OnInitDialog() | ||
113 | { | ||
114 | BOOL rv = CPropertySheet::OnInitDialog(); | ||
115 | VERIFY(m_OK.SubclassWindow(GetDlgItem(IDOK)->m_hWnd)); | ||
116 | m_OK.EnableWindow(TRUE); | ||
117 | return rv; | ||
118 | } | ||
119 | |||
120 | void CHostPropertyPages::OnOK() | ||
121 | { | ||
122 | UpdateBrother(); | ||
123 | AfxGetApp()->GetMainWnd()->SetFocus(); | ||
124 | } | ||