- Main Page
- Namespaces
- Classes
- Files
- Directories

- File List
- File Members

# PPageBase.cpp

    00001 /*
    00002  *      Copyright (C) 2003-2005 Gabest
    00003  *      http://www.gabest.org
    00004  *
    00005  *  This Program is free software; you can redistribute it and/or modify
    00006  *  it under the terms of the GNU General Public License as published by
    00007  *  the Free Software Foundation; either version 2, or (at your option)
    00008  *  any later version.
    00009  *
    00010  *  This Program is distributed in the hope that it will be useful,
    00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    00013  *  GNU General Public License for more details.
    00014  *
    00015  *  You should have received a copy of the GNU General Public License
    00016  *  along with GNU Make; see the file COPYING.  If not, write to
    00017  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
    00018  *  http://www.gnu.org/copyleft/gpl.html
    00019  *
    00020  */
    00021
    00022 // PPageBase.cpp : implementation file
    00023 //
    00024
    00025 #include "stdafx.h"
    00026 #include "mplayerc.h"
    00027 #include "PPageBase.h"
    00028
    00029 // CPPageBase dialog
    00030
    00031 IMPLEMENT_DYNAMIC(CPPageBase, CCmdUIPropertyPage)
    00032 CPPageBase::CPPageBase(UINT nIDTemplate, UINT nIDCaption)
    00033         : CCmdUIPropertyPage(nIDTemplate, nIDCaption)
    00034 {
    00035 }
    00036
    00037 CPPageBase::~CPPageBase()
    00038 {
    00039 }
    00040
    00041 void CPPageBase::DoDataExchange(CDataExchange* pDX)
    00042 {
    00043         __super::DoDataExchange(pDX);
    00044 }
    00045
    00046 void CPPageBase::CreateToolTip()
    00047 {
    00048         m_wndToolTip.Create(this);
    00049         m_wndToolTip.Activate(TRUE);
    00050         m_wndToolTip.SetMaxTipWidth(300);
    00051         m_wndToolTip.SetDelayTime(TTDT_AUTOPOP, 10000);
    00052         for(CWnd* pChild = GetWindow(GW_CHILD); pChild; pChild = pChild->GetWindow(GW_HWNDNEXT))
    00053         {
    00054                 CString strToolTip;
    00055                 if(strToolTip.LoadString(pChild->GetDlgCtrlID()))
    00056                         m_wndToolTip.AddTool(pChild, strToolTip);
    00057         }
    00058 }
    00059
    00060 BOOL CPPageBase::PreTranslateMessage(MSG* pMsg)
    00061 {
    00062         if(IsWindow(m_wndToolTip))
    00063         if(pMsg->message >= WM_MOUSEFIRST && pMsg->message <= WM_MOUSELAST)
    00064         {
    00065                 MSG msg;
    00066                 memcpy(&msg, pMsg, sizeof(MSG));
    00067                 for(HWND hWndParent = ::GetParent(msg.hwnd);
    00068                         hWndParent && hWndParent != m_hWnd;
    00069                         hWndParent = ::GetParent(hWndParent))
    00070                 {
    00071                         msg.hwnd = hWndParent;
    00072                 }
    00073
    00074                 if(msg.hwnd)
    00075                 {
    00076                         m_wndToolTip.RelayEvent(&msg);
    00077                 }
    00078         }
    00079
    00080         return __super::PreTranslateMessage(pMsg);
    00081 }
    00082
    00083 BEGIN_MESSAGE_MAP(CPPageBase, CCmdUIPropertyPage)
    00084         ON_WM_DESTROY()
    00085 END_MESSAGE_MAP()
    00086
    00087
    00088 // CPPageBase message handlers
    00089
    00090 BOOL CPPageBase::OnSetActive()
    00091 {
    00092         AfxGetApp()->WriteProfileInt(ResStr(IDS_R_SETTINGS), _T("LastUsedPage"), (UINT)m_pPSP->pszTemplate);
    00093
    00094         return __super::OnSetActive();
    00095 }
    00096
    00097 void CPPageBase::OnDestroy()
    00098 {
    00099         __super::OnDestroy();
    00100
    00101         m_wndToolTip.DestroyWindow();
    00102 }