#include "helpers.h"
#include <wx/print.h>
#include <wx/printdlg.h>
+#include <wx/dcps.h>
#include "printfw.h"
%}
//----------------------------------------------------------------------
+%{
+ // Put some wx default wxChar* values into wxStrings.
+ static const wxChar* wxPrintoutTitleStr = wxT("Printout");
+ DECLARE_DEF_STRING(PrintoutTitleStr);
+
+ DECLARE_DEF_STRING(FrameNameStr);
+%}
+
+//----------------------------------------------------------------------
+
%include typemaps.i
%include my_typemaps.i
-class wxPrintData {
+class wxPrintData : public wxObject {
public:
wxPrintData();
~wxPrintData();
bool GetCollate();
int GetOrientation();
+ bool Ok();
+
const wxString& GetPrinterName();
bool GetColour();
wxDuplexMode GetDuplex();
//---------------------------------------------------------------------------
-class wxPageSetupDialogData {
+class wxPostScriptDC : public wxDC {
+public:
+ wxPostScriptDC(const wxPrintData& printData);
+// %name(wxPostScriptDC2)wxPostScriptDC(const wxString& output,
+// bool interactive = TRUE,
+// wxWindow* parent = NULL);
+
+ wxPrintData& GetPrintData();
+ void SetPrintData(const wxPrintData& data);
+
+ static void SetResolution(int ppi);
+ static int GetResolution();
+};
+
+//---------------------------------------------------------------------------
+
+class wxPageSetupDialogData : public wxObject {
public:
wxPageSetupDialogData();
~wxPageSetupDialogData();
return new wxPrintData(self->GetPrintData()); // force a copy
}
}
+
+ bool Ok();
+
void SetDefaultInfo(bool flag);
void SetDefaultMinMargins(bool flag);
void SetMarginTopLeft(const wxPoint& pt);
//----------------------------------------------------------------------
-class wxPrintDialogData {
+class wxPrintDialogData : public wxObject {
public:
wxPrintDialogData();
~wxPrintDialogData();
}
bool GetPrintToFile();
int GetToPage();
+
+ bool Ok();
+
void SetCollate(bool flag);
void SetFromPage(int page);
void SetMaxPage(int page);
// Since this one would be tough and ugly to do with the Macros...
void wxPyPrintout::GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo) {
bool hadErr = FALSE;
+ bool found;
- bool doSave = wxPyRestoreThread();
- if (m_myInst.findCallback("GetPageInfo")) {
+ wxPyBeginBlockThreads();
+ if ((found = m_myInst.findCallback("GetPageInfo"))) {
PyObject* result = m_myInst.callCallbackObj(Py_BuildValue("()"));
if (result && PyTuple_Check(result) && PyTuple_Size(result) == 4) {
PyObject* val;
}
Py_DECREF(result);
}
- else
+ wxPyEndBlockThreads();
+ if (! found)
wxPrintout::GetPageInfo(minPage, maxPage, pageFrom, pageTo);
-
- wxPySaveThread(doSave);
}
void wxPyPrintout::base_GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo) {
// Now define the custom class for SWIGging
-%name(wxPrintout) class wxPyPrintout {
+%name(wxPrintout) class wxPyPrintout : public wxObject {
public:
- wxPyPrintout(const char* title = "Printout");
+ wxPyPrintout(const wxString& title = wxPyPrintoutTitleStr);
- void _setSelf(PyObject* self, PyObject* _class);
- %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPrintout)"
+ void _setCallbackInfo(PyObject* self, PyObject* _class);
+ %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPrintout)"
%addmethods {
void Destroy() { delete self; }
//----------------------------------------------------------------------
-class wxPrinter {
+class wxPrinter : public wxObject {
public:
wxPrinter(wxPrintDialogData* data = NULL);
~wxPrinter();
wxPrintDialogData& GetPrintDialogData();
bool Print(wxWindow *parent, wxPyPrintout *printout, int prompt=TRUE);
wxDC* PrintDialog(wxWindow *parent);
- void ReportError(wxWindow *parent, wxPyPrintout *printout, char* message);
+ void ReportError(wxWindow *parent, wxPyPrintout *printout, const wxString& message);
bool Setup(wxWindow *parent);
};
//----------------------------------------------------------------------
-class wxPrintPreview {
+class wxPrintPreview : public wxObject {
public:
wxPrintPreview(wxPyPrintout* printout, wxPyPrintout* printoutForPrinting, wxPrintData* data=NULL);
// ~wxPrintPreview(); **** ????
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
- char* name = "frame");
+ const wxString& name = wxPyFrameNameStr);
- %pragma(python) addtomethod = "__init__:#wx._StdFrameCallbacks(self)"
+ %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
void Initialize();
};
//----------------------------------------------------------------------
+
+%init %{
+ wxPyPtrTypeMap_Add("wxPrintout", "wxPyPrintout");
+%}
+
//----------------------------------------------------------------------
//----------------------------------------------------------------------