GME  13
ActiveBrowserPropertyFrame.cpp
Go to the documentation of this file.
00001 // ActiveBrowserPropertyFrame.cpp : implementation file
00002 //
00003 
00004 #include "stdafx.h"
00005 #include "resource.h"
00006 #include "ActiveBrowserPropertyFrame.h"
00007 
00008 #ifdef _DEBUG
00009 #undef THIS_FILE
00010 static char BASED_CODE THIS_FILE[] = __FILE__;
00011 #endif
00012 
00014 // CActiveBrowserPropertyFrame
00015 
00016 IMPLEMENT_DYNCREATE(CActiveBrowserPropertyFrame, CMiniFrameWnd)
00017 
00018 CActiveBrowserPropertyFrame::CActiveBrowserPropertyFrame()
00019 {
00020         m_pModelessPropSheet = NULL;
00021 }
00022 
00023 CActiveBrowserPropertyFrame::~CActiveBrowserPropertyFrame()
00024 {
00025 }
00026 
00027 
00028 BEGIN_MESSAGE_MAP(CActiveBrowserPropertyFrame, CMiniFrameWnd)
00029         //{{AFX_MSG_MAP(CActiveBrowserPropertyFrame)
00030         ON_WM_CREATE()
00031         ON_WM_CLOSE()
00032         ON_WM_ACTIVATE()
00033         ON_WM_WINDOWPOSCHANGED()
00034         //}}AFX_MSG_MAP
00035 END_MESSAGE_MAP()
00036 
00037 
00039 // CActiveBrowserPropertyFrame message handlers
00040 
00041 int CActiveBrowserPropertyFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) 
00042 {
00043         if (CMiniFrameWnd::OnCreate(lpCreateStruct) == -1)
00044                 return -1;
00045         
00046         m_pModelessPropSheet = new CActiveBrowserPropertySheet(this);
00047 
00048         if (!m_pModelessPropSheet->Create(this, 
00049                 WS_CHILD|WS_VISIBLE, 0))
00050         {
00051                 delete m_pModelessPropSheet;
00052                 m_pModelessPropSheet = NULL;
00053                 return -1;
00054         }
00055 
00056         m_pModelessPropSheet->ModifyStyleEx(0, WS_EX_CONTROLPARENT);
00057 
00058         // Resize the mini frame so that it fits around the child property
00059         // sheet.
00060         CRect rectClient, rectWindow;
00061         m_pModelessPropSheet->GetWindowRect(rectClient);
00062         rectWindow = rectClient;
00063 
00064         // CMiniFrameWnd::CalcWindowRect adds the extra width and height
00065         // needed from the mini frame.
00066         CalcWindowRect(rectWindow);
00067         SetWindowPos(NULL, rectWindow.left, rectWindow.top,
00068                 rectWindow.Width(), rectWindow.Height(),
00069                 SWP_NOZORDER | SWP_NOACTIVATE);
00070         m_pModelessPropSheet->SetWindowPos(NULL, 0, 0,
00071                 rectClient.Width(), rectClient.Height(),
00072                 SWP_NOZORDER | SWP_NOACTIVATE);
00073 
00074         m_pModelessPropSheet->SetParent(this);
00075         
00076 
00077         return 0;
00078 }
00079 
00080 void CActiveBrowserPropertyFrame::OnClose() 
00081 {
00082         
00083         // Instead of closing the modeless property sheet, just hide it.
00084         ShowWindow(SW_HIDE);
00085 }
00086 
00087 void CActiveBrowserPropertyFrame::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized) 
00088 {
00089         CMiniFrameWnd::OnActivate(nState, pWndOther, bMinimized);
00090 
00091         // Forward any WM_ACTIVATEs to the property sheet...
00092         // Like the dialog manager itself, it needs them to save/restore the focus.
00093         ASSERT_VALID(m_pModelessPropSheet);
00094 
00095         // Use GetCurrentMessage to get unmodified message data.
00096         const MSG* pMsg = GetCurrentMessage();
00097 
00098         ASSERT(pMsg->message == WM_ACTIVATE);
00099         m_pModelessPropSheet->SendMessage(pMsg->message, pMsg->wParam,
00100                 pMsg->lParam);
00101 }
00102 
00103 BOOL CActiveBrowserPropertyFrame::PreCreateWindow(CREATESTRUCT& cs) 
00104 {
00105 
00106         cs.style&=~WS_CAPTION;
00107         cs.style|=WS_CHILD;
00108         return CMiniFrameWnd::PreCreateWindow(cs);
00109 }
00110 
00111 
00112 
00113 void CActiveBrowserPropertyFrame::OnOpenProject()
00114 {
00115 
00116         m_pModelessPropSheet->SetActivePage(1);
00117         m_pModelessPropSheet->SetActivePage(2);
00118         m_pModelessPropSheet->SetActivePage(0);
00119 
00120         m_pModelessPropSheet->m_PageAggregate.OpenProject();
00121         m_pModelessPropSheet->m_PageInheritance.OpenProject();
00122         m_pModelessPropSheet->m_PageMeta.OpenProject();
00123         m_pModelessPropSheet->m_PageAggregate.SetFocus2();
00124 
00125 }
00126 
00127 void CActiveBrowserPropertyFrame::OnCloseProject()
00128 {
00129         m_pModelessPropSheet->m_PageAggregate.CloseProject();
00130         m_pModelessPropSheet->m_PageInheritance.CloseProject();
00131         m_pModelessPropSheet->m_PageMeta.CloseProject();
00132         
00133 }
00134 
00135 
00136 
00137 void CActiveBrowserPropertyFrame::OnWindowPosChanged(WINDOWPOS FAR* lpwndpos)
00138 {
00139         CMiniFrameWnd::OnWindowPosChanged(lpwndpos);
00140 
00141         CRect clientRect;
00142         GetClientRect(clientRect);
00143 
00144         m_pModelessPropSheet->MoveWindow(clientRect,TRUE);
00145 }
00146 
00147 void CActiveBrowserPropertyFrame::MoveWindow(LPCRECT lpRect, BOOL bRepaint )
00148 {
00149         CMiniFrameWnd::MoveWindow(lpRect, bRepaint);    
00150 
00151         m_pModelessPropSheet->MoveWindow(lpRect, TRUE); 
00152 }
00153 
00154 void CActiveBrowserPropertyFrame::MoveWindow(int x, int y, int nWidth, int nHeight, BOOL bRepaint)
00155 {
00156         CMiniFrameWnd::MoveWindow(x, y, nWidth, nHeight, bRepaint);     
00157         
00158         m_pModelessPropSheet->MoveWindow(0, 0, nWidth, nHeight, TRUE);
00159 }
00160 
00161