00001
00035 #pragma once
00036
00037 #pragma warning(push) // disable for this header only
00038 #pragma warning(disable:4312)
00039
00040 #include <streams.h>
00041 #pragma warning(pop) // restore original warning level
00042
00043 #include <Commctrl.h>
00044
00045 #include <DirectShow/SettingsInterface.h>
00046
00047 #include "resource.h"
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 #define BUFFER_SIZE 256
00059
00060 class FilterPropertiesBase : public CBasePropertyPage
00061 {
00062 public:
00063 HRESULT OnConnect(IUnknown *pUnk)
00064 {
00065 if (pUnk == NULL)
00066 {
00067 return E_POINTER;
00068 }
00069 ASSERT(m_pSettingsInterface == NULL);
00070
00071 return pUnk->QueryInterface(IID_ISettingsInterface,
00072 reinterpret_cast<void**>(&m_pSettingsInterface));
00073 }
00074
00075 HRESULT OnActivate(void)
00076 {
00077 INITCOMMONCONTROLSEX icc;
00078 icc.dwSize = sizeof(INITCOMMONCONTROLSEX);
00079 icc.dwICC = ICC_BAR_CLASSES;
00080 if (InitCommonControlsEx(&icc) == FALSE)
00081 {
00082 return E_FAIL;
00083 }
00084
00085 ASSERT(m_pSettingsInterface != NULL);
00086
00087 return ReadSettings();
00088 }
00089
00090 BOOL OnReceiveMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
00091 {
00092
00093 SetDirty();
00094
00095 return CBasePropertyPage::OnReceiveMessage(hwnd,uMsg,wParam,lParam);
00096 }
00097
00098 HRESULT OnApplyChanges(void) = 0;
00099
00100 HRESULT OnDisconnect(void)
00101 {
00102 if (m_pSettingsInterface)
00103 {
00104 m_pSettingsInterface->Release();
00105 m_pSettingsInterface = NULL;
00106 }
00107 return S_OK;
00108 }
00109 protected:
00110
00111 FilterPropertiesBase::FilterPropertiesBase(char* szName, IUnknown *pUnk, int nDialogId, int nTitleId) :
00112 CBasePropertyPage(szName, pUnk, nDialogId, nTitleId),
00113 m_pSettingsInterface(NULL)
00114 {;}
00115
00116 virtual HRESULT ReadSettings() = 0;
00117
00118
00119 void SetDirty()
00120 {
00121 m_bDirty = TRUE;
00122 if (m_pPageSite)
00123 {
00124 m_pPageSite->OnStatusChange(PROPPAGESTATUS_DIRTY);
00125 }
00126 }
00127
00128
00129 ISettingsInterface* m_pSettingsInterface;
00130 };
00131