]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/regconf.h
put wxUSE_DATAVIEWCTRL in alphabetical order
[wxWidgets.git] / include / wx / msw / regconf.h
CommitLineData
45c28815 1///////////////////////////////////////////////////////////////////////////////
9869734d 2// Name: msw/regconf.h
8f494e5d 3// Purpose: Registry based implementation of wxConfigBase
45c28815 4// Author: Vadim Zeitlin
9869734d 5// Modified by:
45c28815
VZ
6// Created: 27.04.98
7// RCS-ID: $Id$
8// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
65571936 9// Licence: wxWindows licence
45c28815
VZ
10///////////////////////////////////////////////////////////////////////////////
11
12#ifndef _REGCONF_H
13#define _REGCONF_H
14
8f494e5d 15#ifndef _REGISTRY_H
85d4fc42 16 #include "wx/msw/registry.h"
8f494e5d 17#endif
fdd74b41 18
85d4fc42 19#include "wx/object.h"
fdd74b41 20#include "wx/confbase.h"
8f494e5d 21
45c28815
VZ
22// ----------------------------------------------------------------------------
23// wxRegConfig
24// ----------------------------------------------------------------------------
25
40a88328 26class WXDLLIMPEXP_BASE wxRegConfig : public wxConfigBase
45c28815
VZ
27{
28public:
29 // ctor & dtor
18244936 30 // will store data in HKLM\appName and HKCU\appName
fda7962d
JS
31 wxRegConfig(const wxString& appName = wxEmptyString,
32 const wxString& vendorName = wxEmptyString,
33 const wxString& localFilename = wxEmptyString,
34 const wxString& globalFilename = wxEmptyString,
fa2d17ac 35 long style = wxCONFIG_USE_GLOBAL_FILE);
18244936 36
45c28815 37 // dtor will save unsaved data
6fb99eb3 38 virtual ~wxRegConfig(){}
45c28815
VZ
39
40 // implement inherited pure virtual functions
41 // ------------------------------------------
42
43 // path management
44 virtual void SetPath(const wxString& strPath);
45 virtual const wxString& GetPath() const { return m_strPath; }
46
8f494e5d
VZ
47 // entry/subgroup info
48 // enumerate all of them
49 virtual bool GetFirstGroup(wxString& str, long& lIndex) const;
50 virtual bool GetNextGroup (wxString& str, long& lIndex) const;
51 virtual bool GetFirstEntry(wxString& str, long& lIndex) const;
52 virtual bool GetNextEntry (wxString& str, long& lIndex) const;
45c28815 53
8f494e5d 54 // tests for existence
6d833566
VZ
55 virtual bool HasGroup(const wxString& strName) const;
56 virtual bool HasEntry(const wxString& strName) const;
61ba49f2 57 virtual EntryType GetEntryType(const wxString& name) const;
6d833566 58
a37e8836
JS
59 // get number of entries/subgroups in the current group, with or without
60 // it's subgroups
4d08943e
WS
61 virtual size_t GetNumberOfEntries(bool bRecursive = false) const;
62 virtual size_t GetNumberOfGroups(bool bRecursive = false) const;
a37e8836 63
4d08943e 64 virtual bool Flush(bool WXUNUSED(bCurrentOnly) = false) { return true; }
45c28815 65
5d1902d6
VZ
66 // rename
67 virtual bool RenameEntry(const wxString& oldName, const wxString& newName);
68 virtual bool RenameGroup(const wxString& oldName, const wxString& newName);
69
45c28815 70 // delete
4d08943e 71 virtual bool DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso = true);
18244936 72 virtual bool DeleteGroup(const wxString& key);
45c28815
VZ
73 virtual bool DeleteAll();
74
807a903e
VZ
75protected:
76 // opens the local key creating it if necessary and returns it
77 wxRegKey& LocalKey() const // must be const to be callable from const funcs
78 {
79 wxRegConfig* self = wxConstCast(this, wxRegConfig);
80
81 if ( !m_keyLocal.IsOpened() )
82 {
83 // create on demand
84 self->m_keyLocal.Create();
85 }
86
87 return self->m_keyLocal;
88 }
89
2ba41305
VZ
90 // implement read/write methods
91 virtual bool DoReadString(const wxString& key, wxString *pStr) const;
92 virtual bool DoReadLong(const wxString& key, long *plResult) const;
93
94 virtual bool DoWriteString(const wxString& key, const wxString& szValue);
95 virtual bool DoWriteLong(const wxString& key, long lValue);
96
45c28815 97private:
fd3f686c
VZ
98 // no copy ctor/assignment operator
99 wxRegConfig(const wxRegConfig&);
100 wxRegConfig& operator=(const wxRegConfig&);
101
45c28815
VZ
102 // these keys are opened during all lifetime of wxRegConfig object
103 wxRegKey m_keyLocalRoot, m_keyLocal,
104 m_keyGlobalRoot, m_keyGlobal;
105
106 // current path (not '/' terminated)
107 wxString m_strPath;
108};
109
cf447356 110#endif //_REGCONF_H