2 * Copyright (C) 2003-2006 Gabest
3 * http://www.gabest.org
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GNU Make; see the file COPYING. If not, write to
17 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18 * http://www.gnu.org/copyleft/gpl.html
22 // PPageBase.cpp : implementation file
27 #include "PPageBase.h"
31 IMPLEMENT_DYNAMIC(CPPageBase
, CCmdUIPropertyPage
)
32 CPPageBase::CPPageBase(UINT nIDTemplate
, UINT nIDCaption
)
33 : CCmdUIPropertyPage(nIDTemplate
, nIDCaption
)
37 CPPageBase::~CPPageBase()
41 void CPPageBase::DoDataExchange(CDataExchange
* pDX
)
43 __super::DoDataExchange(pDX
);
46 void CPPageBase::CreateToolTip()
48 m_wndToolTip
.Create(this);
49 m_wndToolTip
.Activate(TRUE
);
50 m_wndToolTip
.SetMaxTipWidth(300);
51 m_wndToolTip
.SetDelayTime(TTDT_AUTOPOP
, 10000);
52 for(CWnd
* pChild
= GetWindow(GW_CHILD
); pChild
; pChild
= pChild
->GetWindow(GW_HWNDNEXT
))
55 if(strToolTip
.LoadString(pChild
->GetDlgCtrlID()))
56 m_wndToolTip
.AddTool(pChild
, strToolTip
);
60 BOOL
CPPageBase::PreTranslateMessage(MSG
* pMsg
)
62 if(IsWindow(m_wndToolTip
))
63 if(pMsg
->message
>= WM_MOUSEFIRST
&& pMsg
->message
<= WM_MOUSELAST
)
66 memcpy(&msg
, pMsg
, sizeof(MSG
));
67 for(HWND hWndParent
= ::GetParent(msg
.hwnd
);
68 hWndParent
&& hWndParent
!= m_hWnd
;
69 hWndParent
= ::GetParent(hWndParent
))
71 msg
.hwnd
= hWndParent
;
76 m_wndToolTip
.RelayEvent(&msg
);
80 return __super::PreTranslateMessage(pMsg
);
83 BEGIN_MESSAGE_MAP(CPPageBase
, CCmdUIPropertyPage
)
88 // CPPageBase message handlers
90 BOOL
CPPageBase::OnSetActive()
92 AfxGetApp()->WriteProfileInt(ResStr(IDS_R_SETTINGS
), _T("LastUsedPage"), (UINT
)m_pPSP
->pszTemplate
);
94 return __super::OnSetActive();
97 void CPPageBase::OnDestroy()
101 m_wndToolTip
.DestroyWindow();