X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f6bcfd974ef26faf6f91a62cac09827e09463fd1..7cdecac3b7597a3cbb9155d5ee46b852293d8c26:/wxPython/src/utils.i diff --git a/wxPython/src/utils.i b/wxPython/src/utils.i index 03fad77f9f..a40bb9ada1 100644 --- a/wxPython/src/utils.i +++ b/wxPython/src/utils.i @@ -4,7 +4,7 @@ // // Author: Robin Dunn // -// Created: 25-nov-1998 +// Created: 25-Nov-1998 // RCS-ID: $Id$ // Copyright: (c) 1998 by Total Control Software // Licence: wxWindows license @@ -14,7 +14,7 @@ %module utils %{ -#include "helpers.h" +#include "export.h" #include #include #include @@ -25,12 +25,17 @@ %include typemaps.i %include my_typemaps.i +// Import some definitions of other classes, etc. +%import _defs.i + %pragma(python) code = "import string" //--------------------------------------------------------------------------- %{ + static wxString wxPyEmptyStr(""); + static PyObject* __EnumerationHelper(bool flag, wxString& str, long index) { PyObject* ret = PyTuple_New(3); if (ret) { @@ -144,8 +149,24 @@ public: bool IsRecordingDefaults(); wxString Read(const wxString& key, const wxString& defaultVal = wxPyEmptyStr); - %name(ReadInt)long Read(const wxString& key, long defaultVal = 0); - %name(ReadFloat)double Read(const wxString& key, double defaultVal = 0.0); + + %addmethods { + long ReadInt(const wxString& key, long defaultVal = 0) { + long rv; + self->Read(key, &rv, defaultVal); + return rv; + } + double ReadFloat(const wxString& key, double defaultVal = 0.0) { + double rv; + self->Read(key, &rv, defaultVal); + return rv; + } + bool ReadBool(const wxString& key, bool defaultVal = FALSE) { + bool rv; + self->Read(key, &rv, defaultVal); + return rv; + } + } void SetExpandEnvVars (bool bDoIt = TRUE); void SetPath(const wxString& strPath); @@ -159,6 +180,7 @@ public: bool Write(const wxString& key, const wxString& value); %name(WriteInt)bool Write(const wxString& key, long value); %name(WriteFloat)bool Write(const wxString& key, double value); + %name(WriteBool)bool Write(const wxString& key, bool value); EntryType GetEntryType(const wxString& name); bool RenameEntry(const wxString& oldName, @@ -170,8 +192,10 @@ public: }; + //--------------------------------------------------------------------------- +// This will be a wxRegConfig on Win32 and wxFileConfig otherwise. class wxConfig : public wxConfigBase { public: wxConfig(const wxString& appName = wxPyEmptyStr, @@ -182,6 +206,8 @@ public: ~wxConfig(); }; + +// Sometimes it's nice to explicitly have a wxFileConfig too. class wxFileConfig : public wxConfigBase { public: wxFileConfig(const wxString& appName = wxPyEmptyStr, @@ -511,10 +537,10 @@ public: int n = 1, Month month = Inv_Month, int year = Inv_Year); - wxDateTime GetWeekDay(WeekDay weekday, - int n = 1, - Month month = Inv_Month, - int year = Inv_Year); +// wxDateTime GetWeekDay(WeekDay weekday, +// int n = 1, +// Month month = Inv_Month, +// int year = Inv_Year); // sets to the last weekday in the given month, year bool SetToLastWeekDay(WeekDay weekday, @@ -1027,10 +1053,8 @@ wxLongLong wxGetLocalTimeMillis(); //--------------------------------------------------------------------------- %init %{ - -// wxClassInfo::CleanUpClasses(); -// wxClassInfo::InitializeClasses(); - + wxClassInfo::CleanUpClasses(); + wxClassInfo::InitializeClasses(); %} //---------------------------------------------------------------------------