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 // CSHDialog.cpp : implementation file
29 #include "CSHDialog.h"
30 #include <afxpriv.h> // for WM_COMMANDHELP
35 static char THIS_FILE[] = __FILE__;
40 /////////////////////////////////////////////////////////////////////////////
43 void CCSHDialog::DoDataExchange(CDataExchange* pDX)
45 CDialog::DoDataExchange(pDX);
46 //{{AFX_DATA_MAP(CCSHDialog)
47 // NOTE: the ClassWizard will add DDX and DDV calls here
52 BEGIN_MESSAGE_MAP(CCSHDialog, CDialog)
53 //{{AFX_MSG_MAP(CCSHDialog)
56 ON_MESSAGE(WM_COMMANDHELP,OnCommandHelp)
57 ON_COMMAND(ID_WHATS_THIS,OnWhatsThis)
58 ON_COMMAND(IDHELP, OnHelp)
62 /////////////////////////////////////////////////////////////////////////////
63 // CCSHDialog message handlers
64 void CCSHDialog::OnContextMenu(CWnd* pWnd, CPoint pt)
66 m_pwndContext=WndFromPoint(this,pWnd,pt);
67 if(NULL==m_pwndContext || !CCSHCommon::OnContextMenu(this,pt,HelpID(m_pwndContext->GetDlgCtrlID()))){
68 CDialog::OnContextMenu(pWnd,pt);
72 void CCSHDialog::OnWhatsThis()
74 DisplayHelp(m_pwndContext->m_hWnd,HelpID(m_pwndContext->m_hWnd),GetInstanceHandle());
77 BOOL CCSHDialog::OnHelpInfo(HELPINFO* pHelpInfo)
79 DisplayHelp((HWND)pHelpInfo->hItemHandle,HelpID((HWND)pHelpInfo->hItemHandle),GetInstanceHandle());
83 BOOL CCSHDialog::OnInitDialog()
85 CDialog::OnInitDialog();
88 // Dynamically add/remove the question mark button to the title bar of the dialog box:
89 ModifyStyleEx(WS_EX_CONTEXTHELP,0,0);
91 ModifyStyleEx(0,WS_EX_CONTEXTHELP,0);
94 CWnd *pHelpButton=GetDlgItem(IDHELP);
95 if(NULL!=pHelpButton){
96 pHelpButton->EnableWindow(!CSHFile().IsEmpty());
98 return TRUE; // return TRUE unless you set the focus to a control
99 // EXCEPTION: OCX Property Pages should return FALSE
102 CString CCSHDialog::CSHFile() const // return the context-sensitive help file
107 UINT CCSHDialog::HelpID(DWORD) const
109 return 0; // dummy implementation
112 void CCSHDialog::OnHelp()
114 if(!CSHFile().IsEmpty()){
115 HtmlHelp(NULL,GetCSHFilePath()+CSHFile(),HH_DISPLAY_TOPIC,0);
119 HINSTANCE CCSHDialog::GetInstanceHandle()
121 return AfxGetInstanceHandle();
124 BOOL CCSHDialog::OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult)
126 if(CCSHCommon::FilterMessage(message, wParam,lParam,pResult)){
127 return true; // handled
129 return CDialog::OnWndMsg(message, wParam, lParam, pResult);