]> git.saurik.com Git - wxWidgets.git/blame - include/wx/paper.h
*** empty log message ***
[wxWidgets.git] / include / wx / paper.h
CommitLineData
33d28952
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: paper.h
3// Purpose: Paper database types and classes
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_PAPERH__
13#define _WX_PAPERH__
14
15#ifdef __GNUG__
16#pragma interface "paper.h"
17#endif
18
19#include "wx/defs.h"
20#include "wx/event.h"
21#include "wx/cmndata.h"
22
23/*
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.
27 */
28
29#ifdef __WXMSW__
30#define WXADDPAPER(paperId, platformId, name, w, h) AddPaperType(paperId, platformId, name, w, h)
31#else
32#define WXADDPAPER(paperId, platformId, name, w, h) AddPaperType(paperId, 0, name, w, h)
33#endif
34
35class WXDLLEXPORT wxPrintPaperType: public wxObject
36{
37public:
38 wxPrintPaperType();
39
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);
42
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; }
46
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; }
50
51 // Get size in tenths of a millimetre
52 inline wxSize GetSize() const { return wxSize(m_width, m_height); }
53
54 // Get size in a millimetres
55 inline wxSize GetSizeMM() const { return wxSize(m_width/10, m_height/10); }
56
57 // Get width and height in device units (1/72th of an inch)
58 wxSize GetSizeDeviceUnits() const ;
59
60public:
61 wxPaperSize m_paperId;
62 int m_platformId;
63 int m_width; // In tenths of a millimetre
64 int m_height; // In tenths of a millimetre
65 wxString m_paperName;
66
67private:
68 DECLARE_DYNAMIC_CLASS(wxPrintPaperType)
69};
70
71class WXDLLEXPORT wxPrintPaperDatabase: public wxList
72{
73public:
74 wxPrintPaperDatabase();
75
76 void CreateDatabase();
77 void ClearDatabase();
78
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);
81
82 // Find by name
83 wxPrintPaperType *FindPaperType(const wxString& name);
84
85 // Find by size id
86 wxPrintPaperType *FindPaperType(wxPaperSize id);
87
88 // Find by platform id
89 wxPrintPaperType *FindPaperTypeByPlatformId(int id);
90
91 // Find by size
92 wxPrintPaperType *FindPaperType(const wxSize& size);
93
94 // Convert name to size id
95 wxPaperSize ConvertNameToId(const wxString& name);
96
97 // Convert size id to name
98 wxString ConvertIdToName(wxPaperSize paperId);
99
100 // Get the paper size
101 wxSize GetSize(wxPaperSize paperId);
102
103 // Get the paper size
104 wxPaperSize GetSize(const wxSize& size);
105
106private:
107 DECLARE_DYNAMIC_CLASS(wxPrintPaperDatabase)
108};
109
110WXDLLEXPORT_DATA(extern wxPrintPaperDatabase*) wxThePrintPaperDatabase;
111
112
113#endif
114 // _WX_PAPERH__