Added docstrings
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25890 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -17,27 +17,97 @@
|
|||||||
%newgroup;
|
%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 {
|
class wxColour : public wxObject {
|
||||||
public:
|
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();
|
~wxColour();
|
||||||
|
|
||||||
%name(NamedColour) wxColour( const wxString& colorName);
|
|
||||||
%name(ColourRGB) wxColour( unsigned long colRGB );
|
|
||||||
|
|
||||||
unsigned char Red();
|
DocDeclStr(
|
||||||
unsigned char Green();
|
unsigned char , Red(),
|
||||||
unsigned char Blue();
|
"Returns the red intensity.");
|
||||||
bool Ok();
|
|
||||||
void Set(unsigned char red, unsigned char green, unsigned char blue);
|
DocDeclStr(
|
||||||
%name(SetRGB) void Set(unsigned long colRGB);
|
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.");
|
||||||
|
|
||||||
|
DocDeclStrName(
|
||||||
|
void , Set(unsigned long colRGB),
|
||||||
|
"Sets the RGB intensity values from a packed RGB value.",
|
||||||
|
SetRGB);
|
||||||
|
|
||||||
|
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");
|
||||||
|
|
||||||
bool operator==(const wxColour& colour) const;
|
|
||||||
bool operator!=(const wxColour& colour) const;
|
|
||||||
|
|
||||||
void InitFromName(const wxString& colourName);
|
|
||||||
|
|
||||||
%extend {
|
%extend {
|
||||||
|
DocAStr(Get,
|
||||||
|
"Get() -> (r, g, b)",
|
||||||
|
"Returns the RGB intensity values as a tuple.");
|
||||||
PyObject* Get() {
|
PyObject* Get() {
|
||||||
PyObject* rv = PyTuple_New(3);
|
PyObject* rv = PyTuple_New(3);
|
||||||
int red = -1;
|
int red = -1;
|
||||||
@@ -53,22 +123,12 @@ public:
|
|||||||
PyTuple_SetItem(rv, 2, PyInt_FromLong(blue));
|
PyTuple_SetItem(rv, 2, PyInt_FromLong(blue));
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
// bool __eq__(PyObject* obj) {
|
|
||||||
// wxColour tmp;
|
DocStr(GetRGB,
|
||||||
// wxColour* ptr = &tmp;
|
"Return the colour as a packed RGB value");
|
||||||
// if (obj == Py_None) return False;
|
unsigned long GetRGB() {
|
||||||
// wxPyBLOCK_THREADS(bool success = wxColour_helper(obj, &ptr); PyErr_Clear());
|
return self->Red() | (self->Green() << 8) | (self->Blue() << 16);
|
||||||
// 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;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -21,6 +21,33 @@ MAKE_CONST_WXSTRING(ComboBoxNameStr);
|
|||||||
%newgroup;
|
%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__
|
#ifdef __WXMSW__
|
||||||
class wxComboBox : public wxChoice
|
class wxComboBox : public wxChoice
|
||||||
#else
|
#else
|
||||||
@@ -31,45 +58,101 @@ public:
|
|||||||
%pythonAppend wxComboBox "self._setOORInfo(self)"
|
%pythonAppend wxComboBox "self._setOORInfo(self)"
|
||||||
%pythonAppend wxComboBox() ""
|
%pythonAppend wxComboBox() ""
|
||||||
|
|
||||||
|
DocCtorAStr(
|
||||||
wxComboBox(wxWindow* parent, wxWindowID id,
|
wxComboBox(wxWindow* parent, wxWindowID id,
|
||||||
const wxString& value = wxPyEmptyString,
|
const wxString& value = wxPyEmptyString,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
//int choices=0, wxString* choices_array=NULL,
|
|
||||||
const wxArrayString& choices = wxPyEmptyStringArray,
|
const wxArrayString& choices = wxPyEmptyStringArray,
|
||||||
long style = 0,
|
long style = 0,
|
||||||
const wxValidator& validator = wxDefaultValidator,
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
const wxString& name = wxPyComboBoxNameStr);
|
const wxString& name = wxPyComboBoxNameStr),
|
||||||
%name(PreComboBox)wxComboBox();
|
"__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,
|
DocCtorStrName(
|
||||||
|
wxComboBox(),
|
||||||
|
"Precreate a ComboBox control for 2-phase creation.",
|
||||||
|
PreComboBox);
|
||||||
|
|
||||||
|
|
||||||
|
DocDeclAStr(
|
||||||
|
bool, Create(wxWindow *parent, wxWindowID id,
|
||||||
const wxString& value = wxPyEmptyString,
|
const wxString& value = wxPyEmptyString,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
//int choices=0, wxString* choices_array=NULL,
|
|
||||||
const wxArrayString& choices = wxPyEmptyStringArray,
|
const wxArrayString& choices = wxPyEmptyStringArray,
|
||||||
long style = 0,
|
long style = 0,
|
||||||
const wxValidator& validator = wxDefaultValidator,
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
const wxString& name = wxPyComboBoxNameStr);
|
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 wxString GetValue() const;
|
DocDeclStr(
|
||||||
virtual void SetValue(const wxString& value);
|
virtual wxString , GetValue() const,
|
||||||
|
"Returns the current value in the combobox text field.");
|
||||||
|
|
||||||
virtual void Copy();
|
DocDeclStr(
|
||||||
virtual void Cut();
|
virtual void , SetValue(const wxString& value),
|
||||||
virtual void Paste();
|
"");
|
||||||
|
|
||||||
|
|
||||||
|
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.");
|
||||||
|
|
||||||
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);
|
%name(SetMark) virtual void SetSelection(long from, long to);
|
||||||
virtual void SetEditable(bool editable);
|
|
||||||
|
|
||||||
virtual void SetInsertionPointEnd();
|
DocDeclStr(
|
||||||
virtual void Remove(long from, long to);
|
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
|
DocStr(wxConfigBase,
|
||||||
// classes
|
"wx.ConfigBase class defines the basic interface of all config
|
||||||
//
|
classes. It can not be used by itself (it is an abstract base
|
||||||
// wxConfig organizes the items in a tree-like structure (modeled after the
|
class) and you will always use one of its derivations: wx.Config
|
||||||
// Unix/Dos filesystem). There are groups (directories) and keys (files).
|
or wx.FileConfig.
|
||||||
// There is always one current group given by the current path.
|
|
||||||
//
|
wx.ConfigBase organizes the items in a tree-like structure
|
||||||
// Keys are pairs "key_name = value" where value may be of string or integer
|
(modeled after the Unix/Dos filesystem). There are groups
|
||||||
// (long) type (TODO doubles and other types such as wxDate coming soon).
|
(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 {
|
class wxConfigBase {
|
||||||
public:
|
public:
|
||||||
// wxConfigBase(const wxString& appName = wxPyEmptyString, **** An ABC
|
// wxConfigBase(const wxString& appName = wxPyEmptyString, **** An ABC
|
||||||
@@ -73,39 +85,52 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// sets the config object, returns the previous pointer
|
DocDeclStr(
|
||||||
static wxConfigBase *Set(wxConfigBase *pConfig);
|
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);
|
|
||||||
|
|
||||||
// create a new config object: this function will create the "best"
|
DocDeclStr(
|
||||||
// implementation of wxConfig available for the current platform, see
|
static wxConfigBase *, Get(bool createOnDemand = True),
|
||||||
// comments near definition wxUSE_CONFIG_NATIVE for details. It returns
|
"Returns the current global config object, creating one if neccessary.");
|
||||||
// the created object and also sets it as ms_pConfig.
|
|
||||||
static wxConfigBase *Create();
|
|
||||||
|
|
||||||
// should Get() try to create a new log object if the current one is NULL?
|
|
||||||
static void DontCreateOnDemand();
|
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.");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// set current path: if the first character is '/', it's the absolute path,
|
DocDeclStr(
|
||||||
// otherwise it's a relative path. '..' is supported. If the strPath
|
static void , DontCreateOnDemand(),
|
||||||
// doesn't exist it is created.
|
"Should Get() try to create a new log object if there isn't a current one?");
|
||||||
virtual void SetPath(const wxString& strPath);
|
|
||||||
|
|
||||||
// retrieve the current path (always as absolute path)
|
|
||||||
virtual const wxString& GetPath() const;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Each of these enumeration methods return a 3-tuple consisting of
|
DocDeclStr(
|
||||||
// the continue flag, the value string, and the index for the next call.
|
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.");
|
||||||
|
|
||||||
|
|
||||||
|
DocDeclStr(
|
||||||
|
virtual const wxString& , GetPath() const,
|
||||||
|
"Retrieve the current path (always as absolute path)");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%extend {
|
%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() {
|
PyObject* GetFirstGroup() {
|
||||||
bool cont;
|
bool cont;
|
||||||
long index = 0;
|
long index = 0;
|
||||||
@@ -114,6 +139,15 @@ public:
|
|||||||
cont = self->GetFirstGroup(value, index);
|
cont = self->GetFirstGroup(value, index);
|
||||||
return __EnumerationHelper(cont, 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) {
|
PyObject* GetNextGroup(long index) {
|
||||||
bool cont;
|
bool cont;
|
||||||
wxString value;
|
wxString value;
|
||||||
@@ -122,7 +156,13 @@ public:
|
|||||||
return __EnumerationHelper(cont, value, index);
|
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() {
|
PyObject* GetFirstEntry() {
|
||||||
bool cont;
|
bool cont;
|
||||||
long index = 0;
|
long index = 0;
|
||||||
@@ -131,6 +171,14 @@ public:
|
|||||||
cont = self->GetFirstEntry(value, index);
|
cont = self->GetFirstEntry(value, index);
|
||||||
return __EnumerationHelper(cont, 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) {
|
PyObject* GetNextEntry(long index) {
|
||||||
bool cont;
|
bool cont;
|
||||||
wxString value;
|
wxString value;
|
||||||
@@ -142,38 +190,64 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// get number of entries/subgroups in the current group, with or without
|
DocDeclStr(
|
||||||
// it's subgroups
|
virtual size_t , GetNumberOfEntries(bool recursive = False) const,
|
||||||
virtual size_t GetNumberOfEntries(bool bRecursive = False) const;
|
"Get the number of entries in the current group, with or\n"
|
||||||
virtual size_t GetNumberOfGroups(bool bRecursive = False) const;
|
"without its subgroups.");
|
||||||
|
|
||||||
// returns True if the group by this name exists
|
DocDeclStr(
|
||||||
virtual bool HasGroup(const wxString& strName) const;
|
virtual size_t , GetNumberOfGroups(bool recursive = False) const,
|
||||||
|
"Get the number of subgroups in the current group, with or\n"
|
||||||
|
"without its subgroups.");
|
||||||
|
|
||||||
// same as above, but for an entry
|
|
||||||
virtual bool HasEntry(const wxString& strName) const;
|
|
||||||
|
|
||||||
// returns True if either a group or an entry with a given name exist
|
|
||||||
bool Exists(const wxString& strName) const;
|
DocDeclStr(
|
||||||
|
virtual bool , HasGroup(const wxString& name) const,
|
||||||
|
"Returns True if the group by this name exists");
|
||||||
|
|
||||||
|
|
||||||
|
DocDeclStr(
|
||||||
|
virtual bool , HasEntry(const wxString& name) const,
|
||||||
|
"Returns True if the entry by this name exists");
|
||||||
|
|
||||||
|
|
||||||
|
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
|
// 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 {
|
%extend {
|
||||||
|
DocStr(ReadInt,
|
||||||
|
"Returns the value of key if it exists, defaultVal otherwise.");
|
||||||
long ReadInt(const wxString& key, long defaultVal = 0) {
|
long ReadInt(const wxString& key, long defaultVal = 0) {
|
||||||
long rv;
|
long rv;
|
||||||
self->Read(key, &rv, defaultVal);
|
self->Read(key, &rv, defaultVal);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DocStr(ReadFloat,
|
||||||
|
"Returns the value of key if it exists, defaultVal otherwise.");
|
||||||
double ReadFloat(const wxString& key, double defaultVal = 0.0) {
|
double ReadFloat(const wxString& key, double defaultVal = 0.0) {
|
||||||
double rv;
|
double rv;
|
||||||
self->Read(key, &rv, defaultVal);
|
self->Read(key, &rv, defaultVal);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DocStr(ReadBool,
|
||||||
|
"Returns the value of key if it exists, defaultVal otherwise.");
|
||||||
bool ReadBool(const wxString& key, bool defaultVal = False) {
|
bool ReadBool(const wxString& key, bool defaultVal = False) {
|
||||||
bool rv;
|
bool rv;
|
||||||
self->Read(key, &rv, defaultVal);
|
self->Read(key, &rv, defaultVal);
|
||||||
@@ -183,114 +257,191 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// write the value (return True on success)
|
// write the value (return True on success)
|
||||||
bool Write(const wxString& key, const wxString& value);
|
DocDeclStr(
|
||||||
%name(WriteInt)bool Write(const wxString& key, long value);
|
bool , Write(const wxString& key, const wxString& value),
|
||||||
%name(WriteFloat)bool Write(const wxString& key, double value);
|
"write the value (return True on success)");
|
||||||
%name(WriteBool)bool Write(const wxString& key, bool value);
|
|
||||||
|
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
|
DocDeclStr(
|
||||||
virtual bool Flush(bool bCurrentOnly = False);
|
virtual bool , Flush(bool currentOnly = False),
|
||||||
|
"permanently writes all changes");
|
||||||
|
|
||||||
|
|
||||||
|
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)");
|
||||||
|
|
||||||
// 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);
|
|
||||||
|
|
||||||
// deletes the specified entry and the group it belongs to if
|
// deletes the specified entry and the group it belongs to if
|
||||||
// it was the last key in it and the second parameter is True
|
// it was the last key in it and the second parameter is True
|
||||||
virtual bool DeleteEntry(const wxString& key,
|
DocDeclStr(
|
||||||
bool bDeleteGroupIfEmpty = True);
|
virtual bool , DeleteEntry(const wxString& key,
|
||||||
|
bool deleteGroupIfEmpty = True),
|
||||||
// delete the group (with all subgroups)
|
"Deletes the specified entry and the group it belongs to if\n"
|
||||||
virtual bool DeleteGroup(const wxString& key);
|
"it was the last key in it and the second parameter is True");
|
||||||
|
|
||||||
// delete the whole underlying object (disk file, registry key, ...)
|
|
||||||
// primarly for use by desinstallation routine.
|
|
||||||
virtual bool DeleteAll();
|
|
||||||
|
|
||||||
|
|
||||||
// we can automatically expand environment variables in the config entries
|
DocDeclStr(
|
||||||
// (this option is on by default, you can turn it on/off at any time)
|
virtual bool , DeleteGroup(const wxString& key),
|
||||||
bool IsExpandingEnvVars() const;
|
"Delete the group (with all subgroups)");
|
||||||
void SetExpandEnvVars(bool bDoIt = True);
|
|
||||||
|
|
||||||
// recording of default values
|
|
||||||
void SetRecordDefaults(bool bDoIt = True);
|
|
||||||
bool IsRecordingDefaults() const;
|
|
||||||
|
|
||||||
// does expansion only if needed
|
DocDeclStr(
|
||||||
wxString ExpandEnvVars(const wxString& str) const;
|
virtual bool , DeleteAll(),
|
||||||
|
"Delete the whole underlying object (disk file, registry key, ...)\n"
|
||||||
|
"primarly intended for use by desinstallation routine.");
|
||||||
|
|
||||||
// misc accessors
|
|
||||||
wxString GetAppName() const;
|
|
||||||
wxString GetVendorName() const;
|
|
||||||
|
|
||||||
// Used wxIniConfig to set members in constructor
|
|
||||||
void SetAppName(const wxString& appName);
|
|
||||||
void SetVendorName(const wxString& vendorName);
|
|
||||||
|
|
||||||
void SetStyle(long style);
|
DocDeclStr(
|
||||||
long GetStyle() const;
|
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?");
|
||||||
|
|
||||||
|
|
||||||
|
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?");
|
||||||
|
|
||||||
|
|
||||||
|
DocDeclStr(
|
||||||
|
wxString , ExpandEnvVars(const wxString& str) const,
|
||||||
|
"Expand any environment variables in str and return the result");
|
||||||
|
|
||||||
|
|
||||||
|
DocDeclStr(
|
||||||
|
wxString , GetAppName() const,
|
||||||
|
"");
|
||||||
|
|
||||||
|
DocDeclStr(
|
||||||
|
wxString , GetVendorName() const,
|
||||||
|
"");
|
||||||
|
|
||||||
|
|
||||||
|
DocDeclStr(
|
||||||
|
void , SetAppName(const wxString& appName),
|
||||||
|
"");
|
||||||
|
|
||||||
|
DocDeclStr(
|
||||||
|
void , SetVendorName(const wxString& vendorName),
|
||||||
|
"");
|
||||||
|
|
||||||
|
|
||||||
|
DocDeclStr(
|
||||||
|
void , SetStyle(long style),
|
||||||
|
"");
|
||||||
|
|
||||||
|
DocDeclStr(
|
||||||
|
long , GetStyle() const,
|
||||||
|
"");
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
// a handy little class which changes current path to the path of given entry
|
DocStr(wxConfig,
|
||||||
// and restores it in dtor: so if you declare a local variable of this type,
|
"This ConfigBase-derived class will use the registry on Windows,
|
||||||
// you work in the entry directory and the path is automatically restored
|
and will be a wx.FileConfig on other platforms.");
|
||||||
// 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();
|
|
||||||
|
|
||||||
// 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 {
|
class wxConfig : public wxConfigBase {
|
||||||
public:
|
public:
|
||||||
|
DocCtorStr(
|
||||||
wxConfig(const wxString& appName = wxPyEmptyString,
|
wxConfig(const wxString& appName = wxPyEmptyString,
|
||||||
const wxString& vendorName = wxPyEmptyString,
|
const wxString& vendorName = wxPyEmptyString,
|
||||||
const wxString& localFilename = wxPyEmptyString,
|
const wxString& localFilename = wxPyEmptyString,
|
||||||
const wxString& globalFilename = wxPyEmptyString,
|
const wxString& globalFilename = wxPyEmptyString,
|
||||||
long style = 0);
|
long style = 0),
|
||||||
|
"");
|
||||||
|
|
||||||
~wxConfig();
|
~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 {
|
class wxFileConfig : public wxConfigBase {
|
||||||
public:
|
public:
|
||||||
|
DocCtorStr(
|
||||||
wxFileConfig(const wxString& appName = wxPyEmptyString,
|
wxFileConfig(const wxString& appName = wxPyEmptyString,
|
||||||
const wxString& vendorName = wxPyEmptyString,
|
const wxString& vendorName = wxPyEmptyString,
|
||||||
const wxString& localFilename = wxPyEmptyString,
|
const wxString& localFilename = wxPyEmptyString,
|
||||||
const wxString& globalFilename = wxPyEmptyString,
|
const wxString& globalFilename = wxPyEmptyString,
|
||||||
long style = 0);
|
long style = 0),
|
||||||
|
"");
|
||||||
|
|
||||||
~wxFileConfig();
|
~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);
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user