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

CtrlLibraryHomeView.cpp

Go to the documentation of this file.
00001 //
00002 // CtrlLibraryHomeView.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 "Library.h"
00027 #include "AlbumFolder.h"
00028 #include "ShellIcons.h"
00029 #include "SchemaCache.h"
00030 #include "Schema.h"
00031 #include "Skin.h"
00032 
00033 #include "CtrlLibraryFrame.h"
00034 #include "CtrlLibraryHomeView.h"
00035 
00036 #ifdef _DEBUG
00037 #define new DEBUG_NEW
00038 #undef THIS_FILE
00039 static char THIS_FILE[] = __FILE__;
00040 #endif
00041 
00042 IMPLEMENT_DYNCREATE(CLibraryHomeView, CLibraryView)
00043 
00044 BEGIN_MESSAGE_MAP(CLibraryHomeView, CLibraryView)
00045         //{{AFX_MSG_MAP(CLibraryHomeView)
00046         ON_WM_CREATE()
00047         ON_WM_SIZE()
00048         ON_WM_DESTROY()
00049         ON_WM_SETFOCUS()
00050         //}}AFX_MSG_MAP
00051 END_MESSAGE_MAP()
00052 
00053 
00055 // CLibraryHomeView construction
00056 
00057 CLibraryHomeView::CLibraryHomeView()
00058 {
00059         m_nCommandID    = ID_LIBRARY_VIEW_HOME;
00060         m_pszToolBar    = _T("CLibraryHomeView");
00061 }
00062 
00063 CLibraryHomeView::~CLibraryHomeView()
00064 {
00065 }
00066 
00068 // CLibraryHomeView message handlers
00069 
00070 BOOL CLibraryHomeView::CheckAvailable(CLibraryTreeItem* pSel)
00071 {
00072         m_bAvailable = ( pSel == NULL );
00073         return m_bAvailable;
00074 }
00075 
00076 int CLibraryHomeView::OnCreate(LPCREATESTRUCT lpCreateStruct)
00077 {
00078         if ( CLibraryView::OnCreate( lpCreateStruct ) == -1 ) return -1;
00079 
00080         m_wndTile.Create( this );
00081         m_wndTile.SetOwner( GetOwner() );
00082         m_wndTile.ShowWindow( SW_SHOW );
00083 
00084         return 0;
00085 }
00086 
00087 void CLibraryHomeView::OnDestroy()
00088 {
00089         CLibraryView::OnDestroy();
00090 }
00091 
00092 void CLibraryHomeView::OnSize(UINT nType, int cx, int cy)
00093 {
00094         if ( nType != 1982 ) CLibraryView::OnSize( nType, cx, cy );
00095 
00096         CRect rc;
00097         GetClientRect( &rc );
00098         m_wndTile.MoveWindow( &rc );
00099 }
00100 
00101 void CLibraryHomeView::GetHeaderContent(int& nImage, CString& str)
00102 {
00103         if ( CSchema* pSchema = SchemaCache.Get( CSchema::uriLibrary ) )
00104         {
00105                 nImage = pSchema->m_nIcon16;
00106                 LoadString( str, IDS_LIBHEAD_EXPLORE_FOLDER );
00107                 LPCTSTR psz = _tcschr( pSchema->m_sTitle, ':' );
00108                 if ( theApp.m_bRTL )
00109                 {
00110                         CString strCaption( psz ? psz + 1 : pSchema->m_sTitle );
00111                         str = _T("\x202A") + strCaption + _T(" \x200E") + str;
00112                 }
00113                 else
00114                         str += psz ? psz + 1 : pSchema->m_sTitle;
00115         }
00116         else
00117         {
00118                 nImage = SHI_COMPUTER;
00119                 LoadString( str, IDS_LIBHEAD_HOME );
00120         }
00121 }
00122 
00123 void CLibraryHomeView::Update()
00124 {
00125         CSingleLock pLock( &Library.m_pSection );
00126         if ( ! pLock.Lock( 100 ) ) return;
00127 
00128         m_wndTile.Update();
00129 }
00130 
00131 BOOL CLibraryHomeView::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
00132 {
00133         if ( m_wndTile.m_hWnd != NULL )
00134         {
00135                 if ( m_wndTile.OnCmdMsg( nID, nCode, pExtra, pHandlerInfo ) ) return TRUE;
00136         }
00137 
00138         return CLibraryView::OnCmdMsg( nID, nCode, pExtra, pHandlerInfo );
00139 }
00140 
00141 void CLibraryHomeView::OnSetFocus(CWnd* pOldWnd)
00142 {
00143         CLibraryView::OnSetFocus( pOldWnd );
00144         if ( m_wndTile.m_hWnd ) m_wndTile.SetFocus();
00145 }

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