]> git.saurik.com Git - wxWidgets.git/blob - utils/wxPython/src/utils.i
Added wxSashWindow, wxSashEvent, wxLayoutAlgorithm, etc.
[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 // **** DANGER Will Robinson! DANGER! bool DeleteAll();
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.1 1998/12/15 20:41:23 RD
142 // Changed the import semantics from "from wxPython import *" to "from
143 // wxPython.wx import *" This is for people who are worried about
144 // namespace pollution, they can use "from wxPython import wx" and then
145 // prefix all the wxPython identifiers with "wx."
146 //
147 // Added wxTaskbarIcon for wxMSW.
148 //
149 // Made the events work for wxGrid.
150 //
151 // Added wxConfig.
152 //
153 // Added wxMiniFrame for wxGTK, (untested.)
154 //
155 // Changed many of the args and return values that were pointers to gdi
156 // objects to references to reflect changes in the wxWindows API.
157 //
158 // Other assorted fixes and additions.
159 //