00001 // 00002 // WndSettingsSheet.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 #pragma once 00023 00024 #include "DlgSkinDialog.h" 00025 #include "CtrlIconButton.h" 00026 00027 class CSettingsPage; 00028 00029 00030 class CSettingsSheet : public CSkinDialog 00031 { 00032 // Construction 00033 public: 00034 CSettingsSheet(CWnd* pParent = NULL, UINT nCaptionID = 0); 00035 virtual ~CSettingsSheet(); 00036 00037 DECLARE_DYNAMIC(CSettingsSheet) 00038 00039 // Attributes 00040 protected: 00041 CObArray m_pPages; 00042 CSettingsPage* m_pPage; 00043 CSettingsPage* m_pFirst; 00044 CSize m_szPages; 00045 protected: 00046 CTreeCtrl m_wndTree; 00047 CButton m_wndOK; 00048 CButton m_wndCancel; 00049 CButton m_wndApply; 00050 BOOL m_bModified; 00051 protected: 00052 DLGTEMPLATE* m_pTemplate; 00053 CString m_sCaption; 00054 int m_nLeftMargin; 00055 int m_nTopMargin; 00056 int m_nListWidth; 00057 int m_nListMargin; 00058 int m_nButtonHeight; 00059 00060 // Operations 00061 public: 00062 void AddPage(CSettingsPage* pPage, LPCTSTR pszCaption = NULL); 00063 void AddGroup(CSettingsPage* pPage, LPCTSTR pszCaption = NULL); 00064 CSettingsPage* GetPage(int nPage) const; 00065 CSettingsPage* GetPage(CRuntimeClass* pClass) const; 00066 CSettingsPage* GetPage(LPCTSTR pszClass) const; 00067 int GetPageIndex(CSettingsPage* pPage) const; 00068 int GetPageCount() const; 00069 CSettingsPage* GetActivePage() const; 00070 BOOL SetActivePage(CSettingsPage* pPage); 00071 BOOL SetActivePage(int nPage); 00072 BOOL IsModified() const; 00073 void SetModified(BOOL bChanged = TRUE); 00074 int DoModal(); 00075 protected: 00076 void BuildTree(); 00077 void Layout(); 00078 BOOL CreatePage(CSettingsPage* pPage); 00079 virtual void DoPaint(CDC& dc); 00080 00081 // Overrides 00082 protected: 00083 virtual void DoDataExchange(CDataExchange* pDX); 00084 virtual BOOL OnInitDialog(); 00085 virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam); 00086 00087 // Implementation 00088 protected: 00089 DECLARE_MESSAGE_MAP() 00090 afx_msg void OnPaint(); 00091 virtual void OnOK(); 00092 virtual void OnCancel(); 00093 afx_msg void OnApply(); 00094 afx_msg void OnTreeExpanding(NM_TREEVIEW* pNotify, LRESULT *pResult); 00095 afx_msg void OnSelectPage(NM_TREEVIEW* pNotify, LRESULT *pResult); 00096 00097 }; 00098 00099 #define IDC_SETTINGS_TREE 100