]> git.saurik.com Git - wxWidgets.git/blob - include/wx/paper.h
Got rid wx-license
[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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
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 wxPrintPaperType 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 wxStringToPrintPaperTypeHashMap;
73 class WXDLLEXPORT wxPrintPaperTypeList;
74
75 class WXDLLEXPORT wxPrintPaperDatabase
76 {
77 public:
78 wxPrintPaperDatabase();
79 ~wxPrintPaperDatabase();
80
81 void CreateDatabase();
82 void ClearDatabase();
83
84 void AddPaperType(wxPaperSize paperId, const wxString& name, int w, int h);
85 void AddPaperType(wxPaperSize paperId, int platformId, const wxString& name, int w, int h);
86
87 // Find by name
88 wxPrintPaperType *FindPaperType(const wxString& name);
89
90 // Find by size id
91 wxPrintPaperType *FindPaperType(wxPaperSize id);
92
93 // Find by platform id
94 wxPrintPaperType *FindPaperTypeByPlatformId(int id);
95
96 // Find by size
97 wxPrintPaperType *FindPaperType(const wxSize& size);
98
99 // Convert name to size id
100 wxPaperSize ConvertNameToId(const wxString& name);
101
102 // Convert size id to name
103 wxString ConvertIdToName(wxPaperSize paperId);
104
105 // Get the paper size
106 wxSize GetSize(wxPaperSize paperId);
107
108 // Get the paper size
109 wxPaperSize GetSize(const wxSize& size);
110
111 //
112 wxPrintPaperType* Item(size_t index) const;
113 size_t GetCount() const;
114 private:
115 wxStringToPrintPaperTypeHashMap* m_map;
116 wxPrintPaperTypeList* m_list;
117 // DECLARE_DYNAMIC_CLASS(wxPrintPaperDatabase)
118 };
119
120 WXDLLEXPORT_DATA(extern wxPrintPaperDatabase*) wxThePrintPaperDatabase;
121
122
123 #endif
124 // _WX_PAPERH__