00001 // 00002 // Plugins.h 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 #if !defined(AFX_PLUGINS_H__3EDF2C68_FCEB_438E_A5CD_CF5DC1114FC4__INCLUDED_) 00023 #define AFX_PLUGINS_H__3EDF2C68_FCEB_438E_A5CD_CF5DC1114FC4__INCLUDED_ 00024 00025 #pragma once 00026 00027 class CPlugin; 00028 class CChildWnd; 00029 00030 00031 class CPlugins 00032 { 00033 // Construction 00034 public: 00035 CPlugins(); 00036 virtual ~CPlugins(); 00037 00038 // Attributes 00039 public: 00040 CPtrList m_pList; 00041 UINT m_nCommandID; 00042 00043 // Operations 00044 public: 00045 void Enumerate(); 00046 void Clear(); 00047 BOOL LookupCLSID(LPCTSTR pszGroup, LPCTSTR pszKey, CLSID& pCLSID, BOOL bEnableDefault = TRUE); 00048 BOOL LookupEnable(REFCLSID pCLSID, BOOL bDefault); 00049 public: 00050 void OnSkinChanged(); 00051 void RegisterCommands(); 00052 UINT GetCommandID(); 00053 BOOL OnUpdate(CChildWnd* pActiveWnd, CCmdUI* pCmdUI); 00054 BOOL OnCommand(CChildWnd* pActiveWnd, UINT nCommandID); 00055 BOOL OnExecuteFile(LPCTSTR pszFile); 00056 BOOL OnEnqueueFile(LPCTSTR pszFile); 00057 00058 // Inlines 00059 public: 00060 inline POSITION GetIterator() const 00061 { 00062 return m_pList.GetHeadPosition(); 00063 } 00064 00065 inline CPlugin* GetNext(POSITION& pos) const 00066 { 00067 return (CPlugin*)m_pList.GetNext( pos ); 00068 } 00069 00070 inline int GetCount() const 00071 { 00072 return m_pList.GetCount(); 00073 } 00074 00075 }; 00076 00077 00078 class CPlugin 00079 { 00080 // Construction 00081 public: 00082 CPlugin(REFCLSID pCLSID, LPCTSTR pszName); 00083 virtual ~CPlugin(); 00084 00085 // Attributes 00086 public: 00087 CLSID m_pCLSID; 00088 CString m_sName; 00089 HICON m_hIcon; 00090 DWORD m_nCapabilities; 00091 public: 00092 IGeneralPlugin* m_pPlugin; 00093 ICommandPlugin* m_pCommand; 00094 IExecutePlugin* m_pExecute; 00095 00096 // Operations 00097 public: 00098 BOOL Start(); 00099 void Stop(); 00100 BOOL StartIfEnabled(); 00101 CString GetStringCLSID() const; 00102 protected: 00103 HICON LookupIcon(); 00104 00105 }; 00106 00107 extern CPlugins Plugins; 00108 00109 #endif // !defined(AFX_PLUGINS_H__3EDF2C68_FCEB_438E_A5CD_CF5DC1114FC4__INCLUDED_)