Added docstrings
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25890 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
ef22e3d35e
commit
6ad421ae90
@ -17,27 +17,97 @@
|
||||
%newgroup;
|
||||
|
||||
|
||||
DocStr(wxColour,
|
||||
"A colour is an object representing a combination of Red, Green, and Blue (RGB)
|
||||
intensity values, and is used to determine drawing colours, window colours,
|
||||
etc. Valid RGB values are in the range 0 to 255.
|
||||
|
||||
In wxPython there are typemaps that will automatically convert from a colour
|
||||
name, or from a \"#RRGGBB\" colour hex value string to a wx.Colour object when
|
||||
calling C++ methods that expect a wxColour. This means that the following are
|
||||
all equivallent:
|
||||
|
||||
win.SetBackgroundColour(wxColour(0,0,255))
|
||||
win.SetBackgroundColour(\"BLUE\")
|
||||
win.SetBackgroundColour(\"#0000FF\")
|
||||
|
||||
You can retrieve the various current system colour settings with
|
||||
wx.SystemSettings.GetColour.");
|
||||
|
||||
|
||||
class wxColour : public wxObject {
|
||||
public:
|
||||
wxColour(unsigned char red=0, unsigned char green=0, unsigned char blue=0);
|
||||
|
||||
DocCtorStr(
|
||||
wxColour(unsigned char red=0, unsigned char green=0, unsigned char blue=0),
|
||||
"Constructs a colour from red, green and blue values.");
|
||||
|
||||
DocCtorStrName(
|
||||
wxColour( const wxString& colorName),
|
||||
"Constructs a colour object using a colour name listed in wx.TheColourDatabase.",
|
||||
NamedColour);
|
||||
|
||||
DocCtorStrName(
|
||||
wxColour( unsigned long colRGB ),
|
||||
"Constructs a colour from a packed RGB value.",
|
||||
ColourRGB);
|
||||
|
||||
~wxColour();
|
||||
|
||||
%name(NamedColour) wxColour( const wxString& colorName);
|
||||
%name(ColourRGB) wxColour( unsigned long colRGB );
|
||||
|
||||
DocDeclStr(
|
||||
unsigned char , Red(),
|
||||
"Returns the red intensity.");
|
||||
|
||||
DocDeclStr(
|
||||
unsigned char , Green(),
|
||||
"Returns the green intensity.");
|
||||
|
||||
DocDeclStr(
|
||||
unsigned char , Blue(),
|
||||
"Returns the blue intensity.");
|
||||
|
||||
DocDeclStr(
|
||||
bool , Ok(),
|
||||
"Returns True if the colour object is valid (the colour has been\n"
|
||||
"initialised with RGB values).");
|
||||
|
||||
DocDeclStr(
|
||||
void , Set(unsigned char red, unsigned char green, unsigned char blue),
|
||||
"Sets the RGB intensity values.");
|
||||
|
||||
unsigned char Red();
|
||||
unsigned char Green();
|
||||
unsigned char Blue();
|
||||
bool Ok();
|
||||
void Set(unsigned char red, unsigned char green, unsigned char blue);
|
||||
%name(SetRGB) void Set(unsigned long colRGB);
|
||||
DocDeclStrName(
|
||||
void , Set(unsigned long colRGB),
|
||||
"Sets the RGB intensity values from a packed RGB value.",
|
||||
SetRGB);
|
||||
|
||||
bool operator==(const wxColour& colour) const;
|
||||
bool operator!=(const wxColour& colour) const;
|
||||
DocDeclStrName(
|
||||
void , InitFromName(const wxString& colourName),
|
||||
"Sets the RGB intensity values using a colour name listed in wx.TheColourDatabase.",
|
||||
SetFromName);
|
||||
|
||||
|
||||
DocDeclStr(
|
||||
long , GetPixel() const,
|
||||
"Returns a pixel value which is platform-dependent. On Windows, a\n"
|
||||
"COLORREF is returned. On X, an allocated pixel value is returned.\n"
|
||||
"-1 is returned if the pixel is invalid (on X, unallocated).");
|
||||
|
||||
|
||||
DocDeclStr(
|
||||
bool , operator==(const wxColour& colour) const,
|
||||
"Compare colours for equality");
|
||||
|
||||
DocDeclStr(
|
||||
bool , operator!=(const wxColour& colour) const,
|
||||
"Compare colours for inequality");
|
||||
|
||||
|
||||
void InitFromName(const wxString& colourName);
|
||||
|
||||
%extend {
|
||||
DocAStr(Get,
|
||||
"Get() -> (r, g, b)",
|
||||
"Returns the RGB intensity values as a tuple.");
|
||||
PyObject* Get() {
|
||||
PyObject* rv = PyTuple_New(3);
|
||||
int red = -1;
|
||||
@ -53,22 +123,12 @@ public:
|
||||
PyTuple_SetItem(rv, 2, PyInt_FromLong(blue));
|
||||
return rv;
|
||||
}
|
||||
// bool __eq__(PyObject* obj) {
|
||||
// wxColour tmp;
|
||||
// wxColour* ptr = &tmp;
|
||||
// if (obj == Py_None) return False;
|
||||
// wxPyBLOCK_THREADS(bool success = wxColour_helper(obj, &ptr); PyErr_Clear());
|
||||
// if (! success) return False;
|
||||
// return *self == *ptr;
|
||||
// }
|
||||
// bool __ne__(PyObject* obj) {
|
||||
// wxColour tmp;
|
||||
// wxColour* ptr = &tmp;
|
||||
// if (obj == Py_None) return True;
|
||||
// wxPyBLOCK_THREADS(bool success = wxColour_helper(obj, &ptr); PyErr_Clear());
|
||||
// if (! success) return True;
|
||||
// return *self != *ptr;
|
||||
// }
|
||||
|
||||
DocStr(GetRGB,
|
||||
"Return the colour as a packed RGB value");
|
||||
unsigned long GetRGB() {
|
||||
return self->Red() | (self->Green() << 8) | (self->Blue() << 16);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -21,6 +21,33 @@ MAKE_CONST_WXSTRING(ComboBoxNameStr);
|
||||
%newgroup;
|
||||
|
||||
|
||||
DocStr(wxComboBox,
|
||||
"A combobox is like a combination of an edit control and a listbox. It can be
|
||||
displayed as static list with editable or read-only text field; or a drop-down
|
||||
list with text field.");
|
||||
|
||||
RefDoc(wxComboBox, "
|
||||
Styles
|
||||
wx.CB_SIMPLE: Creates a combobox with a permanently displayed list.
|
||||
Windows only.
|
||||
|
||||
wx.CB_DROPDOWN: Creates a combobox with a drop-down list.
|
||||
|
||||
wx.CB_READONLY: Same as wxCB_DROPDOWN but only the strings specified as
|
||||
the combobox choices can be selected, it is impossible
|
||||
to select (even from a program) a string which is not in
|
||||
the choices list.
|
||||
|
||||
wx.CB_SORT: Sorts the entries in the list alphabetically.
|
||||
|
||||
Events
|
||||
|
||||
EVT_COMBOBOX: Sent when an item on the list is selected.
|
||||
EVT_TEXT: Sent when the combobox text changes.
|
||||
");
|
||||
|
||||
|
||||
|
||||
#ifdef __WXMSW__
|
||||
class wxComboBox : public wxChoice
|
||||
#else
|
||||
@ -31,45 +58,101 @@ public:
|
||||
%pythonAppend wxComboBox "self._setOORInfo(self)"
|
||||
%pythonAppend wxComboBox() ""
|
||||
|
||||
wxComboBox(wxWindow* parent, wxWindowID id,
|
||||
const wxString& value = wxPyEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
//int choices=0, wxString* choices_array=NULL,
|
||||
const wxArrayString& choices = wxPyEmptyStringArray,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxPyComboBoxNameStr);
|
||||
%name(PreComboBox)wxComboBox();
|
||||
DocCtorAStr(
|
||||
wxComboBox(wxWindow* parent, wxWindowID id,
|
||||
const wxString& value = wxPyEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
const wxArrayString& choices = wxPyEmptyStringArray,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxPyComboBoxNameStr),
|
||||
"__init__(Window parent, int id, String value=EmptyString,\n"
|
||||
" Point pos=DefaultPosition, Size size=DefaultSize,\n"
|
||||
" List choices=[], long style=0, Validator validator=DefaultValidator,\n"
|
||||
" String name=ComboBoxNameStr) -> ComboBox",
|
||||
"Constructor, creates and shows a ComboBox control.");
|
||||
|
||||
bool Create(wxWindow* parent, wxWindowID id,
|
||||
const wxString& value = wxPyEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
//int choices=0, wxString* choices_array=NULL,
|
||||
const wxArrayString& choices = wxPyEmptyStringArray,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxPyComboBoxNameStr);
|
||||
DocCtorStrName(
|
||||
wxComboBox(),
|
||||
"Precreate a ComboBox control for 2-phase creation.",
|
||||
PreComboBox);
|
||||
|
||||
|
||||
virtual wxString GetValue() const;
|
||||
virtual void SetValue(const wxString& value);
|
||||
|
||||
virtual void Copy();
|
||||
virtual void Cut();
|
||||
virtual void Paste();
|
||||
DocDeclAStr(
|
||||
bool, Create(wxWindow *parent, wxWindowID id,
|
||||
const wxString& value = wxPyEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
const wxArrayString& choices = wxPyEmptyStringArray,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxPyChoiceNameStr),
|
||||
"Create(Window parent, int id, String value=EmptyString,\n"
|
||||
" Point pos=DefaultPosition, Size size=DefaultSize,\n"
|
||||
" List choices=[], long style=0, Validator validator=DefaultValidator,\n"
|
||||
" String name=ChoiceNameStr) -> bool",
|
||||
"Actually create the GUI Choice control for 2-phase creation");
|
||||
|
||||
virtual void SetInsertionPoint(long pos);
|
||||
virtual long GetInsertionPoint() const;
|
||||
virtual long GetLastPosition() const;
|
||||
virtual void Replace(long from, long to, const wxString& value);
|
||||
void SetSelection(int n);
|
||||
%name(SetMark) virtual void SetSelection(long from, long to);
|
||||
virtual void SetEditable(bool editable);
|
||||
|
||||
virtual void SetInsertionPointEnd();
|
||||
virtual void Remove(long from, long to);
|
||||
DocDeclStr(
|
||||
virtual wxString , GetValue() const,
|
||||
"Returns the current value in the combobox text field.");
|
||||
|
||||
DocDeclStr(
|
||||
virtual void , SetValue(const wxString& value),
|
||||
"");
|
||||
|
||||
|
||||
DocDeclStr(
|
||||
virtual void , Copy(),
|
||||
"Copies the selected text to the clipboard.");
|
||||
|
||||
DocDeclStr(
|
||||
virtual void , Cut(),
|
||||
"Copies the selected text to the clipboard and removes the selection.");
|
||||
|
||||
DocDeclStr(
|
||||
virtual void , Paste(),
|
||||
"Pastes text from the clipboard to the text field.");
|
||||
|
||||
|
||||
DocDeclStr(
|
||||
virtual void , SetInsertionPoint(long pos),
|
||||
"Sets the insertion point in the combobox text field.");
|
||||
|
||||
DocDeclStr(
|
||||
virtual long , GetInsertionPoint() const,
|
||||
"Returns the insertion point for the combobox's text field.");
|
||||
|
||||
DocDeclStr(
|
||||
virtual long , GetLastPosition() const,
|
||||
"Returns the last position in the combobox text field.");
|
||||
|
||||
DocDeclStr(
|
||||
virtual void , Replace(long from, long to, const wxString& value),
|
||||
"Replaces the text between two positions with the given text, in the\n"
|
||||
"combobox text field.");
|
||||
|
||||
DocDeclStr(
|
||||
void , SetSelection(int n),
|
||||
"Selects the text between the two positions, in the combobox text field.");
|
||||
|
||||
%name(SetMark) virtual void SetSelection(long from, long to);
|
||||
|
||||
DocDeclStr(
|
||||
virtual void , SetEditable(bool editable),
|
||||
"");
|
||||
|
||||
|
||||
DocDeclStr(
|
||||
virtual void , SetInsertionPointEnd(),
|
||||
"Sets the insertion point at the end of the combobox text field.");
|
||||
|
||||
DocDeclStr(
|
||||
virtual void , Remove(long from, long to),
|
||||
"Removes the text between the two positions in the combobox text field.");
|
||||
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -45,15 +45,27 @@ enum
|
||||
|
||||
|
||||
|
||||
// abstract base class wxConfigBase which defines the interface for derived
|
||||
// classes
|
||||
//
|
||||
// wxConfig organizes the items in a tree-like structure (modeled after the
|
||||
// Unix/Dos filesystem). There are groups (directories) and keys (files).
|
||||
// There is always one current group given by the current path.
|
||||
//
|
||||
// Keys are pairs "key_name = value" where value may be of string or integer
|
||||
// (long) type (TODO doubles and other types such as wxDate coming soon).
|
||||
DocStr(wxConfigBase,
|
||||
"wx.ConfigBase class defines the basic interface of all config
|
||||
classes. It can not be used by itself (it is an abstract base
|
||||
class) and you will always use one of its derivations: wx.Config
|
||||
or wx.FileConfig.
|
||||
|
||||
wx.ConfigBase organizes the items in a tree-like structure
|
||||
(modeled after the Unix/Dos filesystem). There are groups
|
||||
(directories) and keys (files). There is always one current
|
||||
group given by the current path. As in the file system case, to
|
||||
specify a key in the config class you must use a path to it.
|
||||
Config classes also support the notion of the current group,
|
||||
which makes it possible to use relative paths.
|
||||
|
||||
Keys are pairs \"key_name = value\" where value may be of string, integer
|
||||
floating point or boolean, you can not store binary data without first
|
||||
encoding it as a string. For performance reasons items should be kept small,
|
||||
no more than a couple kilobytes.
|
||||
");
|
||||
|
||||
|
||||
class wxConfigBase {
|
||||
public:
|
||||
// wxConfigBase(const wxString& appName = wxPyEmptyString, **** An ABC
|
||||
@ -73,39 +85,52 @@ public:
|
||||
};
|
||||
|
||||
|
||||
// sets the config object, returns the previous pointer
|
||||
static wxConfigBase *Set(wxConfigBase *pConfig);
|
||||
DocDeclStr(
|
||||
static wxConfigBase *, Set(wxConfigBase *config),
|
||||
"Sets the global config object (the one returned by Get) and\n"
|
||||
"returns a reference to the previous global config object.");
|
||||
|
||||
|
||||
// get the config object, creates it on demand unless DontCreateOnDemand
|
||||
// was called
|
||||
static wxConfigBase *Get(bool createOnDemand = True);
|
||||
DocDeclStr(
|
||||
static wxConfigBase *, Get(bool createOnDemand = True),
|
||||
"Returns the current global config object, creating one if neccessary.");
|
||||
|
||||
|
||||
// create a new config object: this function will create the "best"
|
||||
// implementation of wxConfig available for the current platform, see
|
||||
// comments near definition wxUSE_CONFIG_NATIVE for details. It returns
|
||||
// the created object and also sets it as ms_pConfig.
|
||||
static wxConfigBase *Create();
|
||||
DocDeclStr(
|
||||
static wxConfigBase *, Create(),
|
||||
"Create and return a new global config object. This function will\n"
|
||||
"create the \"best\" implementation of wx.Config available for the\n"
|
||||
"current platform.");
|
||||
|
||||
|
||||
// should Get() try to create a new log object if the current one is NULL?
|
||||
static void DontCreateOnDemand();
|
||||
|
||||
DocDeclStr(
|
||||
static void , DontCreateOnDemand(),
|
||||
"Should Get() try to create a new log object if there isn't a current one?");
|
||||
|
||||
|
||||
|
||||
|
||||
// set current path: if the first character is '/', it's the absolute path,
|
||||
// otherwise it's a relative path. '..' is supported. If the strPath
|
||||
// doesn't exist it is created.
|
||||
virtual void SetPath(const wxString& strPath);
|
||||
DocDeclStr(
|
||||
virtual void , SetPath(const wxString& path),
|
||||
"Set current path: if the first character is '/', it's the absolute path,\n"
|
||||
"otherwise it's a relative path. '..' is supported. If the strPath\n"
|
||||
"doesn't exist it is created.");
|
||||
|
||||
|
||||
// retrieve the current path (always as absolute path)
|
||||
virtual const wxString& GetPath() const;
|
||||
DocDeclStr(
|
||||
virtual const wxString& , GetPath() const,
|
||||
"Retrieve the current path (always as absolute path)");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Each of these enumeration methods return a 3-tuple consisting of
|
||||
// the continue flag, the value string, and the index for the next call.
|
||||
%extend {
|
||||
// enumerate subgroups
|
||||
DocAStr(GetFirstGroup,
|
||||
"GetFirstGroup() -> (more, value, index)",
|
||||
"Allows enumerating the subgroups in a config object. Returns\n"
|
||||
"a tuple containing a flag indicating there are more items, the\n"
|
||||
"name of the current item, and an index to pass to GetNextGroup to\n"
|
||||
"fetch the next item.");
|
||||
PyObject* GetFirstGroup() {
|
||||
bool cont;
|
||||
long index = 0;
|
||||
@ -114,6 +139,15 @@ public:
|
||||
cont = self->GetFirstGroup(value, index);
|
||||
return __EnumerationHelper(cont, value, index);
|
||||
}
|
||||
|
||||
|
||||
|
||||
DocAStr(GetNextGroup,
|
||||
"GetNextGroup(long index) -> (more, value, index)",
|
||||
"Allows enumerating the subgroups in a config object. Returns\n"
|
||||
"a tuple containing a flag indicating there are more items, the\n"
|
||||
"name of the current item, and an index to pass to GetNextGroup to\n"
|
||||
"fetch the next item.");
|
||||
PyObject* GetNextGroup(long index) {
|
||||
bool cont;
|
||||
wxString value;
|
||||
@ -122,7 +156,13 @@ public:
|
||||
return __EnumerationHelper(cont, value, index);
|
||||
}
|
||||
|
||||
// enumerate entries
|
||||
|
||||
DocAStr(GetFirstEntry,
|
||||
"GetFirstEntry() -> (more, value, index)",
|
||||
"Allows enumerating the entries in the current group in a config\n"
|
||||
"object. Returns a tuple containing a flag indicating there are\n"
|
||||
"more items, the name of the current item, and an index to pass to\n"
|
||||
"GetNextGroup to fetch the next item.");
|
||||
PyObject* GetFirstEntry() {
|
||||
bool cont;
|
||||
long index = 0;
|
||||
@ -131,6 +171,14 @@ public:
|
||||
cont = self->GetFirstEntry(value, index);
|
||||
return __EnumerationHelper(cont, value, index);
|
||||
}
|
||||
|
||||
|
||||
DocAStr(GetNextEntry,
|
||||
"GetNextEntry(long index) -> (more, value, index)",
|
||||
"Allows enumerating the entries in the current group in a config\n"
|
||||
"object. Returns a tuple containing a flag indicating there are\n"
|
||||
"more items, the name of the current item, and an index to pass to\n"
|
||||
"GetNextGroup to fetch the next item.");
|
||||
PyObject* GetNextEntry(long index) {
|
||||
bool cont;
|
||||
wxString value;
|
||||
@ -142,38 +190,64 @@ public:
|
||||
|
||||
|
||||
|
||||
// get number of entries/subgroups in the current group, with or without
|
||||
// it's subgroups
|
||||
virtual size_t GetNumberOfEntries(bool bRecursive = False) const;
|
||||
virtual size_t GetNumberOfGroups(bool bRecursive = False) const;
|
||||
DocDeclStr(
|
||||
virtual size_t , GetNumberOfEntries(bool recursive = False) const,
|
||||
"Get the number of entries in the current group, with or\n"
|
||||
"without its subgroups.");
|
||||
|
||||
DocDeclStr(
|
||||
virtual size_t , GetNumberOfGroups(bool recursive = False) const,
|
||||
"Get the number of subgroups in the current group, with or\n"
|
||||
"without its subgroups.");
|
||||
|
||||
|
||||
// returns True if the group by this name exists
|
||||
virtual bool HasGroup(const wxString& strName) const;
|
||||
|
||||
DocDeclStr(
|
||||
virtual bool , HasGroup(const wxString& name) const,
|
||||
"Returns True if the group by this name exists");
|
||||
|
||||
|
||||
// same as above, but for an entry
|
||||
virtual bool HasEntry(const wxString& strName) const;
|
||||
DocDeclStr(
|
||||
virtual bool , HasEntry(const wxString& name) const,
|
||||
"Returns True if the entry by this name exists");
|
||||
|
||||
|
||||
// returns True if either a group or an entry with a given name exist
|
||||
bool Exists(const wxString& strName) const;
|
||||
DocDeclStr(
|
||||
bool , Exists(const wxString& name) const,
|
||||
"Returns True if either a group or an entry with a given name exists");
|
||||
|
||||
|
||||
// get the entry type
|
||||
virtual EntryType GetEntryType(const wxString& name) const;
|
||||
DocDeclStr(
|
||||
virtual EntryType , GetEntryType(const wxString& name) const,
|
||||
"Get the type of the entry. Returns one of the wx.Config.Type_XXX values.");
|
||||
|
||||
|
||||
|
||||
// Key access. Returns the value of key if it exists, defaultVal otherwise
|
||||
wxString Read(const wxString& key, const wxString& defaultVal = wxPyEmptyString);
|
||||
DocDeclStr(
|
||||
wxString , Read(const wxString& key, const wxString& defaultVal = wxPyEmptyString),
|
||||
"Returns the value of key if it exists, defaultVal otherwise.");
|
||||
|
||||
|
||||
%extend {
|
||||
DocStr(ReadInt,
|
||||
"Returns the value of key if it exists, defaultVal otherwise.");
|
||||
long ReadInt(const wxString& key, long defaultVal = 0) {
|
||||
long rv;
|
||||
self->Read(key, &rv, defaultVal);
|
||||
return rv;
|
||||
}
|
||||
|
||||
DocStr(ReadFloat,
|
||||
"Returns the value of key if it exists, defaultVal otherwise.");
|
||||
double ReadFloat(const wxString& key, double defaultVal = 0.0) {
|
||||
double rv;
|
||||
self->Read(key, &rv, defaultVal);
|
||||
return rv;
|
||||
}
|
||||
|
||||
DocStr(ReadBool,
|
||||
"Returns the value of key if it exists, defaultVal otherwise.");
|
||||
bool ReadBool(const wxString& key, bool defaultVal = False) {
|
||||
bool rv;
|
||||
self->Read(key, &rv, defaultVal);
|
||||
@ -183,114 +257,191 @@ public:
|
||||
|
||||
|
||||
// write the value (return True on success)
|
||||
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);
|
||||
DocDeclStr(
|
||||
bool , Write(const wxString& key, const wxString& value),
|
||||
"write the value (return True on success)");
|
||||
|
||||
DocDeclStrName(
|
||||
bool, Write(const wxString& key, long value),
|
||||
"write the value (return True on success)",
|
||||
WriteInt);
|
||||
|
||||
DocDeclStrName(
|
||||
bool, Write(const wxString& key, double value),
|
||||
"write the value (return True on success)",
|
||||
WriteFloat);
|
||||
|
||||
DocDeclStrName(
|
||||
bool, Write(const wxString& key, bool value),
|
||||
"write the value (return True on success)",
|
||||
WriteBool);
|
||||
|
||||
|
||||
// permanently writes all changes
|
||||
virtual bool Flush(bool bCurrentOnly = False);
|
||||
DocDeclStr(
|
||||
virtual bool , Flush(bool currentOnly = False),
|
||||
"permanently writes all changes");
|
||||
|
||||
|
||||
// renaming, all functions return False on failure (probably because the new
|
||||
// name is already taken by an existing entry)
|
||||
// rename an entry
|
||||
virtual bool RenameEntry(const wxString& oldName,
|
||||
const wxString& newName);
|
||||
// rename a group
|
||||
virtual bool RenameGroup(const wxString& oldName,
|
||||
const wxString& newName);
|
||||
DocDeclStr(
|
||||
virtual bool , RenameEntry(const wxString& oldName,
|
||||
const wxString& newName),
|
||||
"Rename an entry. Returns False on failure (probably because the new\n"
|
||||
"name is already taken by an existing entry)");
|
||||
|
||||
DocDeclStr(
|
||||
virtual bool , RenameGroup(const wxString& oldName,
|
||||
const wxString& newName),
|
||||
"Rename aa group. Returns False on failure (probably because the new\n"
|
||||
"name is already taken by an existing entry)");
|
||||
|
||||
|
||||
// deletes the specified entry and the group it belongs to if
|
||||
// it was the last key in it and the second parameter is True
|
||||
virtual bool DeleteEntry(const wxString& key,
|
||||
bool bDeleteGroupIfEmpty = True);
|
||||
DocDeclStr(
|
||||
virtual bool , DeleteEntry(const wxString& key,
|
||||
bool deleteGroupIfEmpty = True),
|
||||
"Deletes the specified entry and the group it belongs to if\n"
|
||||
"it was the last key in it and the second parameter is True");
|
||||
|
||||
|
||||
// delete the group (with all subgroups)
|
||||
virtual bool DeleteGroup(const wxString& key);
|
||||
DocDeclStr(
|
||||
virtual bool , DeleteGroup(const wxString& key),
|
||||
"Delete the group (with all subgroups)");
|
||||
|
||||
|
||||
// delete the whole underlying object (disk file, registry key, ...)
|
||||
// primarly for use by desinstallation routine.
|
||||
virtual bool DeleteAll();
|
||||
DocDeclStr(
|
||||
virtual bool , DeleteAll(),
|
||||
"Delete the whole underlying object (disk file, registry key, ...)\n"
|
||||
"primarly intended for use by desinstallation routine.");
|
||||
|
||||
|
||||
|
||||
// we can automatically expand environment variables in the config entries
|
||||
// (this option is on by default, you can turn it on/off at any time)
|
||||
bool IsExpandingEnvVars() const;
|
||||
void SetExpandEnvVars(bool bDoIt = True);
|
||||
DocDeclStr(
|
||||
void , SetExpandEnvVars(bool doIt = True),
|
||||
"We can automatically expand environment variables in the config entries\n"
|
||||
"(this option is on by default, you can turn it on/off at any time)");
|
||||
|
||||
DocDeclStr(
|
||||
bool , IsExpandingEnvVars() const,
|
||||
"Are we currently expanding environment variables?");
|
||||
|
||||
|
||||
// recording of default values
|
||||
void SetRecordDefaults(bool bDoIt = True);
|
||||
bool IsRecordingDefaults() const;
|
||||
DocDeclStr(
|
||||
void , SetRecordDefaults(bool doIt = True),
|
||||
"Set whether the config objec should record default values.");
|
||||
|
||||
DocDeclStr(
|
||||
bool , IsRecordingDefaults() const,
|
||||
"Are we currently recording default values?");
|
||||
|
||||
|
||||
// does expansion only if needed
|
||||
wxString ExpandEnvVars(const wxString& str) const;
|
||||
DocDeclStr(
|
||||
wxString , ExpandEnvVars(const wxString& str) const,
|
||||
"Expand any environment variables in str and return the result");
|
||||
|
||||
|
||||
// misc accessors
|
||||
wxString GetAppName() const;
|
||||
wxString GetVendorName() const;
|
||||
DocDeclStr(
|
||||
wxString , GetAppName() const,
|
||||
"");
|
||||
|
||||
DocDeclStr(
|
||||
wxString , GetVendorName() const,
|
||||
"");
|
||||
|
||||
|
||||
// Used wxIniConfig to set members in constructor
|
||||
void SetAppName(const wxString& appName);
|
||||
void SetVendorName(const wxString& vendorName);
|
||||
DocDeclStr(
|
||||
void , SetAppName(const wxString& appName),
|
||||
"");
|
||||
|
||||
DocDeclStr(
|
||||
void , SetVendorName(const wxString& vendorName),
|
||||
"");
|
||||
|
||||
|
||||
void SetStyle(long style);
|
||||
long GetStyle() const;
|
||||
DocDeclStr(
|
||||
void , SetStyle(long style),
|
||||
"");
|
||||
|
||||
DocDeclStr(
|
||||
long , GetStyle() const,
|
||||
"");
|
||||
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// a handy little class which changes current path to the path of given entry
|
||||
// and restores it in dtor: so if you declare a local variable of this type,
|
||||
// you work in the entry directory and the path is automatically restored
|
||||
// when the function returns
|
||||
// Taken out of wxConfig since not all compilers can cope with nested classes.
|
||||
class wxConfigPathChanger
|
||||
{
|
||||
public:
|
||||
// ctor/dtor do path changing/restorin
|
||||
wxConfigPathChanger(const wxConfigBase *pContainer, const wxString& strEntry);
|
||||
~wxConfigPathChanger();
|
||||
DocStr(wxConfig,
|
||||
"This ConfigBase-derived class will use the registry on Windows,
|
||||
and will be a wx.FileConfig on other platforms.");
|
||||
|
||||
// get the key name
|
||||
const wxString& Name() const { return m_strName; }
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// This will be a wxRegConfig on Win32 and wxFileConfig otherwise.
|
||||
class wxConfig : public wxConfigBase {
|
||||
public:
|
||||
wxConfig(const wxString& appName = wxPyEmptyString,
|
||||
const wxString& vendorName = wxPyEmptyString,
|
||||
const wxString& localFilename = wxPyEmptyString,
|
||||
const wxString& globalFilename = wxPyEmptyString,
|
||||
long style = 0);
|
||||
DocCtorStr(
|
||||
wxConfig(const wxString& appName = wxPyEmptyString,
|
||||
const wxString& vendorName = wxPyEmptyString,
|
||||
const wxString& localFilename = wxPyEmptyString,
|
||||
const wxString& globalFilename = wxPyEmptyString,
|
||||
long style = 0),
|
||||
"");
|
||||
|
||||
~wxConfig();
|
||||
};
|
||||
|
||||
|
||||
// Sometimes it's nice to explicitly have a wxFileConfig too.
|
||||
|
||||
|
||||
DocStr(wxFileConfig,
|
||||
"This config class will use a file for storage on all platforms.");
|
||||
|
||||
class wxFileConfig : public wxConfigBase {
|
||||
public:
|
||||
wxFileConfig(const wxString& appName = wxPyEmptyString,
|
||||
const wxString& vendorName = wxPyEmptyString,
|
||||
const wxString& localFilename = wxPyEmptyString,
|
||||
const wxString& globalFilename = wxPyEmptyString,
|
||||
long style = 0);
|
||||
DocCtorStr(
|
||||
wxFileConfig(const wxString& appName = wxPyEmptyString,
|
||||
const wxString& vendorName = wxPyEmptyString,
|
||||
const wxString& localFilename = wxPyEmptyString,
|
||||
const wxString& globalFilename = wxPyEmptyString,
|
||||
long style = 0),
|
||||
"");
|
||||
|
||||
~wxFileConfig();
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
DocStr(wxConfigPathChanger,
|
||||
"A handy little class which changes current path to the path of
|
||||
given entry and restores it in the destructoir: so if you declare
|
||||
a local variable of this type, you work in the entry directory
|
||||
and the path is automatically restored when the function returns.");
|
||||
|
||||
class wxConfigPathChanger
|
||||
{
|
||||
public:
|
||||
DocCtorStr(
|
||||
wxConfigPathChanger(const wxConfigBase *config, const wxString& entry),
|
||||
"");
|
||||
|
||||
~wxConfigPathChanger();
|
||||
|
||||
DocDeclStr(
|
||||
const wxString& , Name() const,
|
||||
"Get the key name");
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
DocDeclStr(
|
||||
wxString , wxExpandEnvVars(const wxString &sz),
|
||||
"Replace environment variables ($SOMETHING) with their values. The\n"
|
||||
"format is $VARNAME or ${VARNAME} where VARNAME contains\n"
|
||||
"alphanumeric characters and '_' only. '$' must be escaped ('\$')\n"
|
||||
"in order to be taken literally.");
|
||||
|
||||
// Replace environment variables ($SOMETHING) with their values. The format is
|
||||
// $VARNAME or ${VARNAME} where VARNAME contains alphanumeric characters and
|
||||
// '_' only. '$' must be escaped ('\$') in order to be taken literally.
|
||||
wxString wxExpandEnvVars(const wxString &sz);
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user