Made wxGTK dcps.cpp generic.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1447 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
1999-01-22 11:06:20 +00:00
parent cd5bf2a6e3
commit bf38cbffd5
21 changed files with 763 additions and 4514 deletions

7
include/wx/dcps.h Normal file
View File

@@ -0,0 +1,7 @@
#ifndef _WX_DCPS_H_BASE_
#define _WX_DCPS_H_BASE_
#include "wx/generic/dcpsg.h"
#endif

View File

@@ -1,62 +1,45 @@
/////////////////////////////////////////////////////////////////////////////
// Name: postscrp.h
// Name: dcps.h
// Purpose: wxPostScriptDC class
// Author: Julian Smart and others
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem
// Copyright: (c) Julian Smart, Robert Roebling and Markus Holzem
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_POSTSCRPH__
#define _WX_POSTSCRPH__
#ifndef _WX_DCPSG_H_
#define _WX_DCPSG_H_
#ifdef __GNUG__
#pragma interface "postscrp.h"
#pragma interface
#endif
#include "wx/dc.h"
#include "wx/dialog.h"
#include "wx/module.h"
#if wxUSE_POSTSCRIPT
// A module to allow initialization/cleanup of PostScript-related
// things without calling these functions from app.cpp.
#include "wx/dialog.h"
#include "wx/module.h"
#include <fstream.h>
class WXDLLEXPORT wxPostScriptModule: public wxModule
{
DECLARE_DYNAMIC_CLASS(wxPostScriptModule)
public:
wxPostScriptModule() {}
bool OnInit();
void OnExit();
};
#if wxUSE_IOSTREAMH
# include <fstream.h>
#else
# include <fstream>
# ifdef _MSC_VER
using namespace std;
# endif
#endif
//-----------------------------------------------------------------------------
// classes
//-----------------------------------------------------------------------------
#if defined(__WXGTK__) || defined(__WXMOTIF__)
class wxPostScriptDC;
// wxGTK has its own wxPostscriptDC
#include "wx/gtk/dcps.h"
#else
//-----------------------------------------------------------------------------
// wxPostScriptDC
//-----------------------------------------------------------------------------
class WXDLLEXPORT wxPostScriptDC: public wxDC
{
DECLARE_DYNAMIC_CLASS(wxPostScriptDC)
public:
// Create a printer DC
public:
wxPostScriptDC();
wxPostScriptDC(const wxString& output, bool interactive = TRUE, wxWindow *parent = (wxWindow *) NULL);
@@ -64,10 +47,12 @@ class WXDLLEXPORT wxPostScriptDC: public wxDC
bool Create(const wxString& output, bool interactive = TRUE, wxWindow *parent = (wxWindow *) NULL);
virtual bool Ok() const;
virtual bool PrinterDialog(wxWindow *parent = (wxWindow *) NULL);
inline virtual void BeginDrawing(void) {} ;
inline virtual void EndDrawing(void) {} ;
virtual void BeginDrawing() {}
virtual void EndDrawing() {}
void FloodFill(long x1, long y1, const wxColour &col, int style=wxFLOOD_SURFACE) ;
bool GetPixel(long x1, long y1, wxColour *col) const;
@@ -93,17 +78,22 @@ class WXDLLEXPORT wxPostScriptDC: public wxDC
void DrawSpline(wxList *points);
bool Blit(long xdest, long ydest, long width, long height,
wxDC *source, long xsrc, long ysrc, int rop = wxCOPY, bool useMask = FALSE);
inline bool CanDrawBitmap(void) const { return TRUE; }
void DrawIcon( const wxIcon& icon, long x, long y );
void DrawBitmap( const wxBitmap& bitmap, long x, long y, bool useMask=FALSE );
void DrawText(const wxString& text, long x, long y, bool use16 = FALSE);
void Clear();
void SetFont(const wxFont& font);
void SetPen(const wxPen& pen);
void SetBrush(const wxBrush& brush);
void SetLogicalFunction(int function);
void SetBackground(const wxBrush& brush);
void SetFont( const wxFont& font );
void SetPen( const wxPen& pen );
void SetBrush( const wxBrush& brush );
void SetLogicalFunction( int function );
void SetBackground( const wxBrush& brush );
void SetClippingRegion(long x, long y, long width, long height);
void SetClippingRegion( const wxRegion &region );
void DestroyClippingRegion();
@@ -115,52 +105,50 @@ class WXDLLEXPORT wxPostScriptDC: public wxDC
long GetCharHeight();
long GetCharWidth();
inline bool CanGetTextExtent(void) const { return FALSE; }
void GetTextExtent(const wxString& string, long *x, long *y,
long *descent = (long *) NULL,
long *externalLeading = (long *) NULL,
wxFont *theFont = (wxFont *) NULL, bool use16 = FALSE);
virtual void SetLogicalOrigin(long x, long y);
virtual void CalcBoundingBox(long x, long y);
void SetMapMode(int mode);
void SetUserScale(double x, double y);
long DeviceToLogicalX(int x) const;
long DeviceToLogicalY(int y) const;
long DeviceToLogicalXRel(int x) const;
long DeviceToLogicalYRel(int y) const;
long LogicalToDeviceX(long x) const;
long LogicalToDeviceY(long y) const;
long LogicalToDeviceXRel(long x) const;
long LogicalToDeviceYRel(long y) const;
bool Blit(long xdest, long ydest, long width, long height,
wxDC *source, long xsrc, long ysrc, int rop = wxCOPY, bool useMask = FALSE);
inline bool CanGetTextExtent(void) const { return FALSE; }
inline bool CanDrawBitmap(void) const { return FALSE; }
void GetSize(int* width, int* height) const;
void GetSizeMM(long *width, long *height) const;
inline void SetBackgroundMode(int WXUNUSED(mode)) {};
inline void SetPalette(const wxPalette& WXUNUSED(palette)) {}
inline ofstream *GetStream(void) const { return m_pstream; }
inline int GetYOrigin(void) const { return m_yOrigin; }
void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
void SetDeviceOrigin( long x, long y );
void SetupCTM();
inline void SetBackgroundMode(int WXUNUSED(mode)) {}
inline void SetPalette(const wxPalette& WXUNUSED(palette)) {}
inline ofstream *GetStream(void) const { return m_pstream; }
protected:
int m_yOrigin; // For EPS
ofstream * m_pstream; // PostScript output stream
wxString m_title;
unsigned char m_currentRed;
unsigned char m_currentGreen;
unsigned char m_currentBlue;
double m_scaleFactor;
int m_pageNumber;
bool m_clipping;
double m_underlinePosition;
double m_underlineThickness;
};
#endif
// __WXGTK__
// A module to allow initialization/cleanup of PostScript-related
// things without calling these functions from app.cpp.
class WXDLLEXPORT wxPostScriptModule: public wxModule
{
DECLARE_DYNAMIC_CLASS(wxPostScriptModule)
public:
wxPostScriptModule() {}
bool OnInit();
void OnExit();
};
// TODO Needed? Should perhaps use wxGenericPrintDialog instead.
#if 1
#define wxID_PRINTER_COMMAND 1
#define wxID_PRINTER_OPTIONS 2
#define wxID_PRINTER_ORIENTATION 3
@@ -180,7 +168,7 @@ public:
virtual int ShowModal(void) ;
};
#endif
// Print Orientation (Should also add Left, Right)
enum {
@@ -319,10 +307,8 @@ private:
WXDLLEXPORT_DATA(extern wxPrintPaperDatabase*) wxThePrintPaperDatabase;
#endif
// wxUSE_POSTSCRIPT
#endif
// wxUSE_POSTSCRIPT
#endif
// _WX_POSTSCRPH__
// _WX_DCPSG_H_

View File

@@ -21,7 +21,11 @@
#include "wx/dialog.h"
#include "wx/dc.h"
#include "wx/cmndata.h"
#include "wx/postscrp.h"
#include "wx/dialog.h"
#if wxUSE_POSTSCRIPT
#include "wx/dcps.h"
#endif
class WXDLLEXPORT wxTextCtrl;
class WXDLLEXPORT wxButton;

View File

@@ -18,7 +18,10 @@
#include "wx/object.h"
#include "wx/string.h"
#include "wx/gdicmn.h"
#if wxUSE_STREAMS
#include "wx/stream.h"
#endif
//-----------------------------------------------------------------------------
// classes
@@ -44,8 +47,10 @@ class WXDLLEXPORT wxImageHandler: public wxObject
public:
wxImageHandler() { m_name = ""; m_extension = ""; m_type = 0; }
#if wxUSE_STREAMS
virtual bool LoadFile( wxImage *image, wxInputStream& stream );
virtual bool SaveFile( wxImage *image, wxOutputStream& stream );
#endif
inline void SetName(const wxString& name) { m_name = name; }
inline void SetExtension(const wxString& ext) { m_extension = ext; }
@@ -79,8 +84,11 @@ public:
m_type = wxBITMAP_TYPE_PNG;
};
#if wxUSE_STREAMS
virtual bool LoadFile( wxImage *image, wxInputStream& stream );
virtual bool SaveFile( wxImage *image, wxOutputStream& stream );
#endif
};
#endif
@@ -101,7 +109,9 @@ public:
m_type = wxBITMAP_TYPE_BMP;
};
#if wxUSE_STREAMS
virtual bool LoadFile( wxImage *image, wxInputStream& stream );
#endif
};
//-----------------------------------------------------------------------------
@@ -140,9 +150,16 @@ public:
unsigned char GetBlue( int x, int y );
virtual bool LoadFile( const wxString& name, long type = wxBITMAP_TYPE_PNG );
#if wxUSE_STREAMS
virtual bool LoadFile( wxInputStream& stream, long type = wxBITMAP_TYPE_PNG );
#endif
virtual bool SaveFile( const wxString& name, int type );
#if wxUSE_STREAMS
virtual bool SaveFile( wxOutputStream& stream, int type );
#endif
bool Ok() const;
int GetWidth() const;

View File

@@ -134,6 +134,9 @@
#define wxUSE_STD_IOSTREAM 1
// Use standard C++ streams if 1. If 0, use wxWin
// streams implementation.
#define wxUSE_STREAMS 1
// Use wxStream implementation within wxWindows code
/*
* Finer detail
*