1999-03-26 16:14:01 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: paper.h
|
|
|
|
// Purpose: Paper database types and classes
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Julian Smart
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_PAPERH__
|
|
|
|
#define _WX_PAPERH__
|
|
|
|
|
2003-08-09 08:38:21 -04:00
|
|
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
1999-03-26 16:14:01 -05:00
|
|
|
#pragma interface "paper.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/defs.h"
|
|
|
|
#include "wx/event.h"
|
|
|
|
#include "wx/cmndata.h"
|
2000-07-15 15:51:35 -04:00
|
|
|
#include "wx/intl.h"
|
1999-03-26 16:14:01 -05:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Paper type: see defs.h for wxPaperSize enum.
|
2003-06-26 13:29:33 -04:00
|
|
|
* A wxPrintPaperType can have an id and a name, or just a name and wxPAPER_NONE,
|
1999-03-26 16:14:01 -05:00
|
|
|
* so you can add further paper types without needing new ids.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef __WXMSW__
|
|
|
|
#define WXADDPAPER(paperId, platformId, name, w, h) AddPaperType(paperId, platformId, name, w, h)
|
|
|
|
#else
|
|
|
|
#define WXADDPAPER(paperId, platformId, name, w, h) AddPaperType(paperId, 0, name, w, h)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxPrintPaperType: public wxObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxPrintPaperType();
|
|
|
|
|
|
|
|
// platformId is a platform-specific id, such as in Windows, DMPAPER_...
|
|
|
|
wxPrintPaperType(wxPaperSize paperId, int platformId, const wxString& name, int w, int h);
|
|
|
|
|
2000-07-15 15:51:35 -04:00
|
|
|
inline wxString GetName() const { return wxGetTranslation(m_paperName); }
|
1999-03-26 16:14:01 -05:00
|
|
|
inline wxPaperSize GetId() const { return m_paperId; }
|
|
|
|
inline int GetPlatformId() const { return m_platformId; }
|
|
|
|
|
|
|
|
// Get width and height in tenths of a millimetre
|
|
|
|
inline int GetWidth() const { return m_width; }
|
|
|
|
inline int GetHeight() const { return m_height; }
|
|
|
|
|
|
|
|
// Get size in tenths of a millimetre
|
|
|
|
inline wxSize GetSize() const { return wxSize(m_width, m_height); }
|
|
|
|
|
|
|
|
// Get size in a millimetres
|
|
|
|
inline wxSize GetSizeMM() const { return wxSize(m_width/10, m_height/10); }
|
|
|
|
|
|
|
|
// Get width and height in device units (1/72th of an inch)
|
|
|
|
wxSize GetSizeDeviceUnits() const ;
|
|
|
|
|
|
|
|
public:
|
|
|
|
wxPaperSize m_paperId;
|
|
|
|
int m_platformId;
|
|
|
|
int m_width; // In tenths of a millimetre
|
|
|
|
int m_height; // In tenths of a millimetre
|
|
|
|
wxString m_paperName;
|
|
|
|
|
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxPrintPaperType)
|
|
|
|
};
|
|
|
|
|
2003-07-10 15:55:12 -04:00
|
|
|
class WXDLLEXPORT wxStringToPrintPaperTypeHashMap;
|
|
|
|
class WXDLLEXPORT wxPrintPaperTypeList;
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxPrintPaperDatabase
|
1999-03-26 16:14:01 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxPrintPaperDatabase();
|
2003-07-10 15:55:12 -04:00
|
|
|
~wxPrintPaperDatabase();
|
1999-03-26 16:14:01 -05:00
|
|
|
|
|
|
|
void CreateDatabase();
|
|
|
|
void ClearDatabase();
|
|
|
|
|
|
|
|
void AddPaperType(wxPaperSize paperId, const wxString& name, int w, int h);
|
|
|
|
void AddPaperType(wxPaperSize paperId, int platformId, const wxString& name, int w, int h);
|
|
|
|
|
|
|
|
// Find by name
|
|
|
|
wxPrintPaperType *FindPaperType(const wxString& name);
|
|
|
|
|
|
|
|
// Find by size id
|
|
|
|
wxPrintPaperType *FindPaperType(wxPaperSize id);
|
|
|
|
|
|
|
|
// Find by platform id
|
|
|
|
wxPrintPaperType *FindPaperTypeByPlatformId(int id);
|
|
|
|
|
|
|
|
// Find by size
|
|
|
|
wxPrintPaperType *FindPaperType(const wxSize& size);
|
|
|
|
|
|
|
|
// Convert name to size id
|
|
|
|
wxPaperSize ConvertNameToId(const wxString& name);
|
|
|
|
|
|
|
|
// Convert size id to name
|
|
|
|
wxString ConvertIdToName(wxPaperSize paperId);
|
|
|
|
|
|
|
|
// Get the paper size
|
|
|
|
wxSize GetSize(wxPaperSize paperId);
|
|
|
|
|
|
|
|
// Get the paper size
|
|
|
|
wxPaperSize GetSize(const wxSize& size);
|
|
|
|
|
2003-07-10 15:55:12 -04:00
|
|
|
//
|
|
|
|
wxPrintPaperType* Item(size_t index) const;
|
|
|
|
size_t GetCount() const;
|
1999-03-26 16:14:01 -05:00
|
|
|
private:
|
2003-07-10 15:55:12 -04:00
|
|
|
wxStringToPrintPaperTypeHashMap* m_map;
|
|
|
|
wxPrintPaperTypeList* m_list;
|
|
|
|
// DECLARE_DYNAMIC_CLASS(wxPrintPaperDatabase)
|
1999-03-26 16:14:01 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
WXDLLEXPORT_DATA(extern wxPrintPaperDatabase*) wxThePrintPaperDatabase;
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
// _WX_PAPERH__
|