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

DlgProfileManager.cpp

Go to the documentation of this file.
00001 //
00002 // DlgProfileManager.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 "GProfile.h"
00026 #include "Skin.h"
00027 
00028 #include "DlgProfileManager.h"
00029 #include "PageProfileIdentity.h"
00030 #include "PageProfileContact.h"
00031 #include "PageProfileProfile.h"
00032 #include "PageProfileBio.h"
00033 #include "PageProfileAvatar.h"
00034 #include "PageProfileFavourites.h"
00035 #include "PageProfileFiles.h"
00036 #include "PageProfileCertificate.h"
00037 #include "PageSettingsRich.h"
00038 
00039 #ifdef _DEBUG
00040 #define new DEBUG_NEW
00041 #undef THIS_FILE
00042 static char THIS_FILE[] = __FILE__;
00043 #endif
00044 
00045 IMPLEMENT_DYNAMIC(CProfileManagerDlg, CSettingsSheet)
00046 
00047 BEGIN_MESSAGE_MAP(CProfileManagerDlg, CSettingsSheet)
00048         //{{AFX_MSG_MAP(CProfileManagerDlg)
00049         //}}AFX_MSG_MAP
00050         ON_COMMAND(IDRETRY, OnApply)
00051 END_MESSAGE_MAP()
00052 
00053 
00055 // CProfileManagerDlg construction
00056 
00057 CProfileManagerDlg::CProfileManagerDlg() : CSettingsSheet( 0, IDS_USER_PROFILE )
00058 {
00059         m_nTopMargin = 52;
00060 }
00061 
00062 CProfileManagerDlg::~CProfileManagerDlg()
00063 {
00064 }
00065 
00067 // CProfileManagerDlg operations
00068 
00069 BOOL CProfileManagerDlg::Run(LPCTSTR pszWindow)
00070 {
00071         CProfileManagerDlg pSheet;
00072         BOOL bResult = ( pSheet.DoModal( pszWindow ) == IDOK );
00073         return bResult;
00074 }
00075 
00076 int CProfileManagerDlg::DoModal(LPCTSTR pszWindow)
00077 {
00078         CIdentityProfilePage    pIdentity;
00079         CContactProfilePage             pContact;
00080         CProfileProfilePage             pProfile;
00081         CBioProfilePage                 pBio;
00082         CAvatarProfilePage              pAvatar;
00083         CFavouritesProfilePage  pFavourites;
00084         CFilesProfilePage               pFiles;
00085         CCertificateProfilePage pCertificate;
00086 
00087         AddGroup( &pIdentity );
00088         AddPage( &pContact );
00089         AddPage( &pProfile );
00090         AddPage( &pBio );
00091         AddPage( &pAvatar );
00092         AddGroup( &pFavourites );
00093         AddPage( &pFiles );
00094         AddGroup( &pCertificate );
00095 
00096         if ( pszWindow ) SetActivePage( GetPage( pszWindow ) );
00097 
00098         int nReturn = CSettingsSheet::DoModal();
00099 
00100         return nReturn;
00101 }
00102 
00103 void CProfileManagerDlg::AddPage(CSettingsPage* pPage)
00104 {
00105         CString strCaption = Skin.GetDialogCaption( CString( pPage->GetRuntimeClass()->m_lpszClassName ) );
00106         CSettingsSheet::AddPage( pPage, strCaption.GetLength() ? (LPCTSTR)strCaption : NULL );
00107 }
00108 
00109 void CProfileManagerDlg::AddGroup(CSettingsPage* pPage)
00110 {
00111         if ( pPage->IsKindOf( RUNTIME_CLASS(CRichSettingsPage) ) )
00112         {
00113                 CString strCaption = ((CRichSettingsPage*)pPage)->m_sCaption;
00114                 CSettingsSheet::AddGroup( pPage, strCaption );
00115         }
00116         else
00117         {
00118                 CString strName = pPage->GetRuntimeClass()->m_lpszClassName;
00119                 CString strCaption = Skin.GetDialogCaption( strName );
00120                 CSettingsSheet::AddGroup( pPage, strCaption.GetLength() ? (LPCTSTR)strCaption : NULL );
00121         }
00122 }
00123 
00125 // CProfileManagerDlg message handlers
00126 
00127 BOOL CProfileManagerDlg::OnInitDialog()
00128 {
00129         CSettingsSheet::OnInitDialog();
00130 
00131         m_bmHeader.LoadBitmap( IDB_WIZARD );
00132 
00133         SkinMe( NULL, IDR_MAINFRAME, TRUE );
00134 
00135         return TRUE;
00136 }
00137 
00138 void CProfileManagerDlg::DoPaint(CDC& dc)
00139 {
00140         CRect rc;
00141         GetClientRect( &rc );
00142 
00143         BITMAP pInfo;
00144         m_bmHeader.GetBitmap( &pInfo );
00145 
00146         CDC mdc;
00147         mdc.CreateCompatibleDC( &dc );
00148         CBitmap* pOldBitmap = (CBitmap*)mdc.SelectObject( &m_bmHeader );
00149         dc.BitBlt( 0, 0, pInfo.bmWidth, pInfo.bmHeight, &mdc, 0, 0, SRCCOPY );
00150         mdc.SelectObject( pOldBitmap );
00151         mdc.DeleteDC();
00152 
00153         CSettingsSheet::DoPaint( dc );
00154 }
00155 
00156 void CProfileManagerDlg::OnOK()
00157 {
00158         CSettingsSheet::OnOK();
00159         MyProfile.Save();
00160 }
00161 
00162 void CProfileManagerDlg::OnApply()
00163 {
00164         CSettingsSheet::OnApply();
00165         MyProfile.Save();
00166 }

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