1 /*
2  * ReactOS Explorer
3  *
4  * Copyright 2009 Andrew Hill <ash77@reactos.org>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20 
21 #pragma once
22 
23 struct SBFOLDERSETTINGS // Private version of DEFFOLDERSETTINGS used by CShellBrowser
24 {
25     FOLDERSETTINGS FolderSettings;
26 
27     enum { DEF_FVM = FVM_DETAILS }; // Windows uses FVM_ICON?
28     enum { DEF_FWF = FWF_NOHEADERINALLVIEWS };
29     void InitializeDefaults()
30     {
31         FolderSettings.ViewMode = DEF_FVM;
32         FolderSettings.fFlags = DEF_FWF;
33     }
34     void Load();
35 };
36 
37 class CGlobalFolderSettings :
38     public CComCoClass<CGlobalFolderSettings, &CLSID_GlobalFolderSettings>,
39     public CComObjectRootEx<CComMultiThreadModelNoCS>,
40     public IGlobalFolderSettings
41 {
42 private:
43 public:
44     CGlobalFolderSettings();
45     ~CGlobalFolderSettings();
46 
47     static HRESULT ResetBrowserSettings();
48     static HRESULT SaveBrowserSettings(const SBFOLDERSETTINGS &sbfs);
49     static HRESULT Load(DEFFOLDERSETTINGS &dfs);
50     static HRESULT Save(const DEFFOLDERSETTINGS *pFDS);
51 
52     // *** IGlobalFolderSettings methods ***
53     STDMETHOD(Get)(struct DEFFOLDERSETTINGS *pFDS, UINT cb) override;
54     STDMETHOD(Set)(const struct DEFFOLDERSETTINGS *pFDS, UINT cb, UINT unknown) override;
55 
56     DECLARE_REGISTRY_RESOURCEID(IDR_GLOBALFOLDERSETTINGS)
57     DECLARE_NOT_AGGREGATABLE(CGlobalFolderSettings)
58 
59     DECLARE_PROTECT_FINAL_CONSTRUCT()
60 
61     BEGIN_COM_MAP(CGlobalFolderSettings)
62         COM_INTERFACE_ENTRY_IID(IID_IGlobalFolderSettings, IGlobalFolderSettings)
63     END_COM_MAP()
64 };
65