]> git.saurik.com Git - wxWidgets.git/blob - utils/wxPython/src/utils.i
Some slight cleanup and reorganization
[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 //
133 // $Log$
134 // Revision 1.5 1999/05/01 04:40:57 RD
135 // wxPython 2.0b9, second phase (gtk)
136 // Added gobs of stuff, see wxPython/README.txt for details
137 //
138 // Revision 1.4 1999/04/30 03:29:19 RD
139 //
140 // wxPython 2.0b9, first phase (win32)
141 // Added gobs of stuff, see wxPython/README.txt for details
142 //
143 // Revision 1.3.4.1 1999/03/27 23:29:15 RD
144 //
145 // wxPython 2.0b8
146 // Python thread support
147 // various minor additions
148 // various minor fixes
149 //
150 // Revision 1.3 1999/02/25 07:08:36 RD
151 //
152 // wxPython version 2.0b5
153 //
154 // Revision 1.2 1999/02/20 09:03:02 RD
155 // Added wxWindow_FromHWND(hWnd) for wxMSW to construct a wxWindow from a
156 // window handle. If you can get the window handle into the python code,
157 // it should just work... More news on this later.
158 //
159 // Added wxImageList, wxToolTip.
160 //
161 // Re-enabled wxConfig.DeleteAll() since it is reportedly fixed for the
162 // wxRegConfig class.
163 //
164 // As usual, some bug fixes, tweaks, etc.
165 //
166 // Revision 1.1 1998/12/15 20:41:23 RD
167 // Changed the import semantics from "from wxPython import *" to "from
168 // wxPython.wx import *" This is for people who are worried about
169 // namespace pollution, they can use "from wxPython import wx" and then
170 // prefix all the wxPython identifiers with "wx."
171 //
172 // Added wxTaskbarIcon for wxMSW.
173 //
174 // Made the events work for wxGrid.
175 //
176 // Added wxConfig.
177 //
178 // Added wxMiniFrame for wxGTK, (untested.)
179 //
180 // Changed many of the args and return values that were pointers to gdi
181 // objects to references to reflect changes in the wxWindows API.
182 //
183 // Other assorted fixes and additions.
184 //