header changes for the fixes commited previously

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1999 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-03-29 20:49:05 +00:00
parent 0fb67cd196
commit d6b9496a96
6 changed files with 811 additions and 654 deletions

View File

@@ -31,10 +31,10 @@ public:
wxColourData(const wxColourData& data);
~wxColourData();
inline void SetChooseFull(bool flag) { chooseFull = flag; }
inline bool GetChooseFull() const { return chooseFull; }
inline void SetColour(wxColour& colour) { dataColour = colour; }
inline wxColour &GetColour() { return dataColour; }
void SetChooseFull(bool flag) { chooseFull = flag; }
bool GetChooseFull() const { return chooseFull; }
void SetColour(wxColour& colour) { dataColour = colour; }
wxColour &GetColour() { return dataColour; }
// Array of 16 custom colours
void SetCustomColour(int i, wxColour& colour);
@@ -56,25 +56,25 @@ public:
wxFontData(const wxFontData& fontData);
~wxFontData();
inline void SetAllowSymbols(bool flag) { allowSymbols = flag; }
inline bool GetAllowSymbols() const { return allowSymbols; }
void SetAllowSymbols(bool flag) { allowSymbols = flag; }
bool GetAllowSymbols() const { return allowSymbols; }
inline void SetColour(const wxColour& colour) { fontColour = colour; }
inline wxColour &GetColour() { return fontColour; }
void SetColour(const wxColour& colour) { fontColour = colour; }
wxColour &GetColour() { return fontColour; }
inline void SetShowHelp(bool flag) { showHelp = flag; }
inline bool GetShowHelp() const { return showHelp; }
void SetShowHelp(bool flag) { showHelp = flag; }
bool GetShowHelp() const { return showHelp; }
inline void EnableEffects(bool flag) { enableEffects = flag; }
inline bool GetEnableEffects() const { return enableEffects; }
void EnableEffects(bool flag) { enableEffects = flag; }
bool GetEnableEffects() const { return enableEffects; }
inline void SetInitialFont(const wxFont& font) { initialFont = font; }
inline wxFont GetInitialFont() const { return initialFont; }
void SetInitialFont(const wxFont& font) { initialFont = font; }
wxFont GetInitialFont() const { return initialFont; }
inline void SetChosenFont(const wxFont& font) { chosenFont = font; }
inline wxFont GetChosenFont() const { return chosenFont; }
void SetChosenFont(const wxFont& font) { chosenFont = font; }
wxFont GetChosenFont() const { return chosenFont; }
inline void SetRange(int minRange, int maxRange) { minSize = minRange; maxSize = maxRange; }
void SetRange(int minRange, int maxRange) { minSize = minRange; maxSize = maxRange; }
void operator=(const wxFontData& data);
@@ -102,53 +102,53 @@ class WXDLLEXPORT wxPrintData: public wxObject
wxPrintData(const wxPrintData& printData);
~wxPrintData();
inline int GetNoCopies() const { return m_printNoCopies; };
inline bool GetCollate() const { return m_printCollate; };
inline int GetOrientation() const { return m_printOrientation; };
int GetNoCopies() const { return m_printNoCopies; };
bool GetCollate() const { return m_printCollate; };
int GetOrientation() const { return m_printOrientation; };
inline const wxString& GetPrinterName() const { return m_printerName; }
inline bool GetColour() const { return m_colour; }
inline wxDuplexMode GetDuplex() const { return m_duplexMode; }
inline wxPaperSize GetPaperId() const { return m_paperId; }
inline const wxSize& GetPaperSize() const { return m_paperSize; } // Not used yet: confusable with paper size
const wxString& GetPrinterName() const { return m_printerName; }
bool GetColour() const { return m_colour; }
wxDuplexMode GetDuplex() const { return m_duplexMode; }
wxPaperSize GetPaperId() const { return m_paperId; }
const wxSize& GetPaperSize() const { return m_paperSize; } // Not used yet: confusable with paper size
// in wxPageSetupDialogData
inline wxPrintQuality GetQuality() const { return m_printQuality; }
wxPrintQuality GetQuality() const { return m_printQuality; }
inline void SetNoCopies(int v) { m_printNoCopies = v; };
inline void SetCollate(bool flag) { m_printCollate = flag; };
inline void SetOrientation(int orient) { m_printOrientation = orient; };
void SetNoCopies(int v) { m_printNoCopies = v; };
void SetCollate(bool flag) { m_printCollate = flag; };
void SetOrientation(int orient) { m_printOrientation = orient; };
inline void SetPrinterName(const wxString& name) { m_printerName = name; }
inline void SetColour(bool colour) { m_colour = colour; }
inline void SetDuplex(wxDuplexMode duplex) { m_duplexMode = duplex; }
inline void SetPaperId(wxPaperSize sizeId) { m_paperId = sizeId; }
inline void SetPaperSize(const wxSize& sz) { m_paperSize = sz; }
inline void SetQuality(wxPrintQuality quality) { m_printQuality = quality; }
void SetPrinterName(const wxString& name) { m_printerName = name; }
void SetColour(bool colour) { m_colour = colour; }
void SetDuplex(wxDuplexMode duplex) { m_duplexMode = duplex; }
void SetPaperId(wxPaperSize sizeId) { m_paperId = sizeId; }
void SetPaperSize(const wxSize& sz) { m_paperSize = sz; }
void SetQuality(wxPrintQuality quality) { m_printQuality = quality; }
// PostScript-specific data
inline const wxString& GetPrinterCommand() const { return m_printerCommand; }
inline const wxString& GetPrinterOptions() const { return m_printerOptions; }
inline const wxString& GetPreviewCommand() const { return m_previewCommand; }
inline const wxString& GetFilename() const { return m_filename; }
inline const wxString& GetFontMetricPath() const { return m_afmPath; }
inline double GetPrinterScaleX() const { return m_printerScaleX; }
inline double GetPrinterScaleY() const { return m_printerScaleY; }
inline long GetPrinterTranslateX() const { return m_printerTranslateX; }
inline long GetPrinterTranslateY() const { return m_printerTranslateY; }
inline wxPrintMode GetPrintMode() const { return m_printMode; }
const wxString& GetPrinterCommand() const { return m_printerCommand; }
const wxString& GetPrinterOptions() const { return m_printerOptions; }
const wxString& GetPreviewCommand() const { return m_previewCommand; }
const wxString& GetFilename() const { return m_filename; }
const wxString& GetFontMetricPath() const { return m_afmPath; }
double GetPrinterScaleX() const { return m_printerScaleX; }
double GetPrinterScaleY() const { return m_printerScaleY; }
long GetPrinterTranslateX() const { return m_printerTranslateX; }
long GetPrinterTranslateY() const { return m_printerTranslateY; }
wxPrintMode GetPrintMode() const { return m_printMode; }
inline void SetPrinterCommand(const wxString& command) { m_printerCommand = command; }
inline void SetPrinterOptions(const wxString& options) { m_printerOptions = options; }
inline void SetPreviewCommand(const wxString& command) { m_previewCommand = command; }
inline void SetFilename(const wxString& filename) { m_filename = filename; }
inline void SetFontMetricPath(const wxString& path) { m_afmPath = path; }
inline void SetPrinterScaleX(double x) { m_printerScaleX = x; }
inline void SetPrinterScaleY(double y) { m_printerScaleY = y; }
inline void SetPrinterScaling(double x, double y) { m_printerScaleX = x; m_printerScaleY = y; }
inline void SetPrinterTranslateX(long x) { m_printerTranslateX = x; }
inline void SetPrinterTranslateY(long y) { m_printerTranslateY = y; }
inline void SetPrinterTranslation(long x, long y) { m_printerTranslateX = x; m_printerTranslateY = y; }
inline void SetPrintMode(wxPrintMode printMode) { m_printMode = printMode; }
void SetPrinterCommand(const wxString& command) { m_printerCommand = command; }
void SetPrinterOptions(const wxString& options) { m_printerOptions = options; }
void SetPreviewCommand(const wxString& command) { m_previewCommand = command; }
void SetFilename(const wxString& filename) { m_filename = filename; }
void SetFontMetricPath(const wxString& path) { m_afmPath = path; }
void SetPrinterScaleX(double x) { m_printerScaleX = x; }
void SetPrinterScaleY(double y) { m_printerScaleY = y; }
void SetPrinterScaling(double x, double y) { m_printerScaleX = x; m_printerScaleY = y; }
void SetPrinterTranslateX(long x) { m_printerTranslateX = x; }
void SetPrinterTranslateY(long y) { m_printerTranslateY = y; }
void SetPrinterTranslation(long x, long y) { m_printerTranslateX = x; m_printerTranslateY = y; }
void SetPrintMode(wxPrintMode printMode) { m_printMode = printMode; }
void operator=(const wxPrintData& data);
@@ -161,8 +161,8 @@ class WXDLLEXPORT wxPrintData: public wxObject
// Convert to/from the DEVMODE structure
void ConvertToNative();
void ConvertFromNative();
inline void* GetNativeData() const { return m_devMode; }
inline void SetNativeData(void* data) { m_devMode = data; }
void* GetNativeData() const { return m_devMode; }
void SetNativeData(void* data) { m_devMode = data; }
#endif
public:
@@ -213,38 +213,38 @@ class WXDLLEXPORT wxPrintDialogData: public wxObject
wxPrintDialogData(const wxPrintData& printData);
~wxPrintDialogData();
inline int GetFromPage() const { return m_printFromPage; };
inline int GetToPage() const { return m_printToPage; };
inline int GetMinPage() const { return m_printMinPage; };
inline int GetMaxPage() const { return m_printMaxPage; };
inline int GetNoCopies() const { return m_printNoCopies; };
inline bool GetAllPages() const { return m_printAllPages; };
inline bool GetCollate() const { return m_printCollate; };
inline bool GetPrintToFile() const { return m_printToFile; };
inline bool GetSetupDialog() const { return m_printSetupDialog; };
int GetFromPage() const { return m_printFromPage; };
int GetToPage() const { return m_printToPage; };
int GetMinPage() const { return m_printMinPage; };
int GetMaxPage() const { return m_printMaxPage; };
int GetNoCopies() const { return m_printNoCopies; };
bool GetAllPages() const { return m_printAllPages; };
bool GetCollate() const { return m_printCollate; };
bool GetPrintToFile() const { return m_printToFile; };
bool GetSetupDialog() const { return m_printSetupDialog; };
inline void SetFromPage(int v) { m_printFromPage = v; };
inline void SetToPage(int v) { m_printToPage = v; };
inline void SetMinPage(int v) { m_printMinPage = v; };
inline void SetMaxPage(int v) { m_printMaxPage = v; };
inline void SetNoCopies(int v) { m_printNoCopies = v; };
inline void SetAllPages(bool flag) { m_printAllPages = flag; };
inline void SetCollate(bool flag) { m_printCollate = flag; };
inline void SetPrintToFile(bool flag) { m_printToFile = flag; };
inline void SetSetupDialog(bool flag) { m_printSetupDialog = flag; };
void SetFromPage(int v) { m_printFromPage = v; };
void SetToPage(int v) { m_printToPage = v; };
void SetMinPage(int v) { m_printMinPage = v; };
void SetMaxPage(int v) { m_printMaxPage = v; };
void SetNoCopies(int v) { m_printNoCopies = v; };
void SetAllPages(bool flag) { m_printAllPages = flag; };
void SetCollate(bool flag) { m_printCollate = flag; };
void SetPrintToFile(bool flag) { m_printToFile = flag; };
void SetSetupDialog(bool flag) { m_printSetupDialog = flag; };
inline void EnablePrintToFile(bool flag) { m_printEnablePrintToFile = flag; };
inline void EnableSelection(bool flag) { m_printEnableSelection = flag; };
inline void EnablePageNumbers(bool flag) { m_printEnablePageNumbers = flag; };
inline void EnableHelp(bool flag) { m_printEnableHelp = flag; };
void EnablePrintToFile(bool flag) { m_printEnablePrintToFile = flag; };
void EnableSelection(bool flag) { m_printEnableSelection = flag; };
void EnablePageNumbers(bool flag) { m_printEnablePageNumbers = flag; };
void EnableHelp(bool flag) { m_printEnableHelp = flag; };
inline bool GetEnablePrintToFile() const { return m_printEnablePrintToFile; };
inline bool GetEnableSelection() const { return m_printEnableSelection; };
inline bool GetEnablePageNumbers() const { return m_printEnablePageNumbers; };
inline bool GetEnableHelp() const { return m_printEnableHelp; };
bool GetEnablePrintToFile() const { return m_printEnablePrintToFile; };
bool GetEnableSelection() const { return m_printEnableSelection; };
bool GetEnablePageNumbers() const { return m_printEnablePageNumbers; };
bool GetEnableHelp() const { return m_printEnableHelp; };
inline wxPrintData& GetPrintData() { return m_printData; }
inline void SetPrintData(const wxPrintData& printData) { m_printData = printData; }
wxPrintData& GetPrintData() { return m_printData; }
void SetPrintData(const wxPrintData& printData) { m_printData = printData; }
void operator=(const wxPrintDialogData& data);
void operator=(const wxPrintData& data); // Sets internal m_printData member
@@ -254,7 +254,7 @@ class WXDLLEXPORT wxPrintDialogData: public wxObject
void ConvertToNative();
void ConvertFromNative();
void SetOwnerWindow(wxWindow* win);
inline void* GetNativeData() const { return m_printDlgData; }
void* GetNativeData() const { return m_printDlgData; }
#endif
#ifdef __WXMSW__
@@ -297,20 +297,20 @@ public:
wxPageSetupDialogData(const wxPrintData& printData);
~wxPageSetupDialogData();
inline wxSize GetPaperSize() const { return m_paperSize; };
inline wxPaperSize GetPaperId() const { return m_printData.GetPaperId(); };
inline wxPoint GetMinMarginTopLeft() const { return m_minMarginTopLeft; };
inline wxPoint GetMinMarginBottomRight() const { return m_minMarginBottomRight; };
inline wxPoint GetMarginTopLeft() const { return m_marginTopLeft; };
inline wxPoint GetMarginBottomRight() const { return m_marginBottomRight; };
wxSize GetPaperSize() const { return m_paperSize; };
wxPaperSize GetPaperId() const { return m_printData.GetPaperId(); };
wxPoint GetMinMarginTopLeft() const { return m_minMarginTopLeft; };
wxPoint GetMinMarginBottomRight() const { return m_minMarginBottomRight; };
wxPoint GetMarginTopLeft() const { return m_marginTopLeft; };
wxPoint GetMarginBottomRight() const { return m_marginBottomRight; };
inline bool GetDefaultMinMargins() const { return m_defaultMinMargins; };
inline bool GetEnableMargins() const { return m_enableMargins; };
inline bool GetEnableOrientation() const { return m_enableOrientation; };
inline bool GetEnablePaper() const { return m_enablePaper; };
inline bool GetEnablePrinter() const { return m_enablePrinter; };
inline bool GetDefaultInfo() const { return m_getDefaultInfo; };
inline bool GetEnableHelp() const { return m_enableHelp; };
bool GetDefaultMinMargins() const { return m_defaultMinMargins; };
bool GetEnableMargins() const { return m_enableMargins; };
bool GetEnableOrientation() const { return m_enableOrientation; };
bool GetEnablePaper() const { return m_enablePaper; };
bool GetEnablePrinter() const { return m_enablePrinter; };
bool GetDefaultInfo() const { return m_getDefaultInfo; };
bool GetEnableHelp() const { return m_enableHelp; };
// If a corresponding paper type is found in the paper database, will set the m_printData
// paper size id member as well.
@@ -319,25 +319,25 @@ public:
// Sets the wxPrintData id, plus the paper width/height if found in the paper database.
void SetPaperSize(wxPaperSize id);
inline void SetMinMarginTopLeft(const wxPoint& pt) { m_minMarginTopLeft = pt; };
inline void SetMinMarginBottomRight(const wxPoint& pt) { m_minMarginBottomRight = pt; };
inline void SetMarginTopLeft(const wxPoint& pt) { m_marginTopLeft = pt; };
inline void SetMarginBottomRight(const wxPoint& pt) { m_marginBottomRight = pt; };
inline void SetDefaultMinMargins(bool flag) { m_defaultMinMargins = flag; };
inline void SetDefaultInfo(bool flag) { m_getDefaultInfo = flag; };
void SetMinMarginTopLeft(const wxPoint& pt) { m_minMarginTopLeft = pt; };
void SetMinMarginBottomRight(const wxPoint& pt) { m_minMarginBottomRight = pt; };
void SetMarginTopLeft(const wxPoint& pt) { m_marginTopLeft = pt; };
void SetMarginBottomRight(const wxPoint& pt) { m_marginBottomRight = pt; };
void SetDefaultMinMargins(bool flag) { m_defaultMinMargins = flag; };
void SetDefaultInfo(bool flag) { m_getDefaultInfo = flag; };
inline void EnableMargins(bool flag) { m_enableMargins = flag; };
inline void EnableOrientation(bool flag) { m_enableOrientation = flag; };
inline void EnablePaper(bool flag) { m_enablePaper = flag; };
inline void EnablePrinter(bool flag) { m_enablePrinter = flag; };
inline void EnableHelp(bool flag) { m_enableHelp = flag; };
void EnableMargins(bool flag) { m_enableMargins = flag; };
void EnableOrientation(bool flag) { m_enableOrientation = flag; };
void EnablePaper(bool flag) { m_enablePaper = flag; };
void EnablePrinter(bool flag) { m_enablePrinter = flag; };
void EnableHelp(bool flag) { m_enableHelp = flag; };
#if defined(__WIN95__)
// Convert to/from the PAGESETUPDLG structure
void ConvertToNative();
void ConvertFromNative();
void SetOwnerWindow(wxWindow* win);
inline void* GetNativeData() const { return m_pageSetupData; }
void* GetNativeData() const { return m_pageSetupData; }
#endif
// Use paper size defined in this object to set the wxPrintData
@@ -350,8 +350,8 @@ public:
void operator=(const wxPageSetupData& data);
void operator=(const wxPrintData& data);
inline wxPrintData& GetPrintData() { return m_printData; }
inline void SetPrintData(const wxPrintData& printData) { m_printData = printData; }
wxPrintData& GetPrintData() { return m_printData; }
void SetPrintData(const wxPrintData& printData) { m_printData = printData; }
#if defined(__WIN95__)
void* m_pageSetupData;

View File

@@ -14,43 +14,52 @@
#define __PRINTPSH__
#ifdef __GNUG__
#pragma interface "printps.h"
#pragma interface "printps.h"
#endif
#include "wx/prntbase.h"
/*
* Represents the printer: manages printing a wxPrintout object
*/
// ----------------------------------------------------------------------------
// Represents the printer: manages printing a wxPrintout object
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxPostScriptPrinter: public wxPrinterBase
class WXDLLEXPORT wxPostScriptPrinter : public wxPrinterBase
{
DECLARE_DYNAMIC_CLASS(wxPostScriptPrinter)
public:
wxPostScriptPrinter(wxPrintDialogData *data = (wxPrintDialogData *) NULL);
~wxPostScriptPrinter(void);
virtual ~wxPostScriptPrinter();
virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = TRUE);
virtual wxDC* PrintDialog(wxWindow *parent);
virtual bool Setup(wxWindow *parent);
};
/*
* wxPrintPreview
* Programmer creates an object of this class to preview a wxPrintout.
*/
// ----------------------------------------------------------------------------
// wxPrintPreview: programmer creates an object of this class to preview a
// wxPrintout.
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxPostScriptPrintPreview: public wxPrintPreviewBase
class WXDLLEXPORT wxPostScriptPrintPreview : public wxPrintPreviewBase
{
DECLARE_CLASS(wxPostScriptPrintPreview)
public:
wxPostScriptPrintPreview(wxPrintout *printout, wxPrintout *printoutForPrinting = (wxPrintout *) NULL, wxPrintDialogData *data = (wxPrintDialogData *) NULL);
~wxPostScriptPrintPreview(void);
wxPostScriptPrintPreview(wxPrintout *printout,
wxPrintout *printoutForPrinting = (wxPrintout *) NULL,
wxPrintDialogData *data = (wxPrintDialogData *) NULL);
wxPostScriptPrintPreview(wxPrintout *printout,
wxPrintout *printoutForPrinting,
wxPrintData *data);
virtual ~wxPostScriptPrintPreview();
virtual bool Print(bool interactive);
virtual void DetermineScaling(void);
virtual void DetermineScaling();
private:
void Init(wxPrintout *printout, wxPrintout *printoutForPrinting);
};
#endif

View File

@@ -14,17 +14,15 @@
#define __PRINTDLGH_G_
#ifdef __GNUG__
#pragma interface "prntdlgg.h"
#pragma interface "prntdlgg.h"
#endif
#include "wx/defs.h"
#include "wx/dialog.h"
#include "wx/dc.h"
#include "wx/cmndata.h"
#include "wx/dialog.h"
#if wxUSE_POSTSCRIPT
#include "wx/dcps.h"
#include "wx/dcps.h"
#endif
class WXDLLEXPORT wxTextCtrl;
@@ -35,26 +33,55 @@ class WXDLLEXPORT wxStaticText;
class WXDLLEXPORT wxRadioBox;
class WXDLLEXPORT wxPrintSetupData;
/*
* Simulated Print and Print Setup dialogs
* for non-Windows platforms (and Windows using PostScript print/preview)
*/
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
#define wxPRINTID_STATIC 10
#define wxPRINTID_RANGE 11
#define wxPRINTID_FROM 12
#define wxPRINTID_TO 13
#define wxPRINTID_COPIES 14
#define wxPRINTID_PRINTTOFILE 15
#define wxPRINTID_SETUP 16
// FIXME why all these enums start with 10 or 30?
class WXDLLEXPORT wxGenericPrintDialog: public wxDialog
enum
{
wxPRINTID_STATIC = 10,
wxPRINTID_RANGE,
wxPRINTID_FROM,
wxPRINTID_TO,
wxPRINTID_COPIES,
wxPRINTID_PRINTTOFILE,
wxPRINTID_SETUP
};
enum
{
wxPRINTID_LEFTMARGIN = 30,
wxPRINTID_RIGHTMARGIN,
wxPRINTID_TOPMARGIN,
wxPRINTID_BOTTOMMARGIN
};
enum
{
wxPRINTID_PRINTCOLOUR = 10,
wxPRINTID_ORIENTATION,
wxPRINTID_COMMAND,
wxPRINTID_OPTIONS,
wxPRINTID_PAPERSIZE
};
// ----------------------------------------------------------------------------
// Simulated Print and Print Setup dialogs for non-Windows platforms (and
// Windows using PostScript print/preview)
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxGenericPrintDialog : public wxDialog
{
DECLARE_DYNAMIC_CLASS(wxGenericPrintDialog)
public:
wxGenericPrintDialog(wxWindow *parent, wxPrintDialogData* data = (wxPrintDialogData*) NULL);
~wxGenericPrintDialog();
wxGenericPrintDialog(wxWindow *parent,
wxPrintDialogData* data = (wxPrintDialogData*)NULL);
wxGenericPrintDialog(wxWindow *parent, wxPrintData* data);
virtual ~wxGenericPrintDialog();
void OnSetup(wxCommandEvent& event);
void OnRange(wxCommandEvent& event);
@@ -65,7 +92,12 @@ public:
virtual int ShowModal();
inline wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; }
#if wxUSE_POSTSCRIPT
wxPrintData& GetPrintData()
{ return m_printDialogData.GetPrintData(); }
#endif // wxUSE_POSTSCRIPT
wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; }
wxDC *GetPrintDC();
public:
@@ -81,17 +113,14 @@ public:
wxPrintDialogData m_printDialogData;
protected:
void Init(wxWindow *parent);
private:
DECLARE_EVENT_TABLE()
};
#define wxPRINTID_PRINTCOLOUR 10
#define wxPRINTID_ORIENTATION 11
#define wxPRINTID_COMMAND 12
#define wxPRINTID_OPTIONS 13
#define wxPRINTID_PAPERSIZE 14
class WXDLLEXPORT wxGenericPrintSetupDialog: public wxDialog
class WXDLLEXPORT wxGenericPrintSetupDialog : public wxDialog
{
DECLARE_CLASS(wxGenericPrintSetupDialog)
@@ -100,7 +129,7 @@ public:
// just pass the wxPrintData object (no wxPrintSetupDialogData class needed)
wxGenericPrintSetupDialog(wxWindow *parent, wxPrintData* data);
wxGenericPrintSetupDialog(wxWindow *parent, wxPrintSetupData* data);
~wxGenericPrintSetupDialog();
virtual ~wxGenericPrintSetupDialog();
void Init(wxPrintData* data);
@@ -118,23 +147,17 @@ public:
#if wxUSE_POSTSCRIPT
wxPrintData m_printData;
inline wxPrintData& GetPrintData() { return m_printData; }
#endif
wxPrintData& GetPrintData() { return m_printData; }
#endif // wxUSE_POSTSCRIPT
};
#define wxPRINTID_LEFTMARGIN 30
#define wxPRINTID_RIGHTMARGIN 31
#define wxPRINTID_TOPMARGIN 32
#define wxPRINTID_BOTTOMMARGIN 33
class WXDLLEXPORT wxGenericPageSetupDialog: public wxDialog
class WXDLLEXPORT wxGenericPageSetupDialog : public wxDialog
{
DECLARE_CLASS(wxGenericPageSetupDialog)
public:
wxGenericPageSetupDialog(wxWindow *parent, wxPageSetupData* data = (wxPageSetupData*) NULL);
~wxGenericPageSetupDialog();
virtual ~wxGenericPageSetupDialog();
virtual bool TransferDataFromWindow();
virtual bool TransferDataToWindow();
@@ -142,7 +165,7 @@ public:
void OnPrinter(wxCommandEvent& event);
wxChoice *CreatePaperTypeChoice(int* x, int* y);
inline wxPageSetupData& GetPageSetupData() { return m_pageData; }
wxPageSetupData& GetPageSetupData() { return m_pageData; }
public:
wxButton* m_printerButton;
@@ -157,6 +180,7 @@ public:
wxPageSetupData m_pageData;
private:
DECLARE_EVENT_TABLE()
};

View File

@@ -13,9 +13,11 @@
#define _WX_LOG_H_
#ifdef __GNUG__
#pragma interface "log.h"
#pragma interface "log.h"
#endif
#include <wx/dynarray.h>
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
@@ -35,6 +37,22 @@ enum
wxLOG_User = 100 // user defined levels start here
};
// symbolic trace masks - wxLogTrace("foo", "some trace message...") will be
// discarded unless the string "foo" has been added to the list of allowed
// ones with AddTraceMask()
#define wxTRACE_MemAlloc "memalloc" // trace memory allocation (new/delete)
#define wxTRACE_Messages "messages" // trace window messages/X callbacks
#define wxTRACE_ResAlloc "resalloc" // trace GDI resource allocation
#define wxTRACE_RefCount "refcount" // trace various ref counting operations
#ifdef __WXMSW__
#define wxTRACE_OleCalls "ole" // OLE interface calls
#endif
// the trace masks have been superceded by symbolic trace constants, they're
// for compatibility only andwill be removed soon - do NOT use them
// meaning of different bits of the trace mask (which allows selectively
// enable/disable some trace messages)
#define wxTraceMemAlloc 0x0001 // trace memory allocation (new/delete)
@@ -52,12 +70,13 @@ typedef unsigned long wxLogLevel;
// ----------------------------------------------------------------------------
// forward declarations
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxTextCtrl;
class WXDLLEXPORT wxLogFrame;
class WXDLLEXPORT wxFrame;
#if wxUSE_IOSTREAMH
// N.B. BC++ doesn't have istream.h, ostream.h
// N.B. BC++ doesn't have istream.h, ostream.h
# include <iostream.h>
#else
# include <ostream>
@@ -70,6 +89,7 @@ class WXDLLEXPORT wxFrame;
// derive from this class to redirect (or suppress, or ...) log messages
// normally, only a single instance of this class exists but it's not enforced
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxLog
{
public:
@@ -83,83 +103,83 @@ public:
static bool EnableLogging(bool doIt = TRUE)
{ bool doLogOld = ms_doLog; ms_doLog = doIt; return doLogOld; }
// sink function
static void OnLog(wxLogLevel level, const char *szString)
// static sink function - see DoLog() for function to overload in the
// derived classes
static void OnLog(wxLogLevel level, const char *szString, time_t t)
{
if ( IsEnabled() ) {
wxLog *pLogger = GetActiveTarget();
if ( pLogger )
pLogger->DoLog(level, szString);
pLogger->DoLog(level, szString, t);
}
}
// message buffering
// flush shows all messages if they're not logged immediately
// (FILE and iostream logs don't need it, but wxGuiLog does to avoid
// showing 17 modal dialogs one after another)
// flush shows all messages if they're not logged immediately (FILE
// and iostream logs don't need it, but wxGuiLog does to avoid showing
// 17 modal dialogs one after another)
virtual void Flush();
// call to Flush() may be optimized: call it only if this function
// returns true (although Flush() also returns immediately if there
// is no messages, this functions is more efficient because inline)
// returns true (although Flush() also returns immediately if there is
// no messages, this functions is more efficient because inline)
bool HasPendingMessages() const { return m_bHasMessages; }
// only one sink is active at each moment
// get current log target, will call wxApp::CreateLogTarget() to create one
// if none exists
// get current log target, will call wxApp::CreateLogTarget() to
// create one if none exists
static wxLog *GetActiveTarget();
// change log target, pLogger may be NULL
static wxLog *SetActiveTarget(wxLog *pLogger);
// functions controlling the default wxLog behaviour
// verbose mode is activated by standard command-line '-verbose' option
// verbose mode is activated by standard command-line '-verbose'
// option
void SetVerbose(bool bVerbose = TRUE) { m_bVerbose = bVerbose; }
// sets the format for timestamp prepended by wxLog::DoLog(): it's
// passed to strftime() function, see it's documentation for details.
// no time stamp at all if szTF is NULL or empty
// NB: the string is not copied, so it's lifetime must be long enough!
void SetTimeStampFormat(const char *szTF) { m_szTimeFormat = szTF; }
// should GetActiveTarget() try to create a new log object if the
// current is NULL?
static void DontCreateOnDemand() { ms_bAutoCreate = FALSE; }
// trace mask (see wxTraceXXX constants for details)
static void SetTraceMask(wxTraceMask ulMask) { ms_ulTraceMask = ulMask; }
// should GetActiveTarget() try to create a new log object if the current
// is NULL?
static void DontCreateOnDemand() { ms_bAutoCreate = FALSE; }
// add string trace mask
static void AddTraceMask(const wxString& str) { ms_aTraceMasks.Add(str); }
// add string trace mask
static void RemoveTraceMask(const wxString& str);
// accessors
// gets the verbose status
bool GetVerbose() const { return m_bVerbose; }
// get current time format
const char *GetTimeStampFormat() const { return m_szTimeFormat; }
// get trace mask
static wxTraceMask GetTraceMask() { return ms_ulTraceMask; }
// is this trace mask in the list?
static bool IsAllowedTraceMask(const char *mask)
{ return ms_aTraceMasks.Index(mask) != wxNOT_FOUND; }
// make dtor virtual for all derived classes
virtual ~wxLog() { }
protected:
bool m_bHasMessages;
bool m_bHasMessages; // any messages in the queue?
bool m_bVerbose; // FALSE => ignore LogInfo messages
const char *m_szTimeFormat; // format for strftime()
// the logging functions that can be overriden
// default DoLog() prepends the time stamp and a prefix corresponding
// to the message to szString and then passes it to DoLogString()
virtual void DoLog(wxLogLevel level, const char *szString);
virtual void DoLog(wxLogLevel level, const char *szString, time_t t);
// default DoLogString does nothing but is not pure virtual because if
// you override DoLog() you might not need it at all
virtual void DoLogString(const char *szString);
// helpers
// put the time stamp in the current format into the string
wxString TimeStamp() const;
virtual void DoLogString(const char *szString, time_t t);
private:
// static variables
// ----------------
static wxLog *ms_pLogger; // currently active log sink
static bool ms_doLog; // FALSE => all logging disabled
static bool ms_bAutoCreate; // automatically create new log targets?
static bool ms_bAutoCreate; // create new log targets on demand?
static wxTraceMask ms_ulTraceMask; // controls wxLogTrace behaviour
static wxArrayString ms_aTraceMasks; // more powerful filter for wxLogTrace
};
// ----------------------------------------------------------------------------
@@ -175,7 +195,7 @@ public:
private:
// implement sink function
virtual void DoLogString(const char *szString);
virtual void DoLogString(const char *szString, time_t t);
FILE *m_fp;
};
@@ -190,9 +210,9 @@ public:
protected:
// implement sink function
virtual void DoLogString(const char *szString);
virtual void DoLogString(const char *szString, time_t t);
// @@ using ptr here to avoid including <iostream.h> from this file
// using ptr here to avoid including <iostream.h> from this file
ostream *m_ostr;
};
#endif
@@ -223,10 +243,15 @@ public:
virtual void Flush();
protected:
virtual void DoLog(wxLogLevel level, const char *szString);
virtual void DoLog(wxLogLevel level, const char *szString, time_t t);
// empty everything
void Clear();
wxArrayString m_aMessages;
bool m_bErrors;
wxArrayLong m_aTimes;
bool m_bErrors, // do we have any errors?
m_bWarnings; // any warnings?
};
// ----------------------------------------------------------------------------
@@ -273,8 +298,8 @@ public:
virtual void OnFrameDelete(wxFrame *frame);
protected:
virtual void DoLog(wxLogLevel level, const char *szString);
virtual void DoLogString(const char *szString);
virtual void DoLog(wxLogLevel level, const char *szString, time_t t);
virtual void DoLogString(const char *szString, time_t t);
private:
bool m_bPassMessages; // pass messages to m_pOldLog?
@@ -290,17 +315,17 @@ private:
// example of usage:
/*
void Foo() {
void Foo() {
wxFile file;
// wxFile.Open() normally complains if file can't be opened, we don't want it
wxLogNull logNo;
if ( !file.Open("bar") )
... process error ourselves ...
// wxFile.Open() normally complains if file can't be opened, we don't want it
wxLogNull logNo;
if ( !file.Open("bar") )
... process error ourselves ...
// ~wxLogNull called, old log sink restored
// ~wxLogNull called, old log sink restored
}
*/
*/
class WXDLLEXPORT wxLogNull
{
public:
@@ -324,79 +349,86 @@ private:
// -------------------
#define DECLARE_LOG_FUNCTION(level) \
extern void WXDLLEXPORT wxLog##level(const char *szFormat, ...)
extern void WXDLLEXPORT wxLog##level(const char *szFormat, ...)
#define DECLARE_LOG_FUNCTION2(level, arg1) \
extern void WXDLLEXPORT wxLog##level(arg1, const char *szFormat, ...)
extern void WXDLLEXPORT wxLog##level(arg1, const char *szFormat, ...)
// a generic function for all levels (level is passes as parameter)
DECLARE_LOG_FUNCTION2(Generic, wxLogLevel level);
// a generic function for all levels (level is passes as parameter)
DECLARE_LOG_FUNCTION2(Generic, wxLogLevel level);
// one function per each level
DECLARE_LOG_FUNCTION(FatalError);
DECLARE_LOG_FUNCTION(Error);
DECLARE_LOG_FUNCTION(Warning);
DECLARE_LOG_FUNCTION(Message);
DECLARE_LOG_FUNCTION(Info);
DECLARE_LOG_FUNCTION(Verbose);
// one function per each level
DECLARE_LOG_FUNCTION(FatalError);
DECLARE_LOG_FUNCTION(Error);
DECLARE_LOG_FUNCTION(Warning);
DECLARE_LOG_FUNCTION(Message);
DECLARE_LOG_FUNCTION(Info);
DECLARE_LOG_FUNCTION(Verbose);
// this function sends the log message to the status line of the top level
// application frame, if any
DECLARE_LOG_FUNCTION(Status);
// this function sends the log message to the status line of the top level
// application frame, if any
DECLARE_LOG_FUNCTION(Status);
// this one is the same as previous except that it allows to explicitly
// specify the frame to which the output should go
DECLARE_LOG_FUNCTION2(Status, wxFrame *pFrame);
// this one is the same as previous except that it allows to explicitly
// specify the frame to which the output should go
DECLARE_LOG_FUNCTION2(Status, wxFrame *pFrame);
// additional one: as wxLogError, but also logs last system call error code
// and the corresponding error message if available
DECLARE_LOG_FUNCTION(SysError);
// additional one: as wxLogError, but also logs last system call error code
// and the corresponding error message if available
DECLARE_LOG_FUNCTION(SysError);
// and another one which also takes the error code (for those broken APIs
// that don't set the errno (like registry APIs in Win32))
DECLARE_LOG_FUNCTION2(SysError, long lErrCode);
// and another one which also takes the error code (for those broken APIs
// that don't set the errno (like registry APIs in Win32))
DECLARE_LOG_FUNCTION2(SysError, long lErrCode);
// debug functions do nothing in release mode
// debug functions do nothing in release mode
#ifdef __WXDEBUG__
DECLARE_LOG_FUNCTION(Debug);
// first king of LogTrace is uncoditional: it doesn't check the level,
// while the second one does nothing if all of level bits are not set
// in wxLog::GetActive()->GetTraceMask().
DECLARE_LOG_FUNCTION(Trace);
// this second version will only log the message if the mask had been
// added to the list of masks with AddTraceMask()
DECLARE_LOG_FUNCTION2(Trace, const char *mask);
// the last one does nothing if all of level bits are not set
// in wxLog::GetActive()->GetTraceMask() - it's deprecated in favour of
// string identifiers
DECLARE_LOG_FUNCTION2(Trace, wxTraceMask mask);
#else //!debug
// these functions do nothing
// these functions do nothing in release builds
inline void wxLogDebug(const char *, ...) { }
inline void wxLogTrace(const char *, ...) { }
inline void wxLogTrace(wxTraceMask, const char *, ...) { }
inline void wxLogTrace(const char *, const char *, ...) { }
#endif
// are we in 'verbose' mode?
// (note that it's often handy to change this var manually from the
// debugger, thus enabling/disabling verbose reporting for some
// parts of the program only)
WXDLLEXPORT_DATA(extern bool) g_bVerbose;
// are we in 'verbose' mode?
// (note that it's often handy to change this var manually from the
// debugger, thus enabling/disabling verbose reporting for some
// parts of the program only)
WXDLLEXPORT_DATA(extern bool) g_bVerbose;
// ----------------------------------------------------------------------------
// get error code/error message from system in a portable way
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// get error code/error message from system in a portable way
// ----------------------------------------------------------------------------
// return the last system error code
WXDLLEXPORT unsigned long wxSysErrorCode();
// return the error message for given (or last if 0) error code
WXDLLEXPORT const char* wxSysErrorMsg(unsigned long nErrCode = 0);
// return the last system error code
WXDLLEXPORT unsigned long wxSysErrorCode();
// return the error message for given (or last if 0) error code
WXDLLEXPORT const char* wxSysErrorMsg(unsigned long nErrCode = 0);
// ----------------------------------------------------------------------------
// debug only logging functions: use them with API name and error code
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// debug only logging functions: use them with API name and error code
// ----------------------------------------------------------------------------
#ifdef __WXDEBUG__
#define wxLogApiError(api, rc) \
#define wxLogApiError(api, rc) \
wxLogDebug("At %s(%d) '%s' failed with error %lx (%s).", \
__FILE__, __LINE__, api, \
rc, wxSysErrorMsg(rc))
#define wxLogLastError(api) wxLogApiError(api, wxSysErrorCode())
#define wxLogLastError(api) wxLogApiError(api, wxSysErrorCode())
#else //!debug
inline void wxLogApiError(const char *, long) { }
inline void wxLogLastError(const char *) { }

View File

@@ -13,7 +13,7 @@
#define _WX_PRNTBASEH__
#ifdef __GNUG__
#pragma interface "prntbase.h"
#pragma interface "prntbase.h"
#endif
#include "wx/defs.h"
@@ -45,12 +45,14 @@ class WXDLLEXPORT wxPrinterBase: public wxObject
public:
wxPrinterBase(wxPrintDialogData *data = (wxPrintDialogData *) NULL);
~wxPrinterBase();
virtual ~wxPrinterBase();
virtual wxWindow *CreateAbortWindow(wxWindow *parent, wxPrintout *printout);
virtual void ReportError(wxWindow *parent, wxPrintout *printout, char *message);
inline wxPrintDialogData& GetPrintDialogData() const { return (wxPrintDialogData&) m_printDialogData; };
inline bool GetAbort() const { return sm_abortIt; }
wxPrintDialogData& GetPrintDialogData() const
{ return (wxPrintDialogData&) m_printDialogData; }
bool GetAbort() const { return sm_abortIt; }
///////////////////////////////////////////////////////////////////////////
// OVERRIDES
@@ -62,6 +64,7 @@ public:
protected:
wxPrintDialogData m_printDialogData;
wxPrintout* m_currentPrintout;
public:
static wxWindow* sm_abortWindow;
static bool sm_abortIt;
@@ -78,11 +81,11 @@ public:
class WXDLLEXPORT wxPrintout: public wxObject
{
DECLARE_ABSTRACT_CLASS(wxPrintout)
DECLARE_ABSTRACT_CLASS(wxPrintout)
public:
wxPrintout(const wxString& title = "Printout");
~wxPrintout();
virtual ~wxPrintout();
virtual bool OnBeginDocument(int startPage, int endPage);
virtual void OnEndDocument();
@@ -90,29 +93,29 @@ public:
virtual void OnEndPrinting();
// Guaranteed to be before any other functions are called
inline virtual void OnPreparePrinting() { }
virtual void OnPreparePrinting() { }
virtual bool HasPage(int page);
virtual bool OnPrintPage(int page) = 0;
virtual void GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo);
inline virtual wxString GetTitle() const { return m_printoutTitle; }
virtual wxString GetTitle() const { return m_printoutTitle; }
inline wxDC *GetDC() const { return m_printoutDC; }
inline void SetDC(wxDC *dc) { m_printoutDC = dc; }
inline void SetPageSizePixels(int w, int h) { m_pageWidthPixels = w; m_pageHeightPixels = h; }
inline void GetPageSizePixels(int *w, int *h) const { *w = m_pageWidthPixels; *h = m_pageHeightPixels; }
inline void SetPageSizeMM(int w, int h) { m_pageWidthMM = w; m_pageHeightMM = h; }
inline void GetPageSizeMM(int *w, int *h) const { *w = m_pageWidthMM; *h = m_pageHeightMM; }
wxDC *GetDC() const { return m_printoutDC; }
void SetDC(wxDC *dc) { m_printoutDC = dc; }
void SetPageSizePixels(int w, int h) { m_pageWidthPixels = w; m_pageHeightPixels = h; }
void GetPageSizePixels(int *w, int *h) const { *w = m_pageWidthPixels; *h = m_pageHeightPixels; }
void SetPageSizeMM(int w, int h) { m_pageWidthMM = w; m_pageHeightMM = h; }
void GetPageSizeMM(int *w, int *h) const { *w = m_pageWidthMM; *h = m_pageHeightMM; }
inline void SetPPIScreen(int x, int y) { m_PPIScreenX = x; m_PPIScreenY = y; }
inline void GetPPIScreen(int *x, int *y) const { *x = m_PPIScreenX; *y = m_PPIScreenY; }
inline void SetPPIPrinter(int x, int y) { m_PPIPrinterX = x; m_PPIPrinterY = y; }
inline void GetPPIPrinter(int *x, int *y) const { *x = m_PPIPrinterX; *y = m_PPIPrinterY; }
void SetPPIScreen(int x, int y) { m_PPIScreenX = x; m_PPIScreenY = y; }
void GetPPIScreen(int *x, int *y) const { *x = m_PPIScreenX; *y = m_PPIScreenY; }
void SetPPIPrinter(int x, int y) { m_PPIPrinterX = x; m_PPIPrinterY = y; }
void GetPPIPrinter(int *x, int *y) const { *x = m_PPIPrinterX; *y = m_PPIPrinterY; }
inline virtual bool IsPreview() const { return m_isPreview; }
virtual bool IsPreview() const { return m_isPreview; }
inline virtual void SetIsPreview(bool p) { m_isPreview = p; }
virtual void SetIsPreview(bool p) { m_isPreview = p; }
private:
wxString m_printoutTitle;
@@ -142,9 +145,12 @@ class WXDLLEXPORT wxPreviewCanvas: public wxScrolledWindow
DECLARE_CLASS(wxPreviewCanvas)
public:
wxPreviewCanvas(wxPrintPreviewBase *preview, wxWindow *parent,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = 0, const wxString& name = "canvas");
wxPreviewCanvas(wxPrintPreviewBase *preview,
wxWindow *parent,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = "canvas");
~wxPreviewCanvas();
void OnPaint(wxPaintEvent& event);
@@ -155,7 +161,7 @@ public:
private:
wxPrintPreviewBase* m_printPreview;
DECLARE_EVENT_TABLE()
DECLARE_EVENT_TABLE()
};
/*
@@ -168,9 +174,13 @@ class WXDLLEXPORT wxPreviewFrame: public wxFrame
DECLARE_CLASS(wxPreviewFrame)
public:
wxPreviewFrame(wxPrintPreviewBase *preview, wxFrame *parent, const wxString& title = "Print Preview",
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame");
wxPreviewFrame(wxPrintPreviewBase *preview,
wxFrame *parent,
const wxString& title = "Print Preview",
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = "frame");
~wxPreviewFrame();
void OnCloseWindow(wxCloseEvent& event);
@@ -183,7 +193,8 @@ protected:
wxPreviewControlBar* m_controlBar;
wxPrintPreviewBase* m_printPreview;
DECLARE_EVENT_TABLE()
private:
DECLARE_EVENT_TABLE()
};
/*
@@ -212,15 +223,20 @@ class WXDLLEXPORT wxPreviewControlBar: public wxPanel
DECLARE_CLASS(wxPreviewControlBar)
public:
wxPreviewControlBar(wxPrintPreviewBase *preview, long buttons,
wxWindow *parent, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = 0, const wxString& name = "panel");
wxPreviewControlBar(wxPrintPreviewBase *preview,
long buttons,
wxWindow *parent,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = "panel");
~wxPreviewControlBar();
virtual void CreateButtons();
virtual void SetZoomControl(int zoom);
virtual int GetZoomControl();
inline virtual wxPrintPreviewBase *GetPrintPreview() const { return m_printPreview; }
virtual wxPrintPreviewBase *GetPrintPreview() const
{ return m_printPreview; }
void OnPrint(wxCommandEvent& event);
void OnWindowClose(wxCommandEvent& event);
@@ -238,7 +254,8 @@ protected:
wxChoice* m_zoomControl;
long m_buttonFlags;
DECLARE_EVENT_TABLE()
private:
DECLARE_EVENT_TABLE()
};
/*
@@ -251,21 +268,26 @@ class WXDLLEXPORT wxPrintPreviewBase: public wxObject
DECLARE_CLASS(wxPrintPreviewBase)
public:
wxPrintPreviewBase(wxPrintout *printout, wxPrintout *printoutForPrinting = (wxPrintout *) NULL, wxPrintDialogData *data = (wxPrintDialogData *) NULL);
~wxPrintPreviewBase();
wxPrintPreviewBase(wxPrintout *printout,
wxPrintout *printoutForPrinting = (wxPrintout *) NULL,
wxPrintDialogData *data = (wxPrintDialogData *) NULL);
wxPrintPreviewBase(wxPrintout *printout,
wxPrintout *printoutForPrinting,
wxPrintData *data);
virtual ~wxPrintPreviewBase();
virtual bool SetCurrentPage(int pageNum);
inline int GetCurrentPage() const { return m_currentPage; };
int GetCurrentPage() const { return m_currentPage; };
inline void SetPrintout(wxPrintout *printout) { m_previewPrintout = printout; };
inline wxPrintout *GetPrintout() const { return m_previewPrintout; };
inline wxPrintout *GetPrintoutForPrinting() const { return m_printPrintout; };
void SetPrintout(wxPrintout *printout) { m_previewPrintout = printout; };
wxPrintout *GetPrintout() const { return m_previewPrintout; };
wxPrintout *GetPrintoutForPrinting() const { return m_printPrintout; };
inline void SetFrame(wxFrame *frame) { m_previewFrame = frame; };
inline void SetCanvas(wxWindow *canvas) { m_previewCanvas = canvas; };
void SetFrame(wxFrame *frame) { m_previewFrame = frame; };
void SetCanvas(wxWindow *canvas) { m_previewCanvas = canvas; };
inline virtual wxFrame *GetFrame() const { return m_previewFrame; }
inline virtual wxWindow *GetCanvas() const { return m_previewCanvas; }
virtual wxFrame *GetFrame() const { return m_previewFrame; }
virtual wxWindow *GetCanvas() const { return m_previewCanvas; }
// The preview canvas should call this from OnPaint
virtual bool PaintPage(wxWindow *canvas, wxDC& dc);
@@ -273,20 +295,19 @@ public:
// This draws a blank page onto the preview canvas
virtual bool DrawBlankPage(wxWindow *canvas, wxDC& dc);
// This is called by wxPrintPreview to render a page into
// a wxMemoryDC.
// This is called by wxPrintPreview to render a page into a wxMemoryDC.
virtual bool RenderPage(int pageNum);
inline wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; }
wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; }
virtual void SetZoom(int percent);
inline int GetZoom() const { return m_currentZoom; };
int GetZoom() const { return m_currentZoom; };
inline int GetMaxPage() const { return m_maxPage; }
inline int GetMinPage() const { return m_minPage; }
int GetMaxPage() const { return m_maxPage; }
int GetMinPage() const { return m_minPage; }
inline bool Ok() const { return m_isOk; }
inline void SetOk(bool ok) { m_isOk = ok; }
bool Ok() const { return m_isOk; }
void SetOk(bool ok) { m_isOk = ok; }
///////////////////////////////////////////////////////////////////////////
// OVERRIDES
@@ -317,8 +338,11 @@ protected:
int m_pageHeight;
int m_minPage;
int m_maxPage;
protected:
bool m_isOk;
private:
void Init(wxPrintout *printout, wxPrintout *printoutForPrinting);
};
/*
@@ -329,14 +353,18 @@ class WXDLLEXPORT wxPrintAbortDialog: public wxDialog
{
public:
wxPrintAbortDialog(wxWindow *parent,
const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = 0, const wxString& name = "dialog"):
wxDialog(parent, -1, title, pos, size, style, name)
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = "dialog")
: wxDialog(parent, -1, title, pos, size, style, name)
{
}
void OnCancel(wxCommandEvent& event);
private:
DECLARE_EVENT_TABLE()
};

View File

@@ -12,8 +12,12 @@
#ifndef _WX_UTILSH__
#define _WX_UTILSH__
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#ifdef __GNUG__
#pragma interface "utils.h"
#pragma interface "utils.h"
#endif
#include "wx/setup.h"
@@ -24,54 +28,88 @@
#include "wx/ioswrap.h"
class WXDLLEXPORT wxProcess;
#ifdef __X__
#ifndef __VMS__
/*steve: these two are not known under VMS */
#include <dirent.h>
#include <unistd.h>
#endif
#include <dirent.h>
#include <unistd.h>
#endif
#include <stdio.h>
#ifdef __GNUWIN32__
#define stricmp strcasecmp
#define strnicmp strncasecmp
#endif
// ----------------------------------------------------------------------------
// Forward declaration
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxProcess;
class WXDLLEXPORT wxFrame;
// Stupid ASCII macros
#define wxToUpper(C) (((C) >= 'a' && (C) <= 'z')? (C) - 'a' + 'A': (C))
#define wxToLower(C) (((C) >= 'A' && (C) <= 'Z')? (C) - 'A' + 'a': (C))
// FIXME should use wxStricmp() instead
#ifdef __GNUWIN32__
#define stricmp strcasecmp
#define strnicmp strncasecmp
#endif
// Return a string with the current date/time
WXDLLEXPORT wxString wxNow();
// ----------------------------------------------------------------------------
// Macros
// ----------------------------------------------------------------------------
#define wxMax(a,b) (((a) > (b)) ? (a) : (b))
#define wxMin(a,b) (((a) < (b)) ? (a) : (b))
// ----------------------------------------------------------------------------
// String functions (deprecated, use wxString)
// ----------------------------------------------------------------------------
// Useful buffer (FIXME VZ: yeah, that is. To be removed!)
WXDLLEXPORT_DATA(extern char*) wxBuffer;
// Make a copy of this string using 'new'
WXDLLEXPORT char* copystring(const char *s);
// Matches string one within string two regardless of case
WXDLLEXPORT bool StringMatch(char *one, char *two, bool subString = TRUE, bool exact = FALSE);
// A shorter way of using strcmp
#define wxStringEq(s1, s2) (s1 && s2 && (strcmp(s1, s2) == 0))
// ----------------------------------------------------------------------------
// Miscellaneous functions
// ----------------------------------------------------------------------------
// Sound the bell
WXDLLEXPORT void wxBell(void) ;
// Get OS version
WXDLLEXPORT int wxGetOsVersion(int *majorVsn= (int *) NULL,int *minorVsn= (int *) NULL) ;
// Return a string with the current date/time
WXDLLEXPORT wxString wxNow();
// ----------------------------------------------------------------------------
// Window ID management
// ----------------------------------------------------------------------------
// Generate a unique ID
WXDLLEXPORT long wxNewId();
#define NewId wxNewId
#if !defined(NewId) && defined(WXWIN_COMPATIBILITY)
#define NewId wxNewId
#endif
// Ensure subsequent IDs don't clash with this one
WXDLLEXPORT void wxRegisterId(long id);
#define RegisterId wxRegisterId
#if !defined(RegisterId) && defined(WXWIN_COMPATIBILITY)
#define RegisterId wxRegisterId
#endif
// Return the current ID
WXDLLEXPORT long wxGetCurrentId();
// Useful buffer
WXDLLEXPORT_DATA(extern char*) wxBuffer;
// ----------------------------------------------------------------------------
// Various conversions
// ----------------------------------------------------------------------------
WXDLLEXPORT_DATA(extern const char*) wxFloatToStringStr;
WXDLLEXPORT_DATA(extern const char*) wxDoubleToStringStr;
// Various conversions
WXDLLEXPORT void StringToFloat(char *s, float *number);
WXDLLEXPORT char* FloatToString(float number, const char *fmt = wxFloatToStringStr);
WXDLLEXPORT void StringToDouble(char *s, double *number);
@@ -81,12 +119,6 @@ WXDLLEXPORT void StringToLong(char *s, long *number);
WXDLLEXPORT char* IntToString(int number);
WXDLLEXPORT char* LongToString(long number);
// Matches string one within string two regardless of case
WXDLLEXPORT bool StringMatch(char *one, char *two, bool subString = TRUE, bool exact = FALSE);
// A shorter way of using strcmp
#define wxStringEq(s1, s2) (s1 && s2 && (strcmp(s1, s2) == 0))
// Convert 2-digit hex number to decimal
WXDLLEXPORT int wxHexToDec(const wxString& buf);
@@ -94,15 +126,41 @@ WXDLLEXPORT int wxHexToDec(const wxString& buf);
WXDLLEXPORT void wxDecToHex(int dec, char *buf);
WXDLLEXPORT wxString wxDecToHex(int dec);
// ----------------------------------------------------------------------------
// Process management
// ----------------------------------------------------------------------------
// Execute another program. Returns 0 if there was an error, a PID otherwise.
WXDLLEXPORT long wxExecute(char **argv, bool sync = FALSE,
wxProcess *process = (wxProcess *) NULL);
WXDLLEXPORT long wxExecute(const wxString& command, bool sync = FALSE,
wxProcess *process = (wxProcess *) NULL);
#define wxSIGTERM 1
enum wxSignal
{
wxSIGNONE = 0, // verify if the process exists under Unix
wxSIGHUP,
wxSIGINT,
wxSIGQUIT,
wxSIGILL,
wxSIGTRAP,
wxSIGABRT,
wxSIGIOT = wxSIGABRT, // another name
wxSIGEMT,
wxSIGFPE,
wxSIGKILL,
wxSIGBUS,
wxSIGSEGV,
wxSIGSYS,
wxSIGPIPE,
wxSIGALRM,
wxSIGTERM
WXDLLEXPORT int wxKill(long pid, int sig=wxSIGTERM);
// further signals are different in meaning between different Unix systems
};
// the argument is ignored under Windows - the process is always killed
WXDLLEXPORT int wxKill(long pid, wxSignal sig = wxSIGTERM);
// Execute a command in an interactive shell window
// If no command then just the shell
@@ -117,35 +175,49 @@ WXDLLEXPORT void wxUsleep(unsigned long milliseconds);
// Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX)
WXDLLEXPORT long wxGetFreeMemory();
// Consume all events until no more left
WXDLLEXPORT void wxFlushEvents();
// ----------------------------------------------------------------------------
// Network and username functions.
// ----------------------------------------------------------------------------
/*
* Network and username functions.
*
*/
// NB: "char *" functions are deprecated, use wxString ones!
// Get eMail address
WXDLLEXPORT bool wxGetEmailAddress(char *buf, int maxSize);
WXDLLEXPORT wxString wxGetEmailAddress();
// Get hostname.
WXDLLEXPORT bool wxGetHostName(char *buf, int maxSize);
WXDLLEXPORT bool wxGetHostName(wxString& buf);
WXDLLEXPORT wxString wxGetHostName();
// Get user ID e.g. jacs
// Get FQDN
WXDLLEXPORT wxString wxGetFullHostName();
// Get user ID e.g. jacs (this is known as login name under Unix)
WXDLLEXPORT bool wxGetUserId(char *buf, int maxSize);
WXDLLEXPORT bool wxGetUserId(wxString& buf);
WXDLLEXPORT wxString wxGetUserId();
// Get user name e.g. Julian Smart
WXDLLEXPORT bool wxGetUserName(char *buf, int maxSize);
WXDLLEXPORT bool wxGetUserName(wxString& buf);
WXDLLEXPORT wxString wxGetUserName();
// Get current Home dir and copy to dest (returns pstr->c_str())
WXDLLEXPORT const char* wxGetHomeDir(wxString *pstr);
// Get the user's home dir (caller must copy --- volatile)
// returns NULL is no HOME dir is known
WXDLLEXPORT char* wxGetUserHome(const wxString& user = wxEmptyString);
// ----------------------------------------------------------------------------
// Strip out any menu codes
// ----------------------------------------------------------------------------
/*
* Strip out any menu codes
*/
WXDLLEXPORT char* wxStripMenuCodes(char *in, char *out = (char *) NULL);
WXDLLEXPORT wxString wxStripMenuCodes(const wxString& str);
// ----------------------------------------------------------------------------
// Window search
// ----------------------------------------------------------------------------
// Find the window/widget with the given title or label.
// Pass a parent to begin the search from, or NULL to look through
// all windows.
@@ -157,16 +229,9 @@ WXDLLEXPORT wxWindow* wxFindWindowByName(const wxString& name, wxWindow *parent
// Returns menu item id or -1 if none.
WXDLLEXPORT int wxFindMenuItemId(wxFrame *frame, const wxString& menuString, const wxString& itemString);
/*
#if (!defined(__MINMAX_DEFINED) && !defined(max))
#define max(a,b) (((a) > (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))
#define __MINMAX_DEFINED 1
#endif
*/
#define wxMax(a,b) (((a) > (b)) ? (a) : (b))
#define wxMin(a,b) (((a) < (b)) ? (a) : (b))
// ----------------------------------------------------------------------------
// Message/event queue helpers
// ----------------------------------------------------------------------------
// Yield to other apps/messages
WXDLLEXPORT bool wxYield();
@@ -174,15 +239,16 @@ WXDLLEXPORT bool wxYield();
// Yield to other apps/messages and disable user input
WXDLLEXPORT bool wxSafeYield(wxWindow *win = NULL);
// Format a message on the standard error (UNIX) or the debugging
// stream (Windows)
WXDLLEXPORT void wxDebugMsg(const char *fmt ...) ;
// Check whether this window wants to process messages, e.g. Stop button
// in long calculations.
WXDLLEXPORT bool wxCheckForInterrupt(wxWindow *wnd);
// Sound the bell
WXDLLEXPORT void wxBell(void) ;
// Consume all events until no more left
WXDLLEXPORT void wxFlushEvents();
// Get OS version
WXDLLEXPORT int wxGetOsVersion(int *majorVsn= (int *) NULL,int *minorVsn= (int *) NULL) ;
// ----------------------------------------------------------------------------
// Cursors
// ----------------------------------------------------------------------------
// Set the cursor to the busy cursor for all windows
class WXDLLEXPORT wxCursor;
@@ -205,7 +271,13 @@ public:
{ wxEndBusyCursor(); }
};
// Error message functions used by wxWindows
// ----------------------------------------------------------------------------
// Error message functions used by wxWindows (deprecated, use wxLog)
// ----------------------------------------------------------------------------
// Format a message on the standard error (UNIX) or the debugging
// stream (Windows)
WXDLLEXPORT void wxDebugMsg(const char *fmt ...) ;
// Non-fatal error (continues)
WXDLLEXPORT_DATA(extern const char*) wxInternalErrorStr;
@@ -215,7 +287,10 @@ WXDLLEXPORT void wxError(const wxString& msg, const wxString& title = wxInternal
WXDLLEXPORT_DATA(extern const char*) wxFatalErrorStr;
WXDLLEXPORT void wxFatalError(const wxString& msg, const wxString& title = wxFatalErrorStr);
// ----------------------------------------------------------------------------
// Reading and writing resources (eg WIN.INI, .Xdefaults)
// ----------------------------------------------------------------------------
#if wxUSE_RESOURCES
WXDLLEXPORT bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file = wxEmptyString);
WXDLLEXPORT bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file = wxEmptyString);
@@ -228,17 +303,6 @@ WXDLLEXPORT bool wxGetResource(const wxString& section, const wxString& entry, l
WXDLLEXPORT bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file = wxEmptyString);
#endif // wxUSE_RESOURCES
// Get current Home dir and copy to dest (returns pstr->c_str())
WXDLLEXPORT const char* wxGetHomeDir(wxString *pstr);
// Get the user's home dir (caller must copy--- volatile)
// returns NULL is no HOME dir is known
WXDLLEXPORT char* wxGetUserHome(const wxString& user = wxEmptyString);
// Check whether this window wants to process messages, e.g. Stop button
// in long calculations.
WXDLLEXPORT bool wxCheckForInterrupt(wxWindow *wnd);
void WXDLLEXPORT wxGetMousePosition( int* x, int* y );
// MSW only: get user-defined resource from the .res file.
@@ -251,13 +315,16 @@ WXDLLEXPORT char* wxLoadUserResource(const wxString& resourceName, const wxStrin
// input/output
WXDLLEXPORT void wxRedirectIOToConsole();
#endif
#endif // MSW
// ----------------------------------------------------------------------------
// Display and colorss (X only)
// ----------------------------------------------------------------------------
// X only
#ifdef __X__
WXDisplay *wxGetDisplay();
bool wxSetDisplay(const wxString& display_name);
wxString wxGetDisplayName();
WXDisplay *wxGetDisplay();
bool wxSetDisplay(const wxString& display_name);
wxString wxGetDisplayName();
#endif
#ifdef __X__
@@ -278,9 +345,6 @@ typedef struct wx_hsv {
#define wxMax3(x,y,z) ((x > y) ? ((x > z) ? x : z) : ((y > z) ? y : z))
#define wxMin3(x,y,z) ((x < y) ? ((x < z) ? x : z) : ((y < z) ? y : z))
#define wxMax2(x,y) ((x > y) ? x : y)
#define wxMin2(x,y) ((x < y) ? x : y)
void wxHSVToXColor(wxHSV *hsv,XColor *xcolor);
void wxXColorToHSV(wxHSV *hsv,XColor *xcolor);
void wxAllocNearestColor(Display *display,Colormap colormap,XColor *xcolor);