00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "StdAfx.h"
00023 #include "Shareaza.h"
00024 #include "DlgHelp.h"
00025 #include "Skin.h"
00026 #include "RichElement.h"
00027
00028 #ifdef _DEBUG
00029 #define new DEBUG_NEW
00030 #undef THIS_FILE
00031 static char THIS_FILE[] = __FILE__;
00032 #endif
00033
00034 IMPLEMENT_DYNAMIC(CHelpDlg, CSkinDialog)
00035
00036 BEGIN_MESSAGE_MAP(CHelpDlg, CSkinDialog)
00037
00038 ON_WM_SIZE()
00039 ON_NOTIFY(RVN_CLICK, IDC_HELP_VIEW, OnClickView)
00040
00041 END_MESSAGE_MAP()
00042
00043
00045
00046
00047 BOOL CHelpDlg::Show(LPCTSTR pszName, CWnd* pParent)
00048 {
00049 CHelpDlg dlg( pszName, pParent );
00050 return dlg.DoModal() == IDOK;
00051 }
00052
00054
00055
00056 CHelpDlg::CHelpDlg(LPCTSTR pszName, CWnd* pParent) : CSkinDialog( CHelpDlg::IDD, pParent )
00057 {
00058 m_sDocument = pszName;
00059
00060
00061 }
00062
00063 void CHelpDlg::DoDataExchange(CDataExchange* pDX)
00064 {
00065 CSkinDialog::DoDataExchange(pDX);
00066
00067 DDX_Control(pDX, IDC_BANNER, m_wndBanner);
00068
00069 }
00070
00072
00073
00074 BOOL CHelpDlg::OnInitDialog()
00075 {
00076 CSkinDialog::OnInitDialog();
00077
00078 if ( CXMLElement* pXML = Skin.GetDocument( m_sDocument ) )
00079 {
00080 m_pDocument.LoadXML( pXML );
00081 }
00082 else
00083 {
00084 PostMessage( WM_CLOSE );
00085 }
00086
00087 m_pDocument.m_crBackground = Skin.m_crDialog;
00088
00089 CRect rect( 0, 0, 0, 0 );
00090 m_wndView.Create( WS_CHILD, rect, this, IDC_HELP_VIEW );
00091 m_wndView.SetDocument( &m_pDocument );
00092 m_wndView.SetSelectable( TRUE );
00093
00094 SkinMe( _T("CHelpDlg"), ID_HELP_ABOUT );
00095 OnSize( 1982, 0, 0 );
00096
00097 return TRUE;
00098 }
00099
00100 void CHelpDlg::OnSize(UINT nType, int cx, int cy)
00101 {
00102 if ( nType != 1982 ) CSkinDialog::OnSize( nType, cx, cy );
00103
00104 if ( m_wndBanner.m_hWnd != NULL && m_wndView.m_hWnd != NULL )
00105 {
00106 CRect rcClient, rcBanner;
00107
00108 GetClientRect( &rcClient );
00109 m_wndBanner.GetClientRect( &rcBanner );
00110
00111 rcClient.top += rcBanner.Height();
00112 rcClient.bottom -= 32;
00113
00114 m_wndView.SetWindowPos( NULL, rcClient.left, rcClient.top,
00115 rcClient.Width(), rcClient.Height(), SWP_NOZORDER|SWP_SHOWWINDOW );
00116 }
00117 }
00118
00119 void CHelpDlg::OnClickView(RVN_ELEMENTEVENT* pNotify, LRESULT *pResult)
00120 {
00121 if ( CRichElement* pElement = pNotify->pElement )
00122 {
00123 theApp.InternalURI( pElement->m_sLink );
00124 }
00125 }