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

PageSettingsRich.cpp

Go to the documentation of this file.
00001 //
00002 // PageSettingsRich.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 "Settings.h"
00025 #include "CoolInterface.h"
00026 #include "Skin.h"
00027 #include "XML.h"
00028 #include "Skin.h"
00029 #include "RichDocument.h"
00030 #include "RichElement.h"
00031 #include "WndSettingsSheet.h"
00032 #include "PageSettingsRich.h"
00033 
00034 #ifdef _DEBUG
00035 #define new DEBUG_NEW
00036 #undef THIS_FILE
00037 static char THIS_FILE[] = __FILE__;
00038 #endif
00039 
00040 IMPLEMENT_DYNCREATE(CRichSettingsPage, CSettingsPage)
00041 
00042 BEGIN_MESSAGE_MAP(CRichSettingsPage, CSettingsPage)
00043         //{{AFX_MSG_MAP(CRichSettingsPage)
00044         //}}AFX_MSG_MAP
00045         ON_NOTIFY(RVN_CLICK, IDC_RICH_VIEW, OnClickView)
00046 END_MESSAGE_MAP()
00047 
00048 
00050 // CRichSettingsPage property page
00051 
00052 CRichSettingsPage::CRichSettingsPage(LPCTSTR pszName) : CSettingsPage(CRichSettingsPage::IDD)
00053 {
00054         if ( pszName == NULL )
00055                 m_sName = GetRuntimeClass()->m_lpszClassName;
00056         else
00057                 m_sName = pszName;
00058         
00059         m_pDocument = NULL;
00060         
00061         if ( CXMLElement* pXML = Skin.GetDocument( m_sName ) )
00062         {
00063                 m_sCaption = pXML->GetAttributeValue( _T("title"), m_sName );
00064                 
00065                 m_pDocument = new CRichDocument();
00066                 m_pDocument->CreateFonts( theApp.m_sDefaultFont, theApp.m_nDefaultFontSize );
00067                 m_pDocument->m_crBackground = CCoolInterface::GetDialogBkColor();
00068                 m_pDocument->LoadXML( pXML );
00069         }
00070 }
00071 
00072 CRichSettingsPage::~CRichSettingsPage()
00073 {
00074         if ( m_pDocument ) delete m_pDocument;
00075 }
00076 
00077 void CRichSettingsPage::DoDataExchange(CDataExchange* pDX)
00078 {
00079         CSettingsPage::DoDataExchange(pDX);
00080         //{{AFX_DATA_MAP(CRichSettingsPage)
00081         //}}AFX_DATA_MAP
00082 }
00083 
00085 // CRichSettingsPage message handlers
00086 
00087 BOOL CRichSettingsPage::OnInitDialog() 
00088 {
00089         CSettingsPage::OnInitDialog();
00090         
00091         SetWindowText( m_sCaption );
00092         Skin.Apply( m_sName, this );
00093 
00094         CRect rc;
00095         GetClientRect( &rc );
00096         m_wndView.Create( WS_VISIBLE, rc, this, IDC_RICH_VIEW );
00097         m_wndView.SetDocument( m_pDocument );
00098         
00099         return TRUE;
00100 }
00101 
00102 void CRichSettingsPage::OnClickView(RVN_ELEMENTEVENT* pNotify, LRESULT *pResult)
00103 {
00104         CRichElement* pElement = pNotify->pElement;
00105         if ( ! pElement ) return;
00106 
00107         if ( _tcsncmp( pElement->m_sLink, _T("raza:page:"), 10 ) == 0 )
00108         {
00109                 CString strPage = pElement->m_sLink.Mid( 10 );
00110                 GetSheet()->SetActivePage( GetSheet()->GetPage( strPage ) );
00111         }
00112 }

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