Returns the \helpref{page setup data}{wxpagesetupdialogdata} associated with the dialog.
+\membersection{wxPageSetupDialog::Ok}\label{wxpagesetupdialogok}
+
+\constfunc{bool}{Ok}{\void}
+
+Returns TRUE if the print data associated with the dialog data is valid.
+This can return FALSE on Windows if the current printer is not set, for example.
+On all other platforms, it returns TRUE.
+
\membersection{wxPageSetupDialog::ShowModal}\label{wxpagesetupdialogshowmodal}
\func{int}{ShowModal}{\void}
Returns a reference to the \helpref{print data}{wxprintdata} associated with this object.
+\membersection{wxPageSetupDialogData::Ok}\label{wxpagesetupdialogdataok}
+
+\constfunc{bool}{Ok}{\void}
+
+Returns TRUE if the print data associated with the dialog data is valid.
+This can return FALSE on Windows if the current printer is not set, for example.
+On all other platforms, it returns TRUE.
+
\membersection{wxPageSetupDialogData::SetDefaultInfo}\label{wxpagesetupdialogdatasetdefaultinfo}
\func{void}{SetDefaultInfo}{\param{bool}{ flag}}
On input you should pass one of these identifiers, but on return you may get back a positive integer
indicating the current resolution setting.
+\membersection{wxPrintData::Ok}\label{wxprintdataok}
+
+\constfunc{bool}{Ok}{\void}
+
+Returns TRUE if the print data is valid for using in print dialogs.
+This can return FALSE on Windows if the current printer is not set, for example.
+On all other platforms, it returns TRUE.
+
\membersection{wxPrintData::SetCollate}\label{wxprintdatasetcollate}
\func{void}{SetCollate}{\param{bool }{flag}}
is transferred to the application, so it must then be deleted
explicitly.
+\membersection{wxPrintDialog::Ok}\label{wxprintdialogok}
+
+\constfunc{bool}{Ok}{\void}
+
+Returns TRUE if the print data associated with the dialog is valid.
+This can return FALSE on Windows if the current printer is not set, for example.
+On all other platforms, it returns TRUE.
+
\membersection{wxPrintDialog::ShowModal}\label{wxprintdialogshowmodal}
\func{int}{ShowModal}{\void}
Returns the {\it to} page number, as entered by the user.
+\membersection{wxPrintDialogData::Ok}\label{wxprintdialogdataok}
+
+\constfunc{bool}{Ok}{\void}
+
+Returns TRUE if the print data is valid for using in print dialogs.
+This can return FALSE on Windows if the current printer is not set, for example.
+On all other platforms, it returns TRUE.
+
\membersection{wxPrintDialogData::SetCollate}\label{wxprintdialogdatasetcollate}
\func{void}{SetCollate}{\param{bool }{flag}}
bool GetCollate() const { return m_printCollate; };
int GetOrientation() const { return m_printOrientation; };
+ // Is this data OK for showing the print dialog?
+ bool Ok() const ;
+
const wxString& GetPrinterName() const { return m_printerName; }
bool GetColour() const { return m_colour; }
wxDuplexMode GetDuplex() const { return m_duplexMode; }
bool GetEnablePageNumbers() const { return m_printEnablePageNumbers; };
bool GetEnableHelp() const { return m_printEnableHelp; };
+ // Is this data OK for showing the print dialog?
+ bool Ok() const { return m_printData.Ok() ; }
+
wxPrintData& GetPrintData() { return m_printData; }
void SetPrintData(const wxPrintData& printData) { m_printData = printData; }
bool GetDefaultInfo() const { return m_getDefaultInfo; };
bool GetEnableHelp() const { return m_enableHelp; };
+ // Is this data OK for showing the page setup dialog?
+ bool Ok() const { return m_printData.Ok() ; }
+
// If a corresponding paper type is found in the paper database, will set the m_printData
// paper size id member as well.
void SetPaperSize(const wxSize& sz);
}
#endif // wxCOMPATIBILITY_WITH_PRINTSETUPDATA
+// Is this data OK for showing the print dialog?
+bool wxPrintData::Ok() const
+{
+#ifdef __WXMSW__
+ ((wxPrintData*)this)->ConvertToNative();
+ return (m_devMode != NULL) ;
+#else
+ return TRUE;
+#endif
+}
// ----------------------------------------------------------------------------
// Print dialog data
m_printData.SetNativeData((void*) NULL);
- wxASSERT_MSG( (pd->hDevMode), wxT("hDevMode must be non-NULL in ConvertToNative!"));
+ // Shouldn't assert; we should be able to test Ok-ness at a higher level
+ //wxASSERT_MSG( (pd->hDevMode), wxT("hDevMode must be non-NULL in ConvertToNative!"));
pd->hDevNames = (HGLOBAL)(DWORD) m_printData.GetNativeDataDevNames();
m_printData.SetNativeData((void*) NULL);
- wxASSERT_MSG( (pd->hDevMode), wxT("hDevMode must be non-NULL in ConvertToNative!"));
+ // Shouldn't assert; we should be able to test Ok-ness at a higher level
+ //wxASSERT_MSG( (pd->hDevMode), wxT("hDevMode must be non-NULL in ConvertToNative!"));
// Pass the devnames data (created in m_printData.ConvertToNative)
// to the PRINTDLG structure, since it'll
void wxHtmlEasyPrinting::PageSetup()
{
+ if (!m_PrintData->Ok())
+ {
+ wxMessageBox(_("Sorry, there was a problem: you may need to set a default printer."),
+ _("Page Setup Problem"), wxICON_INFORMATION|wxOK, m_Frame);
+ return;
+ }
+
m_PageSetupData->SetPrintData(*m_PrintData);
wxPageSetupDialog pageSetupDialog(m_Frame, m_PageSetupData);
long wxStaticText::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{
- // Ensure that static items get messages. Some controls don't like this
- // message to be intercepted (e.g. RichEdit), hence the tests.
- if (nMsg == WM_NCHITTEST)
- return (long)HTCLIENT;
-
- return wxWindow::MSWWindowProc(nMsg, wParam, lParam);
+ // Ensure that static items get messages. Some controls don't like this
+ // message to be intercepted (e.g. RichEdit), hence the tests.
+ // Messes up display with Windows XP, apparently, so have to
+ // do explicit hit-testing in wxWindowMSW.
+#if 0
+ if (nMsg == WM_NCHITTEST)
+ return (long)HTCLIENT;
+#endif
+ return wxWindow::MSWWindowProc(nMsg, wParam, lParam);
}
#endif // wxUSE_STATTEXT