Finished initial reviews of the rest of the [d*] interface headers.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53300 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: docmdi.h
|
||||
// Purpose: interface of wxDocMDIParentFrame
|
||||
// Purpose: interface of wxDocMDIParentFrame and wxDocMDIChildFrame
|
||||
// Author: wxWidgets team
|
||||
// RCS-ID: $Id$
|
||||
// Licence: wxWindows license
|
||||
@@ -11,18 +11,16 @@
|
||||
@wxheader{docmdi.h}
|
||||
|
||||
The wxDocMDIParentFrame class provides a default top-level frame for
|
||||
applications using the document/view framework. This class can only be used for
|
||||
MDI parent frames.
|
||||
applications using the document/view framework. This class can only be used
|
||||
for MDI parent frames.
|
||||
|
||||
It cooperates with the wxView, wxDocument,
|
||||
wxDocManager and wxDocTemplates() classes.
|
||||
|
||||
See the example application in @c samples/docview.
|
||||
It cooperates with the wxView, wxDocument, wxDocManager and wxDocTemplate
|
||||
classes.
|
||||
|
||||
@library{wxcore}
|
||||
@category{FIXME}
|
||||
@category{docview}
|
||||
|
||||
@see @ref overview_docviewoverview, wxMDIParentFrame
|
||||
@see @ref overview_docview, @ref page_samples_docview, wxMDIParentFrame
|
||||
*/
|
||||
class wxDocMDIParentFrame : public wxMDIParentFrame
|
||||
{
|
||||
@@ -59,8 +57,21 @@ public:
|
||||
/**
|
||||
Deletes all views and documents. If no user input cancelled the
|
||||
operation, the frame will be destroyed and the application will exit.
|
||||
Since understanding how document/view clean-up takes place can be difficult,
|
||||
the implementation of this function is shown below.
|
||||
|
||||
Since understanding how document/view clean-up takes place can be
|
||||
difficult, the implementation of this function is shown below:
|
||||
|
||||
@code
|
||||
void wxDocParentFrame::OnCloseWindow(wxCloseEvent& event)
|
||||
{
|
||||
if (m_docManager->Clear(!event.CanVeto()))
|
||||
{
|
||||
this->Destroy();
|
||||
}
|
||||
else
|
||||
event.Veto();
|
||||
}
|
||||
@endcode
|
||||
*/
|
||||
void OnCloseWindow(wxCloseEvent& event);
|
||||
};
|
||||
@@ -71,19 +82,18 @@ public:
|
||||
@class wxDocMDIChildFrame
|
||||
@wxheader{docmdi.h}
|
||||
|
||||
The wxDocMDIChildFrame class provides a default frame for displaying documents
|
||||
on separate windows. This class can only be used for MDI child frames.
|
||||
The wxDocMDIChildFrame class provides a default frame for displaying
|
||||
documents on separate windows. This class can only be used for MDI child
|
||||
frames.
|
||||
|
||||
The class is part of the document/view framework supported by wxWidgets,
|
||||
and cooperates with the wxView, wxDocument,
|
||||
wxDocManager and wxDocTemplate classes.
|
||||
|
||||
See the example application in @c samples/docview.
|
||||
and cooperates with the wxView, wxDocument, wxDocManager and wxDocTemplate
|
||||
classes.
|
||||
|
||||
@library{wxcore}
|
||||
@category{FIXME}
|
||||
@category{docview}
|
||||
|
||||
@see @ref overview_docviewoverview, wxMDIChildFrame
|
||||
@see @ref overview_docview, @ref page_samples_docview, wxMDIChildFrame
|
||||
*/
|
||||
class wxDocMDIChildFrame : public wxMDIChildFrame
|
||||
{
|
||||
@@ -92,8 +102,7 @@ public:
|
||||
Constructor.
|
||||
*/
|
||||
wxDocMDIChildFrame(wxDocument* doc, wxView* view,
|
||||
wxFrame* parent,
|
||||
wxWindowID id,
|
||||
wxFrame* parent, wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
@@ -136,16 +145,5 @@ public:
|
||||
Sets the view for this frame.
|
||||
*/
|
||||
void SetView(wxView* view);
|
||||
|
||||
/**
|
||||
wxDocument* m_childDocument
|
||||
The document associated with the frame.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
wxView* m_childView
|
||||
The view associated with the frame.
|
||||
*/
|
||||
};
|
||||
|
||||
|
1002
interface/docview.h
1002
interface/docview.h
File diff suppressed because it is too large
Load Diff
@@ -10,89 +10,138 @@
|
||||
@class wxDragImage
|
||||
@wxheader{dragimag.h}
|
||||
|
||||
This class is used when you wish to drag an object on the screen,
|
||||
and a simple cursor is not enough.
|
||||
This class is used when you wish to drag an object on the screen, and a
|
||||
simple cursor is not enough.
|
||||
|
||||
On Windows, the Win32 API is used to achieve smooth dragging. On other
|
||||
platforms,
|
||||
wxGenericDragImage is used. Applications may also prefer to use
|
||||
platforms, wxGenericDragImage is used. Applications may also prefer to use
|
||||
wxGenericDragImage on Windows, too.
|
||||
|
||||
@b wxPython note: wxPython uses wxGenericDragImage on all platforms, but
|
||||
uses the wxDragImage name.
|
||||
@beginWxPythonOnly
|
||||
wxPython uses wxGenericDragImage on all platforms, but uses the wxDragImage
|
||||
name.
|
||||
@endWxPythonOnly
|
||||
|
||||
To use this class, when you wish to start dragging an image, create a
|
||||
wxDragImage
|
||||
object and store it somewhere you can access it as the drag progresses.
|
||||
Call BeginDrag to start, and EndDrag to stop the drag. To move the image,
|
||||
initially call Show and then Move. If you wish to update the screen contents
|
||||
during the drag (for example, highlight an item as in the dragimag sample),
|
||||
first call Hide,
|
||||
update the screen, call Move, and then call Show.
|
||||
wxDragImage object and store it somewhere you can access it as the drag
|
||||
progresses. Call BeginDrag() to start, and EndDrag() to stop the drag. To
|
||||
move the image, initially call Show() and then Move(). If you wish to
|
||||
update the screen contents during the drag (for example, highlight an item
|
||||
as in the dragimag sample), first call Hide(), update the screen, call
|
||||
Move(), and then call Show().
|
||||
|
||||
You can drag within one window, or you can use full-screen dragging
|
||||
either across the whole screen, or just restricted to one area
|
||||
of the screen to save resources. If you want the user to drag between
|
||||
two windows, then you will need to use full-screen dragging.
|
||||
You can drag within one window, or you can use full-screen dragging either
|
||||
across the whole screen, or just restricted to one area of the screen to
|
||||
save resources. If you want the user to drag between two windows, then you
|
||||
will need to use full-screen dragging.
|
||||
|
||||
If you wish to draw the image yourself, use wxGenericDragImage and
|
||||
override wxDragImage::DoDrawImage and
|
||||
wxDragImage::GetImageRect.
|
||||
|
||||
Please see @c samples/dragimag for an example.
|
||||
If you wish to draw the image yourself, use wxGenericDragImage and override
|
||||
DoDrawImage() and GetImageRect().
|
||||
|
||||
@library{wxcore}
|
||||
@category{FIXME}
|
||||
@category{dnd}
|
||||
|
||||
@see @ref page_samples_dragimag
|
||||
*/
|
||||
class wxDragImage : public wxObject
|
||||
{
|
||||
public:
|
||||
//@{
|
||||
/**
|
||||
)
|
||||
Constructs a drag image an optional cursor. This constructor is only available
|
||||
for
|
||||
wxGenericDragImage, and can be used when the application
|
||||
supplies DoDrawImage() and GetImageRect().
|
||||
Default constructor.
|
||||
*/
|
||||
wxDragImage();
|
||||
/**
|
||||
Constructs a drag image from a bitmap and optional cursor.
|
||||
|
||||
@param image
|
||||
Icon or bitmap to be used as the drag image. The bitmap can
|
||||
have a mask.
|
||||
Bitmap to be used as the drag image. The bitmap can have a mask.
|
||||
@param cursor
|
||||
Optional cursor to combine with the image.
|
||||
@param cursorHotspot
|
||||
This parameter is deprecated.
|
||||
*/
|
||||
wxDragImage(const wxBitmap& image, const wxCursor& cursor = wxNullCursor,
|
||||
const wxPoint& cursorHotspot = wxPoint(0, 0));
|
||||
/**
|
||||
Constructs a drag image from an icon and optional cursor.
|
||||
|
||||
@param image
|
||||
Icon to be used as the drag image.
|
||||
@param cursor
|
||||
Optional cursor to combine with the image.
|
||||
@param cursorHotspot
|
||||
This parameter is deprecated.
|
||||
|
||||
@beginWxPythonOnly
|
||||
This constructor is called wxDragIcon in wxPython.
|
||||
@endWxPythonOnly
|
||||
*/
|
||||
wxDragImage(const wxIcon& image, const wxCursor& cursor = wxNullCursor,
|
||||
const wxPoint& cursorHotspot = wxPoint(0, 0));
|
||||
/**
|
||||
Constructs a drag image from a text string and optional cursor.
|
||||
|
||||
@param text
|
||||
Text used to construct a drag image.
|
||||
@param cursor
|
||||
Optional cursor to combine with the image.
|
||||
@param hotspot
|
||||
@param cursorHotspot
|
||||
This parameter is deprecated.
|
||||
|
||||
@beginWxPythonOnly
|
||||
This constructor is called wxDragString in wxPython.
|
||||
@endWxPythonOnly
|
||||
*/
|
||||
wxDragImage(const wxString& text, const wxCursor& cursor = wxNullCursor,
|
||||
const wxPoint& cursorHotspot = wxPoint(0, 0));
|
||||
/**
|
||||
Constructs a drag image from the text in the given tree control item,
|
||||
and optional cursor.
|
||||
|
||||
@param treeCtrl
|
||||
Tree control for constructing a tree drag image.
|
||||
@param id
|
||||
Tree control item id.
|
||||
|
||||
@beginWxPythonOnly
|
||||
This constructor is called wxDragTreeItem in wxPython.
|
||||
@endWxPythonOnly
|
||||
*/
|
||||
wxDragImage(const wxTreeCtrl& treeCtrl, wxTreeItemId& id);
|
||||
/**
|
||||
Constructs a drag image from the text in the given list control item,
|
||||
and optional cursor.
|
||||
|
||||
@param listCtrl
|
||||
List control for constructing a list drag image.
|
||||
@param id
|
||||
Tree or list control item id.
|
||||
*/
|
||||
wxDragImage();
|
||||
wxDragImage(const wxBitmap& image,
|
||||
const wxCursor& cursor = wxNullCursor);
|
||||
wxDragImage(const wxIcon& image,
|
||||
const wxCursor& cursor = wxNullCursor);
|
||||
wxDragImage(const wxString& text,
|
||||
const wxCursor& cursor = wxNullCursor);
|
||||
wxDragImage(const wxTreeCtrl& treeCtrl, wxTreeItemId& id);
|
||||
wxDragImage(const wxListCtrl& treeCtrl, long id);
|
||||
wxDragImage(const wxCursor& cursor = wxNullCursor);
|
||||
//@}
|
||||
List control item id.
|
||||
|
||||
//@{
|
||||
@beginWxPythonOnly
|
||||
This constructor is called wxDragListItem in wxPython.
|
||||
@endWxPythonOnly
|
||||
*/
|
||||
wxDragImage(const wxListCtrl& listCtrl, long id);
|
||||
/**
|
||||
Start dragging the image, using the first window to capture the mouse and the
|
||||
second
|
||||
to specify the bounding area. This form is equivalent to using the first form,
|
||||
but more convenient than working out the bounding rectangle explicitly.
|
||||
You need to then call Show()
|
||||
and Move() to show the image on the screen.
|
||||
Call EndDrag() when the drag has finished.
|
||||
Note that this call automatically calls CaptureMouse.
|
||||
Constructs a drag image an optional cursor. This constructor is only
|
||||
available for wxGenericDragImage, and can be used when the application
|
||||
supplies DoDrawImage() and GetImageRect().
|
||||
|
||||
@param cursor
|
||||
Optional cursor to combine with the image.
|
||||
@param cursorHotspot
|
||||
This parameter is deprecated.
|
||||
*/
|
||||
wxDragImage(const wxCursor& cursor = wxNullCursor,
|
||||
const wxPoint& cursorHotspot = wxPoint(0, 0));
|
||||
|
||||
/**
|
||||
Start dragging the image, in a window or full screen.
|
||||
|
||||
You need to then call Show() and Move() to show the image on the
|
||||
screen. Call EndDrag() when the drag has finished.
|
||||
|
||||
Note that this call automatically calls CaptureMouse().
|
||||
|
||||
@param hotspot
|
||||
The location of the drag position relative to the upper-left corner
|
||||
@@ -100,72 +149,87 @@ public:
|
||||
@param window
|
||||
The window that captures the mouse, and within which the dragging
|
||||
is limited unless fullScreen is @true.
|
||||
@param boundingWindow
|
||||
In the second form of the function, specifies the
|
||||
area within which the drag occurs.
|
||||
@param fullScreen
|
||||
If @true, specifies that the drag will be visible over the full
|
||||
screen, or over as much of the screen as is specified by rect. Note that
|
||||
the mouse will
|
||||
still be captured in window.
|
||||
screen, or over as much of the screen as is specified by rect. Note
|
||||
that the mouse will still be captured in window.
|
||||
@param rect
|
||||
If non-@NULL, specifies the rectangle (in screen coordinates) that
|
||||
bounds the dragging operation. Specifying this can make the operation more
|
||||
efficient
|
||||
by cutting down on the area under consideration, and it can also make a
|
||||
visual difference
|
||||
since the drag is clipped to this area.
|
||||
bounds the dragging operation. Specifying this can make the
|
||||
operation more efficient by cutting down on the area under
|
||||
consideration, and it can also make a visual difference since the
|
||||
drag is clipped to this area.
|
||||
*/
|
||||
bool BeginDrag(const wxPoint& hotspot, wxWindow* window,
|
||||
bool fullScreen = false,
|
||||
wxRect* rect = NULL);
|
||||
bool fullScreen = false, wxRect* rect = NULL);
|
||||
/**
|
||||
Start dragging the image, using the first window to capture the mouse
|
||||
and the second to specify the bounding area. This form is equivalent to
|
||||
using the first form, but more convenient than working out the bounding
|
||||
rectangle explicitly.
|
||||
|
||||
You need to then call Show() and Move() to show the image on the
|
||||
screen. Call EndDrag() when the drag has finished.
|
||||
|
||||
Note that this call automatically calls CaptureMouse().
|
||||
|
||||
@param hotspot
|
||||
The location of the drag position relative to the upper-left corner
|
||||
of the image.
|
||||
@param window
|
||||
The window that captures the mouse, and within which the dragging
|
||||
is limited.
|
||||
@param boundingWindow
|
||||
Specifies the area within which the drag occurs.
|
||||
*/
|
||||
bool BeginDrag(const wxPoint& hotspot, wxWindow* window,
|
||||
wxWindow* boundingWindow);
|
||||
//@}
|
||||
|
||||
/**
|
||||
Draws the image on the device context with top-left corner at the given
|
||||
position.
|
||||
This function is only available with wxGenericDragImage, to allow applications
|
||||
to
|
||||
draw their own image instead of using an actual bitmap. If you override this
|
||||
function,
|
||||
you must also override GetImageRect().
|
||||
|
||||
This function is only available with wxGenericDragImage, to allow
|
||||
applications to draw their own image instead of using an actual bitmap.
|
||||
If you override this function, you must also override GetImageRect().
|
||||
*/
|
||||
virtual bool DoDrawImage(wxDC& dc, const wxPoint& pos);
|
||||
|
||||
/**
|
||||
Call this when the drag has finished.
|
||||
Note that this call automatically calls ReleaseMouse.
|
||||
|
||||
@note This function automatically releases mouse capture.
|
||||
*/
|
||||
bool EndDrag();
|
||||
|
||||
/**
|
||||
Returns the rectangle enclosing the image, assuming that the image is drawn
|
||||
with its
|
||||
top-left corner at the given point.
|
||||
This function is available in wxGenericDragImage only, and may be overridden
|
||||
(together with
|
||||
wxDragImage::DoDrawImage) to provide a virtual drawing capability.
|
||||
Returns the rectangle enclosing the image, assuming that the image is
|
||||
drawn with its top-left corner at the given point.
|
||||
|
||||
This function is available in wxGenericDragImage only, and may be
|
||||
overridden (together with DoDrawImage()) to provide a virtual drawing
|
||||
capability.
|
||||
*/
|
||||
virtual wxRect GetImageRect(const wxPoint& pos) const;
|
||||
|
||||
/**
|
||||
Hides the image. You may wish to call this before updating the window
|
||||
contents (perhaps highlighting an item). Then call Move()
|
||||
and Show().
|
||||
contents (perhaps highlighting an item). Then call Move() and Show().
|
||||
*/
|
||||
bool Hide();
|
||||
|
||||
/**
|
||||
Call this to move the image to a new position. The image will only be shown if
|
||||
Show() has been called previously (for example
|
||||
at the start of the drag).
|
||||
@a pt is the position in client coordinates (relative to the window specified
|
||||
in BeginDrag).
|
||||
You can move the image either when the image is hidden or shown, but in general
|
||||
dragging
|
||||
will be smoother if you move the image when it is shown.
|
||||
Call this to move the image to a new position. The image will only be
|
||||
shown if Show() has been called previously (for example at the start of
|
||||
the drag).
|
||||
|
||||
@param pt
|
||||
The position in client coordinates (relative to the window
|
||||
specified in BeginDrag()).
|
||||
|
||||
You can move the image either when the image is hidden or shown, but in
|
||||
general dragging will be smoother if you move the image when it is
|
||||
shown.
|
||||
*/
|
||||
bool Move(const wxPoint& pt);
|
||||
|
||||
@@ -175,20 +239,20 @@ public:
|
||||
bool Show();
|
||||
|
||||
/**
|
||||
Override this if you wish to draw the window contents to the backing bitmap
|
||||
yourself. This can be desirable if you wish to avoid flicker by not having to
|
||||
redraw the updated window itself just before dragging, which can cause a
|
||||
flicker just
|
||||
as the drag starts. Instead, paint the drag image's backing bitmap to show the
|
||||
appropriate
|
||||
graphic @e minus the objects to be dragged, and leave the window itself to be
|
||||
updated
|
||||
by the drag image. This can provide eerily smooth, flicker-free drag behaviour.
|
||||
The default implementation copies the window contents to the backing bitmap. A
|
||||
new
|
||||
implementation will normally copy information from another source, such as from
|
||||
its
|
||||
own backing bitmap if it has one, or directly from internal data structures.
|
||||
Override this if you wish to draw the window contents to the backing
|
||||
bitmap yourself. This can be desirable if you wish to avoid flicker by
|
||||
not having to redraw the updated window itself just before dragging,
|
||||
which can cause a flicker just as the drag starts. Instead, paint the
|
||||
drag image's backing bitmap to show the appropriate graphic @e minus
|
||||
the objects to be dragged, and leave the window itself to be updated by
|
||||
the drag image. This can provide eerily smooth, flicker-free drag
|
||||
behaviour.
|
||||
|
||||
The default implementation copies the window contents to the backing
|
||||
bitmap. A new implementation will normally copy information from
|
||||
another source, such as from its own backing bitmap if it has one, or
|
||||
directly from internal data structures.
|
||||
|
||||
This function is available in wxGenericDragImage only.
|
||||
*/
|
||||
bool UpdateBackingFromWindow(wxDC& windowDC, wxMemoryDC& destDC,
|
||||
|
1030
interface/dynarray.h
1030
interface/dynarray.h
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: dynlib.h
|
||||
// Purpose: interface of wxDynamicLibraryDetails
|
||||
// Purpose: interface of wxDynamicLibrary and wxDynamicLibraryDetails
|
||||
// Author: wxWidgets team
|
||||
// RCS-ID: $Id$
|
||||
// Licence: wxWindows license
|
||||
@@ -10,14 +10,14 @@
|
||||
@class wxDynamicLibraryDetails
|
||||
@wxheader{dynlib.h}
|
||||
|
||||
This class is used for the objects returned by
|
||||
wxDynamicLibrary::ListLoaded method and
|
||||
contains the information about a single module loaded into the address space of
|
||||
the current process. A module in this context may be either a dynamic library
|
||||
or the main program itself.
|
||||
This class is used for the objects returned by the
|
||||
wxDynamicLibrary::ListLoaded() method and contains the information about a
|
||||
single module loaded into the address space of the current process. A
|
||||
module in this context may be either a dynamic library or the main program
|
||||
itself.
|
||||
|
||||
@library{wxbase}
|
||||
@category{FIXME}
|
||||
@category{appmanagement}
|
||||
*/
|
||||
class wxDynamicLibraryDetails
|
||||
{
|
||||
@@ -26,33 +26,32 @@ public:
|
||||
Retrieves the load address and the size of this module.
|
||||
|
||||
@param addr
|
||||
the pointer to the location to return load address in, may be
|
||||
@NULL
|
||||
The pointer to the location to return load address in, may be
|
||||
@NULL.
|
||||
@param len
|
||||
pointer to the location to return the size of this module in
|
||||
memory in, may be @NULL
|
||||
Pointer to the location to return the size of this module in
|
||||
memory in, may be @NULL.
|
||||
|
||||
@returns @true if the load address and module size were retrieved, @false
|
||||
if this information is not available.
|
||||
@returns @true if the load address and module size were retrieved,
|
||||
@false if this information is not available.
|
||||
*/
|
||||
bool GetAddress(void** addr, size_t len) const;
|
||||
|
||||
/**
|
||||
Returns the base name of this module, e.g. @c kernel32.dll or
|
||||
@c libc-2.3.2.so.
|
||||
Returns the base name of this module, e.g. @c "kernel32.dll" or
|
||||
@c "libc-2.3.2.so".
|
||||
*/
|
||||
wxString GetName() const;
|
||||
|
||||
/**
|
||||
Returns the full path of this module if available, e.g.
|
||||
@c c:\windows\system32\kernel32.dll or
|
||||
@c /lib/libc-2.3.2.so.
|
||||
@c "c:\windows\system32\kernel32.dll" or @c "/lib/libc-2.3.2.so".
|
||||
*/
|
||||
wxString GetPath() const;
|
||||
|
||||
/**
|
||||
Returns the version of this module, e.g. @c 5.2.3790.0 or
|
||||
@c 2.3.2. The returned string is empty if the version information is not
|
||||
Returns the version of this module, e.g. @c "5.2.3790.0" or @c "2.3.2".
|
||||
The returned string is empty if the version information is not
|
||||
available.
|
||||
*/
|
||||
wxString GetVersion() const;
|
||||
@@ -61,131 +60,23 @@ public:
|
||||
|
||||
|
||||
/**
|
||||
@class wxDllLoader
|
||||
@wxheader{dynlib.h}
|
||||
|
||||
@b Deprecation note: This class is deprecated since version 2.4 and is
|
||||
not compiled in by default in version 2.6 and will be removed in 2.8. Please
|
||||
use wxDynamicLibrary instead.
|
||||
|
||||
wxDllLoader is a class providing an interface similar to Unix's @c dlopen(). It
|
||||
is used by the wxLibrary framework and manages the actual
|
||||
loading of shared libraries and the resolving of symbols in them. There are no
|
||||
instances of this class, it simply serves as a namespace for its static member
|
||||
functions.
|
||||
|
||||
Please note that class wxDynamicLibrary provides
|
||||
alternative, friendlier interface to wxDllLoader.
|
||||
|
||||
The terms @e DLL and @e shared library/object will both be used in the
|
||||
documentation to refer to the same thing: a @c .dll file under Windows or
|
||||
@c .so or @c .sl one under Unix.
|
||||
|
||||
Example of using this class to dynamically load the @c strlen() function:
|
||||
|
||||
@code
|
||||
#if defined(__WXMSW__)
|
||||
static const wxChar *LIB_NAME = _T("kernel32");
|
||||
static const wxChar *FUNC_NAME = _T("lstrlenA");
|
||||
#elif defined(__UNIX__)
|
||||
static const wxChar *LIB_NAME = _T("/lib/libc-2.0.7.so");
|
||||
static const wxChar *FUNC_NAME = _T("strlen");
|
||||
#endif
|
||||
|
||||
wxDllType dllHandle = wxDllLoader::LoadLibrary(LIB_NAME);
|
||||
if ( !dllHandle )
|
||||
{
|
||||
... error ...
|
||||
}
|
||||
else
|
||||
{
|
||||
typedef int (*strlenType)(char *);
|
||||
strlenType pfnStrlen = (strlenType)wxDllLoader::GetSymbol(dllHandle,
|
||||
FUNC_NAME);
|
||||
if ( !pfnStrlen )
|
||||
{
|
||||
... error ...
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( pfnStrlen("foo") != 3 )
|
||||
{
|
||||
... error ...
|
||||
}
|
||||
else
|
||||
{
|
||||
... ok! ...
|
||||
}
|
||||
}
|
||||
|
||||
wxDllLoader::UnloadLibrary(dllHandle);
|
||||
}
|
||||
@endcode
|
||||
|
||||
@library{wxbase}
|
||||
@category{appmanagement}
|
||||
Dynamic library category used with wxDynamicLibrary::CanonicalizeName().
|
||||
*/
|
||||
class wxDllLoader
|
||||
enum wxDynamicLibraryCategory
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Returns the string containing the usual extension for shared libraries for the
|
||||
given systems (including the leading dot if not empty).
|
||||
For example, this function will return @c ".dll" under Windows or (usually)
|
||||
@c ".so" under Unix.
|
||||
*/
|
||||
static wxString GetDllExt();
|
||||
|
||||
/**
|
||||
This function returns a valid handle for the main program itself. Notice that
|
||||
the @NULL return value is valid for some systems (i.e. doesn't mean that
|
||||
the function failed).
|
||||
@note This function is Unix specific. It will always fail under Windows
|
||||
or OS/2.
|
||||
*/
|
||||
wxDllType GetProgramHandle();
|
||||
|
||||
/**
|
||||
This function resolves a symbol in a loaded DLL, such as a variable or
|
||||
function name.
|
||||
Returned value will be @NULL if the symbol was not found in the DLL or if
|
||||
an error occurred.
|
||||
|
||||
@param dllHandle
|
||||
Valid handle previously returned by
|
||||
LoadLibrary
|
||||
@param name
|
||||
Name of the symbol.
|
||||
*/
|
||||
void* GetSymbol(wxDllType dllHandle, const wxString& name);
|
||||
|
||||
/**
|
||||
This function loads a shared library into memory, with @a libname being the
|
||||
name of the library: it may be either the full name including path and
|
||||
(platform-dependent) extension, just the basename (no path and no extension)
|
||||
or a basename with extension. In the last two cases, the library will be
|
||||
searched in all standard locations.
|
||||
Returns a handle to the loaded DLL. Use @a success parameter to test if it
|
||||
is valid. If the handle is valid, the library must be unloaded later with
|
||||
UnloadLibrary().
|
||||
|
||||
@param libname
|
||||
Name of the shared object to load.
|
||||
@param success
|
||||
May point to a bool variable which will be set to @true or
|
||||
@false; may also be @NULL.
|
||||
*/
|
||||
wxDllType LoadLibrary(const wxString& libname,
|
||||
bool* success = NULL);
|
||||
|
||||
/**
|
||||
This function unloads the shared library. The handle @a dllhandle must have
|
||||
been returned by LoadLibrary() previously.
|
||||
*/
|
||||
void UnloadLibrary(wxDllType dllhandle);
|
||||
wxDL_LIBRARY, ///< Standard library.
|
||||
wxDL_MODULE ///< Loadable module/plugin.
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
Dynamic library plugin category used with
|
||||
wxDynamicLibrary::CanonicalizePluginName().
|
||||
*/
|
||||
enum wxPluginCategory
|
||||
{
|
||||
wxDL_PLUGIN_GUI, ///< Plugin that uses GUI classes.
|
||||
wxDL_PLUGIN_BASE ///< wxBase-only plugin.
|
||||
};
|
||||
|
||||
/**
|
||||
@class wxDynamicLibrary
|
||||
@@ -193,40 +84,46 @@ public:
|
||||
|
||||
wxDynamicLibrary is a class representing dynamically loadable library
|
||||
(Windows DLL, shared library under Unix etc.). Just create an object of
|
||||
this class to load a library and don't worry about unloading it -- it will be
|
||||
done in the objects destructor automatically.
|
||||
this class to load a library and don't worry about unloading it -- it will
|
||||
be done in the objects destructor automatically.
|
||||
|
||||
The following flags can be used with wxDynamicLibrary() or Load():
|
||||
|
||||
@beginStyleTable
|
||||
@style{wxDL_LAZY}
|
||||
Equivalent of RTLD_LAZY under Unix, ignored elsewhere.
|
||||
@style{wxDL_NOW}
|
||||
Equivalent of RTLD_NOW under Unix, ignored elsewhere.
|
||||
@style{wxDL_GLOBAL}
|
||||
Equivalent of RTLD_GLOBAL under Unix, ignored elsewhere.
|
||||
@style{wxDL_VERBATIM}
|
||||
Don't try to append the appropriate extension to the library name
|
||||
(this is done by default).
|
||||
@style{wxDL_DEFAULT}
|
||||
Default flags, same as wxDL_NOW currently.
|
||||
@style{wxDL_QUIET}
|
||||
Don't log an error message if the library couldn't be loaded.
|
||||
@endStyleTable
|
||||
|
||||
@library{wxbase}
|
||||
@category{FIXME}
|
||||
|
||||
@see wxDynamicLibrary::CanonicalizePluginName
|
||||
@category{appmanagement}
|
||||
*/
|
||||
class wxDynamicLibrary
|
||||
{
|
||||
public:
|
||||
//@{
|
||||
/**
|
||||
Constructor. Second form calls Load().
|
||||
Default constructor.
|
||||
*/
|
||||
wxDynamicLibrary();
|
||||
wxDynamicLibrary(const wxString& name,
|
||||
int flags = wxDL_DEFAULT);
|
||||
//@}
|
||||
/**
|
||||
Constructor. Calls Load() with the given @a name.
|
||||
*/
|
||||
wxDynamicLibrary(const wxString& name, int flags = wxDL_DEFAULT);
|
||||
|
||||
/**
|
||||
Returns the platform-specific full name for the library called @e name. E.g.
|
||||
it adds a @c ".dll" extension under Windows and @c "lib" prefix and
|
||||
@c ".so", @c ".sl" or maybe @c ".dylib" extension under Unix.
|
||||
The possible values for @a cat are:
|
||||
|
||||
|
||||
wxDL_LIBRARY
|
||||
|
||||
normal library
|
||||
|
||||
wxDL_MODULE
|
||||
|
||||
a loadable module or plugin
|
||||
Returns the platform-specific full name for the library called @a name.
|
||||
E.g. it adds a @c ".dll" extension under Windows and @c "lib" prefix
|
||||
and @c ".so", @c ".sl" or @c ".dylib" extension under Unix.
|
||||
|
||||
@see CanonicalizePluginName()
|
||||
*/
|
||||
@@ -234,29 +131,18 @@ public:
|
||||
wxDynamicLibraryCategory cat = wxDL_LIBRARY);
|
||||
|
||||
/**
|
||||
This function does the same thing as
|
||||
CanonicalizeName() but for wxWidgets
|
||||
plugins. The only difference is that compiler and version information are added
|
||||
to the name to ensure that the plugin which is going to be loaded will be
|
||||
compatible with the main program.
|
||||
The possible values for @a cat are:
|
||||
|
||||
|
||||
wxDL_PLUGIN_GUI
|
||||
|
||||
plugin which uses GUI classes (default)
|
||||
|
||||
wxDL_PLUGIN_BASE
|
||||
|
||||
plugin which only uses wxBase
|
||||
This function does the same thing as CanonicalizeName() but for
|
||||
wxWidgets plugins. The only difference is that compiler and version
|
||||
information are added to the name to ensure that the plugin which is
|
||||
going to be loaded will be compatible with the main program.
|
||||
*/
|
||||
static wxString CanonicalizePluginName(const wxString& name,
|
||||
wxPluginCategory cat = wxDL_PLUGIN_GUI);
|
||||
|
||||
/**
|
||||
Detaches this object from its library handle, i.e. the object will not unload
|
||||
the library any longer in its destructor but it is now the callers
|
||||
responsibility to do this using Unload().
|
||||
Detaches this object from its library handle, i.e. the object will not
|
||||
unload the library any longer in its destructor but it is now the
|
||||
callers responsibility to do this using Unload().
|
||||
*/
|
||||
wxDllType Detach();
|
||||
|
||||
@@ -267,8 +153,8 @@ public:
|
||||
static wxDllType GetProgramHandle();
|
||||
|
||||
/**
|
||||
Returns pointer to symbol @a name in the library or @NULL if the library
|
||||
contains no such symbol.
|
||||
Returns pointer to symbol @a name in the library or @NULL if the
|
||||
library contains no such symbol.
|
||||
|
||||
@see wxDYNLIB_FUNCTION()
|
||||
*/
|
||||
@@ -276,19 +162,19 @@ public:
|
||||
|
||||
/**
|
||||
This function is available only under Windows as it is only useful when
|
||||
dynamically loading symbols from standard Windows DLLs. Such functions have
|
||||
either @c 'A' (in ANSI build) or @c 'W' (in Unicode, or wide
|
||||
character build) suffix if they take string parameters. Using this function you
|
||||
can use just the base name of the function and the correct suffix is appende
|
||||
automatically depending on the current build. Otherwise, this method is
|
||||
identical to GetSymbol().
|
||||
dynamically loading symbols from standard Windows DLLs. Such functions
|
||||
have either @c 'A' (in ANSI build) or @c 'W' (in Unicode, or wide
|
||||
character build) suffix if they take string parameters. Using this
|
||||
function, you can use just the base name of the function and the
|
||||
correct suffix is appended automatically depending on the current
|
||||
build. Otherwise, this method is identical to GetSymbol().
|
||||
*/
|
||||
void* GetSymbolAorW(const wxString& name) const;
|
||||
|
||||
/**
|
||||
Returns @true if the symbol with the given @a name is present in the dynamic
|
||||
library, @false otherwise. Unlike GetSymbol(),
|
||||
this function doesn't log an error message if the symbol is not found.
|
||||
Returns @true if the symbol with the given @a name is present in the
|
||||
dynamic library, @false otherwise. Unlike GetSymbol(), this function
|
||||
doesn't log an error message if the symbol is not found.
|
||||
|
||||
@since 2.5.4
|
||||
*/
|
||||
@@ -300,61 +186,41 @@ public:
|
||||
bool IsLoaded() const;
|
||||
|
||||
/**
|
||||
This static method returns an array() containing the details
|
||||
of all modules loaded into the address space of the current project, the array
|
||||
elements are object of @c wxDynamicLibraryDetails class. The array will
|
||||
be empty if an error occurred.
|
||||
This method is currently implemented only under Win32 and Linux and is useful
|
||||
mostly for diagnostics purposes.
|
||||
This static method returns a wxArray containing the details of all
|
||||
modules loaded into the address space of the current project. The array
|
||||
elements are objects of the type: wxDynamicLibraryDetails. The array
|
||||
will be empty if an error occurred.
|
||||
|
||||
This method is currently implemented only under Win32 and Linux and is
|
||||
useful mostly for diagnostics purposes.
|
||||
*/
|
||||
static wxDynamicLibraryDetailsArray ListLoaded();
|
||||
|
||||
/**
|
||||
Loads DLL with the given @a name into memory. The @a flags argument can
|
||||
be a combination of the following bits:
|
||||
|
||||
wxDL_LAZY
|
||||
|
||||
equivalent of RTLD_LAZY under Unix, ignored elsewhere
|
||||
|
||||
wxDL_NOW
|
||||
|
||||
equivalent of RTLD_NOW under Unix, ignored elsewhere
|
||||
|
||||
wxDL_GLOBAL
|
||||
|
||||
equivalent of RTLD_GLOBAL under Unix, ignored elsewhere
|
||||
|
||||
wxDL_VERBATIM
|
||||
|
||||
don't try to append the appropriate extension to
|
||||
the library name (this is done by default).
|
||||
|
||||
wxDL_DEFAULT
|
||||
|
||||
default flags, same as wxDL_NOW currently
|
||||
|
||||
wxDL_QUIET
|
||||
|
||||
don't log an error message if the library couldn't be
|
||||
loaded.
|
||||
be a combination of the styles outlined in the class description.
|
||||
|
||||
Returns @true if the library was successfully loaded, @false otherwise.
|
||||
*/
|
||||
bool Load(const wxString& name, int flags = wxDL_DEFAULT);
|
||||
|
||||
//@{
|
||||
/**
|
||||
Unloads the library from memory. wxDynamicLibrary object automatically calls
|
||||
this method from its destructor if it had been successfully loaded.
|
||||
The second version is only used if you need to keep the library in memory
|
||||
during a longer period of time than the scope of the wxDynamicLibrary object.
|
||||
In this case you may call Detach() and store
|
||||
the handle somewhere and call this static method later to unload it.
|
||||
Unloads the library from memory. wxDynamicLibrary object automatically
|
||||
calls this method from its destructor if it had been successfully
|
||||
loaded.
|
||||
*/
|
||||
void Unload();
|
||||
/**
|
||||
Unloads the library from memory. wxDynamicLibrary object automatically
|
||||
calls this method from its destructor if it had been successfully
|
||||
loaded.
|
||||
|
||||
This version of Unload() is only used if you need to keep the library
|
||||
in memory during a longer period of time than the scope of the
|
||||
wxDynamicLibrary object. In this case you may call Detach() and store
|
||||
the handle somewhere and call this static method later to unload it.
|
||||
*/
|
||||
static void Unload(wxDllType handle);
|
||||
//@}
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user