]> git.saurik.com Git - wxWidgets.git/blob - utils/wxPython/src/utils.i
Corrected link error for missing wxRegTipProvider::GetTip by giving it
[wxWidgets.git] / utils / wxPython / src / utils.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: utils.i
3 // Purpose: SWIG definitions of various utility classes
4 //
5 // Author: Robin Dunn
6 //
7 // Created: 25-nov-1998
8 // RCS-ID: $Id$
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13
14 %module utils
15
16 %{
17 #include "helpers.h"
18 #include <wx/config.h>
19 %}
20
21 //---------------------------------------------------------------------------
22
23 %include typemaps.i
24 %include my_typemaps.i
25
26
27 %{
28 #ifdef SEPARATE
29 wxString wxPyEmptyStr("");
30 #endif
31 %}
32
33
34 %{
35 static PyObject* __EnumerationHelper(bool flag, wxString& str, long index) {
36 PyObject* ret = PyTuple_New(3);
37 if (ret) {
38 PyTuple_SET_ITEM(ret, 0, PyInt_FromLong(flag));
39 PyTuple_SET_ITEM(ret, 1, PyString_FromString(str));
40 PyTuple_SET_ITEM(ret, 2, PyInt_FromLong(index));
41 }
42 return ret;
43 }
44 %}
45
46 //---------------------------------------------------------------------------
47
48 class wxConfig {
49 public:
50 wxConfig(const wxString& appName = wxPyEmptyStr,
51 const wxString& vendorName = wxPyEmptyStr,
52 const wxString& localFilename = wxPyEmptyStr,
53 const wxString& globalFilename = wxPyEmptyStr,
54 long style = 0);
55 ~wxConfig();
56
57
58 void DontCreateOnDemand();
59 bool DeleteAll(); // This is supposed to have been fixed...
60 bool DeleteEntry(const wxString& key, bool bDeleteGroupIfEmpty = TRUE);
61 bool DeleteGroup(const wxString& key);
62 bool Exists(wxString& strName);
63 bool Flush(bool bCurrentOnly = FALSE);
64 wxString GetAppName();
65
66
67 // Each of these enumeration methods return a 3-tuple consisting of
68 // the continue flag, the value string, and the index for the next call.
69 %addmethods {
70 PyObject* GetFirstGroup() {
71 bool cont;
72 long index = 0;
73 wxString value;
74
75 cont = self->GetFirstGroup(value, index);
76 return __EnumerationHelper(cont, value, index);
77 }
78
79 PyObject* GetFirstEntry() {
80 bool cont;
81 long index = 0;
82 wxString value;
83
84 cont = self->GetFirstEntry(value, index);
85 return __EnumerationHelper(cont, value, index);
86 }
87
88 PyObject* GetNextGroup(long index) {
89 bool cont;
90 wxString value;
91
92 cont = self->GetNextGroup(value, index);
93 return __EnumerationHelper(cont, value, index);
94 }
95
96 PyObject* GetNextEntry(long index) {
97 bool cont;
98 wxString value;
99
100 cont = self->GetNextEntry(value, index);
101 return __EnumerationHelper(cont, value, index);
102 }
103 }
104
105
106 int GetNumberOfEntries(bool bRecursive = FALSE);
107 int GetNumberOfGroups(bool bRecursive = FALSE);
108 wxString GetPath();
109 wxString GetVendorName();
110 bool HasEntry(wxString& strName);
111 bool HasGroup(const wxString& strName);
112 bool IsExpandingEnvVars();
113 bool IsRecordingDefaults();
114
115 wxString Read(const wxString& key, const wxString& defaultVal = wxPyEmptyStr);
116 %name(ReadInt)long Read(const wxString& key, long defaultVal = 0);
117 %name(ReadFloat)double Read(const wxString& key, double defaultVal = 0.0);
118
119 void SetExpandEnvVars (bool bDoIt = TRUE);
120 void SetPath(const wxString& strPath);
121 void SetRecordDefaults(bool bDoIt = TRUE);
122
123 bool Write(const wxString& key, const wxString& value);
124 %name(WriteInt)bool Write(const wxString& key, long value);
125 %name(WriteFloat)bool Write(const wxString& key, double value);
126
127 };
128
129
130 //---------------------------------------------------------------------------
131
132 %init %{
133
134 wxClassInfo::CleanUpClasses();
135 wxClassInfo::InitializeClasses();
136
137 %}
138
139 //---------------------------------------------------------------------------