]> git.saurik.com Git - wxWidgets.git/blob - include/wx/paper.h
Got rid of VisualAge true/false defs with db class fixes.
[wxWidgets.git] / include / wx / paper.h
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 #include "wx/intl.h"
23
24 /*
25 * Paper type: see defs.h for wxPaperSize enum.
26 * A wxPrintePaperType can have an id and a name, or just a name and wxPAPER_NONE,
27 * so you can add further paper types without needing new ids.
28 */
29
30 #ifdef __WXMSW__
31 #define WXADDPAPER(paperId, platformId, name, w, h) AddPaperType(paperId, platformId, name, w, h)
32 #else
33 #define WXADDPAPER(paperId, platformId, name, w, h) AddPaperType(paperId, 0, name, w, h)
34 #endif
35
36 class WXDLLEXPORT wxPrintPaperType: public wxObject
37 {
38 public:
39 wxPrintPaperType();
40
41 // platformId is a platform-specific id, such as in Windows, DMPAPER_...
42 wxPrintPaperType(wxPaperSize paperId, int platformId, const wxString& name, int w, int h);
43
44 inline wxString GetName() const { return wxGetTranslation(m_paperName); }
45 inline wxPaperSize GetId() const { return m_paperId; }
46 inline int GetPlatformId() const { return m_platformId; }
47
48 // Get width and height in tenths of a millimetre
49 inline int GetWidth() const { return m_width; }
50 inline int GetHeight() const { return m_height; }
51
52 // Get size in tenths of a millimetre
53 inline wxSize GetSize() const { return wxSize(m_width, m_height); }
54
55 // Get size in a millimetres
56 inline wxSize GetSizeMM() const { return wxSize(m_width/10, m_height/10); }
57
58 // Get width and height in device units (1/72th of an inch)
59 wxSize GetSizeDeviceUnits() const ;
60
61 public:
62 wxPaperSize m_paperId;
63 int m_platformId;
64 int m_width; // In tenths of a millimetre
65 int m_height; // In tenths of a millimetre
66 wxString m_paperName;
67
68 private:
69 DECLARE_DYNAMIC_CLASS(wxPrintPaperType)
70 };
71
72 class WXDLLEXPORT wxPrintPaperDatabase: public wxList
73 {
74 public:
75 wxPrintPaperDatabase();
76
77 void CreateDatabase();
78 void ClearDatabase();
79
80 void AddPaperType(wxPaperSize paperId, const wxString& name, int w, int h);
81 void AddPaperType(wxPaperSize paperId, int platformId, const wxString& name, int w, int h);
82
83 // Find by name
84 wxPrintPaperType *FindPaperType(const wxString& name);
85
86 // Find by size id
87 wxPrintPaperType *FindPaperType(wxPaperSize id);
88
89 // Find by platform id
90 wxPrintPaperType *FindPaperTypeByPlatformId(int id);
91
92 // Find by size
93 wxPrintPaperType *FindPaperType(const wxSize& size);
94
95 // Convert name to size id
96 wxPaperSize ConvertNameToId(const wxString& name);
97
98 // Convert size id to name
99 wxString ConvertIdToName(wxPaperSize paperId);
100
101 // Get the paper size
102 wxSize GetSize(wxPaperSize paperId);
103
104 // Get the paper size
105 wxPaperSize GetSize(const wxSize& size);
106
107 private:
108 DECLARE_DYNAMIC_CLASS(wxPrintPaperDatabase)
109 };
110
111 WXDLLEXPORT_DATA(extern wxPrintPaperDatabase*) wxThePrintPaperDatabase;
112
113
114 #endif
115 // _WX_PAPERH__