]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/regconf.h
wxMenu::Insert() seems to work, bug in wxMenuBase::Insert() is corrected
[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>
bbcdf8bc 9// Licence: wxWindows licence
45c28815
VZ
10///////////////////////////////////////////////////////////////////////////////
11
12#ifndef _REGCONF_H
13#define _REGCONF_H
14
0d3820b3
JS
15#ifdef __GNUG__
16#pragma interface "regconf.h"
17#endif
18
8f494e5d
VZ
19#ifndef _REGISTRY_H
20 #include <wx/msw/registry.h>
21#endif
22
45c28815
VZ
23// ----------------------------------------------------------------------------
24// wxRegConfig
25// ----------------------------------------------------------------------------
26
6c905cb7 27class WXDLLEXPORT wxRegConfig : public wxConfigBase
45c28815
VZ
28{
29public:
30 // ctor & dtor
18244936 31 // will store data in HKLM\appName and HKCU\appName
9869734d
VZ
32 wxRegConfig(const wxString& appName = "",
33 const wxString& vendorName = "",
34 const wxString& localFilename = "",
35 const wxString& globalFilename = "",
a7ee1343 36 long style = 0);
18244936 37
45c28815
VZ
38 // dtor will save unsaved data
39 virtual ~wxRegConfig();
40
41 // implement inherited pure virtual functions
42 // ------------------------------------------
43
44 // path management
45 virtual void SetPath(const wxString& strPath);
46 virtual const wxString& GetPath() const { return m_strPath; }
47
8f494e5d
VZ
48 // entry/subgroup info
49 // enumerate all of them
50 virtual bool GetFirstGroup(wxString& str, long& lIndex) const;
51 virtual bool GetNextGroup (wxString& str, long& lIndex) const;
52 virtual bool GetFirstEntry(wxString& str, long& lIndex) const;
53 virtual bool GetNextEntry (wxString& str, long& lIndex) const;
45c28815 54
8f494e5d 55 // tests for existence
6d833566
VZ
56 virtual bool HasGroup(const wxString& strName) const;
57 virtual bool HasEntry(const wxString& strName) const;
61ba49f2 58 virtual EntryType GetEntryType(const wxString& name) const;
6d833566 59
a37e8836
JS
60 // get number of entries/subgroups in the current group, with or without
61 // it's subgroups
3cda6353
VZ
62 virtual size_t GetNumberOfEntries(bool bRecursive = FALSE) const;
63 virtual size_t GetNumberOfGroups(bool bRecursive = FALSE) const;
a37e8836 64
45c28815 65 // read/write
18244936
JS
66 bool Read(const wxString& key, wxString *pStr) const;
67 bool Read(const wxString& key, wxString *pStr, const wxString& szDefault) const;
e43cab59
UC
68 wxString Read(const wxString& key, const wxString& defVal) const
69 { return wxConfigBase::Read(key, defVal); }
70
18244936 71 bool Read(const wxString& key, long *plResult) const;
e43cab59
UC
72 bool Read(const wxString& key, long *pl, long defVal) const
73 { return wxConfigBase::Read(key, pl, defVal); }
74 long Read(const wxString& key, long defVal) const
75 { return wxConfigBase::Read(key, defVal); }
76
18244936 77 // The following are necessary to satisfy the compiler
dfad0599 78 bool Read(const wxString& key, int *pi, int defVal) const
e43cab59
UC
79 { return wxConfigBase::Read(key, pi, defVal); }
80 bool Read(const wxString& key, int *pi) const
81 { return wxConfigBase::Read(key, pi); }
82
83 bool Read(const wxString& key, double* val, double defVal) const
84 { return wxConfigBase::Read(key, val, defVal); }
85 bool Read(const wxString& key, double* val) const
86 { return wxConfigBase::Read(key, val); }
87
88 bool Read(const wxString& key, bool *pb, bool defVal) const
89 { return wxConfigBase::Read(key, pb, defVal); }
90 bool Read(const wxString& key, bool *pb) const
91 { return wxConfigBase::Read(key, pb); }
92
18244936
JS
93 bool Write(const wxString& key, const wxString& szValue);
94 bool Write(const wxString& key, long lValue);
e43cab59
UC
95 bool Write(const wxString& key, double dValue)
96 { return wxConfigBase::Write(key, dValue); }
97 bool Write(const wxString& key, bool bValue)
98 { return wxConfigBase::Write(key, bValue); }
18244936 99
cf447356 100 virtual bool Flush(bool /* bCurrentOnly = FALSE */ ) { return TRUE; }
45c28815 101
5d1902d6
VZ
102 // rename
103 virtual bool RenameEntry(const wxString& oldName, const wxString& newName);
104 virtual bool RenameGroup(const wxString& oldName, const wxString& newName);
105
45c28815 106 // delete
18244936
JS
107 virtual bool DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso);
108 virtual bool DeleteGroup(const wxString& key);
45c28815
VZ
109 virtual bool DeleteAll();
110
111private:
fd3f686c
VZ
112 // no copy ctor/assignment operator
113 wxRegConfig(const wxRegConfig&);
114 wxRegConfig& operator=(const wxRegConfig&);
115
45c28815
VZ
116 // these keys are opened during all lifetime of wxRegConfig object
117 wxRegKey m_keyLocalRoot, m_keyLocal,
118 m_keyGlobalRoot, m_keyGlobal;
119
120 // current path (not '/' terminated)
121 wxString m_strPath;
122};
123
cf447356 124#endif //_REGCONF_H