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

WndHome.cpp

Go to the documentation of this file.
00001 //
00002 // WndHome.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 "RichDocument.h"
00026 #include "RichElement.h"
00027 #include "Network.h"
00028 #include "Neighbours.h"
00029 #include "Library.h"
00030 #include "LibraryHistory.h"
00031 #include "SharedFile.h"
00032 #include "VersionChecker.h"
00033 #include "GraphItem.h"
00034 #include "Statistics.h"
00035 #include "ShellIcons.h"
00036 
00037 #include "WndHome.h"
00038 #include "WndSearch.h"
00039 #include "WndBrowseHost.h"
00040 #include "WindowManager.h"
00041 #include "Skin.h"
00042 #include "XML.h"
00043 
00044 
00045 #ifdef _DEBUG
00046 #define new DEBUG_NEW
00047 #undef THIS_FILE
00048 static char THIS_FILE[] = __FILE__;
00049 #endif
00050 
00051 IMPLEMENT_DYNCREATE(CHomeWnd, CPanelWnd)
00052 
00053 BEGIN_MESSAGE_MAP(CHomeWnd, CPanelWnd)
00054         //{{AFX_MSG_MAP(CHomeWnd)
00055         ON_WM_CREATE()
00056         ON_WM_SIZE()
00057         ON_WM_CONTEXTMENU()
00058         ON_WM_TIMER()
00059         ON_WM_MDIACTIVATE()
00060         ON_NOTIFY(RVN_CLICK, IDC_HOME_VIEW, OnClickView)
00061         ON_NOTIFY(RVN_CLICK, 1, OnClickView)
00062         ON_WM_PAINT()
00063         //}}AFX_MSG_MAP
00064 END_MESSAGE_MAP()
00065 
00066 #define PANEL_WIDTH             200
00067 
00068 
00070 // CHomeWnd construction
00071 
00072 CHomeWnd::CHomeWnd() : CPanelWnd( TRUE )
00073 {
00074         Create( IDR_HOMEFRAME );
00075 }
00076 
00077 CHomeWnd::~CHomeWnd()
00078 {
00079 }
00080 
00082 // CHomeWnd message handlers
00083 
00084 int CHomeWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
00085 {
00086         if ( CPanelWnd::OnCreate( lpCreateStruct ) == -1 ) return -1;
00087 
00088         if ( ! m_wndView.Create( rectDefault, this ) ) return -1;
00089         if ( ! m_wndPanel.Create( this ) ) return -1;
00090 
00091         OnSkinChange();
00092 
00093         return 0;
00094 }
00095 
00096 void CHomeWnd::OnSkinChange()
00097 {
00098         m_wndView.Setup();
00099         m_wndPanel.Setup();
00100         CChildWnd::OnSkinChange();
00101 }
00102 
00103 void CHomeWnd::OnSize(UINT nType, int cx, int cy)
00104 {
00105         CPanelWnd::OnSize( nType, cx, cy );
00106 
00107         m_wndPanel.SetWindowPos( NULL, 0, 0, PANEL_WIDTH, cy, SWP_NOZORDER );
00108         m_wndView.SetWindowPos( NULL, PANEL_WIDTH + 1, 0, cx - PANEL_WIDTH - 1, cy, SWP_NOZORDER|SWP_SHOWWINDOW );
00109 }
00110 
00111 void CHomeWnd::OnContextMenu(CWnd* pWnd, CPoint point)
00112 {
00113         TrackPopupMenu( _T("CHomeWnd"), point );
00114 }
00115 
00116 void CHomeWnd::OnTimer(UINT nIDEvent)
00117 {
00118         if ( nIDEvent == 2 || ( nIDEvent == 1 && IsActive() ) )
00119         {
00120                 m_wndView.Update();
00121                 m_wndPanel.Update();
00122         }
00123 }
00124 
00125 void CHomeWnd::OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd)
00126 {
00127         if ( bActivate )
00128         {
00129                 m_wndView.Update();
00130                 m_wndPanel.Update();
00131                 m_wndView.SetFocus();
00132         }
00133 
00134         CPanelWnd::OnMDIActivate( bActivate, pActivateWnd, pDeactivateWnd );
00135 }
00136 
00137 void CHomeWnd::OnPaint()
00138 {
00139         CPaintDC dc( this );
00140         CRect rc;
00141 
00142         m_wndPanel.GetWindowRect( &rc );
00143         ScreenToClient( &rc );
00144 
00145         dc.MoveTo( rc.right, rc.top );
00146         dc.LineTo( rc.right, rc.bottom + 1 );
00147 }
00148 
00149 void CHomeWnd::OnClickView(RVN_ELEMENTEVENT* pNotify, LRESULT *pResult)
00150 {
00151         if ( CRichElement* pElement = pNotify->pElement )
00152         {
00153                 theApp.InternalURI( pElement->m_sLink );
00154         }
00155 
00156         PostMessage( WM_TIMER, 2 );
00157 }

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