1 /////////////////////////////////////////////////////////////////////////////
\r
3 // This file is part of ResizableLib
\r
4 // http://sourceforge.net/projects/resizablelib
\r
6 // Copyright (C) 2000-2004 by Paolo Messina
\r
7 // http://www.geocities.com/ppescher - mailto:ppescher@hotmail.com
\r
9 // The contents of this file are subject to the Artistic License (the "License").
\r
10 // You may not use this file except in compliance with the License.
\r
11 // You may obtain a copy of the License at:
\r
12 // http://www.opensource.org/licenses/artistic-license.html
\r
14 // If you find this code useful, credits would be nice!
\r
16 /////////////////////////////////////////////////////////////////////////////
\r
20 * @brief Implementation of the CResizableSheetState class.
\r
24 #include "ResizableSheetState.h"
\r
26 //////////////////////////////////////////////////////////////////////
\r
27 // Construction/Destruction
\r
28 //////////////////////////////////////////////////////////////////////
\r
30 CResizableSheetState::CResizableSheetState()
\r
35 CResizableSheetState::~CResizableSheetState()
\r
40 // used to save/restore active page
\r
41 // either in the registry or a private .INI file
\r
42 // depending on your application settings
\r
44 #define ACTIVEPAGE_ENT _T("ActivePage")
\r
47 * This function saves the current property sheet active page using the base
\r
48 * class persist method.
\r
49 * @sa CResizableState::WriteState
\r
51 * @param pszName String that identifies stored settings
\r
53 * @return Returns @a TRUE if successful, @a FALSE otherwise
\r
55 BOOL CResizableSheetState::SavePage(LPCTSTR pszName)
\r
57 // saves active page index, or the initial page if problems
\r
58 // cannot use GetActivePage, because it always fails
\r
60 CPropertySheet* pSheet = DYNAMIC_DOWNCAST(CPropertySheet, GetResizableWnd());
\r
64 int page = pSheet->m_psh.nStartPage;
\r
65 CTabCtrl *pTab = pSheet->GetTabControl();
\r
67 page = pTab->GetCurSel();
\r
69 page = pSheet->m_psh.nStartPage;
\r
72 _itot(page, data.GetBuffer(10), 10);
\r
73 id = CString(pszName) + ACTIVEPAGE_ENT;
\r
74 return WriteState(id, data);
\r
78 * This function loads the active page using the base class persist method.
\r
79 * @sa CResizableState::ReadState
\r
81 * @param pszName String that identifies stored settings
\r
83 * @return Returns @a TRUE if successful, @a FALSE otherwise
\r
85 BOOL CResizableSheetState::LoadPage(LPCTSTR pszName)
\r
87 // restore active page, zero (the first) if not found
\r
90 id = CString(pszName) + ACTIVEPAGE_ENT;
\r
91 if (!ReadState(id, data))
\r
94 int page = _ttoi(data);
\r
95 CPropertySheet* pSheet = DYNAMIC_DOWNCAST(CPropertySheet, GetResizableWnd());
\r
97 return pSheet->SetActivePage(page);
\r