revisions of o-p headers contributed by Utensil Candel and revised by me
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53116 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
@page overview_printing Printing
|
@page overview_printing Printing Framework Overview
|
||||||
|
|
||||||
Classes:
|
Classes:
|
||||||
@li wxPrintout
|
@li wxPrintout
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
@page overview_sizer Sizers
|
@page overview_sizer Sizers Overview
|
||||||
|
|
||||||
Classes: wxSizer, wxGridSizer, wxFlexGridSizer, wxBoxSizer, wxStaticBoxSizer
|
Classes: wxSizer, wxGridSizer, wxFlexGridSizer, wxBoxSizer, wxStaticBoxSizer
|
||||||
|
|
||||||
|
@@ -12,16 +12,19 @@
|
|||||||
|
|
||||||
Window styles are used to specify alternative behaviour and appearances for
|
Window styles are used to specify alternative behaviour and appearances for
|
||||||
windows, when they are created. The symbols are defined in such a way that they
|
windows, when they are created. The symbols are defined in such a way that they
|
||||||
can be combined in a 'bit-list' using the C++ @e bitwise-or operator. For
|
can be combined in a 'bit-list' using the C++ @e bitwise-or operator.
|
||||||
example:
|
|
||||||
|
For example:
|
||||||
|
|
||||||
@code
|
@code
|
||||||
wxCAPTION | wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxRESIZE_BORDER
|
wxCAPTION | wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxRESIZE_BORDER
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
For the window styles specific to each window class, please see the
|
For the window styles specific to each window class, please see the
|
||||||
documentation for the window. Most windows can use the generic styles listed
|
documentation for the window.
|
||||||
for wxWindow in addition to their own styles.
|
|
||||||
|
Most windows can use the generic styles listed for wxWindow in addition to
|
||||||
|
their own styles.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@@ -129,9 +129,17 @@ enum wxPenCap
|
|||||||
@category{gdi}
|
@category{gdi}
|
||||||
|
|
||||||
@stdobjects
|
@stdobjects
|
||||||
::wxNullPen, ::wxRED_PEN, ::wxCYAN_PEN, ::wxGREEN_PEN, ::wxBLACK_PEN, ::wxWHITE_PEN,
|
@li ::wxNullPen
|
||||||
::wxTRANSPARENT_PEN, ::wxBLACK_DASHED_PEN, ::wxGREY_PEN, ::wxMEDIUM_GREY_PEN,
|
@li ::wxRED_PEN
|
||||||
::wxLIGHT_GREY_PEN
|
@li ::wxCYAN_PEN
|
||||||
|
@li ::wxGREEN_PEN
|
||||||
|
@li ::wxBLACK_PEN
|
||||||
|
@li ::wxWHITE_PEN
|
||||||
|
@li ::wxTRANSPARENT_PEN
|
||||||
|
@li ::wxBLACK_DASHED_PEN
|
||||||
|
@li ::wxGREY_PEN
|
||||||
|
@li ::wxMEDIUM_GREY_PEN
|
||||||
|
@li ::wxLIGHT_GREY_PEN
|
||||||
|
|
||||||
@see wxPenList, wxDC, wxDC::SetPen()
|
@see wxPenList, wxDC, wxDC::SetPen()
|
||||||
*/
|
*/
|
||||||
|
@@ -79,8 +79,8 @@ enum wxPortId
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
The architecture of the operating system
|
The architecture of the operating system
|
||||||
(regardless of the build environment of wxWidgets library
|
(regardless of the build environment of wxWidgets library - see ::wxIsPlatform64bit()
|
||||||
- see ::wxIsPlatform64bit documentation for more info).
|
documentation for more info).
|
||||||
*/
|
*/
|
||||||
enum wxArchitecture
|
enum wxArchitecture
|
||||||
{
|
{
|
||||||
|
@@ -11,25 +11,30 @@
|
|||||||
@wxheader{position.h}
|
@wxheader{position.h}
|
||||||
|
|
||||||
This class represents the position of an item in any kind of grid of rows and
|
This class represents the position of an item in any kind of grid of rows and
|
||||||
columns such as wxGridBagSizer, or
|
columns such as wxGridBagSizer, or wxHVScrolledWindow.
|
||||||
wxHVScrolledWindow.
|
|
||||||
|
@todo rename this class to wxItemPosition or such, wxPosition is too generic
|
||||||
|
|
||||||
@library{wxbase}
|
@library{wxbase}
|
||||||
@category{FIXME}
|
@category{data}
|
||||||
|
|
||||||
@see wxPoint, wxSize
|
@see wxPoint, wxSize
|
||||||
*/
|
*/
|
||||||
class wxPosition
|
class wxPosition
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//@{
|
|
||||||
/**
|
/**
|
||||||
Construct a new wxPosition, optionally setting the row and column. The
|
Construct a new wxPosition, setting the row and column to the
|
||||||
default value is (0, 0).
|
default value of (0, 0).
|
||||||
*/
|
*/
|
||||||
wxPosition();
|
wxPosition();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Construct a new wxPosition, setting the row and column to the
|
||||||
|
value of (@a row, @a col).
|
||||||
|
*/
|
||||||
wxPosition(int row, int col);
|
wxPosition(int row, int col);
|
||||||
//@}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
A synonym for GetColumn().
|
A synonym for GetColumn().
|
||||||
@@ -46,22 +51,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
int GetRow() const;
|
int GetRow() const;
|
||||||
|
|
||||||
//@{
|
|
||||||
/**
|
|
||||||
|
|
||||||
*/
|
|
||||||
bool operator ==(const wxPosition& p) const;
|
|
||||||
const bool operator !=(const wxPosition& p) const;
|
|
||||||
const wxPosition& operator +=(const wxPosition& p) const;
|
|
||||||
wxPosition operator -=(const wxPosition& p) const;
|
|
||||||
wxPosition operator +=(const wxSize& s) const;
|
|
||||||
wxPosition operator -=(const wxSize& s) const;
|
|
||||||
wxPosition operator +(const wxPosition& p) const;
|
|
||||||
const wxPosition operator -(const wxPosition& p) const;
|
|
||||||
const wxPosition operator +(const wxSize& s) const;
|
|
||||||
const wxPosition operator -(const wxSize& s) const;
|
|
||||||
//@}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
A synonym for SetColumn().
|
A synonym for SetColumn().
|
||||||
*/
|
*/
|
||||||
@@ -76,5 +65,23 @@ public:
|
|||||||
Set a new row value.
|
Set a new row value.
|
||||||
*/
|
*/
|
||||||
void SetRow(int row);
|
void SetRow(int row);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@name Miscellaneous operators
|
||||||
|
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
bool operator ==(const wxPosition& p) const;
|
||||||
|
bool operator !=(const wxPosition& p) const;
|
||||||
|
wxPosition& operator +=(const wxPosition& p) const;
|
||||||
|
wxPosition& operator -=(const wxPosition& p) const;
|
||||||
|
wxPosition& operator +=(const wxSize& s) const;
|
||||||
|
wxPosition& operator -=(const wxSize& s) const;
|
||||||
|
wxPosition& operator +(const wxPosition& p) const;
|
||||||
|
wxPosition& operator -(const wxPosition& p) const;
|
||||||
|
wxPosition& operator +(const wxSize& s) const;
|
||||||
|
wxPosition& operator -(const wxSize& s) const;
|
||||||
|
//@}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -16,22 +16,38 @@
|
|||||||
|
|
||||||
Notice that currently only suspend and resume events are generated and only
|
Notice that currently only suspend and resume events are generated and only
|
||||||
under MS Windows platform. To avoid the need to change the code using this
|
under MS Windows platform. To avoid the need to change the code using this
|
||||||
event later when these events are implemented on the other platforms please use
|
event later when these events are implemented on the other platforms please
|
||||||
the test @c ifdef wxHAS_POWER_EVENTS instead of directly testing for
|
use the test <tt>ifdef wxHAS_POWER_EVENTS</tt> instead of directly testing for
|
||||||
the platform in your code: this symbol will be defined for all platforms
|
the platform in your code: this symbol will be defined for all platforms
|
||||||
supporting the power events.
|
supporting the power events.
|
||||||
|
|
||||||
@library{wxbase}
|
@beginEventTable{wxPowerEvent}
|
||||||
@category{FIXME}
|
@event{EVT_POWER_SUSPENDING(func)}:
|
||||||
|
System is about to be suspended, this event can be vetoed to prevent
|
||||||
|
suspend from taking place.
|
||||||
|
@event{EVT_POWER_SUSPENDED(func)}:
|
||||||
|
System is about to suspend: normally the application should quickly
|
||||||
|
(i.e. without user intervention) close all the open files and network
|
||||||
|
connections here, possibly remembering them to reopen them later when
|
||||||
|
the system is resumed.
|
||||||
|
@event{EVT_POWER_SUSPEND_CANCEL(func)}:
|
||||||
|
System suspension was cancelled because some application vetoed it.
|
||||||
|
@event{EVT_POWER_RESUME(func)}:
|
||||||
|
System resumed from suspend: normally the application should restore
|
||||||
|
the state in which it had been before the suspension.
|
||||||
|
@endEventTable
|
||||||
|
|
||||||
@see wxGetPowerType(), wxGetBatteryState()
|
@library{wxbase}
|
||||||
|
@category{events}
|
||||||
|
|
||||||
|
@see ::wxGetPowerType(), ::wxGetBatteryState()
|
||||||
*/
|
*/
|
||||||
class wxPowerEvent : public wxEvent
|
class wxPowerEvent : public wxEvent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
Call this to prevent suspend from taking place in
|
Call this to prevent suspend from taking place in @c wxEVT_POWER_SUSPENDING
|
||||||
@c wxEVT_POWER_SUSPENDING handler (it is ignored for all the others).
|
handler (it is ignored for all the others).
|
||||||
*/
|
*/
|
||||||
void Veto();
|
void Veto();
|
||||||
};
|
};
|
||||||
|
@@ -11,9 +11,10 @@
|
|||||||
@wxheader{print.h}
|
@wxheader{print.h}
|
||||||
|
|
||||||
This is the default implementation of the preview control bar, a panel
|
This is the default implementation of the preview control bar, a panel
|
||||||
with buttons and a zoom control. You can derive a new class from this and
|
with buttons and a zoom control.
|
||||||
override some or all member functions to change the behaviour and appearance;
|
|
||||||
or you can leave it as it is.
|
You can derive a new class from this and override some or all member functions
|
||||||
|
to change the behaviour and appearance; or you can leave it as it is.
|
||||||
|
|
||||||
@library{wxbase}
|
@library{wxbase}
|
||||||
@category{printing}
|
@category{printing}
|
||||||
@@ -23,6 +24,35 @@
|
|||||||
class wxPreviewControlBar : public wxPanel
|
class wxPreviewControlBar : public wxPanel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
Constructor.
|
||||||
|
|
||||||
|
The @a buttons parameter may be a combination of the following, using the bitwise
|
||||||
|
'or' operator:
|
||||||
|
|
||||||
|
@beginStyleTable
|
||||||
|
@style{wxPREVIEW_PRINT}:
|
||||||
|
Create a print button.
|
||||||
|
@style{wxPREVIEW_NEXT}:
|
||||||
|
Create a next page button.
|
||||||
|
@style{wxPREVIEW_PREVIOUS}:
|
||||||
|
Create a previous page button.
|
||||||
|
@style{wxPREVIEW_ZOOM}:
|
||||||
|
Create a zoom control.
|
||||||
|
@style{wxPREVIEW_DEFAULT}:
|
||||||
|
Equivalent to a combination of @c wxPREVIEW_PREVIOUS, @c wxPREVIEW_NEXT
|
||||||
|
and @c wxPREVIEW_ZOOM.
|
||||||
|
@endStyleTable
|
||||||
|
*/
|
||||||
|
wxPreviewControlBar(wxPrintPreview* preview,
|
||||||
|
long buttons,
|
||||||
|
wxWindow* parent,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = 0,
|
||||||
|
const wxString& name = "panel");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Destructor.
|
Destructor.
|
||||||
*/
|
*/
|
||||||
@@ -48,38 +78,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
void SetZoomControl(int percent);
|
void SetZoomControl(int percent);
|
||||||
|
|
||||||
/**
|
|
||||||
Constructor.
|
|
||||||
The buttons parameter may be a combination of the following, using the bitwise
|
|
||||||
'or' operator.
|
|
||||||
|
|
||||||
wxPREVIEW_PRINT
|
|
||||||
|
|
||||||
Create a print button.
|
|
||||||
|
|
||||||
wxPREVIEW_NEXT
|
|
||||||
|
|
||||||
Create a next page button.
|
|
||||||
|
|
||||||
wxPREVIEW_PREVIOUS
|
|
||||||
|
|
||||||
Create a previous page button.
|
|
||||||
|
|
||||||
wxPREVIEW_ZOOM
|
|
||||||
|
|
||||||
Create a zoom control.
|
|
||||||
|
|
||||||
wxPREVIEW_DEFAULT
|
|
||||||
|
|
||||||
Equivalent to a combination of wxPREVIEW_PREVIOUS, wxPREVIEW_NEXT and
|
|
||||||
wxPREVIEW_ZOOM.
|
|
||||||
*/
|
|
||||||
wxPreviewControlBar(wxPrintPreview* preview, long buttons,
|
|
||||||
wxWindow* parent,
|
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
|
||||||
const wxSize& size = wxDefaultSize,
|
|
||||||
long style = 0,
|
|
||||||
const wxString& name = "panel");
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -114,7 +112,7 @@ public:
|
|||||||
~wxPreviewCanvas();
|
~wxPreviewCanvas();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Calls wxPrintPreview::PaintPage to refresh the canvas.
|
Calls wxPrintPreview::PaintPage() to refresh the canvas.
|
||||||
*/
|
*/
|
||||||
void OnPaint(wxPaintEvent& event);
|
void OnPaint(wxPaintEvent& event);
|
||||||
};
|
};
|
||||||
@@ -138,7 +136,9 @@ class wxPreviewFrame : public wxFrame
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
Constructor. Pass a print preview object plus other normal frame arguments.
|
Constructor.
|
||||||
|
|
||||||
|
Pass a print preview object plus other normal frame arguments.
|
||||||
The print preview object will be destroyed by the frame when it closes.
|
The print preview object will be destroyed by the frame when it closes.
|
||||||
*/
|
*/
|
||||||
wxPreviewFrame(wxPrintPreview* preview, wxWindow* parent,
|
wxPreviewFrame(wxPrintPreview* preview, wxWindow* parent,
|
||||||
@@ -154,14 +154,18 @@ public:
|
|||||||
~wxPreviewFrame();
|
~wxPreviewFrame();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates a wxPreviewCanvas. Override this function to allow
|
Creates a wxPreviewCanvas.
|
||||||
a user-defined preview canvas object to be created.
|
|
||||||
|
Override this function to allow a user-defined preview canvas object
|
||||||
|
to be created.
|
||||||
*/
|
*/
|
||||||
void CreateCanvas();
|
void CreateCanvas();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates a wxPreviewControlBar. Override this function to allow
|
Creates a wxPreviewControlBar.
|
||||||
a user-defined preview control bar object to be created.
|
|
||||||
|
Override this function to allow a user-defined preview control bar object
|
||||||
|
to be created.
|
||||||
*/
|
*/
|
||||||
void CreateControlBar();
|
void CreateControlBar();
|
||||||
|
|
||||||
@@ -169,6 +173,7 @@ public:
|
|||||||
Creates the preview canvas and control bar, and calls
|
Creates the preview canvas and control bar, and calls
|
||||||
wxWindow::MakeModal(@true) to disable other top-level windows
|
wxWindow::MakeModal(@true) to disable other top-level windows
|
||||||
in the application.
|
in the application.
|
||||||
|
|
||||||
This function should be called by the application prior to
|
This function should be called by the application prior to
|
||||||
showing the frame.
|
showing the frame.
|
||||||
*/
|
*/
|
||||||
@@ -191,42 +196,45 @@ public:
|
|||||||
Objects of this class manage the print preview process. The object is passed
|
Objects of this class manage the print preview process. The object is passed
|
||||||
a wxPrintout object, and the wxPrintPreview object itself is passed to
|
a wxPrintout object, and the wxPrintPreview object itself is passed to
|
||||||
a wxPreviewFrame object. Previewing is started by initializing and showing
|
a wxPreviewFrame object. Previewing is started by initializing and showing
|
||||||
the preview frame. Unlike wxPrinter::Print, flow of control returns to the
|
the preview frame. Unlike wxPrinter::Print(), flow of control returns to the
|
||||||
application
|
application immediately after the frame is shown.
|
||||||
immediately after the frame is shown.
|
|
||||||
|
|
||||||
@library{wxbase}
|
@library{wxbase}
|
||||||
@category{printing}
|
@category{printing}
|
||||||
|
|
||||||
@see @ref overview_printingoverview "Printing framework overview", wxPrinterDC,
|
@see @ref overview_printing "Printing framework overview", wxPrinterDC,
|
||||||
wxPrintDialog, wxPrintout, wxPrinter, wxPreviewCanvas, wxPreviewControlBar, wxPreviewFrame.
|
wxPrintDialog, wxPrintout, wxPrinter, wxPreviewCanvas, wxPreviewControlBar,
|
||||||
|
wxPreviewFrame.
|
||||||
*/
|
*/
|
||||||
class wxPrintPreview : public wxObject
|
class wxPrintPreview : public wxObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
Constructor. Pass a printout object, an optional printout object to be
|
Constructor.
|
||||||
used for actual printing, and the address of an optional
|
|
||||||
block of printer data, which will be copied to the print preview object's
|
Pass a printout object, an optional printout object to be used for actual
|
||||||
print data.
|
printing, and the address of an optional block of printer data, which will
|
||||||
|
be copied to the print preview object's print data.
|
||||||
|
|
||||||
If @a printoutForPrinting is non-@NULL, a @b Print... button will be placed on
|
If @a printoutForPrinting is non-@NULL, a @b Print... button will be placed on
|
||||||
the
|
the preview frame so that the user can print directly from the preview interface.
|
||||||
preview frame so that the user can print directly from the preview interface.
|
|
||||||
|
@remarks
|
||||||
Do not explicitly delete the printout objects once this destructor has been
|
Do not explicitly delete the printout objects once this destructor has been
|
||||||
called, since they will be deleted in the wxPrintPreview constructor.
|
called, since they will be deleted in the wxPrintPreview constructor.
|
||||||
The same does not apply to the @a data argument.
|
The same does not apply to the @a data argument.
|
||||||
Test the Ok member to check whether the wxPrintPreview object was created
|
|
||||||
|
Test the Ok() to check whether the wxPrintPreview object was created
|
||||||
correctly.
|
correctly.
|
||||||
Ok could return @false if there was a problem initializing the printer device
|
|
||||||
context
|
|
||||||
(current printer not set, for example).
|
|
||||||
*/
|
*/
|
||||||
wxPrintPreview(wxPrintout* printout,
|
wxPrintPreview(wxPrintout* printout,
|
||||||
wxPrintout* printoutForPrinting,
|
wxPrintout* printoutForPrinting,
|
||||||
wxPrintData* data = NULL);
|
wxPrintData* data = NULL);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Destructor. Deletes both print preview objects, so do not destroy these objects
|
Destructor.
|
||||||
|
|
||||||
|
Deletes both print preview objects, so do not destroy these objects
|
||||||
in your application.
|
in your application.
|
||||||
*/
|
*/
|
||||||
~wxPrinter();
|
~wxPrinter();
|
||||||
@@ -270,16 +278,17 @@ public:
|
|||||||
wxPrintout* GetPrintoutForPrinting();
|
wxPrintout* GetPrintoutForPrinting();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns @true if the wxPrintPreview is valid, @false otherwise. It could return
|
Returns @true if the wxPrintPreview is valid, @false otherwise.
|
||||||
@false if there was a
|
|
||||||
problem initializing the printer device context (current printer not set, for
|
It could return @false if there was a problem initializing the printer
|
||||||
example).
|
device context (current printer not set, for example).
|
||||||
*/
|
*/
|
||||||
bool Ok();
|
bool Ok();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This refreshes the preview window with the preview image.
|
This refreshes the preview window with the preview image.
|
||||||
It must be called from the preview window's OnPaint member.
|
It must be called from the preview window's OnPaint member.
|
||||||
|
|
||||||
The implementation simply blits the preview bitmap onto
|
The implementation simply blits the preview bitmap onto
|
||||||
the canvas, creating a new preview bitmap if none exists.
|
the canvas, creating a new preview bitmap if none exists.
|
||||||
*/
|
*/
|
||||||
@@ -290,9 +299,9 @@ public:
|
|||||||
supplied in the wxPrintPreview constructor.
|
supplied in the wxPrintPreview constructor.
|
||||||
Will normally be called by the @b Print... panel item on the
|
Will normally be called by the @b Print... panel item on the
|
||||||
preview frame's control bar.
|
preview frame's control bar.
|
||||||
Returns @false in case of error -- call
|
|
||||||
wxPrinter::GetLastError to get detailed
|
Returns @false in case of error -- call wxPrinter::GetLastError()
|
||||||
information about the kind of the error.
|
to get detailed information about the kind of the error.
|
||||||
*/
|
*/
|
||||||
bool Print(bool prompt);
|
bool Print(bool prompt);
|
||||||
|
|
||||||
@@ -336,24 +345,25 @@ public:
|
|||||||
@wxheader{print.h}
|
@wxheader{print.h}
|
||||||
|
|
||||||
This class represents the Windows or PostScript printer, and is the vehicle
|
This class represents the Windows or PostScript printer, and is the vehicle
|
||||||
through
|
through which printing may be launched by an application.
|
||||||
which printing may be launched by an application. Printing can also
|
Printing can also be achieved through using of lower functions and classes,
|
||||||
be achieved through using of lower functions and classes, but
|
but this and associated classes provide a more convenient and general method
|
||||||
this and associated classes provide a more convenient and general
|
of printing.
|
||||||
method of printing.
|
|
||||||
|
|
||||||
@library{wxbase}
|
@library{wxbase}
|
||||||
@category{printing}
|
@category{printing}
|
||||||
|
|
||||||
@see @ref overview_printingoverview "Printing framework overview", wxPrinterDC,
|
@see @ref overview_printing "Printing framework overview", wxPrinterDC,
|
||||||
wxPrintDialog, wxPrintout, wxPrintPreview.
|
wxPrintDialog, wxPrintout, wxPrintPreview.
|
||||||
*/
|
*/
|
||||||
class wxPrinter : public wxObject
|
class wxPrinter : public wxObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
Constructor. Pass an optional pointer to a block of print
|
Constructor.
|
||||||
dialog data, which will be copied to the printer object's local data.
|
|
||||||
|
Pass an optional pointer to a block of print dialog data, which will be
|
||||||
|
copied to the printer object's local data.
|
||||||
|
|
||||||
@see wxPrintDialogData, wxPrintData
|
@see wxPrintDialogData, wxPrintData
|
||||||
*/
|
*/
|
||||||
@@ -370,52 +380,48 @@ public:
|
|||||||
bool GetAbort();
|
bool GetAbort();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Return last error. Valid after calling Print(),
|
Return last error. Valid after calling Print(), PrintDialog() or
|
||||||
PrintDialog() or
|
wxPrintPreview::Print().
|
||||||
wxPrintPreview::Print. These functions
|
These functions set last error to @c wxPRINTER_NO_ERROR if no error
|
||||||
set last error to @b wxPRINTER_NO_ERROR if no error happened.
|
happened.
|
||||||
|
|
||||||
Returned value is one of the following:
|
Returned value is one of the following:
|
||||||
|
|
||||||
@b wxPRINTER_NO_ERROR
|
@beginTable
|
||||||
|
@row2col{wxPRINTER_NO_ERROR,No error happened.}
|
||||||
No error happened.
|
@row2col{wxPRINTER_CANCELLED,The user cancelled printing.}
|
||||||
|
@row2col{wxPRINTER_ERROR,There was an error during printing.}
|
||||||
@b wxPRINTER_CANCELLED
|
@endTable
|
||||||
|
|
||||||
The user cancelled printing.
|
|
||||||
|
|
||||||
@b wxPRINTER_ERROR
|
|
||||||
|
|
||||||
There was an error during printing.
|
|
||||||
*/
|
*/
|
||||||
static wxPrinterError GetLastError();
|
static wxPrinterError GetLastError();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the @ref overview_wxprintdata "print data" associated with the printer
|
Returns the @ref overview_printing_printdata "print data" associated with
|
||||||
object.
|
the printer object.
|
||||||
*/
|
*/
|
||||||
wxPrintDialogData GetPrintDialogData();
|
wxPrintDialogData& GetPrintDialogData();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Starts the printing process. Provide a parent window, a user-defined wxPrintout
|
Starts the printing process. Provide a parent window, a user-defined wxPrintout
|
||||||
object which controls
|
object which controls the printing of a document, and whether the print dialog
|
||||||
the printing of a document, and whether the print dialog should be invoked
|
should be invoked first.
|
||||||
first.
|
|
||||||
Print could return @false if there was a problem initializing the printer device
|
Print() could return @false if there was a problem initializing the printer device
|
||||||
context
|
context (current printer not set, for example) or the user cancelled printing.
|
||||||
(current printer not set, for example) or the user cancelled printing. Call
|
Call GetLastError() to get detailed information about the kind of the error.
|
||||||
GetLastError() to get detailed
|
|
||||||
information about the kind of the error.
|
|
||||||
*/
|
*/
|
||||||
bool Print(wxWindow* parent, wxPrintout* printout,
|
bool Print(wxWindow* parent, wxPrintout* printout,
|
||||||
bool prompt = true);
|
bool prompt = true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Invokes the print dialog. If successful (the user did not press Cancel
|
Invokes the print dialog.
|
||||||
and no error occurred), a suitable device context will be returned
|
|
||||||
(otherwise @NULL is returned -- call
|
If successful (the user did not press Cancel and no error occurred),
|
||||||
GetLastError() to get detailed
|
a suitable device context will be returned;
|
||||||
information about the kind of the error).
|
otherwise @NULL is returned -- call GetLastError() to get detailed
|
||||||
|
information about the kind of the error.
|
||||||
|
|
||||||
|
@remarks
|
||||||
The application must delete this device context to avoid a memory leak.
|
The application must delete this device context to avoid a memory leak.
|
||||||
*/
|
*/
|
||||||
wxDC* PrintDialog(wxWindow* parent);
|
wxDC* PrintDialog(wxWindow* parent);
|
||||||
@@ -427,8 +433,11 @@ public:
|
|||||||
const wxString& message);
|
const wxString& message);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Invokes the print setup dialog. Note that the setup dialog is obsolete from
|
Invokes the print setup dialog.
|
||||||
Windows 95, though retained for backward compatibility.
|
|
||||||
|
@remarks
|
||||||
|
The setup dialog is obsolete from Windows 95, though retained
|
||||||
|
for backward compatibility.
|
||||||
*/
|
*/
|
||||||
bool Setup(wxWindow* parent);
|
bool Setup(wxWindow* parent);
|
||||||
};
|
};
|
||||||
@@ -439,10 +448,11 @@ public:
|
|||||||
@class wxPrintout
|
@class wxPrintout
|
||||||
@wxheader{print.h}
|
@wxheader{print.h}
|
||||||
|
|
||||||
This class encapsulates the functionality of printing out an application
|
This class encapsulates the functionality of printing out an application document.
|
||||||
document. A new class must be derived and members overridden to respond to calls
|
|
||||||
such as OnPrintPage and HasPage and to render the print image onto an associated
|
A new class must be derived and members overridden to respond to calls such as
|
||||||
wxDC. Instances of this class are passed to wxPrinter::Print or
|
OnPrintPage() and HasPage() and to render the print image onto an associated wxDC.
|
||||||
|
Instances of this class are passed to wxPrinter::Print() or
|
||||||
to a wxPrintPreview object to initiate printing or previewing.
|
to a wxPrintPreview object to initiate printing or previewing.
|
||||||
|
|
||||||
Your derived wxPrintout is responsible for drawing both the preview image and
|
Your derived wxPrintout is responsible for drawing both the preview image and
|
||||||
@@ -464,16 +474,17 @@ public:
|
|||||||
@library{wxbase}
|
@library{wxbase}
|
||||||
@category{printing}
|
@category{printing}
|
||||||
|
|
||||||
@see @ref overview_printingoverview "Printing framework overview", wxPrinterDC,
|
@see @ref overview_printing "Printing framework overview", wxPrinterDC,
|
||||||
wxPrintDialog, wxPageSetupDialog, wxPrinter, wxPrintPreview
|
wxPrintDialog, wxPageSetupDialog, wxPrinter, wxPrintPreview
|
||||||
*/
|
*/
|
||||||
class wxPrintout : public wxObject
|
class wxPrintout : public wxObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
Constructor. Pass an optional title argument - the current filename would be a
|
Constructor.
|
||||||
good idea. This will appear in the printing list
|
|
||||||
(at least in MSW)
|
Pass an optional title argument - the current filename would be a
|
||||||
|
good idea. This will appear in the printing list (at least in MSW)
|
||||||
*/
|
*/
|
||||||
wxPrintout(const wxString& title = "Printout");
|
wxPrintout(const wxString& title = "Printout");
|
||||||
|
|
||||||
@@ -485,23 +496,28 @@ public:
|
|||||||
/**
|
/**
|
||||||
Set the user scale and device origin of the wxDC associated with this wxPrintout
|
Set the user scale and device origin of the wxDC associated with this wxPrintout
|
||||||
so that the given image size fits entirely within the page rectangle and the
|
so that the given image size fits entirely within the page rectangle and the
|
||||||
origin is at the top left corner of the page rectangle. On MSW and Mac, the page
|
origin is at the top left corner of the page rectangle.
|
||||||
rectangle is the printable area of the page. On other platforms and PostScript
|
|
||||||
printing, the page rectangle is the entire paper. Use this if you want your
|
On MSW and Mac, the page rectangle is the printable area of the page.
|
||||||
printed image as large as possible, but with the caveat that on some platforms,
|
On other platforms and PostScript printing, the page rectangle is the entire paper.
|
||||||
portions of the image might be cut off at the edges.
|
|
||||||
|
Use this if you want your printed image as large as possible, but with the caveat
|
||||||
|
that on some platforms, portions of the image might be cut off at the edges.
|
||||||
*/
|
*/
|
||||||
void FitThisSizeToPage(const wxSize& imageSize);
|
void FitThisSizeToPage(const wxSize& imageSize);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set the user scale and device origin of the wxDC associated with this wxPrintout
|
Set the user scale and device origin of the wxDC associated with this wxPrintout
|
||||||
so that the given image size fits entirely within the page margins set in the
|
so that the given image size fits entirely within the page margins set in the
|
||||||
given wxPageSetupDialogData object. This function provides the greatest
|
given wxPageSetupDialogData object.
|
||||||
consistency across all platforms because it does not depend on having access to
|
|
||||||
the printable area of the paper. Note that on Mac, the native wxPageSetupDialog
|
This function provides the greatest consistency across all platforms because it
|
||||||
does not let you set the page margins; you'll have to provide your own
|
does not depend on having access to the printable area of the paper.
|
||||||
mechanism,
|
|
||||||
or you can use the Mac-only class wxMacPageMarginsDialog.
|
@remarks
|
||||||
|
On Mac, the native wxPageSetupDialog does not let you set the page margins;
|
||||||
|
you'll have to provide your own mechanism, or you can use the Mac-only class
|
||||||
|
wxMacPageMarginsDialog.
|
||||||
*/
|
*/
|
||||||
void FitThisSizeToPageMargins(const wxSize& imageSize,
|
void FitThisSizeToPageMargins(const wxSize& imageSize,
|
||||||
const wxPageSetupDialogData& pageSetupData);
|
const wxPageSetupDialogData& pageSetupData);
|
||||||
@@ -509,35 +525,45 @@ public:
|
|||||||
/**
|
/**
|
||||||
Set the user scale and device origin of the wxDC associated with this wxPrintout
|
Set the user scale and device origin of the wxDC associated with this wxPrintout
|
||||||
so that the given image size fits entirely within the paper and the origin is at
|
so that the given image size fits entirely within the paper and the origin is at
|
||||||
the top left corner of the paper. Note that with most printers, the region
|
the top left corner of the paper.
|
||||||
around the edges of the paper are not printable so that the edges of the image
|
|
||||||
could be cut off. Use this if you're managing your own page margins.
|
Use this if you're managing your own page margins.
|
||||||
|
|
||||||
|
@note
|
||||||
|
With most printers, the region around the edges of the paper are not
|
||||||
|
printable so that the edges of the image could be cut off.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
void FitThisSizeToPaper(const wxSize& imageSize);
|
void FitThisSizeToPaper(const wxSize& imageSize);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the device context associated with the printout (given to the printout
|
Returns the device context associated with the printout (given to the printout
|
||||||
at start of
|
at start of printing or previewing).
|
||||||
printing or previewing). This will be a wxPrinterDC if printing under Windows
|
|
||||||
or Mac,
|
The application can use GetDC() to obtain a device context to draw on.
|
||||||
a wxPostScriptDC if printing on other platforms, and a wxMemoryDC if previewing.
|
|
||||||
|
This will be a wxPrinterDC if printing under Windows or Mac, a wxPostScriptDC
|
||||||
|
if printing on other platforms, and a wxMemoryDC if previewing.
|
||||||
*/
|
*/
|
||||||
wxDC* GetDC();
|
wxDC* GetDC();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Return the rectangle corresponding to the page margins specified by the given
|
Return the rectangle corresponding to the page margins specified by the given
|
||||||
wxPageSetupDialogData object in the associated wxDC's logical coordinates for
|
wxPageSetupDialogData object in the associated wxDC's logical coordinates for
|
||||||
the
|
the current user scale and device origin.
|
||||||
current user scale and device origin. The page margins are specified
|
|
||||||
with respect to the edges of the paper on all platforms.
|
The page margins are specified with respect to the edges of the paper on all
|
||||||
|
platforms.
|
||||||
*/
|
*/
|
||||||
wxRect GetLogicalPageMarginsRect(const wxPageSetupDialogData& pageSetupData);
|
wxRect GetLogicalPageMarginsRect(const wxPageSetupDialogData& pageSetupData);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Return the rectangle corresponding to the page in the associated wxDC 's
|
Return the rectangle corresponding to the page in the associated wxDC 's
|
||||||
logical coordinates for the current user scale and device origin.
|
logical coordinates for the current user scale and device origin.
|
||||||
On MSW and Mac, this will be the printable area of the paper. On other platforms
|
|
||||||
and PostScript printing, this will be the full paper rectangle.
|
On MSW and Mac, this will be the printable area of the paper.
|
||||||
|
On other platforms and PostScript printing, this will be the full paper
|
||||||
|
rectangle.
|
||||||
*/
|
*/
|
||||||
wxRect GetLogicalPageRect();
|
wxRect GetLogicalPageRect();
|
||||||
|
|
||||||
@@ -549,63 +575,97 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the number of pixels per logical inch of the printer device context.
|
Returns the number of pixels per logical inch of the printer device context.
|
||||||
|
|
||||||
Dividing the printer PPI by the screen PPI can give a suitable scaling factor
|
Dividing the printer PPI by the screen PPI can give a suitable scaling factor
|
||||||
for drawing text onto the printer. Remember to multiply this by a scaling factor
|
for drawing text onto the printer.
|
||||||
to take the preview DC size into account. Or you can just use the
|
|
||||||
FitThisSizeToXXX() and MapScreenSizeToXXX routines below, which do most of the
|
Remember to multiply this by a scaling factor to take the preview DC size into
|
||||||
scaling calculations for you.
|
account.
|
||||||
|
Or you can just use the FitThisSizeToXXX() and MapScreenSizeToXXX routines below,
|
||||||
|
which do most of the scaling calculations for you.
|
||||||
|
|
||||||
|
@beginWxPythonOnly
|
||||||
|
This method returns the output-only parameters as a tuple.
|
||||||
|
@endWxPythonOnly
|
||||||
*/
|
*/
|
||||||
void GetPPIPrinter(int* w, int* h);
|
void GetPPIPrinter(int* w, int* h);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the number of pixels per logical inch of the screen device context.
|
Returns the number of pixels per logical inch of the screen device context.
|
||||||
|
|
||||||
Dividing the printer PPI by the screen PPI can give a suitable scaling factor
|
Dividing the printer PPI by the screen PPI can give a suitable scaling factor
|
||||||
for drawing text onto the printer. If you are doing your own scaling, remember
|
for drawing text onto the printer.
|
||||||
to multiply this by a scaling factor to take the preview DC size into account.
|
|
||||||
|
If you are doing your own scaling, remember to multiply this by a scaling
|
||||||
|
factor to take the preview DC size into account.
|
||||||
|
|
||||||
|
@beginWxPythonOnly
|
||||||
|
This method returns the output-only parameters as a tuple.
|
||||||
|
@endWxPythonOnly
|
||||||
*/
|
*/
|
||||||
void GetPPIScreen(int* w, int* h);
|
void GetPPIScreen(int* w, int* h);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Called by the framework to obtain information from the application about minimum
|
Called by the framework to obtain information from the application about minimum
|
||||||
and maximum page values that the user can select, and the required page range to
|
and maximum page values that the user can select, and the required page range to
|
||||||
be printed. By default this returns 1, 32000 for the page minimum and maximum
|
be printed.
|
||||||
values, and 1, 1 for the required page range.
|
|
||||||
|
By default this returns (1, 32000) for the page minimum and maximum values, and
|
||||||
|
(1, 1) for the required page range.
|
||||||
|
|
||||||
If @a minPage is zero, the page number controls in the print dialog will be
|
If @a minPage is zero, the page number controls in the print dialog will be
|
||||||
disabled.
|
disabled.
|
||||||
|
|
||||||
|
@beginWxPythonOnly
|
||||||
|
When this method is implemented in a derived Python class, it should be designed
|
||||||
|
to take no parameters (other than the self reference) and to return a tuple of
|
||||||
|
four integers.
|
||||||
|
@endWxPythonOnly
|
||||||
*/
|
*/
|
||||||
void GetPageInfo(int* minPage, int* maxPage, int* pageFrom,
|
void GetPageInfo(int* minPage, int* maxPage, int* pageFrom,
|
||||||
int* pageTo);
|
int* pageTo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the size of the printer page in millimetres.
|
Returns the size of the printer page in millimetres.
|
||||||
|
|
||||||
|
@beginWxPythonOnly
|
||||||
|
This method returns the output-only parameters as a tuple.
|
||||||
|
@endWxPythonOnly
|
||||||
*/
|
*/
|
||||||
void GetPageSizeMM(int* w, int* h);
|
void GetPageSizeMM(int* w, int* h);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the size of the printer page in pixels, called the page rectangle.
|
Returns the size of the printer page in pixels, called the page rectangle.
|
||||||
|
|
||||||
The page rectangle has a top left corner at (0,0) and a bottom right corner at
|
The page rectangle has a top left corner at (0,0) and a bottom right corner at
|
||||||
(w,h). These values may not be the same as the values returned from
|
(w,h). These values may not be the same as the values returned from
|
||||||
wxDC::GetSize; if the printout is being used for
|
wxDC::GetSize(); if the printout is being used for
|
||||||
previewing, a memory device context is used, which uses a bitmap size reflecting
|
previewing, a memory device context is used, which uses a bitmap size reflecting
|
||||||
the current preview zoom. The application must take this discrepancy into
|
the current preview zoom. The application must take this discrepancy into
|
||||||
account if previewing is to be supported.
|
account if previewing is to be supported.
|
||||||
|
|
||||||
|
@beginWxPythonOnly
|
||||||
|
This method returns the output-only parameters as a tuple.
|
||||||
|
@endWxPythonOnly
|
||||||
*/
|
*/
|
||||||
void GetPageSizePixels(int* w, int* h);
|
void GetPageSizePixels(int* w, int* h);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the rectangle that corresponds to the entire paper in pixels, called the
|
Returns the rectangle that corresponds to the entire paper in pixels, called the
|
||||||
paper rectangle. This distinction between paper rectangle and page
|
paper rectangle.
|
||||||
rectangle reflects the fact that most printers cannot print all the way to the
|
|
||||||
edge of the paper. The page rectangle is a rectangle whose top left corner is at
|
This distinction between paper rectangle and page rectangle reflects the fact that
|
||||||
(0,0) and whose width and height are given by
|
most printers cannot print all the way to the edge of the paper.
|
||||||
wxDC::GetPageSizePixels. On MSW and Mac,
|
The page rectangle is a rectangle whose top left corner is at (0,0) and whose width
|
||||||
the page rectangle gives the printable area of the paper, while the paper
|
and height are given by wxDC::GetPageSizePixels().
|
||||||
rectangle represents the entire paper, including non-printable borders. Thus,
|
|
||||||
the rectangle returned by GetPaperRectPixels will have a top left corner whose
|
On MSW and Mac, the page rectangle gives the printable area of the paper, while the
|
||||||
coordinates are small negative numbers and the bottom right corner will have
|
paper rectangle represents the entire paper, including non-printable borders.
|
||||||
values somewhat larger than the width and height given by
|
Thus, the rectangle returned by wxDC::GetPaperRectPixels() will have a top left corner
|
||||||
wxDC::GetPageSizePixels. On other
|
whose coordinates are small negative numbers and the bottom right corner will have
|
||||||
platforms and for PostScript printing, the paper is treated as if its entire
|
values somewhat larger than the width and height given by wxDC::GetPageSizePixels().
|
||||||
|
|
||||||
|
On other platforms and for PostScript printing, the paper is treated as if its entire
|
||||||
area were printable, so this function will return the same rectangle as the page
|
area were printable, so this function will return the same rectangle as the page
|
||||||
rectangle.
|
rectangle.
|
||||||
*/
|
*/
|
||||||
@@ -618,7 +678,9 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Should be overridden to return @true if the document has this page, or @false
|
Should be overridden to return @true if the document has this page, or @false
|
||||||
if not. Returning @false signifies the end of the document. By default,
|
if not.
|
||||||
|
|
||||||
|
Returning @false signifies the end of the document. By default,
|
||||||
HasPage behaves as if the document has only one page.
|
HasPage behaves as if the document has only one page.
|
||||||
*/
|
*/
|
||||||
bool HasPage(int pageNum);
|
bool HasPage(int pageNum);
|
||||||
@@ -630,32 +692,33 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Set the user scale and device origin of the wxDC associated with this wxPrintout
|
Set the user scale and device origin of the wxDC associated with this wxPrintout
|
||||||
so that one screen pixel maps to one device pixel on the DC. That is, the user
|
so that one screen pixel maps to one device pixel on the DC.
|
||||||
scale is set to (1,1) and the device origin is set to (0,0). Use this if you
|
That is, the user scale is set to (1,1) and the device origin is set to (0,0).
|
||||||
want to do your own scaling prior to calling wxDC drawing calls, for example, if
|
|
||||||
your underlying model is floating-point and you want to achieve maximum drawing
|
Use this if you want to do your own scaling prior to calling wxDC drawing calls,
|
||||||
precision on high-resolution printers. (Note that while the underlying drawing
|
for example, if your underlying model is floating-point and you want to achieve
|
||||||
model of Mac OS X is floating-point, wxWidgets's drawing model scales from
|
maximum drawing precision on high-resolution printers.
|
||||||
integer
|
|
||||||
coordinates.) You can use the GetLogicalXXXRect() routines below to obtain the
|
You can use the GetLogicalXXXRect() routines below to obtain the paper rectangle,
|
||||||
paper rectangle, page rectangle, or page margins rectangle to perform your own
|
page rectangle, or page margins rectangle to perform your own scaling.
|
||||||
scaling.
|
|
||||||
|
@note
|
||||||
|
While the underlying drawing model of Mac OS X is floating-point,
|
||||||
|
wxWidgets's drawing model scales from integer coordinates.
|
||||||
*/
|
*/
|
||||||
void MapScreenSizeToDevice();
|
void MapScreenSizeToDevice();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This sets the user scale of the wxDC assocated with this wxPrintout to the same
|
This sets the user scale of the wxDC assocated with this wxPrintout to the same
|
||||||
scale as MapScreenSizeToPaper() but sets
|
scale as MapScreenSizeToPaper() but sets the logical origin to the top left corner
|
||||||
the logical origin to the top left corner of the page rectangle.
|
of the page rectangle.
|
||||||
*/
|
*/
|
||||||
void MapScreenSizeToPage();
|
void MapScreenSizeToPage();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This sets the user scale of the wxDC assocated with this wxPrintout to the same
|
This sets the user scale of the wxDC assocated with this wxPrintout to the same
|
||||||
scale as
|
scale as MapScreenSizeToPageMargins() but sets the logical origin to the top left
|
||||||
MapScreenSizeToPageMargins() but
|
corner of the page margins specified by the given wxPageSetupDialogData object.
|
||||||
sets the logical origin to the top left corner of the page margins specified by
|
|
||||||
the given wxPageSetupDialogData object.
|
|
||||||
*/
|
*/
|
||||||
void MapScreenSizeToPageMargins(const wxPageSetupDialogData& pageSetupData);
|
void MapScreenSizeToPageMargins(const wxPageSetupDialogData& pageSetupData);
|
||||||
|
|
||||||
@@ -663,12 +726,12 @@ public:
|
|||||||
Set the user scale and device origin of the wxDC associated with this wxPrintout
|
Set the user scale and device origin of the wxDC associated with this wxPrintout
|
||||||
so that the printed page matches the screen size as closely as possible
|
so that the printed page matches the screen size as closely as possible
|
||||||
and the logical origin is in the top left corner of the paper rectangle.
|
and the logical origin is in the top left corner of the paper rectangle.
|
||||||
That is,
|
That is, a 100-pixel object on screen should appear at the same size on the printed
|
||||||
a 100-pixel object on screen should appear at the same size on the printed
|
page.
|
||||||
page. (It
|
(It will, of course, be larger or smaller in the preview image, depending on the
|
||||||
will, of course, be larger or smaller in the preview image, depending on the
|
zoom factor.)
|
||||||
zoom
|
|
||||||
factor.) Use this if you want WYSIWYG behavior, e.g., in a text editor.
|
Use this if you want WYSIWYG behavior, e.g., in a text editor.
|
||||||
*/
|
*/
|
||||||
void MapScreenSizeToPaper();
|
void MapScreenSizeToPaper();
|
||||||
|
|
||||||
@@ -679,46 +742,60 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Called by the framework at the start of document printing. Return @false from
|
Called by the framework at the start of document printing. Return @false from
|
||||||
this function cancels the print job. OnBeginDocument is called once for every
|
this function cancels the print job.
|
||||||
copy printed.
|
|
||||||
The base OnBeginDocument() @e must be called (and the return value
|
OnBeginDocument() is called once for every copy printed.
|
||||||
checked) from within the overridden function, since it calls wxDC::StartDoc.
|
|
||||||
|
@remarks
|
||||||
|
The base OnBeginDocument() must be called (and the return value
|
||||||
|
checked) from within the overridden function, since it calls wxDC::StartDoc().
|
||||||
|
|
||||||
|
@beginWxPythonOnly
|
||||||
|
If this method is overridden in a Python class then the base class version can
|
||||||
|
be called by using the method <tt>base_OnBeginDocument(startPage, endPage)</tt>.
|
||||||
|
@endWxPythonOnly
|
||||||
*/
|
*/
|
||||||
bool OnBeginDocument(int startPage, int endPage);
|
bool OnBeginDocument(int startPage, int endPage);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Called by the framework at the start of printing. OnBeginPrinting is called
|
Called by the framework at the start of printing.
|
||||||
once for every
|
|
||||||
print job (regardless of how many copies are being printed).
|
OnBeginPrinting() is called once for every print job
|
||||||
|
(regardless of how many copies are being printed).
|
||||||
*/
|
*/
|
||||||
void OnBeginPrinting();
|
void OnBeginPrinting();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Called by the framework at the end of document printing. OnEndDocument
|
Called by the framework at the end of document printing.
|
||||||
is called once for every copy printed.
|
|
||||||
The base OnEndDocument() @e must be called
|
OnEndDocument() is called once for every copy printed.
|
||||||
from within the overridden function, since it calls wxDC::EndDoc.
|
|
||||||
|
@remarks
|
||||||
|
The base OnEndDocument() must be called from within the overridden function,
|
||||||
|
since it calls wxDC::EndDoc().
|
||||||
*/
|
*/
|
||||||
void OnEndDocument();
|
void OnEndDocument();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Called by the framework at the end of printing. OnEndPrinting
|
Called by the framework at the end of printing.
|
||||||
is called once for every print job (regardless of how many copies are being
|
|
||||||
printed).
|
OnEndPrinting is called once for every print job
|
||||||
|
(regardless of how many copies are being printed).
|
||||||
*/
|
*/
|
||||||
void OnEndPrinting();
|
void OnEndPrinting();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Called once by the framework before any other demands are made of the
|
Called once by the framework before any other demands are made of the
|
||||||
wxPrintout object. This gives the object an opportunity to calculate the
|
wxPrintout object.
|
||||||
number of pages in the document, for example.
|
|
||||||
|
This gives the object an opportunity to calculate the number of pages
|
||||||
|
in the document, for example.
|
||||||
*/
|
*/
|
||||||
void OnPreparePrinting();
|
void OnPreparePrinting();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Called by the framework when a page should be printed. Returning @false cancels
|
Called by the framework when a page should be printed. Returning @false cancels
|
||||||
the print job. The application can use GetDC() to obtain a device
|
the print job.
|
||||||
context to draw on.
|
|
||||||
*/
|
*/
|
||||||
bool OnPrintPage(int pageNum);
|
bool OnPrintPage(int pageNum);
|
||||||
|
|
||||||
|
@@ -11,20 +11,21 @@
|
|||||||
@wxheader{printdlg.h}
|
@wxheader{printdlg.h}
|
||||||
|
|
||||||
This class represents the print and print setup common dialogs.
|
This class represents the print and print setup common dialogs.
|
||||||
You may obtain a wxPrinterDC device context from
|
You may obtain a wxPrinterDC device context from a successfully dismissed
|
||||||
a successfully dismissed print dialog.
|
print dialog.
|
||||||
|
|
||||||
@library{wxcore}
|
@library{wxcore}
|
||||||
@category{printing}
|
@category{printing}
|
||||||
|
|
||||||
@see @ref overview_printingoverview "Printing framework overview", @ref
|
@see @ref overview_printing, @ref overview_cmndlg_print
|
||||||
overview_wxprintdialogoverview "wxPrintDialog Overview"
|
|
||||||
*/
|
*/
|
||||||
class wxPrintDialog : public wxDialog
|
class wxPrintDialog : public wxDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
Constructor. Pass a parent window, and optionally a pointer to a block of print
|
Constructor.
|
||||||
|
|
||||||
|
Pass a parent window, and optionally a pointer to a block of print
|
||||||
data, which will be copied to the print dialog's print data.
|
data, which will be copied to the print dialog's print data.
|
||||||
|
|
||||||
@see wxPrintDialogData
|
@see wxPrintDialogData
|
||||||
@@ -32,13 +33,16 @@ public:
|
|||||||
wxPrintDialog(wxWindow* parent, wxPrintDialogData* data = NULL);
|
wxPrintDialog(wxWindow* parent, wxPrintDialogData* data = NULL);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Destructor. If GetPrintDC() has @e not been called,
|
Destructor.
|
||||||
the device context obtained by the dialog (if any) will be deleted.
|
|
||||||
|
If GetPrintDC() has not been called, the device context obtained by
|
||||||
|
the dialog (if any) will be deleted.
|
||||||
*/
|
*/
|
||||||
~wxPrintDialog();
|
~wxPrintDialog();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the device context created by the print dialog, if any.
|
Returns the device context created by the print dialog, if any.
|
||||||
|
|
||||||
When this function has been called, the ownership of the device context
|
When this function has been called, the ownership of the device context
|
||||||
is transferred to the application, so it must then be deleted
|
is transferred to the application, so it must then be deleted
|
||||||
explicitly.
|
explicitly.
|
||||||
@@ -46,15 +50,17 @@ public:
|
|||||||
wxDC* GetPrintDC();
|
wxDC* GetPrintDC();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the @ref overview_wxprintdialogdata "print dialog data" associated with
|
Returns the @ref overview_printing_printdata "print dialog data" associated
|
||||||
the print dialog.
|
with the print dialog.
|
||||||
*/
|
*/
|
||||||
wxPrintDialogData GetPrintDialogData();
|
wxPrintDialogData GetPrintDialogData();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Shows the dialog, returning wxID_OK if the user pressed OK, and wxID_CANCEL
|
Shows the dialog, returning @c wxID_OK if the user pressed OK, and @c
|
||||||
otherwise. After this function is called, a device context may
|
wxID_CANCEL otherwise.
|
||||||
be retrievable using GetPrintDC().
|
|
||||||
|
After this function is called, a device context may be retrievable using
|
||||||
|
GetPrintDC().
|
||||||
*/
|
*/
|
||||||
int ShowModal();
|
int ShowModal();
|
||||||
};
|
};
|
||||||
@@ -67,9 +73,9 @@ public:
|
|||||||
|
|
||||||
This class represents the page setup common dialog. In MSW, the page setup
|
This class represents the page setup common dialog. In MSW, the page setup
|
||||||
dialog is standard from Windows 95 on, replacing the print setup dialog (which
|
dialog is standard from Windows 95 on, replacing the print setup dialog (which
|
||||||
is retained in Windows and wxWidgets for backward compatibility). On Windows 95
|
is retained in Windows and wxWidgets for backward compatibility).
|
||||||
and NT 4.0 and above, the page setup dialog is native to the windowing system,
|
On Windows 95 and NT 4.0 and above, the page setup dialog is native to the windowing
|
||||||
otherwise it is emulated.
|
system, otherwise it is emulated.
|
||||||
|
|
||||||
The page setup dialog contains controls for paper size (A4, A5 etc.),
|
The page setup dialog contains controls for paper size (A4, A5 etc.),
|
||||||
orientation (landscape or portrait), and controls for setting left, top, right
|
orientation (landscape or portrait), and controls for setting left, top, right
|
||||||
@@ -80,9 +86,8 @@ public:
|
|||||||
|
|
||||||
On other platforms, a generic dialog is used.
|
On other platforms, a generic dialog is used.
|
||||||
|
|
||||||
When the dialog has been closed, you need to query the
|
When the dialog has been closed, you need to query the wxPageSetupDialogData
|
||||||
wxPageSetupDialogData object associated with
|
object associated with the dialog.
|
||||||
the dialog.
|
|
||||||
|
|
||||||
Note that the OK and Cancel buttons do not destroy the dialog; this must be done
|
Note that the OK and Cancel buttons do not destroy the dialog; this must be done
|
||||||
by the application.
|
by the application.
|
||||||
@@ -90,19 +95,19 @@ public:
|
|||||||
@library{wxcore}
|
@library{wxcore}
|
||||||
@category{printing}
|
@category{printing}
|
||||||
|
|
||||||
@see @ref overview_printingoverview "Printing framework overview",
|
@see @ref overview_printing "Printing framework overview",
|
||||||
wxPrintDialog, wxPageSetupDialogData
|
wxPrintDialog, wxPageSetupDialogData
|
||||||
*/
|
*/
|
||||||
class wxPageSetupDialog : public wxDialog
|
class wxPageSetupDialog : public wxDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
Constructor. Pass a parent window, and optionally a pointer to a block of page
|
Constructor.
|
||||||
setup
|
|
||||||
data, which will be copied to the print dialog's internal data.
|
Pass a parent window, and optionally a pointer to a block of page
|
||||||
|
setup data, which will be copied to the print dialog's internal data.
|
||||||
*/
|
*/
|
||||||
wxPageSetupDialog(wxWindow* parent,
|
wxPageSetupDialog(wxWindow* parent, wxPageSetupDialogData* data = NULL);
|
||||||
wxPageSetupDialogData* data = NULL);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Destructor.
|
Destructor.
|
||||||
@@ -110,14 +115,13 @@ public:
|
|||||||
~wxPageSetupDialog();
|
~wxPageSetupDialog();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the @ref overview_wxpagesetupdialogdata "page setup data" associated
|
Returns the wxPageSetupDialogData object associated with the dialog.
|
||||||
with the dialog.
|
|
||||||
*/
|
*/
|
||||||
wxPageSetupDialogData GetPageSetupData();
|
wxPageSetupDialogData& GetPageSetupData();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Shows the dialog, returning wxID_OK if the user pressed OK, and wxID_CANCEL
|
Shows the dialog, returning @c wxID_OK if the user pressed OK, and
|
||||||
otherwise.
|
@c wxID_CANCEL otherwise.
|
||||||
*/
|
*/
|
||||||
int ShowModal();
|
int ShowModal();
|
||||||
};
|
};
|
||||||
|
@@ -6,68 +6,97 @@
|
|||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
Signal constants used by wxProcess.
|
||||||
|
*/
|
||||||
|
enum wxSignal
|
||||||
|
{
|
||||||
|
wxSIGNONE = 0, //!< verify if the process exists under Unix
|
||||||
|
wxSIGHUP,
|
||||||
|
wxSIGINT,
|
||||||
|
wxSIGQUIT,
|
||||||
|
wxSIGILL,
|
||||||
|
wxSIGTRAP,
|
||||||
|
wxSIGABRT,
|
||||||
|
wxSIGEMT,
|
||||||
|
wxSIGFPE,
|
||||||
|
wxSIGKILL, //!< forcefully kill, dangerous!
|
||||||
|
wxSIGBUS,
|
||||||
|
wxSIGSEGV,
|
||||||
|
wxSIGSYS,
|
||||||
|
wxSIGPIPE,
|
||||||
|
wxSIGALRM,
|
||||||
|
wxSIGTERM //!< terminate the process gently
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return values for wxProcess::Kill.
|
||||||
|
*/
|
||||||
|
enum wxKillError
|
||||||
|
{
|
||||||
|
wxKILL_OK, //!< no error
|
||||||
|
wxKILL_BAD_SIGNAL, //!< no such signal
|
||||||
|
wxKILL_ACCESS_DENIED, //!< permission denied
|
||||||
|
wxKILL_NO_PROCESS, //!< no such process
|
||||||
|
wxKILL_ERROR //!< another, unspecified error
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class wxProcess
|
@class wxProcess
|
||||||
@wxheader{process.h}
|
@wxheader{process.h}
|
||||||
|
|
||||||
The objects of this class are used in conjunction with the
|
The objects of this class are used in conjunction with the ::wxExecute() function.
|
||||||
wxExecute() function. When a wxProcess object is passed to
|
When a wxProcess object is passed to ::wxExecute(), its OnTerminate() virtual method
|
||||||
wxExecute(), its wxProcess::OnTerminate virtual method
|
is called when the process terminates. This allows the program to be (asynchronously)
|
||||||
is called when the process terminates. This allows the program to be
|
notified about the process termination and also retrieve its exit status which is
|
||||||
(asynchronously) notified about the process termination and also retrieve its
|
unavailable from ::wxExecute() in the case of asynchronous execution.
|
||||||
exit status which is unavailable from wxExecute() in the case of
|
|
||||||
asynchronous execution.
|
|
||||||
|
|
||||||
Please note that if the process termination notification is processed by the
|
@note If the process termination notification is processed by the
|
||||||
parent, it is responsible for deleting the wxProcess object which sent it.
|
parent, it is responsible for deleting the wxProcess object which sent it.
|
||||||
However, if it is not processed, the object will delete itself and so the
|
However, if it is not processed, the object will delete itself and so the
|
||||||
library users should only delete those objects whose notifications have been
|
library users should only delete those objects whose notifications have been
|
||||||
processed (and call wxProcess::Detach for others).
|
processed (and call wxProcess::Detach for others).
|
||||||
|
|
||||||
wxProcess also supports IO redirection of the child process. For this, you have
|
wxProcess also supports IO redirection of the child process. For this, you have
|
||||||
to call its wxProcess::Redirect method before passing it to
|
to call its Redirect() method before passing it to ::wxExecute().
|
||||||
wxExecute(). If the child process was launched successfully,
|
If the child process was launched successfully, GetInputStream(), GetOutputStream()
|
||||||
wxProcess::GetInputStream,
|
and GetErrorStream() can then be used to retrieve the streams corresponding to the
|
||||||
wxProcess::GetOutputStream and
|
child process standard output, input and error output respectively.
|
||||||
wxProcess::GetErrorStream can then be used to retrieve
|
|
||||||
the streams corresponding to the child process standard output, input and
|
|
||||||
error output respectively.
|
|
||||||
|
|
||||||
@b wxPerl note: In wxPerl this class has an additional @c Destroy method,
|
|
||||||
for explicit destruction.
|
|
||||||
|
|
||||||
@library{wxbase}
|
@library{wxbase}
|
||||||
@category{appmanagement}
|
@category{appmanagement}
|
||||||
|
|
||||||
@see wxExecute(), @ref overview_sampleexec "exec sample"
|
@see wxExecute(), @ref page_samples_exec "exec sample"
|
||||||
*/
|
*/
|
||||||
class wxProcess : public wxEvtHandler
|
class wxProcess : public wxEvtHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//@{
|
|
||||||
/**
|
/**
|
||||||
Constructs a process object. @a id is only used in the case you want to
|
Constructs a process object. @a id is only used in the case you want to
|
||||||
use wxWidgets events. It identifies this object, or another window that will
|
use wxWidgets events. It identifies this object, or another window that will
|
||||||
receive the event.
|
receive the event.
|
||||||
|
|
||||||
If the @a parent parameter is different from @NULL, it will receive
|
If the @a parent parameter is different from @NULL, it will receive
|
||||||
a wxEVT_END_PROCESS notification event (you should insert EVT_END_PROCESS
|
a @c wxEVT_END_PROCESS notification event (you should insert @c EVT_END_PROCESS
|
||||||
macro in the event table of the parent to handle it) with the given @e id.
|
macro in the event table of the parent to handle it) with the given @a id.
|
||||||
The second constructor creates an object without any associated parent (and
|
|
||||||
hence no id neither) but allows to specify the @a flags which can have the
|
|
||||||
value of @c wxPROCESS_DEFAULT or @c wxPROCESS_REDIRECT. Specifying the
|
|
||||||
former value has no particular effect while using the latter one is equivalent
|
|
||||||
to calling Redirect().
|
|
||||||
|
|
||||||
@param parent
|
@param parent
|
||||||
The event handler parent.
|
The event handler parent.
|
||||||
@param id
|
@param id
|
||||||
id of an event.
|
id of an event.
|
||||||
@param flags
|
|
||||||
either wxPROCESS_DEFAULT or wxPROCESS_REDIRECT
|
|
||||||
*/
|
*/
|
||||||
wxProcess(wxEvtHandler* parent = NULL, int id = -1);
|
wxProcess(wxEvtHandler* parent = NULL, int id = -1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates an object without any associated parent (and hence no id neither)
|
||||||
|
but allows to specify the @a flags which can have the value of
|
||||||
|
@c wxPROCESS_DEFAULT or @c wxPROCESS_REDIRECT.
|
||||||
|
|
||||||
|
Specifying the former value has no particular effect while using the latter
|
||||||
|
one is equivalent to calling Redirect().
|
||||||
|
*/
|
||||||
wxProcess(int flags);
|
wxProcess(int flags);
|
||||||
//@}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Destroys the wxProcess object.
|
Destroys the wxProcess object.
|
||||||
@@ -76,7 +105,9 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Closes the output stream (the one connected to the stdin of the child
|
Closes the output stream (the one connected to the stdin of the child
|
||||||
process). This function can be used to indicate to the child process that
|
process).
|
||||||
|
|
||||||
|
This function can be used to indicate to the child process that
|
||||||
there is no more data to be read - usually, a filter program will only
|
there is no more data to be read - usually, a filter program will only
|
||||||
terminate when the input stream is closed.
|
terminate when the input stream is closed.
|
||||||
*/
|
*/
|
||||||
@@ -98,7 +129,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
Returns @true if the given process exists in the system.
|
Returns @true if the given process exists in the system.
|
||||||
|
|
||||||
@see Kill(), @ref overview_sampleexec "Exec sample"
|
@see Kill(), @ref page_samples_exec "Exec sample"
|
||||||
*/
|
*/
|
||||||
static bool Exists(int pid);
|
static bool Exists(int pid);
|
||||||
|
|
||||||
@@ -111,14 +142,16 @@ public:
|
|||||||
/**
|
/**
|
||||||
It returns an input stream corresponding to the standard output stream of the
|
It returns an input stream corresponding to the standard output stream of the
|
||||||
subprocess. If it is @NULL, you have not turned on the redirection.
|
subprocess. If it is @NULL, you have not turned on the redirection.
|
||||||
See Redirect().
|
|
||||||
|
@see Redirect().
|
||||||
*/
|
*/
|
||||||
wxInputStream* GetInputStream() const;
|
wxInputStream* GetInputStream() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
It returns an output stream correspoding to the input stream of the subprocess.
|
It returns an output stream correspoding to the input stream of the subprocess.
|
||||||
If it is @NULL, you have not turned on the redirection.
|
If it is @NULL, you have not turned on the redirection.
|
||||||
See Redirect().
|
|
||||||
|
@see Redirect().
|
||||||
*/
|
*/
|
||||||
wxOutputStream* GetOutputStream() const;
|
wxOutputStream* GetOutputStream() const;
|
||||||
|
|
||||||
@@ -137,9 +170,11 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Returns @true if there is data to be read on the child process standard
|
Returns @true if there is data to be read on the child process standard
|
||||||
output stream. This allows to write simple (and extremely inefficient)
|
output stream.
|
||||||
polling-based code waiting for a better mechanism in future wxWidgets versions.
|
|
||||||
See the @ref overview_sampleexec "exec sample" for an example of using this
|
This allows to write simple (and extremely inefficient) polling-based code
|
||||||
|
waiting for a better mechanism in future wxWidgets versions.
|
||||||
|
See the @ref page_samples_exec "exec sample" for an example of using this
|
||||||
function.
|
function.
|
||||||
|
|
||||||
@see IsInputOpened()
|
@see IsInputOpened()
|
||||||
@@ -152,29 +187,30 @@ public:
|
|||||||
bool IsInputOpened() const;
|
bool IsInputOpened() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Send the specified signal to the given process. Possible signal values are:
|
Send the specified signal to the given process. Possible signal values
|
||||||
|
can be one of the ::wxSignal enumeration values.
|
||||||
|
|
||||||
@c wxSIGNONE, @c wxSIGKILL and @c wxSIGTERM have the same meaning
|
@c wxSIGNONE, @c wxSIGKILL and @c wxSIGTERM have the same meaning
|
||||||
under both Unix and Windows but all the other signals are equivalent to
|
under both Unix and Windows but all the other signals are equivalent to
|
||||||
@c wxSIGTERM under Windows.
|
@c wxSIGTERM under Windows.
|
||||||
The @a flags parameter can be wxKILL_NOCHILDREN (the default),
|
|
||||||
or wxKILL_CHILDREN, in which case the child processes of this
|
|
||||||
process will be killed too. Note that under Unix, for wxKILL_CHILDREN
|
|
||||||
to work you should have created the process passing wxEXEC_MAKE_GROUP_LEADER.
|
|
||||||
Returns the element of @c wxKillError enum:
|
|
||||||
|
|
||||||
@see Exists(), wxKill(), @ref overview_sampleexec "Exec sample"
|
The @a flags parameter can be @c wxKILL_NOCHILDREN (the default),
|
||||||
|
or @c wxKILL_CHILDREN, in which case the child processes of this
|
||||||
|
process will be killed too. Note that under Unix, for @c wxKILL_CHILDREN
|
||||||
|
to work you should have created the process passing @c wxEXEC_MAKE_GROUP_LEADER.
|
||||||
|
|
||||||
|
Returns the element of ::wxKillError enum.
|
||||||
|
|
||||||
|
@see Exists(), wxKill(), @ref page_samples_exec "Exec sample"
|
||||||
*/
|
*/
|
||||||
static wxKillError Kill(int pid, wxSignal signal = wxSIGNONE,
|
static wxKillError Kill(int pid, wxSignal signal = wxSIGNONE,
|
||||||
int flags = wxKILL_NOCHILDREN);
|
int flags = wxKILL_NOCHILDREN);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
It is called when the process with the pid
|
It is called when the process with the pid @a pid finishes.
|
||||||
|
|
||||||
@param pid finishes.
|
|
||||||
It raises a wxWidgets event when it isn't overridden.
|
It raises a wxWidgets event when it isn't overridden.
|
||||||
|
|
||||||
pid
|
@param pid
|
||||||
The pid of the process which has just terminated.
|
The pid of the process which has just terminated.
|
||||||
@param status
|
@param status
|
||||||
The exit code of the process.
|
The exit code of the process.
|
||||||
@@ -186,8 +222,11 @@ public:
|
|||||||
the process specified by the @a cmd parameter and returns the wxProcess
|
the process specified by the @a cmd parameter and returns the wxProcess
|
||||||
object which can be used to retrieve the streams connected to the standard
|
object which can be used to retrieve the streams connected to the standard
|
||||||
input, output and error output of the child process.
|
input, output and error output of the child process.
|
||||||
If the process couldn't be launched, @NULL is returned. Note that in any
|
|
||||||
case the returned pointer should @b not be deleted, rather the process
|
If the process couldn't be launched, @NULL is returned.
|
||||||
|
|
||||||
|
@remarks
|
||||||
|
In any case the returned pointer should @b not be deleted, rather the process
|
||||||
object will be destroyed automatically when the child process terminates. This
|
object will be destroyed automatically when the child process terminates. This
|
||||||
does mean that the child process should be told to quit before the main program
|
does mean that the child process should be told to quit before the main program
|
||||||
exits to avoid memory leaks.
|
exits to avoid memory leaks.
|
||||||
@@ -195,21 +234,22 @@ public:
|
|||||||
@param cmd
|
@param cmd
|
||||||
The command to execute, including optional arguments.
|
The command to execute, including optional arguments.
|
||||||
@param flags
|
@param flags
|
||||||
The flags to pass to wxExecute.
|
The flags to pass to ::wxExecute().
|
||||||
NOTE: wxEXEC_SYNC should not be used.
|
Note: @c wxEXEC_SYNC should not be used.
|
||||||
|
|
||||||
@returns A pointer to new wxProcess object or @NULL on error.
|
@returns A pointer to new wxProcess object or @NULL on error.
|
||||||
|
|
||||||
@see wxExecute()
|
@see ::wxExecute()
|
||||||
*/
|
*/
|
||||||
static wxProcess* Open(const wxString& cmd,
|
static wxProcess* Open(const wxString& cmd,
|
||||||
int flags = wxEXEC_ASYNC);
|
int flags = wxEXEC_ASYNC);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Turns on redirection. wxExecute will try to open a couple of pipes
|
Turns on redirection.
|
||||||
to catch the subprocess stdio. The caught input stream is returned by
|
|
||||||
GetOutputStream() as a non-seekable stream. The caught output stream is returned
|
::wxExecute() will try to open a couple of pipes to catch the subprocess stdio.
|
||||||
by GetInputStream() as a non-seekable stream.
|
The caught input stream is returned by GetOutputStream() as a non-seekable stream.
|
||||||
|
The caught output stream is returned by GetInputStream() as a non-seekable stream.
|
||||||
*/
|
*/
|
||||||
void Redirect();
|
void Redirect();
|
||||||
};
|
};
|
||||||
@@ -222,17 +262,25 @@ public:
|
|||||||
|
|
||||||
A process event is sent when a process is terminated.
|
A process event is sent when a process is terminated.
|
||||||
|
|
||||||
|
@beginEventTable{wxProcessEvent}
|
||||||
|
@event{EVT_END_PROCESS(id, func)}
|
||||||
|
Process a @c wxEVT_END_PROCESS event. @a id is the identifier of the process
|
||||||
|
object (the id passed to the wxProcess constructor) or a window to receive
|
||||||
|
the event.
|
||||||
|
@endEventTable
|
||||||
|
|
||||||
@library{wxbase}
|
@library{wxbase}
|
||||||
@category{events}
|
@category{events}
|
||||||
|
|
||||||
@see wxProcess, @ref overview_eventhandlingoverview
|
@see wxProcess, @ref overview_eventhandling
|
||||||
*/
|
*/
|
||||||
class wxProcessEvent : public wxEvent
|
class wxProcessEvent : public wxEvent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
Constructor. Takes a wxProcessObject or window id, a process id and an
|
Constructor.
|
||||||
exit status.
|
|
||||||
|
Takes a wxProcessObject or window id, a process id and an exit status.
|
||||||
*/
|
*/
|
||||||
wxProcessEvent(int id = 0, int pid = 0, int exitcode = 0);
|
wxProcessEvent(int id = 0, int pid = 0, int exitcode = 0);
|
||||||
|
|
||||||
|
@@ -49,8 +49,8 @@ class wxProgressDialog : public wxDialog
|
|||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
Constructor. Creates the dialog, displays it and disables user input
|
Constructor. Creates the dialog, displays it and disables user input
|
||||||
for other windows, or, if wxPD_APP_MODAL flag is not given, for its parent
|
for other windows, or, if @c wxPD_APP_MODAL flag is not given, for its
|
||||||
window only.
|
parent window only.
|
||||||
|
|
||||||
@param title
|
@param title
|
||||||
Dialog title to show in titlebar.
|
Dialog title to show in titlebar.
|
||||||
@@ -74,41 +74,38 @@ public:
|
|||||||
~wxProgressDialog();
|
~wxProgressDialog();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Just like Update() but makes
|
Works like Update() but makes the gauge control run in indeterminate mode
|
||||||
the gauge control run in indeterminate mode (see wxGauge documentation),
|
(see wxGauge documentation); sets the remaining and the estimated time labels
|
||||||
sets the remaining and the estimated time labels (if present) to @c Unknown and
|
(if present) to "Unknown" or to @a newmsg (if it's non-empty); moves the progress
|
||||||
moves
|
bar a bit to indicate that some progress was done.
|
||||||
the progress bar a bit to indicate that some progress was done.
|
|
||||||
*/
|
*/
|
||||||
virtual bool Pulse(const wxString& newmsg = "",
|
virtual bool Pulse(const wxString& newmsg = "",
|
||||||
bool* skip = NULL);
|
bool* skip = NULL);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Can be used to continue with the dialog, after the user had chosen
|
Can be used to continue with the dialog, after the user had clicked the "Abort" button.
|
||||||
ABORT.
|
|
||||||
*/
|
*/
|
||||||
void Resume();
|
void Resume();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Updates the dialog, setting the progress bar to the new value and, if
|
Updates the dialog, setting the progress bar to the new value and, if
|
||||||
given changes the message above it. Returns @true unless the Cancel button
|
given changes the message above it. Returns @true unless the "Cancel" button
|
||||||
has been pressed.
|
has been pressed.
|
||||||
|
|
||||||
If @false is returned, the application can either immediately destroy the
|
If @false is returned, the application can either immediately destroy the
|
||||||
dialog
|
dialog or ask the user for the confirmation and if the abort is not confirmed
|
||||||
or ask the user for the confirmation and if the abort is not confirmed the
|
the dialog may be resumed with Resume() function.
|
||||||
dialog may be resumed with Resume() function.
|
|
||||||
|
|
||||||
@param value
|
@param value
|
||||||
The new value of the progress meter. It should be less than or
|
The new value of the progress meter. It should be less than or equal to
|
||||||
equal to the maximum value given to the constructor and the dialog is
|
the maximum value given to the constructor and the dialog is closed if
|
||||||
closed if
|
|
||||||
it is equal to the maximum.
|
it is equal to the maximum.
|
||||||
@param newmsg
|
@param newmsg
|
||||||
The new messages for the progress dialog text, if it is
|
The new messages for the progress dialog text, if it is
|
||||||
empty (which is the default) the message is not changed.
|
empty (which is the default) the message is not changed.
|
||||||
@param skip
|
@param skip
|
||||||
If "Skip" button was pressed since last
|
If "Skip" button was pressed since last Update() call,
|
||||||
Update call, this is set to @true.
|
this is set to @true.
|
||||||
*/
|
*/
|
||||||
virtual bool Update(int value, const wxString& newmsg = "",
|
virtual bool Update(int value, const wxString& newmsg = "",
|
||||||
bool* skip = NULL);
|
bool* skip = NULL);
|
||||||
|
@@ -11,20 +11,82 @@
|
|||||||
@wxheader{ptr_scpd.h}
|
@wxheader{ptr_scpd.h}
|
||||||
|
|
||||||
This is a simple scoped smart pointer implementation that is similar to
|
This is a simple scoped smart pointer implementation that is similar to
|
||||||
the Boost smart pointers but rewritten to
|
the Boost smart pointers (see http://www.boost.org) but rewritten
|
||||||
use macros instead.
|
to use macros instead.
|
||||||
|
|
||||||
Since wxWidgets 2.9.0 there is also a templated version of this class
|
Since wxWidgets 2.9.0 there is also a templated version of this class
|
||||||
with the same name. See wxScopedPtr<T>.
|
with the same name. See wxScopedPtr<T>.
|
||||||
|
|
||||||
A smart pointer holds a pointer to an object. The memory used by the object is
|
A smart pointer holds a pointer to an object. The memory used by the object is
|
||||||
deleted when the smart pointer goes out of scope. This class is different from
|
deleted when the smart pointer goes out of scope. This class is different from
|
||||||
the @c std::auto_ptr in so far as it doesn't provide copy constructor
|
the @c std::auto_ptr<> in so far as it doesn't provide copy constructor
|
||||||
nor assignment operator. This limits what you can do with it but is much less
|
nor assignment operator. This limits what you can do with it but is much less
|
||||||
surprizing than the "destructive copy" behaviour of the standard class.
|
surprizing than the "destructive copy" behaviour of the standard class.
|
||||||
|
|
||||||
|
@b Example:
|
||||||
|
|
||||||
|
Below is an example of using a wxWidgets scoped smart pointer and pointer array.
|
||||||
|
|
||||||
|
@code
|
||||||
|
class MyClass{ ... };
|
||||||
|
|
||||||
|
// declare a smart pointer to a MyClass called wxMyClassPtr
|
||||||
|
wxDECLARE_SCOPED_PTR(MyClass, wxMyClassPtr)
|
||||||
|
// declare a smart pointer to an array of chars
|
||||||
|
wxDECLARE_SCOPED_ARRAY(char, wxCharArray)
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
// define the first pointer class, must be complete
|
||||||
|
wxDEFINE_SCOPED_PTR(MyClass, wxMyClassPtr)
|
||||||
|
// define the second pointer class
|
||||||
|
wxDEFINE_SCOPED_ARRAY(char, wxCharArray)
|
||||||
|
|
||||||
|
// create an object with a new pointer to MyClass
|
||||||
|
wxMyClassPtr theObj(new MyClass());
|
||||||
|
// reset the pointer (deletes the previous one)
|
||||||
|
theObj.reset(new MyClass());
|
||||||
|
|
||||||
|
// access the pointer
|
||||||
|
theObj->MyFunc();
|
||||||
|
|
||||||
|
// create an object with a new array of chars
|
||||||
|
wxCharArray theCharObj(new char[100]);
|
||||||
|
|
||||||
|
// access the array
|
||||||
|
theCharObj[0] = "!";
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
@section wxscopedptr_newpointers Declaring new smart pointer types
|
||||||
|
|
||||||
|
To declare the smart pointer class @c CLASSNAME containing pointes to
|
||||||
|
a (possibly incomplete) type @c TYPE you should use
|
||||||
|
@code
|
||||||
|
wxDECLARE_SCOPED_PTR( TYPE, // type of the values
|
||||||
|
CLASSNAME ); // name of the class
|
||||||
|
@endcode
|
||||||
|
And later, when @c TYPE is fully defined, you must also use
|
||||||
|
@code
|
||||||
|
wxDEFINE_SCOPED_PTR( TYPE, CLASSNAME );
|
||||||
|
@endcode
|
||||||
|
to implement the scoped pointer class.
|
||||||
|
|
||||||
|
The first argument of these macro is the pointer type, the second is the name
|
||||||
|
of the new smart pointer class being created. Below we will use wxScopedPtr
|
||||||
|
to represent the scoped pointer class, but the user may create the class with
|
||||||
|
any legal name.
|
||||||
|
|
||||||
|
Alternatively, if you don't have to separate the point of declaration and
|
||||||
|
definition of this class and if you accept the standard naming convention,
|
||||||
|
that is that the scoped pointer for the class @c Foo is called @c FooPtr,
|
||||||
|
you can use a single macro which replaces two macros above:
|
||||||
|
@code
|
||||||
|
wxDEFINE_SCOPED_PTR_TYPE( TYPE );
|
||||||
|
@endcode
|
||||||
|
Once again, in this cass @c CLASSNAME will be @c TYPEPtr.
|
||||||
|
|
||||||
@library{wxbase}
|
@library{wxbase}
|
||||||
@category{FIXME}
|
@category{smartpointers}
|
||||||
|
|
||||||
@see wxScopedArray
|
@see wxScopedArray
|
||||||
*/
|
*/
|
||||||
@@ -32,10 +94,11 @@ class wxScopedPtr
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
Creates the smart pointer with the given pointer or none if @NULL. On
|
Creates the smart pointer with the given pointer or none if @NULL.
|
||||||
compilers that support it, this uses the explicit keyword.
|
|
||||||
|
On compilers that support it, this uses the explicit keyword.
|
||||||
*/
|
*/
|
||||||
explicit wxScopedPtr(type T = NULL);
|
explicit wxScopedPtr(type* T = NULL);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Destructor frees the pointer help by this object if it is not @NULL.
|
Destructor frees the pointer help by this object if it is not @NULL.
|
||||||
@@ -43,43 +106,51 @@ public:
|
|||||||
~wxScopedPtr();
|
~wxScopedPtr();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This operator gets the pointer stored in the smart pointer or returns @NULL if
|
This operator gets the pointer stored in the smart pointer or returns
|
||||||
there is none.
|
@NULL if there is none.
|
||||||
*/
|
*/
|
||||||
const T* get();
|
const T* get();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This operator works like the standard C++ pointer operator to return the object
|
This operator works like the standard C++ pointer operator to return the object
|
||||||
being pointed to by the pointer. If the pointer is @NULL or invalid this will
|
being pointed to by the pointer.
|
||||||
crash.
|
|
||||||
|
@note
|
||||||
|
If the pointer is @NULL or invalid this will crash.
|
||||||
*/
|
*/
|
||||||
const T operator *();
|
const T& operator *();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This operator works like the standard C++ pointer operator to return the pointer
|
This operator works like the standard C++ pointer operator to return the pointer
|
||||||
in the smart pointer or @NULL if it is empty.
|
in the smart pointer or @NULL if it is empty.
|
||||||
*/
|
*/
|
||||||
const T* operator -();
|
const T* operator ->();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the currently hold pointer and resets the smart pointer object to
|
Returns the currently hold pointer and resets the smart pointer object to
|
||||||
@NULL. After a call to this function the caller is responsible for
|
@NULL.
|
||||||
deleting the pointer.
|
|
||||||
|
@remarks
|
||||||
|
After a call to this function the caller is responsible for deleting the
|
||||||
|
pointer.
|
||||||
*/
|
*/
|
||||||
T* release();
|
T* release();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Deletes the currently held pointer and sets it to @a p or to @NULL if no
|
Deletes the currently held pointer and sets it to @a p or to @NULL if no
|
||||||
arguments are specified. This function does check to make sure that the
|
arguments are specified.
|
||||||
pointer you are assigning is not the same pointer that is already stored.
|
|
||||||
|
@note
|
||||||
|
This function does check to make sure that the pointer you are assigning
|
||||||
|
is not the same pointer that is already stored.
|
||||||
*/
|
*/
|
||||||
reset(T p = NULL);
|
reset(T* p = NULL);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Swap the pointer inside the smart pointer with @e other. The pointer being
|
Swap the pointer inside the smart pointer with @a other. The pointer being
|
||||||
swapped must be of the same type (hence the same class name).
|
swapped must be of the same type (hence the same class name).
|
||||||
*/
|
*/
|
||||||
swap(wxScopedPtr amp; other);
|
swap(wxScopedPtr& other);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -89,11 +160,60 @@ public:
|
|||||||
@wxheader{ptr_scpd.h}
|
@wxheader{ptr_scpd.h}
|
||||||
|
|
||||||
This is a simple scoped smart pointer array implementation that is similar to
|
This is a simple scoped smart pointer array implementation that is similar to
|
||||||
the Boost smart pointers but rewritten to
|
the Boost smart pointers (see http://www.boost.org/) but rewritten to
|
||||||
use macros instead.
|
use macros instead.
|
||||||
|
|
||||||
|
@b Example:
|
||||||
|
|
||||||
|
Below is an example of using a wxWidgets scoped smart pointer and pointer array.
|
||||||
|
|
||||||
|
@code
|
||||||
|
class MyClass { ... };
|
||||||
|
|
||||||
|
// declare a smart pointer to a MyClass called wxMyClassPtr
|
||||||
|
wxDECLARE_SCOPED_PTR(MyClass, wxMyClassPtr)
|
||||||
|
// declare a smart pointer to an array of chars
|
||||||
|
wxDECLARE_SCOPED_ARRAY(char, wxCharArray)
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
// define the first pointer class, must be complete
|
||||||
|
wxDEFINE_SCOPED_PTR(MyClass, wxMyClassPtr)
|
||||||
|
// define the second pointer class
|
||||||
|
wxDEFINE_SCOPED_ARRAY(char, wxCharArray)
|
||||||
|
|
||||||
|
// create an object with a new pointer to MyClass
|
||||||
|
wxMyClassPtr theObj(new MyClass());
|
||||||
|
// reset the pointer (deletes the previous one)
|
||||||
|
theObj.reset(new MyClass());
|
||||||
|
|
||||||
|
// access the pointer
|
||||||
|
theObj->MyFunc();
|
||||||
|
|
||||||
|
// create an object with a new array of chars
|
||||||
|
wxCharArray theCharObj(new char[100]);
|
||||||
|
|
||||||
|
// access the array
|
||||||
|
theCharObj[0] = "!";
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
<b>Declaring new smart pointer types:</b>
|
||||||
|
@code
|
||||||
|
wxDECLAR_SCOPED_ARRAY( TYPE, // type of the values
|
||||||
|
CLASSNAME ); // name of the class
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
A smart pointer holds a pointer to an object (which must be complete when
|
||||||
|
wxDEFINE_SCOPED_ARRAY() is called).
|
||||||
|
|
||||||
|
The memory used by the object is deleted when the smart pointer goes out of
|
||||||
|
scope. The first argument of the macro is the pointer type, the second is the
|
||||||
|
name of the new smart pointer class being created. Below we will use wxScopedArray
|
||||||
|
to represent the scoped pointer array class, but the user may create the class with
|
||||||
|
any legal name.
|
||||||
|
|
||||||
@library{wxbase}
|
@library{wxbase}
|
||||||
@category{FIXME}
|
@category{smartpointers}
|
||||||
|
|
||||||
@see wxScopedPtr
|
@see wxScopedPtr
|
||||||
*/
|
*/
|
||||||
@@ -104,7 +224,7 @@ public:
|
|||||||
Creates the smart pointer with the given pointer or none if @NULL. On
|
Creates the smart pointer with the given pointer or none if @NULL. On
|
||||||
compilers that support it, this uses the explicit keyword.
|
compilers that support it, this uses the explicit keyword.
|
||||||
*/
|
*/
|
||||||
wxScopedArray(type T = NULL);
|
wxScopedArray(type* T = NULL);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This operator gets the pointer stored in the smart pointer or returns @NULL if
|
This operator gets the pointer stored in the smart pointer or returns @NULL if
|
||||||
@@ -116,20 +236,20 @@ public:
|
|||||||
This operator acts like the standard [] indexing operator for C++ arrays. The
|
This operator acts like the standard [] indexing operator for C++ arrays. The
|
||||||
function does not do bounds checking.
|
function does not do bounds checking.
|
||||||
*/
|
*/
|
||||||
const T operator [](long int i);
|
const T& operator [](long int i);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Deletes the currently held pointer and sets it to 'p' or to @NULL if no
|
Deletes the currently held pointer and sets it to 'p' or to @NULL if no
|
||||||
arguments are specified. This function does check to make sure that the
|
arguments are specified. This function does check to make sure that the
|
||||||
pointer you are assigning is not the same pointer that is already stored.
|
pointer you are assigning is not the same pointer that is already stored.
|
||||||
*/
|
*/
|
||||||
reset(T p = NULL);
|
reset(T* p = NULL);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Swap the pointer inside the smart pointer with 'ot'. The pointer being swapped
|
Swap the pointer inside the smart pointer with @a ot. The pointer being swapped
|
||||||
must be of the same type (hence the same class name).
|
must be of the same type (hence the same class name).
|
||||||
*/
|
*/
|
||||||
swap(wxScopedPtr amp; ot);
|
swap(wxScopedPtr& ot);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -138,24 +258,22 @@ public:
|
|||||||
@class wxScopedTiedPtr
|
@class wxScopedTiedPtr
|
||||||
@wxheader{ptr_scpd.h}
|
@wxheader{ptr_scpd.h}
|
||||||
|
|
||||||
This is a variation on the topic of wxScopedPtr. This
|
This is a variation on the topic of wxScopedPtr. This class is also a smart pointer
|
||||||
class is also a smart pointer but in addition it "ties" the pointer value to
|
but in addition it "ties" the pointer value to another variable. In other words,
|
||||||
another variable. In other words, during the life time of this class the value
|
during the life time of this class the value of that variable is set to be the same
|
||||||
of that variable is set to be the same as the value of the pointer itself and
|
as the value of the pointer itself and it is reset to its old value when the object
|
||||||
it is reset to its old value when the object is destroyed. This class is
|
is destroyed. This class is especially useful when converting the existing code
|
||||||
especially useful when converting the existing code (which may already store
|
(which may already store the pointers value in some variable) to the smart pointers.
|
||||||
the pointers value in some variable) to the smart pointers.
|
|
||||||
|
|
||||||
@library{wxbase}
|
@library{wxbase}
|
||||||
@category{FIXME}
|
@category{smartpointers}
|
||||||
*/
|
*/
|
||||||
class wxScopedTiedPtr
|
class wxScopedTiedPtr
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
Constructor creates a smart pointer initialized with @a ptr and stores
|
Constructor creates a smart pointer initialized with @a ptr and stores
|
||||||
@a ptr in the location specified by @a ppTie which must not be
|
@a ptr in the location specified by @a ppTie which must not be @NULL.
|
||||||
@NULL.
|
|
||||||
*/
|
*/
|
||||||
wxScopedTiedPtr(T** ppTie, T* ptr);
|
wxScopedTiedPtr(T** ppTie, T* ptr);
|
||||||
|
|
||||||
@@ -163,9 +281,10 @@ public:
|
|||||||
Destructor frees the pointer help by this object and restores the value stored
|
Destructor frees the pointer help by this object and restores the value stored
|
||||||
at the tied location (as specified in the @ref ctor() constructor)
|
at the tied location (as specified in the @ref ctor() constructor)
|
||||||
to the old value.
|
to the old value.
|
||||||
Warning: this location may now contain an uninitialized value if it hadn't been
|
|
||||||
initialized previously, in particular don't count on it magically being
|
@warning
|
||||||
@NULL!
|
This location may now contain an uninitialized value if it hadn't been
|
||||||
|
initialized previously, in particular don't count on it magically being @NULL!
|
||||||
*/
|
*/
|
||||||
~wxScopedTiedPtr();
|
~wxScopedTiedPtr();
|
||||||
};
|
};
|
||||||
@@ -176,10 +295,10 @@ public:
|
|||||||
@wxheader{ptr_scpd.h}
|
@wxheader{ptr_scpd.h}
|
||||||
|
|
||||||
A scoped pointer template class. It is the template version of
|
A scoped pointer template class. It is the template version of
|
||||||
the old-style @ref overview_wxscopedptr "scoped pointer macros".
|
the old-style @ref classwx_scoped_ptr "scoped pointer macros".
|
||||||
|
|
||||||
@library{wxbase}
|
@library{wxbase}
|
||||||
@category{FIXME}
|
@category{smartpointers}
|
||||||
|
|
||||||
@see wxSharedPtr<T>, wxWeakRef<T>
|
@see wxSharedPtr<T>, wxWeakRef<T>
|
||||||
*/
|
*/
|
||||||
@@ -204,15 +323,19 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Conversion to a boolean expression (in a variant which is not
|
Conversion to a boolean expression (in a variant which is not
|
||||||
convertable to anything but a boolean expression). If this class
|
convertable to anything but a boolean expression).
|
||||||
contains a valid pointer it will return @e @true, if it contains
|
|
||||||
a @NULL pointer it will return @e @false.
|
If this class contains a valid pointer it will return @true, if it contains
|
||||||
|
a @NULL pointer it will return @false.
|
||||||
*/
|
*/
|
||||||
operator unspecified_bool_type() const;
|
operator unspecified_bool_type() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns a reference to the object. If the internal pointer is @NULL
|
Returns a reference to the object.
|
||||||
this method will cause an assert in debug mode.
|
|
||||||
|
@note
|
||||||
|
If the internal pointer is @NULL this method will cause an assert
|
||||||
|
in debug mode.
|
||||||
*/
|
*/
|
||||||
T operator*() const;
|
T operator*() const;
|
||||||
|
|
||||||
@@ -220,18 +343,20 @@ public:
|
|||||||
Returns pointer to object. If the pointer is @NULL this method will
|
Returns pointer to object. If the pointer is @NULL this method will
|
||||||
cause an assert in debug mode.
|
cause an assert in debug mode.
|
||||||
*/
|
*/
|
||||||
T* operator-() const;
|
T* operator->() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Releases the current pointer and returns it.
|
Releases the current pointer and returns it.
|
||||||
|
|
||||||
|
@remarks
|
||||||
Afterwards the caller is responsible for deleting
|
Afterwards the caller is responsible for deleting
|
||||||
the data contained in the scoped pointer before.
|
the data contained in the scoped pointer before.
|
||||||
*/
|
*/
|
||||||
T* release();
|
T* release();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reset pointer to the value of @e ptr. The
|
Reset pointer to the value of @a ptr.
|
||||||
previous pointer will be deleted.
|
The previous pointer will be deleted.
|
||||||
*/
|
*/
|
||||||
void reset(T* ptr = NULL);
|
void reset(T* ptr = NULL);
|
||||||
|
|
||||||
|
@@ -10,14 +10,15 @@
|
|||||||
@wxheader{ptr_shrd.h}
|
@wxheader{ptr_shrd.h}
|
||||||
|
|
||||||
A smart pointer with non-intrusive reference counting. It is modeled after
|
A smart pointer with non-intrusive reference counting. It is modeled after
|
||||||
@c boost::shared_ptr and can be used with STL containers and wxVector<T> -
|
@c boost::shared_ptr<> and can be used with STL containers and wxVector<T> -
|
||||||
unlike @c std::auto_ptr and wxScopedPtr<T>.
|
unlike @c std::auto_ptr<> and wxScopedPtr<T>.
|
||||||
|
|
||||||
@library{wxbase}
|
@library{wxbase}
|
||||||
@category{smartpointers}
|
@category{smartpointers}
|
||||||
|
|
||||||
@see wxScopedPtr<T>, wxWeakRef<T>, wxObjectDataPtr<T>
|
@see wxScopedPtr<T>, wxWeakRef<T>, wxObjectDataPtr<T>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class wxSharedPtr<T>
|
class wxSharedPtr<T>
|
||||||
{
|
{
|
||||||
@@ -28,9 +29,11 @@ public:
|
|||||||
Creates shared pointer from the raw pointer @a ptr and takes ownership
|
Creates shared pointer from the raw pointer @a ptr and takes ownership
|
||||||
of it.
|
of it.
|
||||||
*/
|
*/
|
||||||
wxSharedPtr(T* ptr = NULL);
|
wxEXPLICIT wxSharedPtr(T* ptr = NULL);
|
||||||
|
|
||||||
/// Copy constructor.
|
/**
|
||||||
|
Copy constructor.
|
||||||
|
*/
|
||||||
wxSharedPtr(const wxSharedPtr<T>& tocopy);
|
wxSharedPtr(const wxSharedPtr<T>& tocopy);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -45,32 +48,44 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Conversion to a boolean expression (in a variant which is not
|
Conversion to a boolean expression (in a variant which is not
|
||||||
convertable to anything but a boolean expression). If this class
|
convertable to anything but a boolean expression).
|
||||||
contains a valid pointer it will return @e @true, if it contains
|
|
||||||
a @NULL pointer it will return @e @false.
|
If this class contains a valid pointer it will return @true, if it contains
|
||||||
|
a @NULL pointer it will return @false.
|
||||||
*/
|
*/
|
||||||
operator unspecified_bool_type() const;
|
operator unspecified_bool_type() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns a reference to the object. If the internal pointer is @NULL
|
Returns a reference to the object.
|
||||||
this method will cause an assert in debug mode.
|
|
||||||
|
If the internal pointer is @NULL this method will cause an assert in debug mode.
|
||||||
*/
|
*/
|
||||||
T operator*() const;
|
T operator*() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns pointer to its object or @NULL.
|
Returns pointer to its object or @NULL.
|
||||||
*/
|
*/
|
||||||
T* operator-() const;
|
T* operator->() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Assignment operator. Releases any previously held pointer
|
Assignment operator.
|
||||||
and creates a reference to @e ptr.
|
|
||||||
|
Releases any previously held pointer and creates a reference to @a ptr.
|
||||||
*/
|
*/
|
||||||
wxSharedPtr& operator operator=(T* ptr);
|
wxSharedPtr<T>& operator=(T* ptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reset pointer to @e ptr. If the reference count of the
|
Assignment operator.
|
||||||
previously owned pointer was 1 it will be deleted.
|
|
||||||
|
Releases any previously held pointer and creates a reference to the
|
||||||
|
same object as @a topcopy.
|
||||||
|
*/
|
||||||
|
wxSharedPtr<T>& operator=(const wxSharedPtr<T>& tocopy)
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reset pointer to @a ptr.
|
||||||
|
|
||||||
|
If the reference count of the previously owned pointer was 1 it will be deleted.
|
||||||
*/
|
*/
|
||||||
void reset(T* ptr = NULL);
|
void reset(T* ptr = NULL);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user