]> git.saurik.com Git - wxWidgets.git/blob - utils/wxPython/src/utils.i
wxString docs are nearly complete (but don't compile :-( ), a brief threads
[wxWidgets.git] / utils / wxPython / src / utils.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: utils.i
3 // Purpose: SWIG definitions of various utility classes 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 #ifdef SEPARATE
28 %{
29 static wxString wxPyEmptyStr("");
30 %}
31 #endif
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 //static wxConfigBase * Create();
58 //static wxConfigBase * Get();
59 //static wxConfigBase * Set(wxConfigBase *pConfig);
60
61
62
63 void DontCreateOnDemand();
64 bool DeleteAll(); // This is supposed to have been fixed...
65 bool DeleteEntry(const wxString& key, bool bDeleteGroupIfEmpty = TRUE);
66 bool DeleteGroup(const wxString& key);
67 bool Exists(wxString& strName);
68 bool Flush(bool bCurrentOnly = FALSE);
69 wxString GetAppName();
70
71
72 // Each of these enumeration methods return a 3-tuple consisting of
73 // the continue flag, the value string, and the index for the next call.
74 %addmethods {
75 PyObject* GetFirstGroup() {
76 bool cont;
77 long index = 0;
78 wxString value;
79
80 cont = self->GetFirstGroup(value, index);
81 return __EnumerationHelper(cont, value, index);
82 }
83
84 PyObject* GetFirstEntry() {
85 bool cont;
86 long index = 0;
87 wxString value;
88
89 cont = self->GetFirstEntry(value, index);
90 return __EnumerationHelper(cont, value, index);
91 }
92
93 PyObject* GetNextGroup(long index) {
94 bool cont;
95 wxString value;
96
97 cont = self->GetNextGroup(value, index);
98 return __EnumerationHelper(cont, value, index);
99 }
100
101 PyObject* GetNextEntry(long index) {
102 bool cont;
103 wxString value;
104
105 cont = self->GetNextEntry(value, index);
106 return __EnumerationHelper(cont, value, index);
107 }
108 }
109
110
111 int GetNumberOfEntries(bool bRecursive = FALSE);
112 int GetNumberOfGroups(bool bRecursive = FALSE);
113 wxString GetPath();
114 wxString GetVendorName();
115 bool HasEntry(wxString& strName);
116 bool HasGroup(const wxString& strName);
117 bool IsExpandingEnvVars();
118 bool IsRecordingDefaults();
119
120 wxString Read(const wxString& key, const wxString& defaultVal = wxPyEmptyStr);
121 %name(ReadInt)long Read(const wxString& key, long defaultVal = 0);
122 %name(ReadFloat)double Read(const wxString& key, double defaultVal = 0.0);
123
124 void SetAppName(const wxString& appName);
125 void SetExpandEnvVars (bool bDoIt = TRUE);
126 void SetPath(const wxString& strPath);
127 void SetRecordDefaults(bool bDoIt = TRUE);
128 void SetVendorName(const wxString& vendorName);
129
130 bool Write(const wxString& key, const wxString& value);
131 %name(WriteInt)bool Write(const wxString& key, long value);
132 %name(WriteFloat)bool Write(const wxString& key, double value);
133
134 };
135
136
137 //---------------------------------------------------------------------------
138 /////////////////////////////////////////////////////////////////////////////
139 //
140 // $Log$
141 // Revision 1.2 1999/02/20 09:03:02 RD
142 // Added wxWindow_FromHWND(hWnd) for wxMSW to construct a wxWindow from a
143 // window handle. If you can get the window handle into the python code,
144 // it should just work... More news on this later.
145 //
146 // Added wxImageList, wxToolTip.
147 //
148 // Re-enabled wxConfig.DeleteAll() since it is reportedly fixed for the
149 // wxRegConfig class.
150 //
151 // As usual, some bug fixes, tweaks, etc.
152 //
153 // Revision 1.1 1998/12/15 20:41:23 RD
154 // Changed the import semantics from "from wxPython import *" to "from
155 // wxPython.wx import *" This is for people who are worried about
156 // namespace pollution, they can use "from wxPython import wx" and then
157 // prefix all the wxPython identifiers with "wx."
158 //
159 // Added wxTaskbarIcon for wxMSW.
160 //
161 // Made the events work for wxGrid.
162 //
163 // Added wxConfig.
164 //
165 // Added wxMiniFrame for wxGTK, (untested.)
166 //
167 // Changed many of the args and return values that were pointers to gdi
168 // objects to references to reflect changes in the wxWindows API.
169 //
170 // Other assorted fixes and additions.
171 //