1 //####COPYRIGHTBEGIN####
3 // ----------------------------------------------------------------------------
4 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
6 // This program is part of the eCos host tools.
8 // This program is free software; you can redistribute it and/or modify it
9 // under the terms of the GNU General Public License as published by the Free
10 // Software Foundation; either version 2 of the License, or (at your option)
13 // This program is distributed in the hope that it will be useful, but WITHOUT
14 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 // You should have received a copy of the GNU General Public License along with
19 // this program; if not, write to the Free Software Foundation, Inc.,
20 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 // ----------------------------------------------------------------------------
24 //####COPYRIGHTEND####
25 // CSHPropertySheet.cpp : implementation file
29 #include "CSHPropertySheet.h"
30 #include <afxpriv.h> // for WM_COMMANDHELP
36 static char THIS_FILE[] = __FILE__;
39 /////////////////////////////////////////////////////////////////////////////
40 // CCSHPropertySheet property page
41 IMPLEMENT_DYNCREATE(CCSHPropertySheet, CPropertySheet)
43 CCSHPropertySheet::~CCSHPropertySheet(){}
45 void CCSHPropertySheet::DoDataExchange(CDataExchange* pDX)
47 CPropertySheet::DoDataExchange(pDX);
48 //{{AFX_DATA_MAP(CCSHPropertySheet)
49 // NOTE: the ClassWizard will add DDX and DDV calls here
54 BEGIN_MESSAGE_MAP(CCSHPropertySheet, CPropertySheet)
55 //{{AFX_MSG_MAP(CCSHPropertySheet)
56 ON_COMMAND(ID_WHATS_THIS,OnWhatsThis)
59 ON_MESSAGE(WM_COMMANDHELP,OnCommandHelp)
60 ON_COMMAND(IDHELP, OnHelp)
64 /////////////////////////////////////////////////////////////////////////////
65 // CCSHPropertySheet message handlers
67 void CCSHPropertySheet::OnWhatsThis()
69 DisplayHelp(m_pwndContext->m_hWnd,HelpID(m_pwndContext->m_hWnd),GetInstanceHandle());
72 void CCSHPropertySheet::OnContextMenu(CWnd*pWnd, CPoint pt)
74 m_pwndContext=WndFromPoint(this,pWnd,pt);
75 if(NULL==m_pwndContext || !CCSHCommon::OnContextMenu(this,pt,HelpID(m_pwndContext->GetDlgCtrlID()))){
76 CPropertySheet::OnContextMenu(pWnd,pt);
80 BOOL CCSHPropertySheet::OnHelpInfo(HELPINFO* pHelpInfo)
82 DisplayHelp((HWND)pHelpInfo->hItemHandle,HelpID((HWND)pHelpInfo->hItemHandle),GetInstanceHandle());
86 BOOL CCSHPropertySheet::OnInitDialog()
88 CPropertySheet::OnInitDialog();
90 // Dynamically add/remove the question mark button to the title bar of the dialog box:
91 ModifyStyleEx(WS_EX_CONTEXTHELP,0,0);
93 ModifyStyleEx(0,WS_EX_CONTEXTHELP,0);
96 if(CSHFile().IsEmpty()){
97 // All of the following mess happens because Microsoft decided to show a help button by
98 // default to every Property sheet constructed by Visual C++ 6.In the following lines,
99 // I hide the help button and move the other three buttons to where they should be.
100 CWnd *pwndHelpButton=GetDlgItem(IDHELP);
102 static const int _afxPropSheetButtons[] = { IDOK, IDCANCEL, ID_APPLY_NOW, IDHELP };
104 for (int i = 0; i < sizeof _afxPropSheetButtons/sizeof _afxPropSheetButtons[0] - 1; i++){
107 GetDlgItem(_afxPropSheetButtons[i+1])->GetWindowRect(&rect);
108 ScreenToClient(&rect);
109 GetDlgItem(_afxPropSheetButtons[i])->MoveWindow(&rect);
111 pwndHelpButton->DestroyWindow();
114 return TRUE; // return TRUE unless you set the focus to a control
115 // EXCEPTION: OCX Property Pages should return FALSE
118 // Dummy implementations
119 UINT CCSHPropertySheet::HelpID(DWORD) const
121 return 0; // dummy implementation
125 CString CCSHPropertySheet::CSHFile() const
127 return m_strCSHFilePath;
130 void CCSHPropertySheet::OnHelp()
132 if(!CSHFile().IsEmpty()){
133 HtmlHelp(NULL,GetCSHFilePath()+CSHFile(),HH_DISPLAY_TOPIC,0);
137 HINSTANCE CCSHPropertySheet::GetInstanceHandle()
139 return AfxGetInstanceHandle();
142 BOOL CCSHPropertySheet::OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult)
144 if(CCSHCommon::FilterMessage(message, wParam,lParam,pResult)){
145 return true; // handled
147 return CPropertySheet::OnWndMsg(message, wParam, lParam, pResult);