Docstring updates and tweaks for epydoc

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27016 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2004-04-30 06:14:22 +00:00
parent 68ae5821b6
commit dce2bd223c
21 changed files with 1216 additions and 665 deletions

View File

@@ -30,35 +30,97 @@
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
%newgroup; %newgroup;
DocStr(wxAcceleratorEntry,
"A class used to define items in an `wx.AcceleratorTable`. wxPython
programs can choose to use wx.AcceleratorEntry objects, but using a
list of 3-tuple of integers (flags, keyCode, cmdID) usually works just
as well. See `__init__` for details of the tuple values.
:see: `wx.AcceleratorTable`");
class wxAcceleratorEntry { class wxAcceleratorEntry {
public: public:
wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0, wxMenuItem *item = NULL); DocCtorStr(
wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmdID = 0/*, wxMenuItem *menuitem = NULL*/),
"Construct a wx.AcceleratorEntry.
:param flags: A bitmask of wx.ACCEL_ALT, wx.ACCEL_SHIFT,
wx.ACCEL_CTRL or wx.ACCEL_NORMAL used to specify
which modifier keys are held down.
:param keyCode: The keycode to be detected
:param cmdID: The menu or control command ID to use for the
accellerator event.
");
~wxAcceleratorEntry(); ~wxAcceleratorEntry();
void Set(int flags, int keyCode, int cmd, wxMenuItem *item = NULL); DocDeclStr(
void , Set(int flags, int keyCode, int cmd/*, wxMenuItem *menuItem = NULL*/),
"(Re)set the attributes of a wx.AcceleratorEntry.
:see `__init__`");
void SetMenuItem(wxMenuItem *item); // void SetMenuItem(wxMenuItem *item);
wxMenuItem *GetMenuItem() const; // wxMenuItem *GetMenuItem() const;
int GetFlags(); DocDeclStr(
int GetKeyCode(); int , GetFlags(),
int GetCommand(); "Get the AcceleratorEntry's flags.");
DocDeclStr(
int , GetKeyCode(),
"Get the AcceleratorEntry's keycode.");
DocDeclStr(
int , GetCommand(),
"Get the AcceleratorEntry's command ID.");
}; };
DocStr(wxAcceleratorTable,
"An accelerator table allows the application to specify a table of
keyboard shortcuts for menus or other commands. On Windows, menu or
button commands are supported; on GTK, only menu commands are
supported.
The object ``wx.NullAcceleratorTable`` is defined to be a table with
no data, and is the initial accelerator table for a window.
An accelerator takes precedence over normal processing and can be a
convenient way to program some event handling. For example, you can
use an accelerator table to make a hotkey generate an event no matter
which window within a frame has the focus.
Foe example::
aTable = wx.AcceleratorTable([(wx.ACCEL_ALT, ord('X'), exitID),
(wx.ACCEL_CTRL, ord('H'), helpID),
(wx.ACCEL_CTRL, ord('F'), findID),
(wx.ACCEL_NORMAL, wx.WXK_F3, findnextID)
])
self.SetAcceleratorTable(aTable)
:see: `wx.AcceleratorEntry`, `wx.Window.SetAcceleratorTable`
");
class wxAcceleratorTable : public wxObject { class wxAcceleratorTable : public wxObject {
public: public:
DocAStr(wxAcceleratorTable, DocAStr(wxAcceleratorTable,
"__init__(entries) -> AcceleratorTable", "__init__(entries) -> AcceleratorTable",
"Construct an AcceleratorTable from a list of AcceleratorEntry items or\n" "Construct an AcceleratorTable from a list of `wx.AcceleratorEntry`
"3-tuples (flags, keyCode, cmdID)"); items or or of 3-tuples (flags, keyCode, cmdID)
:see: `wx.AcceleratorEntry`");
wxAcceleratorTable(int n, const wxAcceleratorEntry* entries); wxAcceleratorTable(int n, const wxAcceleratorEntry* entries);
~wxAcceleratorTable(); ~wxAcceleratorTable();
bool Ok() const; bool Ok() const;
}; };
%immutable; %immutable;
// See also wxPy_ReinitStockObjects in helpers.cpp // See also wxPy_ReinitStockObjects in helpers.cpp

View File

@@ -40,6 +40,9 @@ enum
DocStr(wxPyApp,
"The ``wx.PyApp`` class is an *implementation detail*, please use the
`wx.App` class (or some other derived class) instead.");
class wxPyApp : public wxEvtHandler { class wxPyApp : public wxEvtHandler {
public: public:
@@ -67,73 +70,81 @@ public:
"Get the application name."); "Get the application name.");
DocDeclStr( DocDeclStr(
void, SetAppName(const wxString& name), void, SetAppName(const wxString& name),
"Set the application name. This value may be used automatically\n" "Set the application name. This value may be used automatically by
"by wx.Config and such."); `wx.Config` and such.");
DocDeclStr( DocDeclStr(
wxString, GetClassName() const, wxString, GetClassName() const,
"Get the application's class name."); "Get the application's class name.");
DocDeclStr( DocDeclStr(
void, SetClassName(const wxString& name), void, SetClassName(const wxString& name),
"Set the application's class name. This value may be used for X-resources if\n" "Set the application's class name. This value may be used for
"applicable for the platform"); X-resources if applicable for the platform");
DocDeclStr( DocDeclStr(
const wxString&, GetVendorName() const, const wxString&, GetVendorName() const,
"Get the application's vendor name."); "Get the application's vendor name.");
DocDeclStr( DocDeclStr(
void, SetVendorName(const wxString& name), void, SetVendorName(const wxString& name),
"Set the application's vendor name. This value may be used automatically\n" "Set the application's vendor name. This value may be used
"by wx.Config and such."); automatically by `wx.Config` and such.");
DocDeclStr( DocDeclStr(
wxAppTraits*, GetTraits(), wxAppTraits*, GetTraits(),
"Create the app traits object to which we delegate for everything which either\n" "Return (and create if necessary) the app traits object to which we
"should be configurable by the user (then he can change the default behaviour\n" delegate for everything which either should be configurable by the
"simply by overriding CreateTraits() and returning his own traits object) or\n" user (then he can change the default behaviour simply by overriding
"which is GUI/console dependent as then wx.AppTraits allows us to abstract the\n" CreateTraits() and returning his own traits object) or which is
"differences behind the common facade"); GUI/console dependent as then wx.AppTraits allows us to abstract the
differences behind the common facade.
:todo: Add support for overriding CreateAppTraits in wxPython.");
DocDeclStr( DocDeclStr(
virtual void, ProcessPendingEvents(), virtual void, ProcessPendingEvents(),
"Process all events in the Pending Events list -- it is necessary to call this\n" "Process all events in the Pending Events list -- it is necessary to
"function to process posted events. This happens during each event loop\n" call this function to process posted events. This normally happens
"iteration."); during each event loop iteration.");
DocDeclStr( DocDeclStr(
virtual bool, Yield(bool onlyIfNeeded = False), virtual bool, Yield(bool onlyIfNeeded = False),
"Process all currently pending events right now, instead of waiting until\n" "Process all currently pending events right now, instead of waiting
"return to the event loop. It is an error to call Yield() recursively unless\n" until return to the event loop. It is an error to call ``Yield``
"the value of onlyIfNeeded is True.\n" recursively unless the value of ``onlyIfNeeded`` is True.
"\n"
"WARNING: This function is dangerous as it can lead to unexpected\n" :warning: This function is dangerous as it can lead to unexpected
" reentrancies (i.e. when called from an event handler it\n" reentrancies (i.e. when called from an event handler it may
" may result in calling the same event handler again), use\n" result in calling the same event handler again), use with
" with _extreme_ care or, better, don't use at all!\n"); _extreme_ care or, better, don't use at all!
:see: `wx.Yield`, `wx.YieldIfNeeded`, `wx.SafeYield`");
DocDeclStr( DocDeclStr(
virtual void, WakeUpIdle(), virtual void, WakeUpIdle(),
"Make sure that idle events are sent again"); "Make sure that idle events are sent again.
:see: `wx.WakeUpIdle`");
DocDeclStr( DocDeclStr(
virtual int, MainLoop(), virtual int, MainLoop(),
"Execute the main GUI loop, the function returns when the loop ends."); "Execute the main GUI loop, the function doesn't normally return until
all top level windows have been closed and destroyed.");
DocDeclStr( DocDeclStr(
virtual void, Exit(), virtual void, Exit(),
"Exit the main loop thus terminating the application."); "Exit the main loop thus terminating the application.
:see: `wx.Exit`");
DocDeclStr( DocDeclStr(
virtual void, ExitMainLoop(), virtual void, ExitMainLoop(),
"Exit the main GUI loop during the next iteration (i.e. it does not\n" "Exit the main GUI loop during the next iteration of the main
"stop the program immediately!)"); loop, (i.e. it does not stop the program immediately!)");
DocDeclStr( DocDeclStr(
@@ -143,21 +154,21 @@ public:
DocDeclStr( DocDeclStr(
virtual bool, Dispatch(), virtual bool, Dispatch(),
"Process the first event in the event queue (blocks until an event\n" "Process the first event in the event queue (blocks until an event
"appears if there are none currently)"); appears if there are none currently)");
DocDeclStr( DocDeclStr(
virtual bool, ProcessIdle(), virtual bool, ProcessIdle(),
"Called from the MainLoop when the application becomes idle and sends an\n" "Called from the MainLoop when the application becomes idle (there are
"IdleEvent to all interested parties. Returns True is more idle events are\n" no pending events) and sends a `wx.IdleEvent` to all interested
"needed, False if not."); parties. Returns True if more idle events are needed, False if not.");
DocDeclStr( DocDeclStr(
virtual bool, SendIdleEvents(wxWindow* win, wxIdleEvent& event), virtual bool, SendIdleEvents(wxWindow* win, wxIdleEvent& event),
"Send idle event to window and all subwindows. Returns True if more idle time\n" "Send idle event to window and all subwindows. Returns True if more
"is requested."); idle time is requested.");
DocDeclStr( DocDeclStr(
@@ -167,22 +178,22 @@ public:
DocDeclStr( DocDeclStr(
void, SetTopWindow(wxWindow *win), void, SetTopWindow(wxWindow *win),
"Set the \"main\" top level window"); "Set the *main* top level window");
DocDeclStr( DocDeclStr(
virtual wxWindow*, GetTopWindow() const, virtual wxWindow*, GetTopWindow() const,
"Return the \"main\" top level window (if it hadn't been set previously with\n" "Return the *main* top level window (if it hadn't been set previously
"SetTopWindow(), will return just some top level window and, if there not any,\n" with SetTopWindow(), will return just some top level window and, if
"will return None)"); there not any, will return None)");
DocDeclStr( DocDeclStr(
void, SetExitOnFrameDelete(bool flag), void, SetExitOnFrameDelete(bool flag),
"Control the exit behaviour: by default, the program will exit the main loop\n" "Control the exit behaviour: by default, the program will exit the main
"(and so, usually, terminate) when the last top-level program window is\n" loop (and so, usually, terminate) when the last top-level program
"deleted. Beware that if you disable this behaviour (with\n" window is deleted. Beware that if you disable this behaviour (with
"SetExitOnFrameDelete(False)), you'll have to call ExitMainLoop() explicitly\n" SetExitOnFrameDelete(False)), you'll have to call ExitMainLoop()
"from somewhere.\n"); explicitly from somewhere.");
DocDeclStr( DocDeclStr(
@@ -203,8 +214,8 @@ public:
DocDeclStr( DocDeclStr(
void, SetUseBestVisual( bool flag ), void, SetUseBestVisual( bool flag ),
"Set whether the app should try to use the best available visual on systems\n" "Set whether the app should try to use the best available visual on
"where more than one is available, (Sun, SGI, XFree86 4, etc.)"); systems where more than one is available, (Sun, SGI, XFree86 4, etc.)");
DocDeclStr( DocDeclStr(
bool, GetUseBestVisual() const, bool, GetUseBestVisual() const,
@@ -221,13 +232,18 @@ public:
DocDeclStr( DocDeclStr(
void, SetAssertMode(int mode), void, SetAssertMode(int mode),
"Set the OnAssert behaviour for debug and hybrid builds. The following flags\n" "Set the OnAssert behaviour for debug and hybrid builds. The following
"may be or'd together:\n" flags may be or'd together:
"\n"
" wx.PYAPP_ASSERT_SUPPRESS Don't do anything\n" ========================= =======================================
" wx.PYAPP_ASSERT_EXCEPTION Turn it into a Python exception if possible (default)\n" wx.PYAPP_ASSERT_SUPPRESS Don't do anything
" wx.PYAPP_ASSERT_DIALOG Display a message dialog\n" wx.PYAPP_ASSERT_EXCEPTION Turn it into a Python exception if possible
" wx.PYAPP_ASSERT_LOG Write the assertion info to the wx.Log\n"); (default)
wx.PYAPP_ASSERT_DIALOG Display a message dialog
wx.PYAPP_ASSERT_LOG Write the assertion info to the wx.Log
========================= =======================================
");
DocDeclStr( DocDeclStr(
int, GetAssertMode(), int, GetAssertMode(),
@@ -252,9 +268,8 @@ public:
"For internal use only"); "For internal use only");
DocStr(GetComCtl32Version, DocStr(GetComCtl32Version,
"Returns 400, 470, 471, etc. for comctl32.dll 4.00, 4.70, 4.71 or "Returns 400, 470, 471, etc. for comctl32.dll 4.00, 4.70, 4.71 or 0 if
0 if it wasn't found at all. Raises an exception on non-Windows it wasn't found at all. Raises an exception on non-Windows platforms.");
platforms.");
#ifdef __WXMSW__ #ifdef __WXMSW__
static int GetComCtl32Version(); static int GetComCtl32Version();
#else #else
@@ -287,26 +302,30 @@ DocDeclStr(
DocDeclStr( DocDeclStr(
bool, wxSafeYield(wxWindow* win=NULL, bool onlyIfNeeded=False), bool, wxSafeYield(wxWindow* win=NULL, bool onlyIfNeeded=False),
"This function is similar to wx.Yield, except that it disables the user input\n" "This function is similar to `wx.Yield`, except that it disables the
"to all program windows before calling wx.Yield and re-enables it again\n" user input to all program windows before calling `wx.Yield` and
"afterwards. If win is not None, this window will remain enabled, allowing the\n" re-enables it again afterwards. If ``win`` is not None, this window
"implementation of some limited user interaction.\n" will remain enabled, allowing the implementation of some limited user
"\n" interaction.
"Returns the result of the call to wx.Yield.");
:Returns: the result of the call to `wx.Yield`.");
DocDeclStr( DocDeclStr(
void, wxWakeUpIdle(), void, wxWakeUpIdle(),
"Cause the message queue to become empty again, so idle events will be sent."); "Cause the message queue to become empty again, so idle events will be
sent.");
DocDeclStr( DocDeclStr(
void, wxPostEvent(wxEvtHandler *dest, wxEvent& event), void, wxPostEvent(wxEvtHandler *dest, wxEvent& event),
"Send an event to a window or other wx.EvtHandler to be processed later."); "Send an event to a window or other wx.EvtHandler to be processed
later.");
DocStr(wxApp_CleanUp, DocStr(wxApp_CleanUp,
"For internal use only, it is used to cleanup after wxWindows when Python shuts down."); "For internal use only, it is used to cleanup after wxWindows when
Python shuts down.");
%inline %{ %inline %{
void wxApp_CleanUp() { void wxApp_CleanUp() {
__wxPyCleanup(); __wxPyCleanup();

View File

@@ -67,12 +67,56 @@ _defRedirect = (wx.Platform == '__WXMSW__' or wx.Platform == '__WXMAC__')
class App(wx.PyApp): class App(wx.PyApp):
""" """
The main application class. Derive from this and implement an OnInit The ``wx.App`` class represents the application and is used to:
method that creates a frame and then calls self.SetTopWindow(frame)
* bootstrap the wxPython system and initialize the underlying
gui toolkit
* set and get application-wide properties
* implement the windowing system main message or event loop,
and to dispatch events to window instances
* etc.
Every application must have a ``wx.App`` instance, and all
creation of UI objects should be delayed until after the
``wx.App`` object has been created in order to ensure that the
gui platform and wxWidgets have been fully initialized.
Normally you would derive from this class and implement an
``OnInit`` method that creates a frame and then calls
``self.SetTopWindow(frame)``.
:see: `wx.PySimpleApp` for a simpler app class that can be used directly.
""" """
outputWindowClass = PyOnDemandOutputWindow outputWindowClass = PyOnDemandOutputWindow
def __init__(self, redirect=_defRedirect, filename=None, useBestVisual=False): def __init__(self, redirect=_defRedirect, filename=None, useBestVisual=False):
"""
Construct a ``wx.App`` object.
:param redirect: Should ``sys.stdout`` and ``sys.stderr``
be redirected? Defaults to True on Windows and Mac,
False otherwise. If `filename` is None then output
will be redirected to a window that pops up as
needed. (You can control what kind of window is
created for the output by resetting the class
variable ``outputWindowClass`` to a class of your
choosing.)
:param filename: The name of a file to redirect output
to, if redirect is True.
:param useBestVisual: Should the app try to use the best
available visual provided by the system (only
relevant on systems that have more than one visual.)
This parameter must be used instead of calling
`SetUseBestVisual` later on because it must be set
before the underlying GUI toolkit is initialized.
:note: You should override OnInit to do applicaition
initialization to ensure that the system, toolkit and
wxWidgets are fully initialized.
"""
wx.PyApp.__init__(self) wx.PyApp.__init__(self)
if wx.Platform == "__WXMAC__": if wx.Platform == "__WXMAC__":
@@ -147,7 +191,7 @@ your Mac."""
# change from wxPyApp_ to wxApp_ # change from wx.PyApp_XX to wx.App_XX
App_GetMacSupportPCMenuShortcuts = _core_.PyApp_GetMacSupportPCMenuShortcuts App_GetMacSupportPCMenuShortcuts = _core_.PyApp_GetMacSupportPCMenuShortcuts
App_GetMacAboutMenuItemId = _core_.PyApp_GetMacAboutMenuItemId App_GetMacAboutMenuItemId = _core_.PyApp_GetMacAboutMenuItemId
App_GetMacPreferencesMenuItemId = _core_.PyApp_GetMacPreferencesMenuItemId App_GetMacPreferencesMenuItemId = _core_.PyApp_GetMacPreferencesMenuItemId
@@ -166,9 +210,20 @@ class PySimpleApp(wx.App):
""" """
A simple application class. You can just create one of these and A simple application class. You can just create one of these and
then then make your top level windows later, and not have to worry then then make your top level windows later, and not have to worry
about OnInit.""" about OnInit. For example::
app = wx.PySimpleApp()
frame = wx.Frame(None, title='Hello World')
frame.Show()
app.MainLoop()
:see: `wx.App`
"""
def __init__(self, redirect=False, filename=None, useBestVisual=False): def __init__(self, redirect=False, filename=None, useBestVisual=False):
"""
:see: `wx.App.__init__`
"""
wx.App.__init__(self, redirect, filename, useBestVisual) wx.App.__init__(self, redirect, filename, useBestVisual)
def OnInit(self): def OnInit(self):
@@ -176,6 +231,7 @@ class PySimpleApp(wx.App):
return True return True
# Is anybody using this one? # Is anybody using this one?
class PyWidgetTester(wx.App): class PyWidgetTester(wx.App):
def __init__(self, size = (250, 100)): def __init__(self, size = (250, 100)):
@@ -187,15 +243,15 @@ class PyWidgetTester(wx.App):
self.SetTopWindow(self.frame) self.SetTopWindow(self.frame)
return True return True
def SetWidget(self, widgetClass, *args): def SetWidget(self, widgetClass, *args, **kwargs):
w = widgetClass(self.frame, *args) w = widgetClass(self.frame, *args, **kwargs)
self.frame.Show(True) self.frame.Show(True)
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# DO NOT hold any other references to this object. This is how we # DO NOT hold any other references to this object. This is how we
# know when to cleanup system resources that wxWin is holding. When # know when to cleanup system resources that wxWidgets is holding. When
# the sys module is unloaded, the refcount on sys.__wxPythonCleanup # the sys module is unloaded, the refcount on sys.__wxPythonCleanup
# goes to zero and it calls the wxApp_CleanUp function. # goes to zero and it calls the wx.App_CleanUp function.
class __wxPyCleanup: class __wxPyCleanup:
def __init__(self): def __init__(self):
@@ -206,11 +262,8 @@ class __wxPyCleanup:
_sys.__wxPythonCleanup = __wxPyCleanup() _sys.__wxPythonCleanup = __wxPyCleanup()
## # another possible solution, but it gets called too early... ## # another possible solution, but it gets called too early...
## if sys.version[0] == '2': ## import atexit
## import atexit ## atexit.register(_core_.wxApp_CleanUp)
## atexit.register(_core_.wxApp_CleanUp)
## else:
## sys.exitfunc = _core_.wxApp_CleanUp
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------

View File

@@ -102,6 +102,90 @@ public:
%} %}
// The one for SWIG to see // The one for SWIG to see
DocStr(wxPyArtProvider,
"The wx.ArtProvider class is used to customize the look of wxWidgets
application. When wxWidgets needs to display an icon or a bitmap (e.g.
in the standard file dialog), it does not use hard-coded resource but
asks wx.ArtProvider for it instead. This way the users can plug in
their own wx.ArtProvider class and easily replace standard art with
his/her own version. It is easy thing to do: all that is needed is
to derive a class from wx.ArtProvider, override it's CreateBitmap
method and register the provider with wx.ArtProvider.PushProvider::
class MyArtProvider(wx.ArtProvider):
def __init__(self):
wx.ArtProvider.__init__(self)
def CreateBitmap(self, artid, client, size):
...
return bmp
Identifying art resources
-------------------------
Every bitmap is known to wx.ArtProvider under an unique ID that is
used when requesting a resource from it. The IDs can have one of these
predefined values:
* wx.ART_ADD_BOOKMARK
* wx.ART_DEL_BOOKMARK
* wx.ART_HELP_SIDE_PANEL
* wx.ART_HELP_SETTINGS
* wx.ART_HELP_BOOK
* wx.ART_HELP_FOLDER
* wx.ART_HELP_PAGE
* wx.ART_GO_BACK
* wx.ART_GO_FORWARD
* wx.ART_GO_UP
* wx.ART_GO_DOWN
* wx.ART_GO_TO_PARENT
* wx.ART_GO_HOME
* wx.ART_FILE_OPEN
* wx.ART_PRINT
* wx.ART_HELP
* wx.ART_TIP
* wx.ART_REPORT_VIEW
* wx.ART_LIST_VIEW
* wx.ART_NEW_DIR
* wx.ART_FOLDER
* wx.ART_GO_DIR_UP
* wx.ART_EXECUTABLE_FILE
* wx.ART_NORMAL_FILE
* wx.ART_TICK_MARK
* wx.ART_CROSS_MARK
* wx.ART_ERROR
* wx.ART_QUESTION
* wx.ART_WARNING
* wx.ART_INFORMATION
* wx.ART_MISSING_IMAGE
Clients
-------
The Client is the entity that calls wx.ArtProvider's `GetBitmap` or
`GetIcon` function. Client IDs server as a hint to wx.ArtProvider
that is supposed to help it to choose the best looking bitmap. For
example it is often desirable to use slightly different icons in menus
and toolbars even though they represent the same action (e.g.
wx.ART_FILE_OPEN). Remember that this is really only a hint for
wx.ArtProvider -- it is common that `wx.ArtProvider.GetBitmap` returns
identical bitmap for different client values!
* wx.ART_TOOLBAR
* wx.ART_MENU
* wx.ART_FRAME_ICON
* wx.ART_CMN_DIALOG
* wx.ART_HELP_BROWSER
* wx.ART_MESSAGE_BOX
* wx.ART_OTHER (used for all requests that don't fit into any
of the categories above)
");
%name(ArtProvider) class wxPyArtProvider /*: public wxObject*/ %name(ArtProvider) class wxPyArtProvider /*: public wxObject*/
{ {
public: public:
@@ -111,30 +195,37 @@ public:
void _setCallbackInfo(PyObject* self, PyObject* _class); void _setCallbackInfo(PyObject* self, PyObject* _class);
DocStr(PushProvider, "Add new provider to the top of providers stack."); DocDeclStr(
static void PushProvider(wxPyArtProvider *provider); static void , PushProvider(wxPyArtProvider *provider),
"Add new provider to the top of providers stack.");
DocStr(PopProvider, "Remove latest added provider and delete it."); DocDeclStr(
static bool PopProvider(); static bool , PopProvider(),
"Remove latest added provider and delete it.");
DocStr(RemoveProvider, DocDeclStr(
"Remove provider. The provider must have been added previously!\n" static bool , RemoveProvider(wxPyArtProvider *provider),
"The provider is _not_ deleted."); "Remove provider. The provider must have been added previously! The
static bool RemoveProvider(wxPyArtProvider *provider); provider is _not_ deleted.");
DocStr(GetBitmap, DocDeclStr(
"Query the providers for bitmap with given ID and return it. Return\n" static wxBitmap , GetBitmap(const wxString& id,
"wx.NullBitmap if no provider provides it."); const wxString& client = wxPyART_OTHER,
static wxBitmap GetBitmap(const wxString& id, const wxSize& size = wxDefaultSize),
const wxString& client = wxPyART_OTHER, "Query the providers for bitmap with given ID and return it. Return
const wxSize& size = wxDefaultSize); wx.NullBitmap if no provider provides it.");
DocStr(GetIcon, DocDeclStr(
"Query the providers for icon with given ID and return it. Return\n" static wxIcon , GetIcon(const wxString& id,
"wx.NullIcon if no provider provides it.");
static wxIcon GetIcon(const wxString& id,
const wxString& client = wxPyART_OTHER, const wxString& client = wxPyART_OTHER,
const wxSize& size = wxDefaultSize); const wxSize& size = wxDefaultSize),
"Query the providers for icon with given ID and return it. Return
wx.NullIcon if no provider provides it.");
%extend { void Destroy() { delete self; }} %extend { void Destroy() { delete self; }}
}; };

View File

@@ -43,34 +43,83 @@
// TODO: When the API stabalizes and is available on other platforms, add // TODO: When the API stabalizes and is available on other platforms, add
// wrappers for the new wxBitmap, wxRawBitmap, wxDIB stuff... // wrappers for the new wxBitmap, wxRawBitmap, wxDIB stuff...
DocStr(wxBitmap,
"The wx.Bitmap class encapsulates the concept of a platform-dependent
bitmap. It can be either monochrome or colour, and either loaded from
a file or created dynamically. A bitmap can be selected into a memory
device context (instance of `wx.MemoryDC`). This enables the bitmap to
be copied to a window or memory device context using `wx.DC.Blit`, or
to be used as a drawing surface.
The BMP and XMP image file formats are supported on all platforms by
wx.Bitmap. Other formats are automatically loaded by `wx.Image` and
converted to a wx.Bitmap, so any image file format supported by
`wx.Image` can be used.
:todo: Add wrappers and support for raw bitmap data access. Can this
be be put into Python without losing the speed benefits of the
teplates and iterators in rawbmp.h?
:todo: Find a way to do very efficient PIL Image <--> wx.Bitmap
converstions.
");
class wxBitmap : public wxGDIObject class wxBitmap : public wxGDIObject
{ {
public: public:
DocCtorStr( DocCtorStr(
wxBitmap(const wxString& name, wxBitmapType type=wxBITMAP_TYPE_ANY), wxBitmap(const wxString& name, wxBitmapType type=wxBITMAP_TYPE_ANY),
"Loads a bitmap from a file."); "Loads a bitmap from a file.
:param name: Name of the file to load the bitmap from.
:param type: The type of image to expect. Can be one of the following
constants (assuming that the neccessary `wx.Image` handlers are
loaded):
* wx.BITMAP_TYPE_ANY
* wx.BITMAP_TYPE_BMP
* wx.BITMAP_TYPE_ICO
* wx.BITMAP_TYPE_CUR
* wx.BITMAP_TYPE_XBM
* wx.BITMAP_TYPE_XPM
* wx.BITMAP_TYPE_TIF
* wx.BITMAP_TYPE_GIF
* wx.BITMAP_TYPE_PNG
* wx.BITMAP_TYPE_JPEG
* wx.BITMAP_TYPE_PNM
* wx.BITMAP_TYPE_PCX
* wx.BITMAP_TYPE_PICT
* wx.BITMAP_TYPE_ICON
* wx.BITMAP_TYPE_ANI
* wx.BITMAP_TYPE_IFF
:see: Alternate constructors `wx.EmptyBitmap`, `wx.BitmapFromIcon`,
`wx.BitmapFromImage`, `wx.BitmapFromXPMData`,
`wx.BitmapFromBits`
");
~wxBitmap(); ~wxBitmap();
// DocCtorStrName( DocCtorStrName(
// wxBitmap(int width, int height, int depth=-1), wxBitmap(int width, int height, int depth=-1),
// "Creates a new bitmap of the given size. A depth of -1 indicates the depth of\n" "Creates a new bitmap of the given size. A depth of -1 indicates the
// "the current screen or visual. Some platforms only support 1 for monochrome and\n" depth of the current screen or visual. Some platforms only support 1
// "-1 for the current colour setting.", for monochrome and -1 for the current colour setting.",
// EmptyBitmap); EmptyBitmap);
DocCtorStrName( DocCtorStrName(
wxBitmap(const wxIcon& icon), wxBitmap(const wxIcon& icon),
"Create a new bitmap from an Icon object.", "Create a new bitmap from a `wx.Icon` object.",
BitmapFromIcon); BitmapFromIcon);
DocCtorStrName( DocCtorStrName(
wxBitmap(const wxImage& image, int depth=-1), wxBitmap(const wxImage& image, int depth=-1),
"Creates bitmap object from the image. This has to be done to actually display\n" "Creates bitmap object from a `wx.Image`. This has to be done to
"an image as you cannot draw an image directly on a window. The resulting\n" actually display a `wx.Image` as you cannot draw an image directly on
"bitmap will use the provided colour depth (or that of the current system if\n" a window. The resulting bitmap will use the provided colour depth (or
"depth is -1) which entails that a colour reduction has to take place.", that of the current screen colour depth if depth is -1) which entails
that a colour reduction may have to take place.",
BitmapFromImage); BitmapFromImage);
@@ -90,31 +139,16 @@ public:
} }
DocStr(wxBitmap(PyObject* bits, int width, int height, int depth=1 ), DocStr(wxBitmap(PyObject* bits, int width, int height, int depth=1 ),
"Creates a bitmap from an array of bits. You should only use this function for\n" "Creates a bitmap from an array of bits. You should only use this
"monochrome bitmaps (depth 1) in portable programs: in this case the bits\n" function for monochrome bitmaps (depth 1) in portable programs: in
"parameter should contain an XBM image. For other bit depths, the behaviour is\n" this case the bits parameter should contain an XBM image. For other
"platform dependent."); bit depths, the behaviour is platform dependent.");
%name(BitmapFromBits) wxBitmap(PyObject* bits, int width, int height, int depth=1 ) { %name(BitmapFromBits) wxBitmap(PyObject* bits, int width, int height, int depth=1 ) {
char* buf; char* buf;
int length; int length;
PyString_AsStringAndSize(bits, &buf, &length); PyString_AsStringAndSize(bits, &buf, &length);
return new wxBitmap(buf, width, height, depth); return new wxBitmap(buf, width, height, depth);
} }
DocStr(wxBitmap(const wxSize& size, int depth=-1),
"Creates a new bitmap of the given size. A depth of -1 indicates
the depth of the current screen or visual. Some platforms only
support 1 for monochrome and -1 for the current colour setting.");
%nokwargs wxBitmap(int width, int height, int depth=-1);
%nokwargs wxBitmap(const wxSize& size, int depth=-1);
%name(EmptyBitmap)wxBitmap(int width, int height, int depth=-1) {
return new wxBitmap(width, height, depth);
}
%name(EmptyBitmap)wxBitmap(const wxSize& size, int depth=-1) {
return new wxBitmap(size.x, size.y, depth);
}
} }
@@ -132,16 +166,21 @@ support 1 for monochrome and -1 for the current colour setting.");
bool Ok(); bool Ok();
DocStr(GetWidth, "Gets the width of the bitmap in pixels."); DocDeclStr(
int GetWidth(); int , GetWidth(),
"Gets the width of the bitmap in pixels.");
DocStr(GetHeight, "Gets the height of the bitmap in pixels."); DocDeclStr(
int GetHeight(); int , GetHeight(),
"Gets the height of the bitmap in pixels.");
DocStr(GetDepth, DocDeclStr(
"Gets the colour depth of the bitmap. A value of 1 indicates a\n" int , GetDepth(),
"monochrome bitmap."); "Gets the colour depth of the bitmap. A value of 1 indicates a
int GetDepth(); monochrome bitmap.");
%extend { %extend {
@@ -153,20 +192,29 @@ support 1 for monochrome and -1 for the current colour setting.");
} }
DocStr(ConvertToImage, DocDeclStr(
"Creates a platform-independent image from a platform-dependent bitmap. This\n" virtual wxImage , ConvertToImage() const,
"preserves mask information so that bitmaps and images can be converted back\n" "Creates a platform-independent image from a platform-dependent
"and forth without loss in that respect."); bitmap. This preserves mask information so that bitmaps and images can
virtual wxImage ConvertToImage() const; be converted back and forth without loss in that respect.");
DocStr(GetMask, DocDeclStr(
"Gets the associated mask (if any) which may have been loaded from a file\n" virtual wxMask* , GetMask() const,
"or explpicitly set for the bitmap."); "Gets the associated mask (if any) which may have been loaded from a
virtual wxMask* GetMask() const; file or explpicitly set for the bitmap.
DocStr(SetMask, :see: `SetMask`, `wx.Mask`
"Sets the mask for this bitmap."); ");
virtual void SetMask(wxMask* mask);
DocDeclStr(
virtual void , SetMask(wxMask* mask),
"Sets the mask for this bitmap.
:see: `GetMask`, `wx.Mask`
");
%extend { %extend {
DocStr(SetMaskColour, DocStr(SetMaskColour,
@@ -177,17 +225,26 @@ support 1 for monochrome and -1 for the current colour setting.");
} }
} }
DocStr(GetSubBitmap,
"Returns a sub bitmap of the current one as long as the rect belongs entirely\n"
"to the bitmap. This function preserves bit depth and mask information.");
virtual wxBitmap GetSubBitmap(const wxRect& rect) const;
DocStr(SaveFile, "Saves a bitmap in the named file."); DocDeclStr(
virtual bool SaveFile(const wxString &name, wxBitmapType type, virtual wxBitmap , GetSubBitmap(const wxRect& rect) const,
wxPalette *palette = (wxPalette *)NULL); "Returns a sub-bitmap of the current one as long as the rect belongs
entirely to the bitmap. This function preserves bit depth and mask
information.");
DocStr(LoadFile, "Loads a bitmap from a file"); DocDeclStr(
virtual bool LoadFile(const wxString &name, wxBitmapType type); virtual bool , SaveFile(const wxString &name, wxBitmapType type,
wxPalette *palette = NULL),
"Saves a bitmap in the named file. See `__init__` for a description of
the ``type`` parameter.");
DocDeclStr(
virtual bool , LoadFile(const wxString &name, wxBitmapType type),
"Loads a bitmap from a file. See `__init__` for a description of the
``type`` parameter.");
#if wxUSE_PALETTE #if wxUSE_PALETTE
@@ -198,17 +255,23 @@ support 1 for monochrome and -1 for the current colour setting.");
virtual bool CopyFromIcon(const wxIcon& icon); virtual bool CopyFromIcon(const wxIcon& icon);
DocStr(SetHeight, "Set the height property (does not affect the bitmap data).") DocDeclStr(
virtual void SetHeight(int height); virtual void , SetHeight(int height),
"Set the height property (does not affect the existing bitmap data).");
DocDeclStr(
virtual void , SetWidth(int width),
"Set the width property (does not affect the existing bitmap data).");
DocStr(SetWidth, "Set the width property (does not affect the bitmap data).")
virtual void SetWidth(int width);
DocStr(SetDepth, "Set the depth property (does not affect the bitmap data).") DocDeclStr(
virtual void SetDepth(int depth); virtual void , SetDepth(int depth),
"Set the depth property (does not affect the existing bitmap data).");
%extend { %extend {
DocStr(SetSize, "Set the bitmap size"); DocStr(SetSize, "Set the bitmap size (does not affect the existing bitmap data).");
void SetSize(const wxSize& size) { void SetSize(const wxSize& size) {
self->SetWidth(size.x); self->SetWidth(size.x);
self->SetHeight(size.y); self->SetHeight(size.y);
@@ -233,22 +296,28 @@ support 1 for monochrome and -1 for the current colour setting.");
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
DocStr(wxMask, DocStr(wxMask,
"This class encapsulates a monochrome mask bitmap, where the masked area is\n" "This class encapsulates a monochrome mask bitmap, where the masked
"black and the unmasked area is white. When associated with a bitmap and drawn\n" area is black and the unmasked area is white. When associated with a
"in a device context, the unmasked area of the bitmap will be drawn, and the\n" bitmap and drawn in a device context, the unmasked area of the bitmap
"masked area will not be drawn."); will be drawn, and the masked area will not be drawn.
A mask may be associated with a `wx.Bitmap`. It is used in
`wx.DC.DrawBitmap` or `wx.DC.Blit` when the source device context is a
`wx.MemoryDC` with a `wx.Bitmap` selected into it that contains a
mask.
");
class wxMask : public wxObject { class wxMask : public wxObject {
public: public:
#if 0
DocCtorStr(
wxMask(const wxBitmap& bitmap),
"Constructs a mask from a monochrome bitmap.");
#endif
DocStr(wxMask, DocStr(wxMask,
"Constructs a mask from a bitmap and a colour in that bitmap that indicates\n" "Constructs a mask from a `wx.Bitmap` and a `wx.Colour` in that bitmap
"the transparent portions of the mask, by default BLACK is used."); that indicates the transparent portions of the mask. In other words,
the pixels in ``bitmap`` that match ``colour`` will be the transparent
portions of the mask. If no ``colour`` or an invalid ``colour`` is
passed then BLACK is used.
:see: `wx.Bitmap`, `wx.Colour`");
%extend { %extend {
wxMask(const wxBitmap& bitmap, const wxColour& colour = wxNullColour) { wxMask(const wxBitmap& bitmap, const wxColour& colour = wxNullColour) {
@@ -262,7 +331,7 @@ public:
//~wxMask(); //~wxMask();
}; };
%pythoncode { MaskColour = Mask } %pythoncode { MaskColour = wx._deprecated(Mask, "wx.MaskColour is deprecated, use `wx.Mask` instead.") }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View File

@@ -17,25 +17,81 @@
%newgroup %newgroup
DocStr(wxBrush, DocStr(wxBrush,
"A brush is a drawing tool for filling in areas. It is used for painting the\n" "A brush is a drawing tool for filling in areas. It is used for
"background of rectangles, ellipses, etc. It has a colour and a style."); painting the background of rectangles, ellipses, etc. when drawing on
a `wx.DC`. It has a colour and a style.
:warning: Do not create instances of wx.Brush before the `wx.App`
object has been created because, depending on the platform,
required internal data structures may not have been initialized
yet. Instead create your brushes in the app's OnInit or as they
are needed for drawing.
:note: On monochrome displays all brushes are white, unless the colour
really is black.
:see: `wx.BrushList`, `wx.DC`, `wx.DC.SetBrush`
");
class wxBrush : public wxGDIObject { class wxBrush : public wxGDIObject {
public: public:
DocStr(wxBrush, "Constructs a brush from a colour object and style."); DocCtorStr(
wxBrush(const wxColour& colour, int style=wxSOLID); wxBrush(const wxColour& colour, int style=wxSOLID),
"Constructs a brush from a `wx.Colour` object and a style. The style
parameter may be one of the following:
=================== =============================
Style Meaning
=================== =============================
wx.TRANSPARENT Transparent (no fill).
wx.SOLID Solid.
wx.STIPPLE Uses a bitmap as a stipple.
wx.BDIAGONAL_HATCH Backward diagonal hatch.
wx.CROSSDIAG_HATCH Cross-diagonal hatch.
wx.FDIAGONAL_HATCH Forward diagonal hatch.
wx.CROSS_HATCH Cross hatch.
wx.HORIZONTAL_HATCH Horizontal hatch.
wx.VERTICAL_HATCH Vertical hatch.
=================== =============================
");
~wxBrush(); ~wxBrush();
virtual void SetColour(const wxColour& col);
virtual void SetStyle(int style);
virtual void SetStipple(const wxBitmap& stipple);
wxColour GetColour() const;
int GetStyle() const;
wxBitmap *GetStipple() const;
bool Ok(); DocDeclStr(
virtual void , SetColour(const wxColour& col),
"Set the brush's `wx.Colour`.");
DocDeclStr(
virtual void , SetStyle(int style),
"Sets the style of the brush. See `__init__` for a listing of styles.");
DocDeclStr(
virtual void , SetStipple(const wxBitmap& stipple),
"Sets the stipple `wx.Bitmap`.");
DocDeclStr(
wxColour , GetColour() const,
"Returns the `wx.Colour` of the brush.");
DocDeclStr(
int , GetStyle() const,
"Returns the style of the brush. See `__init__` for a listing of
styles.");
DocDeclStr(
wxBitmap *, GetStipple() const,
"Returns the stiple `wx.Bitmap` of the brush. If the brush does not
have a wx.STIPPLE style, then the return value may be non-None but an
uninitialised bitmap (`wx.Bitmap.Ok` returns False).");
DocDeclStr(
bool , Ok(),
"Returns True if the brush is initialised and valid.");
#ifdef __WXMAC__ #ifdef __WXMAC__
short MacGetTheme(); short MacGetTheme();

View File

@@ -31,21 +31,31 @@ enum {
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
DocStr(wxButton, DocStr(wxButton,
"A button is a control that contains a text string, and is one of the most\n" "A button is a control that contains a text string, and is one of the most
"common elements of a GUI. It may be placed on a dialog box or panel, or\n" common elements of a GUI. It may be placed on a dialog box or panel, or
"indeed almost any other window."); indeed almost any other window.
RefDoc(wxButton, " Window Styles
Styles -------------
wx.BU_LEFT: Left-justifies the label. WIN32 only. ============== ==========================================
wx.BU_TOP: Aligns the label to the top of the button. WIN32 only. wx.BU_LEFT Left-justifies the label. WIN32 only.
wx.BU_RIGHT: Right-justifies the bitmap label. WIN32 only. wx.BU_TOP Aligns the label to the top of the button.
wx.BU_BOTTOM: Aligns the label to the bottom of the button. WIN32 only. WIN32 only.
wx.BU_EXACTFIT: Creates the button as small as possible instead of making wx.BU_RIGHT Right-justifies the bitmap label. WIN32 only.
it of the standard size (which is the default behaviour.) wx.BU_BOTTOM Aligns the label to the bottom of the button.
WIN32 only.
wx.BU_EXACTFIT Creates the button as small as possible
instead of making it of the standard size
(which is the default behaviour.)
============== ==========================================
Events Events
EVT_BUTTON: Sent when the button is clicked. ------
============ ==========================================
EVT_BUTTON Sent when the button is clicked.
============ ==========================================
:see: `wx.BitmapButton`
"); ");
class wxButton : public wxControl class wxButton : public wxControl
@@ -55,41 +65,40 @@ public:
%pythonAppend wxButton() "" %pythonAppend wxButton() ""
DocStr(wxButton, "Create and show a button.");
RefDoc(wxButton, ""); RefDoc(wxButton, "");
wxButton(wxWindow* parent, wxWindowID id, const wxString& label, DocCtorStr(
const wxPoint& pos = wxDefaultPosition, wxButton(wxWindow* parent, wxWindowID id, const wxString& label,
const wxSize& size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition,
long style = 0, const wxSize& size = wxDefaultSize,
const wxValidator& validator = wxDefaultValidator, long style = 0,
const wxString& name = wxPyButtonNameStr); const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyButtonNameStr),
"Create and show a button.");
DocStr(wxButton(), "Precreate a Button for 2-phase creation."); DocCtorStrName(
%name(PreButton)wxButton(); wxButton(),
"Precreate a Button for 2-phase creation.",
PreButton);
DocStr(Create, "Acutally create the GUI Button for 2-phase creation."); DocDeclStr(
bool Create(wxWindow* parent, wxWindowID id, const wxString& label, bool , Create(wxWindow* parent, wxWindowID id, const wxString& label,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = 0, long style = 0,
const wxValidator& validator = wxDefaultValidator, const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyButtonNameStr); const wxString& name = wxPyButtonNameStr),
"Acutally create the GUI Button for 2-phase creation.");
DocStr(SetDefault, "This sets the button to be the default item for the panel or dialog box."); DocDeclStr(
void SetDefault(); void , SetDefault(),
"This sets the button to be the default item for the panel or dialog box.");
DocDeclStr(
// #ifdef __WXMSW__ static wxSize , GetDefaultSize(),
// // show the image in the button in addition to the label "Returns the default button size for this platform.");
// void SetImageLabel(const wxBitmap& bitmap);
// // set the margins around the image
// void SetImageMargins(wxCoord x, wxCoord y);
// #endif
DocStr(GetDefaultButtonSize, "Returns the default button size for this platform.");
static wxSize GetDefaultSize();
}; };
@@ -99,27 +108,37 @@ public:
DocStr(wxBitmapButton, DocStr(wxBitmapButton,
"A Button that contains a bitmap. A bitmap button can be supplied with a "A Button that contains a bitmap. A bitmap button can be supplied with a
single bitmap, and wxWindows will draw all button states using this bitmap. If single bitmap, and wxWidgets will draw all button states using this bitmap. If
the application needs more control, additional bitmaps for the selected state, the application needs more control, additional bitmaps for the selected state,
unpressed focused state, and greyed-out state may be supplied. unpressed focused state, and greyed-out state may be supplied.
");
RefDoc(wxBitmapButton, " Window Styles
Styles -------------
wx.BU_AUTODRAW: If this is specified, the button will be drawn ============== =============================================
automatically using the label bitmap only, providing a wx.BU_AUTODRAW If this is specified, the button will be drawn
3D-look border. If this style is not specified, the button automatically using the label bitmap only,
will be drawn without borders and using all provided providing a 3D-look border. If this style is
not specified, the button will be drawn
without borders and using all provided
bitmaps. WIN32 only. bitmaps. WIN32 only.
wx.BU_LEFT: Left-justifies the label. WIN32 only. wx.BU_LEFT Left-justifies the label. WIN32 only.
wx.BU_TOP: Aligns the label to the top of the button. WIN32 only. wx.BU_TOP Aligns the label to the top of the button. WIN32
wx.BU_RIGHT: Right-justifies the bitmap label. WIN32 only. only.
wx.BU_BOTTOM: Aligns the label to the bottom of the button. WIN32 only. wx.BU_RIGHT Right-justifies the bitmap label. WIN32 only.
wx.BU_EXACTFIT: Creates the button as small as possible instead of making wx.BU_BOTTOM Aligns the label to the bottom of the
it of the standard size (which is the default behaviour.) button. WIN32 only.
wx.BU_EXACTFIT Creates the button as small as possible
instead of making it of the standard size
(which is the default behaviour.)
============== =============================================
Events Events
EVT_BUTTON: Sent when the button is clicked. ------
=========== ==================================
EVT_BUTTON Sent when the button is clicked.
=========== ==================================
:see: `wx.Button`, `wx.Bitmap`
"); ");
class wxBitmapButton : public wxButton class wxBitmapButton : public wxButton
@@ -128,52 +147,70 @@ public:
%pythonAppend wxBitmapButton "self._setOORInfo(self)" %pythonAppend wxBitmapButton "self._setOORInfo(self)"
%pythonAppend wxBitmapButton() "" %pythonAppend wxBitmapButton() ""
DocStr(wxBitmapButton, "Create and show a button with a bitmap for the label.")
RefDoc(wxBitmapButton, ""); // turn it off for the ctors RefDoc(wxBitmapButton, ""); // turn it off for the ctors
wxBitmapButton(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxBU_AUTODRAW,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyButtonNameStr);
DocStr(wxBitmapButton(), "Precreate a BitmapButton for 2-phase creation."); DocCtorStr(
%name(PreBitmapButton)wxBitmapButton(); wxBitmapButton(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxBU_AUTODRAW,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyButtonNameStr),
"Create and show a button with a bitmap for the label.");
DocStr(Create, "Acutally create the GUI BitmapButton for 2-phase creation."); DocCtorStrName(
bool Create(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap, wxBitmapButton(),
"Precreate a BitmapButton for 2-phase creation.",
PreBitmapButton);
DocDeclStr(
bool , Create(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxBU_AUTODRAW, long style = wxBU_AUTODRAW,
const wxValidator& validator = wxDefaultValidator, const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyButtonNameStr); const wxString& name = wxPyButtonNameStr),
"Acutally create the GUI BitmapButton for 2-phase creation.");
DocStr(GetBitmapLabel, "Returns the label bitmap (the one passed to the constructor)."); DocDeclStr(
wxBitmap GetBitmapLabel(); wxBitmap , GetBitmapLabel(),
"Returns the label bitmap (the one passed to the constructor).");
DocDeclStr(
wxBitmap , GetBitmapDisabled(),
"Returns the bitmap for the disabled state.");
DocDeclStr(
wxBitmap , GetBitmapFocus(),
"Returns the bitmap for the focused state.");
DocStr(GetBitmapDisabled, "Returns the bitmap for the disabled state."); DocDeclStr(
wxBitmap GetBitmapDisabled(); wxBitmap , GetBitmapSelected(),
"Returns the bitmap for the selected state.");
DocStr(GetBitmapFocus, "Returns the bitmap for the focused state."); DocDeclStr(
wxBitmap GetBitmapFocus(); void , SetBitmapDisabled(const wxBitmap& bitmap),
"Sets the bitmap for the disabled button appearance.");
DocStr(GetBitmapSelected, "Returns the bitmap for the selected state."); DocDeclStr(
wxBitmap GetBitmapSelected(); void , SetBitmapFocus(const wxBitmap& bitmap),
"Sets the bitmap for the button appearance when it has the keyboard focus.");
DocStr(SetBitmapDisabled, "Sets the bitmap for the disabled button appearance."); DocDeclStr(
void SetBitmapDisabled(const wxBitmap& bitmap); void , SetBitmapSelected(const wxBitmap& bitmap),
"Sets the bitmap for the selected (depressed) button appearance.");
DocStr(SetBitmapFocus, "Sets the bitmap for the button appearance when it has the keyboard focus."); DocDeclStr(
void SetBitmapFocus(const wxBitmap& bitmap); void , SetBitmapLabel(const wxBitmap& bitmap),
"Sets the bitmap label for the button. This is the bitmap used for the
DocStr(SetBitmapSelected, "Sets the bitmap for the selected (depressed) button appearance."); unselected state, and for all other states if no other bitmaps are provided.");
void SetBitmapSelected(const wxBitmap& bitmap);
DocStr(SetBitmapLabel,
"Sets the bitmap label for the button. This is the bitmap used for the\n"
"unselected state, and for all other states if no other bitmaps are provided.");
void SetBitmapLabel(const wxBitmap& bitmap);
void SetMargins(int x, int y); void SetMargins(int x, int y);
int GetMarginX() const; int GetMarginX() const;

View File

@@ -45,24 +45,35 @@ enum wxCheckBoxState
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
DocStr(wxCheckBox, DocStr(wxCheckBox,
"A checkbox is a labelled box which by default is either on (checkmark is "A checkbox is a labelled box which by default is either on (the
visible) or off (no checkmark). Optionally (When the wxCHK_3STATE style flag checkmark is visible) or off (no checkmark). Optionally (When the
is set) it can have a third state, called the mixed or undetermined wx.CHK_3STATE style flag is set) it can have a third state, called the
state. Often this is used as a \"Does Not Apply\" state."); mixed or undetermined state. Often this is used as a \"Does Not
Apply\" state.
RefDoc(wxCheckBox, " Window Styles
Styles -------------
wx.CHK_2STATE: Create a 2-state checkbox. This is the default. ================================= ===============================
wx.CHK_3STATE: Create a 3-state checkbox. wx.CHK_2STATE Create a 2-state checkbox.
wx.CHK_ALLOW_3RD_STATE_FOR_USER: By default a user can't set a 3-state This is the default.
checkbox to the third state. It can only wx.CHK_3STATE Create a 3-state checkbox.
be done from code. Using this flags wx.CHK_ALLOW_3RD_STATE_FOR_USER By default a user can't set a
allows the user to set the checkbox to 3-state checkbox to the
the third state by clicking. third state. It can only be
wx.ALIGN_RIGHT: Makes the text appear on the left of the checkbox. done from code. Using this
flags allows the user to set
the checkbox to the third
state by clicking.
wx.ALIGN_RIGHT Makes the
text appear on the left of
the checkbox.
================================= ===============================
Events Events
EVT_CHECKBOX: Sent when checkbox is clicked. ------
=============================== ===============================
EVT_CHECKBOX Sent when checkbox is clicked.
=============================== ===============================
"); ");
@@ -102,31 +113,33 @@ public:
DocDeclStr( DocDeclStr(
bool, GetValue(), bool, GetValue(),
"Gets the state of a 2-state CheckBox. Returns True if it is checked,\n" "Gets the state of a 2-state CheckBox. Returns True if it is checked,
"False otherwise."); False otherwise.");
DocDeclStr( DocDeclStr(
bool, IsChecked(), bool, IsChecked(),
"Similar to GetValue, but raises an exception if it is not a 2-state CheckBox."); "Similar to GetValue, but raises an exception if it is not a 2-state
CheckBox.");
DocDeclStr( DocDeclStr(
void, SetValue(const bool state), void, SetValue(const bool state),
"Set the state of a 2-state CheckBox. Pass True for checked,\n" "Set the state of a 2-state CheckBox. Pass True for checked, False for
"False for unchecked."); unchecked.");
DocDeclStr( DocDeclStr(
wxCheckBoxState, Get3StateValue() const, wxCheckBoxState, Get3StateValue() const,
"Returns wx.CHK_UNCHECKED when the CheckBox is unchecked, wx.CHK_CHECKED when\n" "Returns wx.CHK_UNCHECKED when the CheckBox is unchecked,
"it is checked and wx.CHK_UNDETERMINED when it's in the undetermined state.\n" wx.CHK_CHECKED when it is checked and wx.CHK_UNDETERMINED when it's in
"Raises an exceptiion when the function is used with a 2-state CheckBox."); the undetermined state. Raises an exceptiion when the function is
used with a 2-state CheckBox.");
DocDeclStr( DocDeclStr(
void, Set3StateValue(wxCheckBoxState state), void, Set3StateValue(wxCheckBoxState state),
"Sets the CheckBox to the given state. The state parameter can be\n" "Sets the CheckBox to the given state. The state parameter can be one
"one of the following: wx.CHK_UNCHECKED (Check is off), wx.CHK_CHECKED\n" of the following: wx.CHK_UNCHECKED (Check is off), wx.CHK_CHECKED (the
"(Check is on) or wx.CHK_UNDETERMINED (Check is mixed). Raises an\n" Check is on) or wx.CHK_UNDETERMINED (Check is mixed). Raises an
"exception when the CheckBox is a 2-state checkbox and setting the state\n" exception when the CheckBox is a 2-state checkbox and setting the
"to wx.CHK_UNDETERMINED."); state to wx.CHK_UNDETERMINED.");
DocDeclStr( DocDeclStr(
bool, Is3State() const, bool, Is3State() const,
@@ -134,7 +147,8 @@ public:
DocDeclStr( DocDeclStr(
bool, Is3rdStateAllowedForUser() const, bool, Is3rdStateAllowedForUser() const,
"Returns whether or not the user can set the CheckBox to the third state."); "Returns whether or not the user can set the CheckBox to the third
state.");
}; };

View File

@@ -22,12 +22,15 @@ MAKE_CONST_WXSTRING(ChoiceNameStr);
DocStr(wxChoice, DocStr(wxChoice,
"A Choice control is used to select one of a list of strings. Unlike a ListBox, "A Choice control is used to select one of a list of strings.
only the selection is visible until the user pulls down the menu of choices."); Unlike a `wx.ListBox`, only the selection is visible until the
user pulls down the menu of choices.
RefDoc(wxChoice, " Events
Events ------
EVT_CHOICE: Sent when an item in the list is selected. ================ ==========================================
EVT_CHOICE Sent when an item in the list is selected.
================ ==========================================
"); ");
@@ -47,9 +50,9 @@ public:
long style = 0, long style = 0,
const wxValidator& validator = wxDefaultValidator, const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyChoiceNameStr), const wxString& name = wxPyChoiceNameStr),
"__init__(Window parent, int id, Point pos=DefaultPosition, Size size=DefaultSize,\n" "__init__(Window parent, int id, Point pos=DefaultPosition, Size size=DefaultSize,
" List choices=[], long style=0, Validator validator=DefaultValidator,\n" List choices=[], long style=0, Validator validator=DefaultValidator,
" String name=ChoiceNameStr) -> Choice", String name=ChoiceNameStr) -> Choice",
"Create and show a Choice control"); "Create and show a Choice control");
DocCtorStrName( DocCtorStrName(
@@ -66,9 +69,9 @@ public:
long style = 0, long style = 0,
const wxValidator& validator = wxDefaultValidator, const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyChoiceNameStr), const wxString& name = wxPyChoiceNameStr),
"Create(Window parent, int id, Point pos=DefaultPosition, Size size=DefaultSize,\n" "Create(Window parent, int id, Point pos=DefaultPosition, Size size=DefaultSize,
" List choices=[], long style=0, Validator validator=DefaultValidator,\n" List choices=[], long style=0, Validator validator=DefaultValidator,
" String name=ChoiceNameStr) -> bool", String name=ChoiceNameStr) -> bool",
"Actually create the GUI Choice control for 2-phase creation"); "Actually create the GUI Choice control for 2-phase creation");

View File

@@ -20,33 +20,38 @@
%} %}
DocStr(wxClipboard, DocStr(wxClipboard,
"wx.Clipboard represents the system clipboard and provides methods to
"wx.Clipboard represents the system clipboard and provides methods to copy data copy data to it or paste data from it. Normally, you should only use
to or paste data from it. Normally, you should only use wx.TheClipboard which ``wx.TheClipboard`` which is a reference to a global wx.Clipboard
is a reference to a global wx.Clipboard instance. instance.
Call wx.TheClipboard.Open to get ownership of the clipboard. If this operation Call ``wx.TheClipboard``'s `Open` method to get ownership of the
returns True, you now own the clipboard. Call wx.TheClipboard.SetData to put clipboard. If this operation returns True, you now own the
data on the clipboard, or wx.TheClipboard.GetData to retrieve data from the clipboard. Call `SetData` to put data on the clipboard, or `GetData`
clipboard. Call wx.TheClipboard.Close to close the clipboard and relinquish to retrieve data from the clipboard. Call `Close` to close the
ownership. You should keep the clipboard open only momentarily. clipboard and relinquish ownership. You should keep the clipboard open
only momentarily.
:see: `wx.DataObject`
"); ");
class wxClipboard : public wxObject { class wxClipboard : public wxObject {
public: public:
DocCtorStr( wxClipboard(), "" ); DocCtorStr(
wxClipboard(),
"");
~wxClipboard(); ~wxClipboard();
DocDeclStr( DocDeclStr(
virtual bool , Open(), virtual bool , Open(),
"Call this function to open the clipboard before calling SetData\n" "Call this function to open the clipboard before calling SetData and
"and GetData. Call Close when you have finished with the clipboard.\n" GetData. Call Close when you have finished with the clipboard. You
"You should keep the clipboard open for only a very short time.\n" should keep the clipboard open for only a very short time. Returns
"Returns true on success. "); True on success.");
DocDeclStr( DocDeclStr(
@@ -64,50 +69,54 @@ public:
DocDeclStr( DocDeclStr(
virtual bool , AddData( wxDataObject *data ), virtual bool , AddData( wxDataObject *data ),
"Call this function to add the data object to the clipboard. You\n" "Call this function to add the data object to the clipboard. You may
"may call this function repeatedly after having cleared the clipboard.\n" call this function repeatedly after having cleared the clipboard.
"After this function has been called, the clipboard owns the data, so\n" After this function has been called, the clipboard owns the data, so
"do not delete the data explicitly."); do not delete the data explicitly.
:see: `wx.DataObject`");
DocDeclStr( DocDeclStr(
virtual bool , SetData( wxDataObject *data ), virtual bool , SetData( wxDataObject *data ),
"Set the clipboard data, this is the same as Clear followed by AddData."); "Set the clipboard data, this is the same as `Clear` followed by
`AddData`.
:see: `wx.DataObject`");
%clear wxDataObject *data; %clear wxDataObject *data;
DocDeclStr( DocDeclStr(
virtual bool , IsSupported( const wxDataFormat& format ), virtual bool , IsSupported( const wxDataFormat& format ),
"Returns True if the given format is available in the data object(s) on\n" "Returns True if the given format is available in the data object(s) on
"the clipboard."); the clipboard.");
DocDeclStr( DocDeclStr(
virtual bool , GetData( wxDataObject& data ), virtual bool , GetData( wxDataObject& data ),
"Call this function to fill data with data on the clipboard, if available\n" "Call this function to fill data with data on the clipboard, if
"in the required format. Returns true on success."); available in the required format. Returns true on success.");
DocDeclStr( DocDeclStr(
virtual void , Clear(), virtual void , Clear(),
"Clears data from the clipboard object and also the system's clipboard\n" "Clears data from the clipboard object and also the system's clipboard
"if possible."); if possible.");
DocDeclStr( DocDeclStr(
virtual bool , Flush(), virtual bool , Flush(),
"Flushes the clipboard: this means that the data which is currently on\n" "Flushes the clipboard: this means that the data which is currently on
"clipboard will stay available even after the application exits (possibly\n" clipboard will stay available even after the application exits,
"eating memory), otherwise the clipboard will be emptied on exit.\n" possibly eating memory, otherwise the clipboard will be emptied on
"Returns False if the operation is unsuccesful for any reason."); exit. Returns False if the operation is unsuccesful for any reason.");
DocDeclStr( DocDeclStr(
virtual void , UsePrimarySelection( bool primary = True ), virtual void , UsePrimarySelection( bool primary = True ),
"On platforms supporting it (the X11 based platforms), selects the so\n" "On platforms supporting it (the X11 based platforms), selects the
"called PRIMARY SELECTION as the clipboard as opposed to the normal\n" so called PRIMARY SELECTION as the clipboard as opposed to the
"clipboard, if primary is True."); normal clipboard, if primary is True.");
}; };
@@ -121,8 +130,8 @@ wxClipboard* const wxTheClipboard;
DocStr(wxClipboardLocker, DocStr(wxClipboardLocker,
"A helpful class for opening the clipboard and automatically closing it when "A helpful class for opening the clipboard and automatically
the locker is destroyed."); closing it when the locker is destroyed.");
class wxClipboardLocker class wxClipboardLocker
{ {
@@ -131,8 +140,8 @@ public:
~wxClipboardLocker(); ~wxClipboardLocker();
DocStr(__nonzero__, DocStr(__nonzero__,
"A ClipboardLocker instance evaluates to True if the clipboard was\n" "A ClipboardLocker instance evaluates to True if the clipboard was
"successfully opened.") successfully opened.")
%extend { %extend {
bool __nonzero__() { return !!(*self); } bool __nonzero__() { return !!(*self); }
} }

View File

@@ -27,7 +27,9 @@ MAKE_CONST_WXSTRING(MessageBoxCaptionStr);
DocStr(wxColourData, DocStr(wxColourData,
"This class holds a variety of information related to colour dialogs."); "This class holds a variety of information related to the colour
chooser dialog, used to transfer settings and results to and from the
`wx.ColourDialog`.");
class wxColourData : public wxObject { class wxColourData : public wxObject {
public: public:
@@ -40,9 +42,9 @@ public:
DocDeclStr( DocDeclStr(
bool , GetChooseFull(), bool , GetChooseFull(),
"Under Windows, determines whether the Windows colour dialog will display\n" "Under Windows, determines whether the Windows colour dialog will
"the full dialog with custom colour selection controls. Has no meaning\n" display the full dialog with custom colour selection controls. Has no
"under other platforms. The default value is true."); meaning under other platforms. The default value is true.");
DocDeclStr( DocDeclStr(
wxColour , GetColour(), wxColour , GetColour(),
@@ -50,27 +52,31 @@ public:
DocDeclStr( DocDeclStr(
wxColour , GetCustomColour(int i), wxColour , GetCustomColour(int i),
"Gets the i'th custom colour associated with the colour dialog. i should\n" "Gets the i'th custom colour associated with the colour dialog. i
"be an integer between 0 and 15. The default custom colours are all white."); should be an integer between 0 and 15. The default custom colours are
all white.");
DocDeclStr( DocDeclStr(
void , SetChooseFull(int flag), void , SetChooseFull(int flag),
"Under Windows, tells the Windows colour dialog to display the full dialog\n" "Under Windows, tells the Windows colour dialog to display the full
"with custom colour selection controls. Under other platforms, has no effect.\n" dialog with custom colour selection controls. Under other platforms,
"The default value is true."); has no effect. The default value is true.");
DocDeclStr( DocDeclStr(
void , SetColour(const wxColour& colour), void , SetColour(const wxColour& colour),
"Sets the default colour for the colour dialog. The default colour is black."); "Sets the default colour for the colour dialog. The default colour is
black.");
DocDeclStr( DocDeclStr(
void , SetCustomColour(int i, const wxColour& colour), void , SetCustomColour(int i, const wxColour& colour),
"Sets the i'th custom colour for the colour dialog. i should be an integer\n" "Sets the i'th custom colour for the colour dialog. i should be an
"between 0 and 15. The default custom colours are all white."); integer between 0 and 15. The default custom colours are all white.");
}; };
DocStr(wxColourDialog, DocStr(wxColourDialog,
"This class represents the colour chooser dialog."); "This class represents the colour chooser dialog.");
@@ -80,12 +86,13 @@ public:
DocCtorStr( DocCtorStr(
wxColourDialog(wxWindow* parent, wxColourData* data = NULL), wxColourDialog(wxWindow* parent, wxColourData* data = NULL),
"Constructor. Pass a parent window, and optionally a ColourData, which\n" "Constructor. Pass a parent window, and optionally a `wx.ColourData`,
"will be copied to the colour dialog's internal ColourData instance."); which will be copied to the colour dialog's internal ColourData
instance.");
DocDeclStr( DocDeclStr(
wxColourData& , GetColourData(), wxColourData& , GetColourData(),
"Returns a reference to the ColourData used by the dialog."); "Returns a reference to the `wx.ColourData` used by the dialog.");
}; };
@@ -93,14 +100,19 @@ public:
DocStr(wxDirDialog, DocStr(wxDirDialog,
"This class represents the directory chooser dialog."); "wx.DirDialog allows the user to select a directory by browising the
file system.
RefDoc(wxDirDialog, "
Styles Window Styles
wxDD_NEW_DIR_BUTTON Add \"Create new directory\" button and allow --------------
directory names to be editable. On Windows the new ==================== ==========================================
directory button is only available with recent wx.DD_NEW_DIR_BUTTON Add 'Create new directory' button and allow
versions of the common dialogs."); directory names to be editable. On Windows
the new directory button is only available
with recent versions of the common dialogs.
==================== ==========================================
");
class wxDirDialog : public wxDialog { class wxDirDialog : public wxDialog {
public: public:
@@ -145,40 +157,46 @@ public:
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
DocStr(wxFileDialog, DocStr(wxFileDialog,
"This class represents the file chooser dialog."); "wx.FileDialog allows the user to select one or more files from the
filesystem.
RefDoc(wxFileDialog, " In Windows, this is the common file selector dialog. On X based
In Windows, this is the common file selector dialog. In X, this is a file platforms a generic alternative is used. The path and filename are
selector box with somewhat less functionality. The path and filename are distinct elements of a full file pathname. If path is \"\", the
distinct elements of a full file pathname. If path is \"\", the current current directory will be used. If filename is \"\", no default
directory will be used. If filename is \"\", no default filename will be filename will be supplied. The wildcard determines what files are
supplied. The wildcard determines what files are displayed in the file displayed in the file selector, and file extension supplies a type
selector, and file extension supplies a type extension for the required extension for the required filename.
filename.
Both the X and Windows versions implement a wildcard filter. Typing a filename Both the X and Windows versions implement a wildcard filter. Typing a
containing wildcards (*, ?) in the filename text item, and clicking on Ok, filename containing wildcards (*, ?) in the filename text item, and
will result in only those files matching the pattern being displayed. The clicking on Ok, will result in only those files matching the pattern
wildcard may be a specification for multiple types of file with a description being displayed. The wildcard may be a specification for multiple
for each, such as: types of file with a description for each, such as::
\"BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif\" \"BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif\"
Styles
Window Styles
--------------
================== ==========================================
wx.OPEN This is an open dialog. wx.OPEN This is an open dialog.
wx.SAVE This is a save dialog. wx.SAVE This is a save dialog.
wx.HIDE_READONLY For open dialog only: hide the checkbox allowing to wx.HIDE_READONLY For open dialog only: hide the checkbox
open the file in read-only mode. allowing to open the file in read-only mode.
wx.OVERWRITE_PROMPT For save dialog only: prompt for a confirmation if a wx.OVERWRITE_PROMPT For save dialog only: prompt for a confirmation
file will be overwritten. if a file will be overwritten.
wx.MULTIPLE For open dialog only: allows selecting multiple files. wx.MULTIPLE For open dialog only: allows selecting multiple
files.
wx.CHANGE_DIR Change the current working directory to the directory wx.CHANGE_DIR Change the current working directory to the
where the file(s) chosen by the user are. directory where the file(s) chosen by the user
are.
================== ==========================================
"); ");
@@ -206,8 +224,8 @@ public:
DocDeclStr( DocDeclStr(
void , SetPath(const wxString& path), void , SetPath(const wxString& path),
"Sets the path (the combined directory and filename that will\n" "Sets the path (the combined directory and filename that will be
"be returned when the dialog is dismissed)."); returned when the dialog is dismissed).");
DocDeclStr( DocDeclStr(
void , SetDirectory(const wxString& dir), void , SetDirectory(const wxString& dir),
@@ -219,8 +237,11 @@ public:
DocDeclStr( DocDeclStr(
void , SetWildcard(const wxString& wildCard), void , SetWildcard(const wxString& wildCard),
"Sets the wildcard, which can contain multiple file types, for example:\n" "Sets the wildcard, which can contain multiple file types, for
" \"BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif\""); example::
\"BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif\"
");
DocDeclStr( DocDeclStr(
void , SetStyle(long style), void , SetStyle(long style),
@@ -257,21 +278,21 @@ public:
DocDeclStr( DocDeclStr(
int , GetFilterIndex() const, int , GetFilterIndex() const,
"Returns the index into the list of filters supplied, optionally, in\n" "Returns the index into the list of filters supplied, optionally, in
"the wildcard parameter. Before the dialog is shown, this is the index\n" the wildcard parameter. Before the dialog is shown, this is the index
"which will be used when the dialog is first displayed. After the dialog\n" which will be used when the dialog is first displayed. After the
"is shown, this is the index selected by the user."); dialog is shown, this is the index selected by the user.");
DocStr(GetFilenames, DocStr(GetFilenames,
"Returns a list of filenames chosen in the dialog. This function should\n" "Returns a list of filenames chosen in the dialog. This function
"only be used with the dialogs which have wx.MULTIPLE style, use\n" should only be used with the dialogs which have wx.MULTIPLE style, use
"GetFilename for the others."); GetFilename for the others.");
DocStr(GetPaths, DocStr(GetPaths,
"Fills the array paths with the full paths of the files chosen. This\n" "Fills the array paths with the full paths of the files chosen. This
"function should only be used with the dialogs which have wx.MULTIPLE style,\n" function should only be used with the dialogs which have wx.MULTIPLE
"use GetPath for the others."); style, use GetPath for the others.");
%extend { %extend {
PyObject* GetFilenames() { PyObject* GetFilenames() {
@@ -330,16 +351,17 @@ public:
int choices=0, wxString* choices_array, int choices=0, wxString* choices_array,
long style = wxCHOICEDLG_STYLE, long style = wxCHOICEDLG_STYLE,
const wxPoint& pos = wxDefaultPosition), const wxPoint& pos = wxDefaultPosition),
"__init__(Window parent, String message, String caption,\n" "__init__(Window parent, String message, String caption,
" List choices=[], long style=CHOICEDLG_STYLE,\n" List choices=[], long style=CHOICEDLG_STYLE,
" Point pos=DefaultPosition) -> MultiChoiceDialog", Point pos=DefaultPosition) -> MultiChoiceDialog",
"Constructor. Use ShowModal method to show the dialog."); "Constructor. Use ShowModal method to show the dialog.");
DocDeclAStr( DocDeclAStr(
void, SetSelections(const wxArrayInt& selections), void, SetSelections(const wxArrayInt& selections),
"SetSelections(List selections)", "SetSelections(List selections)",
"Specify the items in the list that shoudl be selected, using a list of integers."); "Specify the items in the list that should be selected, using a list of
integers.");
DocAStr(GetSelections, DocAStr(GetSelections,
"GetSelections() -> [selections]", "GetSelections() -> [selections]",
@@ -362,9 +384,9 @@ public:
%pythonAppend wxSingleChoiceDialog "self._setOORInfo(self)" %pythonAppend wxSingleChoiceDialog "self._setOORInfo(self)"
DocAStr(wxSingleChoiceDialog, DocAStr(wxSingleChoiceDialog,
"__init__(Window parent, String message, String caption,\n" "__init__(Window parent, String message, String caption,
" List choices=[], long style=CHOICEDLG_STYLE,\n" List choices=[], long style=CHOICEDLG_STYLE,
" Point pos=DefaultPosition) -> SingleChoiceDialog", Point pos=DefaultPosition) -> SingleChoiceDialog",
"Constructor. Use ShowModal method to show the dialog."); "Constructor. Use ShowModal method to show the dialog.");
%extend { %extend {
@@ -416,8 +438,8 @@ public:
DocDeclStr( DocDeclStr(
wxString , GetValue(), wxString , GetValue(),
"Returns the text that the user has entered if the user has pressed OK,\n" "Returns the text that the user has entered if the user has pressed OK,
"or the original value if the user has pressed Cancel."); or the original value if the user has pressed Cancel.");
DocDeclStr( DocDeclStr(
void , SetValue(const wxString& value), void , SetValue(const wxString& value),
@@ -428,7 +450,8 @@ public:
DocStr(wxFontData, DocStr(wxFontData,
"This class holds a variety of information related to font dialogs."); "This class holds a variety of information related to font dialogs and
is used to transfer settings to and results from a `wx.FontDialog`.");
class wxFontData : public wxObject { class wxFontData : public wxObject {
@@ -438,18 +461,20 @@ public:
DocDeclStr( DocDeclStr(
void , EnableEffects(bool enable), void , EnableEffects(bool enable),
"Enables or disables 'effects' under MS Windows only. This refers\n" "Enables or disables 'effects' under MS Windows only. This refers to
"to the controls for manipulating colour, strikeout and underline\n" the controls for manipulating colour, strikeout and underline
"properties. The default value is true."); properties. The default value is true.");
DocDeclStr( DocDeclStr(
bool , GetAllowSymbols(), bool , GetAllowSymbols(),
"Under MS Windows, returns a flag determining whether symbol fonts can be\n" "Under MS Windows, returns a flag determining whether symbol fonts can
"selected. Has no effect on other platforms. The default value is true."); be selected. Has no effect on other platforms. The default value is
true.");
DocDeclStr( DocDeclStr(
wxColour , GetColour(), wxColour , GetColour(),
"Gets the colour associated with the font dialog. The default value is black."); "Gets the colour associated with the font dialog. The default value is
black.");
DocDeclStr( DocDeclStr(
wxFont , GetChosenFont(), wxFont , GetChosenFont(),
@@ -461,27 +486,28 @@ public:
DocDeclStr( DocDeclStr(
wxFont , GetInitialFont(), wxFont , GetInitialFont(),
"Gets the font that will be initially used by the font dialog. This should have\n" "Gets the font that will be initially used by the font dialog. This
"previously been set by the application."); should have previously been set by the application.");
DocDeclStr( DocDeclStr(
bool , GetShowHelp(), bool , GetShowHelp(),
"Returns true if the Help button will be shown (Windows only). The default\n" "Returns true if the Help button will be shown (Windows only). The
"value is false."); default value is false.");
DocDeclStr( DocDeclStr(
void , SetAllowSymbols(bool allowSymbols), void , SetAllowSymbols(bool allowSymbols),
"Under MS Windows, determines whether symbol fonts can be selected. Has no\n" "Under MS Windows, determines whether symbol fonts can be selected. Has
"effect on other platforms. The default value is true."); no effect on other platforms. The default value is true.");
DocDeclStr( DocDeclStr(
void , SetChosenFont(const wxFont& font), void , SetChosenFont(const wxFont& font),
"Sets the font that will be returned to the user (for internal use only)."); "Sets the font that will be returned to the user (normally for internal
use only).");
DocDeclStr( DocDeclStr(
void , SetColour(const wxColour& colour), void , SetColour(const wxColour& colour),
"Sets the colour that will be used for the font foreground colour. The default\n" "Sets the colour that will be used for the font foreground colour. The
"colour is black."); default colour is black.");
DocDeclStr( DocDeclStr(
void , SetInitialFont(const wxFont& font), void , SetInitialFont(const wxFont& font),
@@ -489,34 +515,40 @@ public:
DocDeclStr( DocDeclStr(
void , SetRange(int min, int max), void , SetRange(int min, int max),
"Sets the valid range for the font point size (Windows only). The default is\n" "Sets the valid range for the font point size (Windows only). The
"0, 0 (unrestricted range)."); default is 0, 0 (unrestricted range).");
DocDeclStr( DocDeclStr(
void , SetShowHelp(bool showHelp), void , SetShowHelp(bool showHelp),
"Determines whether the Help button will be displayed in the font dialog\n" "Determines whether the Help button will be displayed in the font
"(Windows only). The default value is false."); dialog (Windows only). The default value is false.");
}; };
DocStr(wxFontDialog, DocStr(wxFontDialog,
"This class represents the font chooser dialog."); "wx.FontDialog allows the user to select a system font and its attributes.
:see: `wx.FontData`
");
class wxFontDialog : public wxDialog { class wxFontDialog : public wxDialog {
public: public:
%pythonAppend wxFontDialog "self._setOORInfo(self)" %pythonAppend wxFontDialog "self._setOORInfo(self)"
DocStr(wxFontDialog, DocStr(wxFontDialog,
"Constructor. Pass a parent window and the FontData object to be\n" "Constructor. Pass a parent window and the `wx.FontData` object to be
"used to initialize the dialog controls."); used to initialize the dialog controls. Call `ShowModal` to display
the dialog. If ShowModal returns ``wx.ID_OK`` then you can fetch the
results with via the `wx.FontData` returned by `GetFontData`.");
wxFontDialog(wxWindow* parent, const wxFontData& data); wxFontDialog(wxWindow* parent, const wxFontData& data);
DocDeclStr( DocDeclStr(
wxFontData& , GetFontData(), wxFontData& , GetFontData(),
"Returns a reference to the internal FontData used by the FontDialog."); "Returns a reference to the internal `wx.FontData` used by the
wx.FontDialog.");
}; };
@@ -524,32 +556,28 @@ public:
DocStr(wxMessageDialog, DocStr(wxMessageDialog,
"This class provides a dialog that shows a single or multi-line message, with\n" "This class provides a simple dialog that shows a single or multi-line
"a choice of OK, Yes, No and Cancel buttons."); message, with a choice of OK, Yes, No and/or Cancel buttons.
RefDoc(wxMessageDialog, "
Styles
wx.OK: Show an OK button.
wx.CANCEL: Show a Cancel button. Window Styles
--------------
wx.YES_NO: Show Yes and No buttons. ================= =============================================
wx.OK Show an OK button.
wx.YES_DEFAULT: Used with wxYES_NO, makes Yes button the default - which is the default behaviour. wx.CANCEL Show a Cancel button.
wx.YES_NO Show Yes and No buttons.
wx.NO_DEFAULT: Used with wxYES_NO, makes No button the default. wx.YES_DEFAULT Used with wxYES_NO, makes Yes button the
default - which is the default behaviour.
wx.ICON_EXCLAMATION: Shows an exclamation mark icon. wx.NO_DEFAULT Used with wxYES_NO, makes No button the default.
wx.ICON_EXCLAMATION Shows an exclamation mark icon.
wx.ICON_HAND: Shows an error icon. wx.ICON_HAND Shows an error icon.
wx.ICON_ERROR Shows an error icon - the same as wxICON_HAND.
wx.ICON_ERROR: Shows an error icon - the same as wxICON_HAND. wx.ICON_QUESTION Shows a question mark icon.
wx.ICON_INFORMATION Shows an information (i) icon.
wx.ICON_QUESTION: Shows a question mark icon. wx.STAY_ON_TOP The message box stays on top of all other
window, even those of the other applications
wx.ICON_INFORMATION: Shows an information (i) icon. (Windows only).
================= =============================================
wx.STAY_ON_TOP: The message box stays on top of all other window, even those of the other applications (Windows only).
"); ");
@@ -558,12 +586,14 @@ public:
%pythonAppend wxMessageDialog "self._setOORInfo(self)" %pythonAppend wxMessageDialog "self._setOORInfo(self)"
RefDoc(wxMessageDialog, ""); // turn it off for the ctors RefDoc(wxMessageDialog, ""); // turn it off for the ctors
wxMessageDialog(wxWindow* parent, DocCtorStr(
const wxString& message, wxMessageDialog(wxWindow* parent,
const wxString& caption = wxPyMessageBoxCaptionStr, const wxString& message,
long style = wxOK | wxCANCEL | wxCENTRE, const wxString& caption = wxPyMessageBoxCaptionStr,
const wxPoint& pos = wxDefaultPosition); long style = wxOK | wxCANCEL | wxCENTRE,
const wxPoint& pos = wxDefaultPosition),
"Constructor, use `ShowModal` to display the dialog.");
}; };
@@ -571,34 +601,35 @@ public:
DocStr(wxProgressDialog, DocStr(wxProgressDialog,
"A dialog that shows a short message and a progress bar. Optionally, it can\n" "A dialog that shows a short message and a progress bar. Optionally, it
"display an ABORT button."); can display an ABORT button.
RefDoc(wxProgressDialog, " Window Styles
Styles --------------
================= =============================================
wx.PD_APP_MODAL Make the progress dialog modal. If this flag is
not given, it is only \"locally\" modal -
that is the input to the parent window is
disabled, but not to the other ones.
wx.PD_APP_MODAL: Make the progress dialog modal. If this flag is wx.PD_AUTO_HIDE Causes the progress dialog to disappear from
not given, it is only \"locally\" modal - that is screen as soon as the maximum value of the
the input to the parent window is disabled, progress meter has been reached.
but not to the other ones.
wx.PD_AUTO_HIDE: Causes the progress dialog to disappear from screen wx.PD_CAN_ABORT This flag tells the dialog that it should have
as soon as the maximum value of the progress a \"Cancel\" button which the user may press. If
meter has been reached. this happens, the next call to Update() will
return false.
wx.PD_CAN_ABORT: This flag tells the dialog that it should have wx.PD_ELAPSED_TIME This flag tells the dialog that it should show
a \"Cancel\" button which the user may press. If elapsed time (since creating the dialog).
this happens, the next call to Update() will
return false.
wx.PD_ELAPSED_TIME: This flag tells the dialog that it should show wx.PD_ESTIMATED_TIME This flag tells the dialog that it should show
elapsed time (since creating the dialog). estimated time.
wx.PD_ESTIMATED_TIME: This flag tells the dialog that it should show wx.PD_REMAINING_TIME This flag tells the dialog that it should show
estimated time. remaining time.
================= =============================================
wx.PD_REMAINING_TIME: This flag tells the dialog that it should show
remaining time.
"); ");
@@ -614,21 +645,24 @@ public:
int maximum = 100, int maximum = 100,
wxWindow* parent = NULL, wxWindow* parent = NULL,
int style = wxPD_AUTO_HIDE | wxPD_APP_MODAL ), int style = wxPD_AUTO_HIDE | wxPD_APP_MODAL ),
"Constructor. Creates the dialog, displays it and disables user input for other\n" "Constructor. Creates the dialog, displays it and disables user input
"windows, or, if wxPD_APP_MODAL flag is not given, for its parent window only."); for other windows, or, if wx.PD_APP_MODAL flag is not given, for its
parent window only.");
DocDeclStr( DocDeclStr(
virtual bool , Update(int value, const wxString& newmsg = wxPyEmptyString), virtual bool , Update(int value, const wxString& newmsg = wxPyEmptyString),
"Updates the dialog, setting the progress bar to the new value and, if given\n" "Updates the dialog, setting the progress bar to the new value and, if
"changes the message above it. Returns true unless the Cancel button has been\n" given changes the message above it. Returns true unless the Cancel
"pressed.\n\n" button has been pressed.
"If false is returned, the application can either immediately destroy the\n"
"dialog or ask the user for the confirmation and if the abort is not confirmed\n" If false is returned, the application can either immediately destroy
"the dialog may be resumed with Resume function."); the dialog or ask the user for the confirmation and if the abort is
not confirmed the dialog may be resumed with Resume function.");
DocDeclStr( DocDeclStr(
void , Resume(), void , Resume(),
"Can be used to continue with the dialog, after the user had chosen to abort."); "Can be used to continue with the dialog, after the user had chosen to
abort.");
}; };
@@ -697,8 +731,8 @@ public:
DocDeclStr( DocDeclStr(
int , GetFlags(), int , GetFlags(),
"Get the currently selected flags: this is the combination of\n" "Get the currently selected flags: this is the combination of
"wx.FR_DOWN, wx.FR_WHOLEWORD and wx.FR_MATCHCASE flags."); wx.FR_DOWN, wx.FR_WHOLEWORD and wx.FR_MATCHCASE flags.");
DocDeclStr( DocDeclStr(
const wxString& , GetFindString(), const wxString& , GetFindString(),
@@ -706,8 +740,8 @@ public:
DocDeclStr( DocDeclStr(
const wxString& , GetReplaceString(), const wxString& , GetReplaceString(),
"Return the string to replace the search string with (only\n" "Return the string to replace the search string with (only for replace
"for replace and replace all events)."); and replace all events).");
DocDeclStr( DocDeclStr(
wxFindReplaceDialog *, GetDialog(), wxFindReplaceDialog *, GetDialog(),
@@ -729,22 +763,26 @@ public:
DocStr(wxFindReplaceData, DocStr(wxFindReplaceData,
"FindReplaceData holds the data for FindReplaceDialog. It is used to initialize "wx.FindReplaceData holds the data for wx.FindReplaceDialog. It is used
the dialog with the default values and will keep the last values from the to initialize the dialog with the default values and will keep the
dialog when it is closed. It is also updated each time a wxFindDialogEvent is last values from the dialog when it is closed. It is also updated each
generated so instead of using the wxFindDialogEvent methods you can also time a `wx.FindDialogEvent` is generated so instead of using the
directly query this object. `wx.FindDialogEvent` methods you can also directly query this object.
Note that all SetXXX() methods may only be called before showing the dialog Note that all SetXXX() methods may only be called before showing the
and calling them has no effect later. dialog and calling them has no effect later.
Flags Flags
wxFR_DOWN: downward search/replace selected (otherwise, upwards) -----
================ ===============================================
wx.FR_DOWN Downward search/replace selected (otherwise,
upwards)
wxFR_WHOLEWORD: whole word search/replace selected wx.FR_WHOLEWORD Whole word search/replace selected
wxFR_MATCHCASE: case sensitive search/replace selected (otherwise, wx.FR_MATCHCASE Case sensitive search/replace selected
case insensitive) (otherwise, case insensitive)
================ ===============================================
"); ");
@@ -790,23 +828,27 @@ public:
DocStr(wxFindReplaceDialog, DocStr(wxFindReplaceDialog,
"FindReplaceDialog is a standard modeless dialog which is used to allow the "wx.FindReplaceDialog is a standard modeless dialog which is used to
user to search for some text (and possibly replace it with something allow the user to search for some text (and possibly replace it with
else). The actual searching is supposed to be done in the owner window which something else). The actual searching is supposed to be done in the
is the parent of this dialog. Note that it means that unlike for the other owner window which is the parent of this dialog. Note that it means
standard dialogs this one must have a parent window. Also note that there is that unlike for the other standard dialogs this one must have a parent
no way to use this dialog in a modal way; it is always, by design and window. Also note that there is no way to use this dialog in a modal
implementation, modeless."); way; it is always, by design and implementation, modeless.
RefDoc(wxFindReplaceDialog, "
Styles
wx.FR_REPLACEDIALOG: replace dialog (otherwise find dialog)
wx.FR_NOUPDOWN: don't allow changing the search direction Window Styles
-------------
wx.FR_NOMATCHCASE: don't allow case sensitive searching ===================== =========================================
wx.FR_REPLACEDIALOG replace dialog (otherwise find dialog)
wx.FR_NOWHOLEWORD: don't allow whole word searching wx.FR_NOUPDOWN don't allow changing the search direction
wx.FR_NOMATCHCASE don't allow case sensitive searching
wx.FR_NOWHOLEWORD don't allow whole word searching
===================== =========================================
"); ");
class wxFindReplaceDialog : public wxDialog { class wxFindReplaceDialog : public wxDialog {
@@ -821,8 +863,8 @@ public:
wxFindReplaceData *data, wxFindReplaceData *data,
const wxString &title, const wxString &title,
int style = 0), int style = 0),
"Create a FindReplaceDialog. The parent and data parameters must be\n" "Create a FindReplaceDialog. The parent and data parameters must be
"non-None. Use Show to display the dialog."); non-None. Use Show to display the dialog.");
DocCtorStrName( DocCtorStrName(
wxFindReplaceDialog(), wxFindReplaceDialog(),
@@ -831,10 +873,8 @@ public:
DocDeclStr( DocDeclStr(
bool , Create(wxWindow *parent, bool , Create(wxWindow *parent, wxFindReplaceData *data,
wxFindReplaceData *data, const wxString &title, int style = 0),
const wxString &title,
int style = 0),
"Create the dialog, for 2-phase create."); "Create the dialog, for 2-phase create.");

View File

@@ -313,7 +313,7 @@ public:
DocDeclStr( DocDeclStr(
virtual bool , DeleteAll(), virtual bool , DeleteAll(),
"Delete the whole underlying object (disk file, registry key, ...)\n" "Delete the whole underlying object (disk file, registry key, ...)\n"
"primarly intended for use by desinstallation routine."); "primarly intended for use by deinstallation routine.");

View File

@@ -56,6 +56,8 @@ public:
#if defined(wxUSE_DC_OLD_METHODS) #if defined(wxUSE_DC_OLD_METHODS)
bool FloodFill(wxCoord x, wxCoord y, const wxColour& col, int style = wxFLOOD_SURFACE); bool FloodFill(wxCoord x, wxCoord y, const wxColour& col, int style = wxFLOOD_SURFACE);
%name(FloodFillPoint) bool FloodFill(const wxPoint& pt, const wxColour& col, int style = wxFLOOD_SURFACE);
//bool GetPixel(wxCoord x, wxCoord y, wxColour *col) const; //bool GetPixel(wxCoord x, wxCoord y, wxColour *col) const;
%extend { %extend {
wxColour GetPixel(wxCoord x, wxCoord y) { wxColour GetPixel(wxCoord x, wxCoord y) {
@@ -63,26 +65,66 @@ public:
self->GetPixel(x, y, &col); self->GetPixel(x, y, &col);
return col; return col;
} }
wxColour GetPixelPoint(const wxPoint& pt) {
wxColour col;
self->GetPixel(pt, &col);
return col;
}
} }
void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
%name(DrawLinePoint) void DrawLine(const wxPoint& pt1, const wxPoint& pt2);
void CrossHair(wxCoord x, wxCoord y); void CrossHair(wxCoord x, wxCoord y);
%name(CrossHairPoint) void CrossHair(const wxPoint& pt);
void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc); void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc);
%name(DrawArcPoint) void DrawArc(const wxPoint& pt1, const wxPoint& pt2, const wxPoint& centre);
void DrawCheckMark(wxCoord x, wxCoord y, wxCoord width, wxCoord height); void DrawCheckMark(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
%name(DrawCheckMarkRect) void DrawCheckMark(const wxRect& rect);
void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, double sa, double ea); void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, double sa, double ea);
%name(DrawEllipticArcPtSz) void DrawEllipticArc(const wxPoint& pt, const wxSize& sz, double sa, double ea);
void DrawPoint(wxCoord x, wxCoord y); void DrawPoint(wxCoord x, wxCoord y);
%name(DrawPointPoint) void DrawPoint(const wxPoint& pt);
void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
%name(DrawRectangleRect)void DrawRectangle(const wxRect& rect); %name(DrawRectangleRect)void DrawRectangle(const wxRect& rect);
%name(DrawRectanglePtSz) void DrawRectangle(const wxPoint& pt, const wxSize& sz);
void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius); void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius);
%name(DrawRoundedRectangleRect) void DrawRoundedRectangle(const wxRect& r, double radius);
%name(DrawRoundedRectanglePtSz) void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz, double radius);
void DrawCircle(wxCoord x, wxCoord y, wxCoord radius); void DrawCircle(wxCoord x, wxCoord y, wxCoord radius);
%name(DrawCirclePoint) void DrawCircle(const wxPoint& pt, wxCoord radius);
void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
%name(DrawEllipseRect) void DrawEllipse(const wxRect& rect);
%name(DrawEllipsePtSz) void DrawEllipse(const wxPoint& pt, const wxSize& sz);
void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y); void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
%name(DrawIconPoint) void DrawIcon(const wxIcon& icon, const wxPoint& pt);
void DrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask = False); void DrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask = False);
%name(DrawBitmapPoint) void DrawBitmap(const wxBitmap &bmp, const wxPoint& pt, bool useMask = False);
void DrawText(const wxString& text, wxCoord x, wxCoord y); void DrawText(const wxString& text, wxCoord x, wxCoord y);
%name(DrawTextPoint) void DrawText(const wxString& text, const wxPoint& pt);
void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle); void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
%name(DrawRotatedTextPoint) void DrawRotatedText(const wxString& text, const wxPoint& pt, double angle);
bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc, wxDC *source, wxCoord xsrc, wxCoord ysrc,
int rop = wxCOPY, bool useMask = False, int rop = wxCOPY, bool useMask = False,
wxCoord xsrcMask = -1, wxCoord ysrcMask = -1); wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
%name(BlitPtSz) bool Blit(const wxPoint& destPt, const wxSize& sz,
wxDC *source, const wxPoint& srcPt,
int rop = wxCOPY, bool useMask = False,
const wxPoint& srcPtMask = wxDefaultPosition);
@@ -105,6 +147,7 @@ public:
return col; return col;
} }
} }
%name(DrawLineXY) void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); %name(DrawLineXY) void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
void DrawLine(const wxPoint& pt1, const wxPoint& pt2); void DrawLine(const wxPoint& pt1, const wxPoint& pt2);

View File

@@ -23,12 +23,14 @@ class PyEventBinder(object):
for et in self.evtType: for et in self.evtType:
target.Connect(id1, id2, et, function) target.Connect(id1, id2, et, function)
def Unbind(self, target, id1, id2): def Unbind(self, target, id1, id2):
"""Remove an event binding.""" """Remove an event binding."""
success = 0 success = 0
for et in self.evtType: for et in self.evtType:
success += target.Disconnect(id1, id2, et) success += target.Disconnect(id1, id2, et)
return success != 0 return success != 0
def __call__(self, *args): def __call__(self, *args):
""" """

View File

@@ -113,7 +113,7 @@ public:
""" """
if source is not None: if source is not None:
id = source.GetId() id = source.GetId()
event.Unbind(self, id, id2) return event.Unbind(self, id, id2)
} }

View File

@@ -130,6 +130,7 @@ public:
~wxSize(); ~wxSize();
// None/NULL is now handled properly by the typemap, so these are not needed.
// %extend { // %extend {
// bool __eq__(const wxSize* other) { return other ? (*self == *other) : False; } // bool __eq__(const wxSize* other) { return other ? (*self == *other) : False; }
// bool __ne__(const wxSize* other) { return other ? (*self != *other) : True; } // bool __ne__(const wxSize* other) { return other ? (*self != *other) : True; }

View File

@@ -83,24 +83,14 @@ public:
%name(ImageFromMime) wxImage(const wxString& name, const wxString& mimetype, int index = -1); %name(ImageFromMime) wxImage(const wxString& name, const wxString& mimetype, int index = -1);
%name(ImageFromStream) wxImage(wxInputStream& stream, long type = wxBITMAP_TYPE_ANY, int index = -1); %name(ImageFromStream) wxImage(wxInputStream& stream, long type = wxBITMAP_TYPE_ANY, int index = -1);
%name(ImageFromStreamMime) wxImage(wxInputStream& stream, const wxString& mimetype, int index = -1 ); %name(ImageFromStreamMime) wxImage(wxInputStream& stream, const wxString& mimetype, int index = -1 );
%extend { %extend {
%nokwargs wxImage(int width=0, int height=0, bool clear = True);
%nokwargs wxImage(const wxSize& size, bool clear = True);
%name(EmptyImage) wxImage(int width=0, int height=0, bool clear = True) { %name(EmptyImage) wxImage(int width=0, int height=0, bool clear = True) {
if (width > 0 && height > 0) if (width > 0 && height > 0)
return new wxImage(width, height, clear); return new wxImage(width, height, clear);
else else
return new wxImage; return new wxImage;
} }
%name(EmptyImage) wxImage(const wxSize& size, bool clear = True) {
return new wxImage(size.x, size.y, clear);
}
%name(ImageFromBitmap) wxImage(const wxBitmap &bitmap) { %name(ImageFromBitmap) wxImage(const wxBitmap &bitmap) {
return new wxImage(bitmap.ConvertToImage()); return new wxImage(bitmap.ConvertToImage());
} }

View File

@@ -271,16 +271,30 @@ public:
%pythoncode { %pythoncode {
def AddMany(self, widgets): def AddMany(self, widgets):
"""
AddMany is a convenience method for adding several items
to a sizer at one time. Simply pass it a list of tuples,
where each tuple consists of the parameters that you
would normally pass to the `Add` method.
"""
for childinfo in widgets: for childinfo in widgets:
if type(childinfo) != type(()) or (len(childinfo) == 2 and type(childinfo[0]) == type(1)): if type(childinfo) != type(()) or (len(childinfo) == 2 and type(childinfo[0]) == type(1)):
childinfo = (childinfo, ) childinfo = (childinfo, )
self.Add(*childinfo) self.Add(*childinfo)
%# for backwards compatibility only, please do not use in new code %# for backwards compatibility only, please do not use in new code
AddWindow = AddSizer = AddSpacer = Add AddWindow = wx._deprecated(Add, "AddWindow is deprecated, use `Add` instead.")
PrependWindow = PrependSizer = PrependSpacer = Prepend AddSizer = wx._deprecated(Add, "AddSizer is deprecated, use `Add` instead.")
InsertWindow = InsertSizer = InsertSpacer = Insert AddSpacer = wx._deprecated(Add, "AddSpacer is deprecated, use `Add` instead.")
RemoveWindow = RemoveSizer = RemovePos = Remove PrependWindow = wx._deprecated(Prepend, "PrependWindow is deprecated, use `Prepend` instead.")
PrependSizer = wx._deprecated(Prepend, "PrependSizer is deprecated, use `Prepend` instead.")
PrependSpacer = wx._deprecated(Prepend, "PrependSpacer is deprecated, use `Prepend` instead.")
InsertWindow = wx._deprecated(Insert, "InsertWindow is deprecated, use `Insert` instead.")
InsertSizer = wx._deprecated(Insert, "InsertSizer is deprecated, use `Insert` instead.")
InsertSpacer = wx._deprecated(Insert, "InsertSpacer is deprecated, use `Insert` instead.")
RemoveWindow = wx._deprecated(Remove, "RemoveWindow is deprecated, use `Remove` instead.")
RemoveSizer = wx._deprecated(Remove, "RemoveSizer is deprecated, use `Remove` instead.")
RemovePos = wx._deprecated(Remove, "RemovePos is deprecated, use `Remove` instead.")
def SetItemMinSize(self, item, *args): def SetItemMinSize(self, item, *args):

View File

@@ -62,8 +62,8 @@ enum wxCalendarDateBorder
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
DocStr(wxCalendarDateAttr, DocStr(wxCalendarDateAttr,
"A set of customization attributes for a calendar date, which can be used to "A set of customization attributes for a calendar date, which can be
control the look of the Calendar object."); used to control the look of the Calendar object.");
class wxCalendarDateAttr class wxCalendarDateAttr
{ {
@@ -142,54 +142,66 @@ MAKE_CONST_WXSTRING(CalendarNameStr);
DocStr(wxCalendarCtrl, DocStr(wxCalendarCtrl,
"The calendar control allows the user to pick a date interactively."); "The calendar control allows the user to pick a date interactively.
RefDoc(wxCalendarCtrl, The CalendarCtrl displays a window containing several parts: the
control to pick the month and the year at the top (either or both of
them may be disabled) and a month area below them which shows all the
days in the month. The user can move the current selection using the
keyboard and select the date (generating EVT_CALENDAR event) by
pressing <Return> or double clicking it.
"The CalendarCtrl displays a window containing several parts: the control to It has advanced possibilities for the customization of its
pick the month and the year at the top (either or both of them may be display. All global settings (such as colours and fonts used) can, of
disabled) and a month area below them which shows all the days in the course, be changed. But also, the display style for each day in the
month. The user can move the current selection using the keyboard and select month can be set independently using CalendarDateAttr class.
the date (generating EVT_CALENDAR event) by pressing <Return> or double
clicking it.
It has advanced possibilities for the customization of its display. All global An item without custom attributes is drawn with the default colours
settings (such as colours and fonts used) can, of course, be changed. But and font and without border, but setting custom attributes with
also, the display style for each day in the month can be set independently SetAttr allows to modify its appearance. Just create a custom
using CalendarDateAttr class. attribute object and set it for the day you want to be displayed
specially A day may be marked as being a holiday, (even if it is not
recognized as one by wx.DateTime) by using the SetHoliday method.
An item without custom attributes is drawn with the default colours and font As the attributes are specified for each day, they may change when the
and without border, but setting custom attributes with SetAttr allows to month is changed, so you will often want to update them in an
modify its appearance. Just create a custom attribute object and set it for EVT_CALENDAR_MONTH event handler.
the day you want to be displayed specially A day may be marked as being a
holiday, (even if it is not recognized as one by wx.DateTime) by using the
SetHoliday method.
As the attributes are specified for each day, they may change when the month Window Styles
is changed, so you will often want to update them in an EVT_CALENDAR_MONTH -------------
event handler. ============================== ============================
CAL_SUNDAY_FIRST Show Sunday as the first day
in the week
CAL_MONDAY_FIRST Show Monday as the first day
in the week
CAL_SHOW_HOLIDAYS Highlight holidays in the
calendar
CAL_NO_YEAR_CHANGE Disable the year changing
CAL_NO_MONTH_CHANGE Disable the month (and,
implicitly, the year) changing
CAL_SHOW_SURROUNDING_WEEKS Show the neighbouring weeks in
the previous and next months
CAL_SEQUENTIAL_MONTH_SELECTION Use alternative, more compact,
style for the month and year
selection controls.
Styles The default calendar style is CAL_SHOW_HOLIDAYS.
CAL_SUNDAY_FIRST: Show Sunday as the first day in the week
CAL_MONDAY_FIRST: Show Monday as the first day in the week
CAL_SHOW_HOLIDAYS: Highlight holidays in the calendar
CAL_NO_YEAR_CHANGE: Disable the year changing
CAL_NO_MONTH_CHANGE: Disable the month (and, implicitly, the year) changing
CAL_SHOW_SURROUNDING_WEEKS: Show the neighbouring weeks in the previous and next months
CAL_SEQUENTIAL_MONTH_SELECTION: Use alternative, more compact, style for the month and year selection controls.
The default calendar style is wxCAL_SHOW_HOLIDAYS. Events
-------
=========================== ==============================
EVT_CALENDAR A day was double clicked in the
calendar.
EVT_CALENDAR_SEL_CHANGED The selected date changed.
EVT_CALENDAR_DAY The selected day changed.
EVT_CALENDAR_MONTH The selected month changed.
EVT_CALENDAR_YEAR The selected year changed.
EVT_CALENDAR_WEEKDAY_CLICKED User clicked on the week day
header
Events Note that changing the selected date will result in one of
EVT_CALENDAR: A day was double clicked in the calendar. EVT_CALENDAR_DAY, MONTH or YEAR events and an EVT_CALENDAR_SEL_CHANGED
EVT_CALENDAR_SEL_CHANGED: The selected date changed. event.
EVT_CALENDAR_DAY: The selected day changed.
EVT_CALENDAR_MONTH: The selected month changed.
EVT_CALENDAR_YEAR: The selected year changed.
EVT_CALENDAR_WEEKDAY_CLICKED: User clicked on the week day header
Note that changing the selected date will result in either of
EVT_CALENDAR_DAY, MONTH or YEAR events and an EVT_CALENDAR_SEL_CHANGED event.
"); ");
@@ -200,29 +212,34 @@ public:
%pythonAppend wxCalendarCtrl "self._setOORInfo(self)" %pythonAppend wxCalendarCtrl "self._setOORInfo(self)"
%pythonAppend wxCalendarCtrl() "" %pythonAppend wxCalendarCtrl() ""
DocStr(wxCalendarCtrl, "Create and show a calendar control.");
RefDoc(wxCalendarCtrl, ""); // turn it off for the ctors RefDoc(wxCalendarCtrl, ""); // turn it off for the ctors
DocCtorStr(
wxCalendarCtrl(wxWindow *parent,
wxWindowID id=-1,
const wxDateTime& date = wxDefaultDateTime,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCAL_SHOW_HOLIDAYS | wxWANTS_CHARS,
const wxString& name = wxPyCalendarNameStr),
"Create and show a calendar control.");
DocCtorStrName(
wxCalendarCtrl(),
"Precreate a CalendarCtrl for 2-phase creation.",
PreCalendarCtrl);
DocDeclStr(
bool , Create(wxWindow *parent,
wxWindowID id,
const wxDateTime& date = wxDefaultDateTime,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCAL_SHOW_HOLIDAYS | wxWANTS_CHARS,
const wxString& name = wxPyCalendarNameStr),
"Acutally create the GUI portion of the CalendarCtrl for 2-phase
creation.");
wxCalendarCtrl(wxWindow *parent,
wxWindowID id=-1,
const wxDateTime& date = wxDefaultDateTime,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCAL_SHOW_HOLIDAYS | wxWANTS_CHARS,
const wxString& name = wxPyCalendarNameStr);
DocStr(wxCalendarCtrl(), "Precreate a CalendarCtrl for 2-phase creation.");
%name(PreCalendarCtrl)wxCalendarCtrl();
DocStr(Create, "Acutally create the GUI portion of the CalendarCtrl for 2-phase creation.");
bool Create(wxWindow *parent,
wxWindowID id,
const wxDateTime& date = wxDefaultDateTime,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCAL_SHOW_HOLIDAYS | wxWANTS_CHARS,
const wxString& name = wxPyCalendarNameStr);
DocDeclStr( DocDeclStr(
@@ -261,74 +278,80 @@ public:
DocDeclStr( DocDeclStr(
void, EnableYearChange(bool enable = True), void, EnableYearChange(bool enable = True),
"This function should be used instead of changing CAL_NO_YEAR_CHANGE\n" "This function should be used instead of changing CAL_NO_YEAR_CHANGE
"style bit directly. It allows or disallows the user to change the year\n" style bit directly. It allows or disallows the user to change the year
"interactively."); interactively.");
DocDeclStr( DocDeclStr(
void, EnableMonthChange(bool enable = True), void, EnableMonthChange(bool enable = True),
"This function should be used instead of changing CAL_NO_MONTH_CHANGE style\n" "This function should be used instead of changing CAL_NO_MONTH_CHANGE
"bit. It allows or disallows the user to change the month interactively. Note\n" style bit. It allows or disallows the user to change the month
"that if the month can not be changed, the year can not be changed either."); interactively. Note that if the month can not be changed, the year can
not be changed either.");
DocDeclStr( DocDeclStr(
void, EnableHolidayDisplay(bool display = True), void, EnableHolidayDisplay(bool display = True),
"This function should be used instead of changing CAL_SHOW_HOLIDAYS style\n" "This function should be used instead of changing CAL_SHOW_HOLIDAYS
"bit directly. It enables or disables the special highlighting of the holidays."); style bit directly. It enables or disables the special highlighting of
the holidays.");
DocDeclStr( DocDeclStr(
void, SetHeaderColours(const wxColour& colFg, const wxColour& colBg), void, SetHeaderColours(const wxColour& colFg, const wxColour& colBg),
"header colours are used for painting the weekdays at the top"); "Header colours are used for painting the weekdays at the top.");
DocDeclStr( DocDeclStr(
wxColour, GetHeaderColourFg() const, wxColour, GetHeaderColourFg() const,
"header colours are used for painting the weekdays at the top"); "Header colours are used for painting the weekdays at the top.");
DocDeclStr( DocDeclStr(
wxColour, GetHeaderColourBg() const, wxColour, GetHeaderColourBg() const,
"header colours are used for painting the weekdays at the top"); "Header colours are used for painting the weekdays at the top.");
DocDeclStr( DocDeclStr(
void, SetHighlightColours(const wxColour& colFg, const wxColour& colBg), void, SetHighlightColours(const wxColour& colFg, const wxColour& colBg),
"highlight colour is used for the currently selected date"); "Highlight colour is used for the currently selected date.");
DocDeclStr( DocDeclStr(
wxColour, GetHighlightColourFg() const, wxColour, GetHighlightColourFg() const,
"highlight colour is used for the currently selected date"); "Highlight colour is used for the currently selected date.");
DocDeclStr( DocDeclStr(
wxColour, GetHighlightColourBg() const, wxColour, GetHighlightColourBg() const,
"highlight colour is used for the currently selected date"); "Highlight colour is used for the currently selected date.");
DocDeclStr( DocDeclStr(
void, SetHolidayColours(const wxColour& colFg, const wxColour& colBg), void, SetHolidayColours(const wxColour& colFg, const wxColour& colBg),
"holiday colour is used for the holidays (if CAL_SHOW_HOLIDAYS style is used)"); "Holiday colour is used for the holidays (if CAL_SHOW_HOLIDAYS style is
used).");
DocDeclStr( DocDeclStr(
wxColour, GetHolidayColourFg() const, wxColour, GetHolidayColourFg() const,
"holiday colour is used for the holidays (if CAL_SHOW_HOLIDAYS style is used)"); "Holiday colour is used for the holidays (if CAL_SHOW_HOLIDAYS style is
used).");
DocDeclStr( DocDeclStr(
wxColour, GetHolidayColourBg() const, wxColour, GetHolidayColourBg() const,
"holiday colour is used for the holidays (if CAL_SHOW_HOLIDAYS style is used)"); "Holiday colour is used for the holidays (if CAL_SHOW_HOLIDAYS style is
used).");
DocDeclStr( DocDeclStr(
wxCalendarDateAttr*, GetAttr(size_t day) const, wxCalendarDateAttr*, GetAttr(size_t day) const,
"Returns the attribute for the given date (should be in the range 1...31).\n" "Returns the attribute for the given date (should be in the range
"The returned value may be None"); 1...31). The returned value may be None");
DocDeclStr( DocDeclStr(
void, SetAttr(size_t day, wxCalendarDateAttr *attr), void, SetAttr(size_t day, wxCalendarDateAttr *attr),
"Associates the attribute with the specified date (in the range 1...31).\n" "Associates the attribute with the specified date (in the range
"If the attribute passed is None, the items attribute is cleared."); 1...31). If the attribute passed is None, the items attribute is
cleared.");
DocDeclStr( DocDeclStr(
void, SetHoliday(size_t day), void, SetHoliday(size_t day),
@@ -336,19 +359,23 @@ public:
DocDeclStr( DocDeclStr(
void, ResetAttr(size_t day), void, ResetAttr(size_t day),
"Clears any attributes associated with the given day (in the range 1...31)."); "Clears any attributes associated with the given day (in the range
1...31).");
DocAStr(HitTest, DocAStr(HitTest,
"HitTest(Point pos) -> (result, date, weekday)", "HitTest(Point pos) -> (result, date, weekday)",
"Returns 3-tuple with information about the given position on the calendar "Returns 3-tuple with information about the given position on the
control. The first value of the tuple is a result code and determines the calendar control. The first value of the tuple is a result code and
validity of the remaining two values. The result codes are: determines the validity of the remaining two values. The result codes
are:
CAL_HITTEST_NOWHERE: hit outside of anything =================== ============================================
CAL_HITTEST_HEADER: hit on the header, weekday is valid CAL_HITTEST_NOWHERE hit outside of anything
CAL_HITTEST_DAY: hit on a day in the calendar, date is set. CAL_HITTEST_HEADER hit on the header, weekday is valid
CAL_HITTEST_DAY hit on a day in the calendar, date is set.
=================== ============================================
"); ");
%extend { %extend {
PyObject* HitTest(const wxPoint& pos) { PyObject* HitTest(const wxPoint& pos) {
@@ -367,11 +394,11 @@ validity of the remaining two values. The result codes are:
DocDeclStr( DocDeclStr(
wxControl*, GetMonthControl() const, wxControl*, GetMonthControl() const,
"get the currently shown control for month"); "Get the currently shown control for month.");
DocDeclStr( DocDeclStr(
wxControl*, GetYearControl() const, wxControl*, GetYearControl() const,
"get the currently shown control for year"); "Get the currently shown control for year.");
}; };

View File

@@ -39,11 +39,32 @@ _core_._wxPySetDictionary(vars())
%#// be used here. %#// be used here.
import sys as _sys import sys as _sys
wx = _sys.modules[__name__] wx = _sys.modules[__name__]
}
}
#endif #endif
%pythoncode {
%#----------------------------------------------------------------------------
def _deprecated(callable, msg=None):
"""
Create a wrapper function that will raise a DeprecationWarning
before calling the callable.
"""
if msg is None:
msg = "%s is deprecated" % callable
def deprecatedWrapper(*args, **kwargs):
import warnings
warnings.warn(msg, DeprecationWarning, stacklevel=2)
return callable(*args, **kwargs)
deprecatedWrapper.__doc__ = msg
return deprecatedWrapper
%#----------------------------------------------------------------------------
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Include all the files that make up the core module // Include all the files that make up the core module

View File

@@ -37,7 +37,7 @@ left-aligned if it has focus.
Hope this can help someone, as much as this list helps me. Hope this can help someone, as much as this list helps me.
Josu Oyanguren Josu Oyanguren
Ubera Servicios Inform<EFBFBD>ticos. Ubera Servicios Informaticos.
P.S. This only works well on wxMSW. P.S. This only works well on wxMSW.