// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c)
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CMNDATA_H_BASE_
wxColourData();
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);
wxColour GetCustomColour(int i);
-
+
void operator=(const wxColourData& data);
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; }
+
+ void SetColour(const wxColour& colour) { fontColour = colour; }
+ wxColour &GetColour() { return fontColour; }
- inline void SetColour(const wxColour& colour) { fontColour = colour; }
- inline wxColour &GetColour() { return fontColour; }
+ void SetShowHelp(bool flag) { showHelp = flag; }
+ bool GetShowHelp() const { return showHelp; }
- inline void SetShowHelp(bool flag) { showHelp = flag; }
- inline bool GetShowHelp() const { return showHelp; }
+ void EnableEffects(bool flag) { enableEffects = flag; }
+ bool GetEnableEffects() const { return enableEffects; }
- inline void EnableEffects(bool flag) { enableEffects = flag; }
- inline bool GetEnableEffects() const { return enableEffects; }
+ void SetInitialFont(const wxFont& font) { initialFont = font; }
+ wxFont GetInitialFont() const { return initialFont; }
- inline void SetInitialFont(const wxFont& font) { initialFont = font; }
- inline wxFont GetInitialFont() const { return initialFont; }
+ void SetChosenFont(const wxFont& font) { chosenFont = font; }
+ wxFont GetChosenFont() const { return chosenFont; }
- inline void SetChosenFont(const wxFont& font) { chosenFont = font; }
- inline wxFont GetChosenFont() const { return chosenFont; }
+ void SetRange(int minRange, int maxRange) { minSize = minRange; maxSize = maxRange; }
- inline void SetRange(int minRange, int maxRange) { minSize = minRange; maxSize = maxRange; }
-
void operator=(const wxFontData& data);
public:
class WXDLLEXPORT wxPrintData: public wxObject
{
DECLARE_DYNAMIC_CLASS(wxPrintData)
-
+
wxPrintData();
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; };
-
- 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
+
+ int GetNoCopies() const { return m_printNoCopies; };
+ bool GetCollate() const { return m_printCollate; };
+ int GetOrientation() const { return m_printOrientation; };
+
+ 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; }
-
- 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; }
+ 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; }
+
+ 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);
#if (defined(__WXMOTIF__) || defined(__WXGTK__)) && wxUSE_POSTSCRIPT
void operator=(const wxPrintSetupData& setupData);
#endif
-
+
#ifdef __WXMSW__
// 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:
#ifdef __WXMSW__
void* m_devMode;
class WXDLLEXPORT wxPrintDialogData: public wxObject
{
DECLARE_DYNAMIC_CLASS(wxPrintDialogData)
-
+
wxPrintDialogData();
wxPrintDialogData(const wxPrintDialogData& dialogData);
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; };
-
- 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; };
-
- 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; };
-
- 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; };
-
- inline wxPrintData& GetPrintData() { return m_printData; }
- inline void SetPrintData(const wxPrintData& printData) { m_printData = printData; }
+
+ 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; };
+
+ 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; };
+
+ 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; };
+
+ bool GetEnablePrintToFile() const { return m_printEnablePrintToFile; };
+ bool GetEnableSelection() const { return m_printEnableSelection; };
+ bool GetEnablePageNumbers() const { return m_printEnablePageNumbers; };
+ bool GetEnableHelp() const { return m_printEnableHelp; };
+
+ 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
-
+
#ifdef __WXMSW__
// Convert to/from the PRINTDLG structure
void ConvertToNative();
void ConvertFromNative();
void SetOwnerWindow(wxWindow* win);
- inline void* GetNativeData() const { return m_printDlgData; }
+ void* GetNativeData() const { return m_printDlgData; }
#endif
-
+
#ifdef __WXMSW__
void* m_printDlgData;
#endif
class WXDLLEXPORT wxPageSetupDialogData: public wxObject
{
DECLARE_DYNAMIC_CLASS(wxPageSetupDialogData)
-
+
public:
wxPageSetupDialogData();
wxPageSetupDialogData(const wxPageSetupDialogData& dialogData);
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; };
-
- 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; };
+ 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; };
+
+ 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.
// 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; };
-
- 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 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; };
+
+ 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
// paper id
void CalculateIdFromPaperSize();
-
+
// Use paper id in wxPrintData to set this object's paper size
void CalculatePaperSizeFromId();
-
+
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;
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c)
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __PRINTPSH__
#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
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c)
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __PRINTDLGH_G_
#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;
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);
void OnOK(wxCommandEvent& event);
-
+
virtual bool TransferDataFromWindow();
virtual bool TransferDataToWindow();
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:
wxTextCtrl* m_noCopiesText;
wxCheckBox* m_printToFileCheckBox;
wxCheckBox* m_collateCopiesCheckBox;
-
+
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)
-
+
public:
// There are no configuration options for the dialog, so we
// 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);
virtual bool TransferDataToWindow();
wxChoice *CreatePaperTypeChoice(int* x, int* y);
-
+
public:
wxRadioBox* m_orientationRadioBox;
wxTextCtrl* m_printerCommandText;
wxTextCtrl* m_printerOptionsText;
wxCheckBox* m_colourCheckBox;
wxChoice* m_paperTypeChoice;
-
+
#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();
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;
wxTextCtrl* m_marginRightText;
wxTextCtrl* m_marginBottomText;
wxChoice* m_paperTypeChoice;
-
+
static bool m_pageSetupDialogCancelled;
-
+
wxPageSetupData m_pageData;
-
+
+private:
DECLARE_EVENT_TABLE()
};
#ifndef _WX_LOG_H_
#define _WX_LOG_H_
-#ifdef __GNUG__
-#pragma interface "log.h"
+#ifdef __GNUG__
+ #pragma interface "log.h"
#endif
+#include <wx/dynarray.h>
+
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// different standard log levels (you may also define your own)
enum
{
- wxLOG_FatalError, // program can't continue, abort immediately
- wxLOG_Error, // a serious error, user must be informed about it
- wxLOG_Warning, // user is normally informed about it but may be ignored
- wxLOG_Message, // normal message (i.e. normal output of a non GUI app)
- wxLOG_Info, // informational message (a.k.a. 'Verbose')
- wxLOG_Status, // informational: might go to the status line of GUI app
- wxLOG_Debug, // never shown to the user, disabled in release mode
- wxLOG_Trace, // trace messages are also only enabled in debug mode
- wxLOG_Progress, // used for progress indicator (not yet)
- wxLOG_User = 100 // user defined levels start here
+ wxLOG_FatalError, // program can't continue, abort immediately
+ wxLOG_Error, // a serious error, user must be informed about it
+ wxLOG_Warning, // user is normally informed about it but may be ignored
+ wxLOG_Message, // normal message (i.e. normal output of a non GUI app)
+ wxLOG_Info, // informational message (a.k.a. 'Verbose')
+ wxLOG_Status, // informational: might go to the status line of GUI app
+ wxLOG_Debug, // never shown to the user, disabled in release mode
+ wxLOG_Trace, // trace messages are also only enabled in debug mode
+ wxLOG_Progress, // used for progress indicator (not yet)
+ 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)
#define wxTraceRefCount 0x0008 // trace various ref counting operations
#ifdef __WXMSW__
- #define wxTraceOleCalls 0x0100 // OLE interface calls
+ #define wxTraceOleCalls 0x0100 // OLE interface calls
#endif
typedef unsigned long wxTraceMask;
// ----------------------------------------------------------------------------
// 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>
// 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:
- // ctor
- wxLog();
-
- // these functions allow to completely disable all log messages
- // is logging disabled now?
- static bool IsEnabled() { return ms_doLog; }
- // change the flag state, return the previous one
- 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)
- {
- if ( IsEnabled() ) {
- wxLog *pLogger = GetActiveTarget();
- if ( pLogger )
- pLogger->DoLog(level, szString);
+ // ctor
+ wxLog();
+
+ // these functions allow to completely disable all log messages
+ // is logging disabled now?
+ static bool IsEnabled() { return ms_doLog; }
+ // change the flag state, return the previous one
+ static bool EnableLogging(bool doIt = TRUE)
+ { bool doLogOld = ms_doLog; ms_doLog = doIt; return doLogOld; }
+
+ // 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, 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)
- 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)
- 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
- 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
- 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; }
- // 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; }
-
- // 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; }
-
- // make dtor virtual for all derived classes
- virtual ~wxLog() { }
+
+ // 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)
+ 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)
+ 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
+ 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
+ void SetVerbose(bool bVerbose = TRUE) { m_bVerbose = bVerbose; }
+ // 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; }
+ // 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 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
- 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, 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, time_t t);
- // 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);
- // 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);
+private:
+ // static variables
+ // ----------------
- // helpers
- // put the time stamp in the current format into the string
- wxString TimeStamp() const;
+ static wxLog *ms_pLogger; // currently active log sink
+ static bool ms_doLog; // FALSE => all logging disabled
+ static bool ms_bAutoCreate; // create new log targets on demand?
-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 wxTraceMask ms_ulTraceMask; // controls wxLogTrace behaviour
+ static wxTraceMask ms_ulTraceMask; // controls wxLogTrace behaviour
+ static wxArrayString ms_aTraceMasks; // more powerful filter for wxLogTrace
};
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxLogStderr : public wxLog
{
public:
- // redirect log output to a FILE
- wxLogStderr(FILE *fp = (FILE *) NULL);
+ // redirect log output to a FILE
+ wxLogStderr(FILE *fp = (FILE *) NULL);
private:
- // implement sink function
- virtual void DoLogString(const char *szString);
+ // implement sink function
+ virtual void DoLogString(const char *szString, time_t t);
- FILE *m_fp;
+ FILE *m_fp;
};
#if wxUSE_STD_IOSTREAM
class WXDLLEXPORT wxLogStream : public wxLog
{
public:
- // redirect log output to an ostream
- wxLogStream(ostream *ostr = (ostream *) NULL);
+ // redirect log output to an ostream
+ wxLogStream(ostream *ostr = (ostream *) NULL);
protected:
- // implement sink function
- virtual void DoLogString(const char *szString);
+ // implement sink function
+ virtual void DoLogString(const char *szString, time_t t);
- // @@ using ptr here to avoid including <iostream.h> from this file
- ostream *m_ostr;
+ // using ptr here to avoid including <iostream.h> from this file
+ ostream *m_ostr;
};
#endif
class WXDLLEXPORT wxLogTextCtrl : public wxLogStream
{
public:
- // we just create an ostream from wxTextCtrl and use it in base class
- wxLogTextCtrl(wxTextCtrl *pTextCtrl);
- ~wxLogTextCtrl();
+ // we just create an ostream from wxTextCtrl and use it in base class
+ wxLogTextCtrl(wxTextCtrl *pTextCtrl);
+ ~wxLogTextCtrl();
};
#endif
class WXDLLEXPORT wxLogGui : public wxLog
{
public:
- // ctor
- wxLogGui();
+ // ctor
+ wxLogGui();
- // show all messages that were logged since the last Flush()
- virtual void Flush();
+ // show all messages that were logged since the last Flush()
+ 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;
+ wxArrayString m_aMessages;
+ wxArrayLong m_aTimes;
+ bool m_bErrors, // do we have any errors?
+ m_bWarnings; // any warnings?
};
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxLogWindow : public wxLog
{
public:
- wxLogWindow(wxFrame *pParent, // the parent frame (can be NULL)
- const char *szTitle, // the title of the frame
- bool bShow = TRUE, // show window immediately?
- bool bPassToOld = TRUE); // pass log messages to the old target?
- ~wxLogWindow();
+ wxLogWindow(wxFrame *pParent, // the parent frame (can be NULL)
+ const char *szTitle, // the title of the frame
+ bool bShow = TRUE, // show window immediately?
+ bool bPassToOld = TRUE); // pass log messages to the old target?
+ ~wxLogWindow();
- // window operations
+ // window operations
// show/hide the log window
- void Show(bool bShow = TRUE);
+ void Show(bool bShow = TRUE);
// retrieve the pointer to the frame
- wxFrame *GetFrame() const;
+ wxFrame *GetFrame() const;
- // accessors
+ // accessors
// the previous log target (may be NULL)
- wxLog *GetOldLog() const { return m_pOldLog; }
+ wxLog *GetOldLog() const { return m_pOldLog; }
// are we passing the messages to the previous log target?
- bool IsPassingMessages() const { return m_bPassMessages; }
+ bool IsPassingMessages() const { return m_bPassMessages; }
- // we can pass the messages to the previous log target (we're in this mode by
- // default: we collect all messages in the window, but also let the default
- // processing take place)
- void PassMessages(bool bDoPass) { m_bPassMessages = bDoPass; }
+ // we can pass the messages to the previous log target (we're in this mode by
+ // default: we collect all messages in the window, but also let the default
+ // processing take place)
+ void PassMessages(bool bDoPass) { m_bPassMessages = bDoPass; }
- // base class virtuals
+ // base class virtuals
// we don't need it ourselves, but we pass it to the previous logger
- virtual void Flush();
+ virtual void Flush();
- // overridables
+ // overridables
// called immediately after the log frame creation allowing for
// any extra initializations
- virtual void OnFrameCreate(wxFrame *frame);
+ virtual void OnFrameCreate(wxFrame *frame);
// called right before the log frame is going to be deleted
- virtual void OnFrameDelete(wxFrame *frame);
+ 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?
- wxLog *m_pOldLog; // previous log target
- wxLogFrame *m_pLogFrame; // the log frame
+ bool m_bPassMessages; // pass messages to m_pOldLog?
+ wxLog *m_pOldLog; // previous log target
+ wxLogFrame *m_pLogFrame; // the log frame
};
#endif // wxUSE_NOGUI
// example of usage:
/*
-void Foo() {
- wxFile file;
+ 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:
- wxLogNull() { m_flagOld = wxLog::EnableLogging(FALSE); }
- ~wxLogNull() { (void)wxLog::EnableLogging(m_flagOld); }
+ wxLogNull() { m_flagOld = wxLog::EnableLogging(FALSE); }
+ ~wxLogNull() { (void)wxLog::EnableLogging(m_flagOld); }
private:
- bool m_flagOld; // the previous value of the wxLog::ms_doLog
+ bool m_flagOld; // the previous value of the wxLog::ms_doLog
};
// ============================================================================
// -------------------
#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);
+ DECLARE_LOG_FUNCTION(Debug);
+
+ // first king of LogTrace is uncoditional: it doesn't check the level,
+ 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);
- // 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);
- DECLARE_LOG_FUNCTION2(Trace, wxTraceMask 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
- inline void wxLogDebug(const char *, ...) { }
- inline void wxLogTrace(const char *, ...) { }
- inline void wxLogTrace(wxTraceMask, const char *, ...) { }
+ // 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) \
- wxLogDebug("At %s(%d) '%s' failed with error %lx (%s).", \
- __FILE__, __LINE__, api, \
- rc, wxSysErrorMsg(rc))
- #define wxLogLastError(api) wxLogApiError(api, wxSysErrorCode())
+#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())
#else //!debug
- inline void wxLogApiError(const char *, long) { }
- inline void wxLogLastError(const char *) { }
+ inline void wxLogApiError(const char *, long) { }
+ inline void wxLogLastError(const char *) { }
#endif //debug/!debug
#endif // _WX_LOG_H_
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_PRNTBASEH__
#define _WX_PRNTBASEH__
#ifdef __GNUG__
-#pragma interface "prntbase.h"
+ #pragma interface "prntbase.h"
#endif
#include "wx/defs.h"
/*
* Represents the printer: manages printing a wxPrintout object
*/
-
+
class WXDLLEXPORT wxPrinterBase: public wxObject
{
- DECLARE_CLASS(wxPrinterBase)
+ DECLARE_CLASS(wxPrinterBase)
public:
- wxPrinterBase(wxPrintDialogData *data = (wxPrintDialogData *) NULL);
- ~wxPrinterBase();
+ wxPrinterBase(wxPrintDialogData *data = (wxPrintDialogData *) NULL);
+ virtual ~wxPrinterBase();
+
+ virtual wxWindow *CreateAbortWindow(wxWindow *parent, wxPrintout *printout);
+ virtual void ReportError(wxWindow *parent, wxPrintout *printout, char *message);
- 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
+ ///////////////////////////////////////////////////////////////////////////
+ // OVERRIDES
- virtual bool Setup(wxWindow *parent) = 0;
- virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = TRUE) = 0;
- virtual wxDC* PrintDialog(wxWindow *parent) = 0;
+ virtual bool Setup(wxWindow *parent) = 0;
+ virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = TRUE) = 0;
+ virtual wxDC* PrintDialog(wxWindow *parent) = 0;
protected:
- wxPrintDialogData m_printDialogData;
- wxPrintout* m_currentPrintout;
+ wxPrintDialogData m_printDialogData;
+ wxPrintout* m_currentPrintout;
+
public:
- static wxWindow* sm_abortWindow;
- static bool sm_abortIt;
+ static wxWindow* sm_abortWindow;
+ static bool sm_abortIt;
};
* and passes it to a wxPrinter object for printing, or a wxPrintPreview
* object for previewing.
*/
-
+
class WXDLLEXPORT wxPrintout: public wxObject
{
- DECLARE_ABSTRACT_CLASS(wxPrintout)
+DECLARE_ABSTRACT_CLASS(wxPrintout)
public:
- wxPrintout(const wxString& title = "Printout");
- ~wxPrintout();
+ wxPrintout(const wxString& title = "Printout");
+ virtual ~wxPrintout();
- virtual bool OnBeginDocument(int startPage, int endPage);
- virtual void OnEndDocument();
- virtual void OnBeginPrinting();
- virtual void OnEndPrinting();
+ virtual bool OnBeginDocument(int startPage, int endPage);
+ virtual void OnEndDocument();
+ virtual void OnBeginPrinting();
+ virtual void OnEndPrinting();
- // Guaranteed to be before any other functions are called
- inline virtual void OnPreparePrinting() { }
+ // Guaranteed to be before any other functions are called
+ 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);
+ 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;
- wxDC* m_printoutDC;
+ wxString m_printoutTitle;
+ wxDC* m_printoutDC;
- int m_pageWidthPixels;
- int m_pageHeightPixels;
+ int m_pageWidthPixels;
+ int m_pageHeightPixels;
- int m_pageWidthMM;
- int m_pageHeightMM;
+ int m_pageWidthMM;
+ int m_pageHeightMM;
- int m_PPIScreenX;
- int m_PPIScreenY;
- int m_PPIPrinterX;
- int m_PPIPrinterY;
+ int m_PPIScreenX;
+ int m_PPIScreenY;
+ int m_PPIPrinterX;
+ int m_PPIPrinterY;
- bool m_isPreview;
+ bool m_isPreview;
};
/*
* wxPreviewCanvas
* Canvas upon which a preview is drawn.
*/
-
+
class WXDLLEXPORT wxPreviewCanvas: public wxScrolledWindow
{
- DECLARE_CLASS(wxPreviewCanvas)
+ 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();
+ 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);
+ void OnPaint(wxPaintEvent& event);
- // Responds to colour changes
- void OnSysColourChanged(wxSysColourChangedEvent& event);
+ // Responds to colour changes
+ void OnSysColourChanged(wxSysColourChangedEvent& event);
private:
- wxPrintPreviewBase* m_printPreview;
+ wxPrintPreviewBase* m_printPreview;
-DECLARE_EVENT_TABLE()
+ DECLARE_EVENT_TABLE()
};
/*
class WXDLLEXPORT wxPreviewFrame: public wxFrame
{
- DECLARE_CLASS(wxPreviewFrame)
+ 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();
-
- void OnCloseWindow(wxCloseEvent& event);
- virtual void Initialize();
- virtual void CreateCanvas();
- virtual void CreateControlBar();
+ 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);
+ virtual void Initialize();
+ virtual void CreateCanvas();
+ virtual void CreateControlBar();
protected:
- wxWindow* m_previewCanvas;
- wxPreviewControlBar* m_controlBar;
- wxPrintPreviewBase* m_printPreview;
+ wxWindow* m_previewCanvas;
+ wxPreviewControlBar* m_controlBar;
+ wxPrintPreviewBase* m_printPreview;
-DECLARE_EVENT_TABLE()
+private:
+ DECLARE_EVENT_TABLE()
};
/*
class WXDLLEXPORT wxPreviewControlBar: public wxPanel
{
- DECLARE_CLASS(wxPreviewControlBar)
+ 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();
-
- virtual void CreateButtons();
- virtual void SetZoomControl(int zoom);
- virtual int GetZoomControl();
- inline virtual wxPrintPreviewBase *GetPrintPreview() const { return m_printPreview; }
-
- void OnPrint(wxCommandEvent& event);
- void OnWindowClose(wxCommandEvent& event);
- void OnNext(wxCommandEvent& event);
- void OnPrevious(wxCommandEvent& event);
- void OnZoom(wxCommandEvent& event);
- void OnPaint(wxPaintEvent& event);
+ 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();
+ virtual wxPrintPreviewBase *GetPrintPreview() const
+ { return m_printPreview; }
+
+ void OnPrint(wxCommandEvent& event);
+ void OnWindowClose(wxCommandEvent& event);
+ void OnNext(wxCommandEvent& event);
+ void OnPrevious(wxCommandEvent& event);
+ void OnZoom(wxCommandEvent& event);
+ void OnPaint(wxPaintEvent& event);
protected:
- wxPrintPreviewBase* m_printPreview;
- wxButton* m_closeButton;
- wxButton* m_nextPageButton;
- wxButton* m_previousPageButton;
- wxButton* m_printButton;
- wxChoice* m_zoomControl;
- long m_buttonFlags;
-
-DECLARE_EVENT_TABLE()
+ wxPrintPreviewBase* m_printPreview;
+ wxButton* m_closeButton;
+ wxButton* m_nextPageButton;
+ wxButton* m_previousPageButton;
+ wxButton* m_printButton;
+ wxChoice* m_zoomControl;
+ long m_buttonFlags;
+
+private:
+ DECLARE_EVENT_TABLE()
};
/*
* wxPrintPreview
* Programmer creates an object of this class to preview a wxPrintout.
*/
-
+
class WXDLLEXPORT wxPrintPreviewBase: public wxObject
{
- DECLARE_CLASS(wxPrintPreviewBase)
+ 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; };
+ virtual bool SetCurrentPage(int pageNum);
+ 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);
+ // The preview canvas should call this from OnPaint
+ virtual bool PaintPage(wxWindow *canvas, wxDC& dc);
- // This draws a blank page onto the preview canvas
- virtual bool DrawBlankPage(wxWindow *canvas, wxDC& dc);
+ // 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.
- virtual bool RenderPage(int pageNum);
+ // 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; };
+ virtual void SetZoom(int percent);
+ 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
+ ///////////////////////////////////////////////////////////////////////////
+ // OVERRIDES
- // If we own a wxPrintout that can be used for printing, this
- // will invoke the actual printing procedure. Called
- // by the wxPreviewControlBar.
- virtual bool Print(bool interactive) = 0;
+ // If we own a wxPrintout that can be used for printing, this
+ // will invoke the actual printing procedure. Called
+ // by the wxPreviewControlBar.
+ virtual bool Print(bool interactive) = 0;
- // Calculate scaling that needs to be done to get roughly
- // the right scaling for the screen pretending to be
- // the currently selected printer.
- virtual void DetermineScaling() = 0;
+ // Calculate scaling that needs to be done to get roughly
+ // the right scaling for the screen pretending to be
+ // the currently selected printer.
+ virtual void DetermineScaling() = 0;
protected:
- wxPrintDialogData m_printDialogData;
- wxWindow* m_previewCanvas;
- wxFrame* m_previewFrame;
- wxBitmap* m_previewBitmap;
- wxPrintout* m_previewPrintout;
- wxPrintout* m_printPrintout;
- int m_currentPage;
- int m_currentZoom;
- float m_previewScale;
- int m_topMargin;
- int m_leftMargin;
- int m_pageWidth;
- int m_pageHeight;
- int m_minPage;
- int m_maxPage;
- protected:
- bool m_isOk;
+ wxPrintDialogData m_printDialogData;
+ wxWindow* m_previewCanvas;
+ wxFrame* m_previewFrame;
+ wxBitmap* m_previewBitmap;
+ wxPrintout* m_previewPrintout;
+ wxPrintout* m_printPrintout;
+ int m_currentPage;
+ int m_currentZoom;
+ float m_previewScale;
+ int m_topMargin;
+ int m_leftMargin;
+ int m_pageWidth;
+ int m_pageHeight;
+ int m_minPage;
+ int m_maxPage;
+
+ bool m_isOk;
+
+private:
+ void Init(wxPrintout *printout, wxPrintout *printoutForPrinting);
};
/*
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)
- {
- }
-
- void OnCancel(wxCommandEvent& event);
+ 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)
+ {
+ }
+
+ void OnCancel(wxCommandEvent& event);
- DECLARE_EVENT_TABLE()
+private:
+ DECLARE_EVENT_TABLE()
};
#endif
#ifndef _WX_UTILSH__
#define _WX_UTILSH__
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
#ifdef __GNUG__
-#pragma interface "utils.h"
+ #pragma interface "utils.h"
#endif
#include "wx/setup.h"
#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>
+// ----------------------------------------------------------------------------
+// Forward declaration
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxProcess;
+class WXDLLEXPORT wxFrame;
+
+// FIXME should use wxStricmp() instead
#ifdef __GNUWIN32__
-#define stricmp strcasecmp
-#define strnicmp strncasecmp
+ #define stricmp strcasecmp
+ #define strnicmp strncasecmp
#endif
-// Forward declaration
-class WXDLLEXPORT wxFrame;
+// ----------------------------------------------------------------------------
+// Macros
+// ----------------------------------------------------------------------------
-// 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))
+#define wxMax(a,b) (((a) > (b)) ? (a) : (b))
+#define wxMin(a,b) (((a) < (b)) ? (a) : (b))
-// Return a string with the current date/time
-WXDLLEXPORT wxString wxNow();
+// ----------------------------------------------------------------------------
+// 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);
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);
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
+
+ // further signals are different in meaning between different Unix systems
+};
-WXDLLEXPORT int wxKill(long pid, int sig=wxSIGTERM);
+// 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
// 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 FQDN
+WXDLLEXPORT wxString wxGetFullHostName();
-// Get user ID e.g. jacs
+// 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.
// 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();
// 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 ...) ;
-
-// Sound the bell
-WXDLLEXPORT void wxBell(void) ;
-
-// Get OS version
-WXDLLEXPORT int wxGetOsVersion(int *majorVsn= (int *) NULL,int *minorVsn= (int *) NULL) ;
+// Check whether this window wants to process messages, e.g. Stop button
+// in long calculations.
+WXDLLEXPORT bool wxCheckForInterrupt(wxWindow *wnd);
+
+// Consume all events until no more left
+WXDLLEXPORT void wxFlushEvents();
+
+// ----------------------------------------------------------------------------
+// Cursors
+// ----------------------------------------------------------------------------
// Set the cursor to the busy cursor for all windows
class WXDLLEXPORT wxCursor;
// Restore cursor to normal
WXDLLEXPORT void wxEndBusyCursor();
-
+
// TRUE if we're between the above two calls
WXDLLEXPORT bool wxIsBusy();
{ 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;
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);
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.
// 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__
typedef struct wx_hsv {
int h,s,v;
} wxHSV;
-
+
#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);