Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

DlgHelp.cpp

Go to the documentation of this file.
00001 //
00002 // DlgHelp.cpp
00003 //
00004 // Copyright (c) Shareaza Development Team, 2002-2005.
00005 // This file is part of SHAREAZA (www.shareaza.com)
00006 //
00007 // Shareaza is free software; you can redistribute it
00008 // and/or modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2 of
00010 // the License, or (at your option) any later version.
00011 //
00012 // Shareaza is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 // GNU General Public License for more details.
00016 //
00017 // You should have received a copy of the GNU General Public License
00018 // along with Shareaza; if not, write to the Free Software
00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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         //{{AFX_MSG_MAP(CHelpDlg)
00038         ON_WM_SIZE()
00039         ON_NOTIFY(RVN_CLICK, IDC_HELP_VIEW, OnClickView)
00040         //}}AFX_MSG_MAP
00041 END_MESSAGE_MAP()
00042 
00043 
00045 // CHelpDlg setup
00046 
00047 BOOL CHelpDlg::Show(LPCTSTR pszName, CWnd* pParent)
00048 {
00049         CHelpDlg dlg( pszName, pParent );
00050         return dlg.DoModal() == IDOK;
00051 }
00052 
00054 // CHelpDlg construction
00055 
00056 CHelpDlg::CHelpDlg(LPCTSTR pszName, CWnd* pParent) : CSkinDialog( CHelpDlg::IDD, pParent )
00057 {
00058         m_sDocument = pszName;
00059         //{{AFX_DATA_INIT(CHelpDlg)
00060         //}}AFX_DATA_INIT
00061 }
00062 
00063 void CHelpDlg::DoDataExchange(CDataExchange* pDX)
00064 {
00065         CSkinDialog::DoDataExchange(pDX);
00066         //{{AFX_DATA_MAP(CHelpDlg)
00067         DDX_Control(pDX, IDC_BANNER, m_wndBanner);
00068         //}}AFX_DATA_MAP
00069 }
00070 
00072 // CHelpDlg message handlers
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 }

Generated on Thu Dec 15 10:39:39 2005 for Shareaza 2.2.1.0 by  doxygen 1.4.2