1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Paper database types and classes
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
16 #pragma interface "paper.h"
21 #include "wx/cmndata.h"
24 * Paper type: see defs.h for wxPaperSize enum.
25 * A wxPrintePaperType can have an id and a name, or just a name and wxPAPER_NONE,
26 * so you can add further paper types without needing new ids.
30 #define WXADDPAPER(paperId, platformId, name, w, h) AddPaperType(paperId, platformId, name, w, h)
32 #define WXADDPAPER(paperId, platformId, name, w, h) AddPaperType(paperId, 0, name, w, h)
35 class WXDLLEXPORT wxPrintPaperType
: public wxObject
40 // platformId is a platform-specific id, such as in Windows, DMPAPER_...
41 wxPrintPaperType(wxPaperSize paperId
, int platformId
, const wxString
& name
, int w
, int h
);
43 inline const wxString
& GetName() const { return m_paperName
; }
44 inline wxPaperSize
GetId() const { return m_paperId
; }
45 inline int GetPlatformId() const { return m_platformId
; }
47 // Get width and height in tenths of a millimetre
48 inline int GetWidth() const { return m_width
; }
49 inline int GetHeight() const { return m_height
; }
51 // Get size in tenths of a millimetre
52 inline wxSize
GetSize() const { return wxSize(m_width
, m_height
); }
54 // Get size in a millimetres
55 inline wxSize
GetSizeMM() const { return wxSize(m_width
/10, m_height
/10); }
57 // Get width and height in device units (1/72th of an inch)
58 wxSize
GetSizeDeviceUnits() const ;
61 wxPaperSize m_paperId
;
63 int m_width
; // In tenths of a millimetre
64 int m_height
; // In tenths of a millimetre
68 DECLARE_DYNAMIC_CLASS(wxPrintPaperType
)
71 class WXDLLEXPORT wxPrintPaperDatabase
: public wxList
74 wxPrintPaperDatabase();
76 void CreateDatabase();
79 void AddPaperType(wxPaperSize paperId
, const wxString
& name
, int w
, int h
);
80 void AddPaperType(wxPaperSize paperId
, int platformId
, const wxString
& name
, int w
, int h
);
83 wxPrintPaperType
*FindPaperType(const wxString
& name
);
86 wxPrintPaperType
*FindPaperType(wxPaperSize id
);
88 // Find by platform id
89 wxPrintPaperType
*FindPaperTypeByPlatformId(int id
);
92 wxPrintPaperType
*FindPaperType(const wxSize
& size
);
94 // Convert name to size id
95 wxPaperSize
ConvertNameToId(const wxString
& name
);
97 // Convert size id to name
98 wxString
ConvertIdToName(wxPaperSize paperId
);
100 // Get the paper size
101 wxSize
GetSize(wxPaperSize paperId
);
103 // Get the paper size
104 wxPaperSize
GetSize(const wxSize
& size
);
107 DECLARE_DYNAMIC_CLASS(wxPrintPaperDatabase
)
110 WXDLLEXPORT_DATA(extern wxPrintPaperDatabase
*) wxThePrintPaperDatabase
;