]> git.saurik.com Git - wxWidgets.git/blob - include/wx/paper.h
Somehow, setting a tint color makes gauge work :/.
[wxWidgets.git] / include / wx / paper.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/paper.h
3 // Purpose: Paper database types and classes
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_PAPERH__
12 #define _WX_PAPERH__
13
14 #include "wx/defs.h"
15 #include "wx/event.h"
16 #include "wx/cmndata.h"
17 #include "wx/intl.h"
18 #include "wx/hashmap.h"
19
20 /*
21 * Paper type: see defs.h for wxPaperSize enum.
22 * A wxPrintPaperType can have an id and a name, or just a name and wxPAPER_NONE,
23 * so you can add further paper types without needing new ids.
24 */
25
26 #ifdef __WXMSW__
27 #define WXADDPAPER(paperId, platformId, name, w, h) AddPaperType(paperId, platformId, name, w, h)
28 #else
29 #define WXADDPAPER(paperId, platformId, name, w, h) AddPaperType(paperId, 0, name, w, h)
30 #endif
31
32 class WXDLLIMPEXP_CORE wxPrintPaperType: public wxObject
33 {
34 public:
35 wxPrintPaperType();
36
37 // platformId is a platform-specific id, such as in Windows, DMPAPER_...
38 wxPrintPaperType(wxPaperSize paperId, int platformId, const wxString& name, int w, int h);
39
40 inline wxString GetName() const { return wxGetTranslation(m_paperName); }
41 inline wxPaperSize GetId() const { return m_paperId; }
42 inline int GetPlatformId() const { return m_platformId; }
43
44 // Get width and height in tenths of a millimetre
45 inline int GetWidth() const { return m_width; }
46 inline int GetHeight() const { return m_height; }
47
48 // Get size in tenths of a millimetre
49 inline wxSize GetSize() const { return wxSize(m_width, m_height); }
50
51 // Get size in a millimetres
52 inline wxSize GetSizeMM() const { return wxSize(m_width/10, m_height/10); }
53
54 // Get width and height in device units (1/72th of an inch)
55 wxSize GetSizeDeviceUnits() const ;
56
57 public:
58 wxPaperSize m_paperId;
59 int m_platformId;
60 int m_width; // In tenths of a millimetre
61 int m_height; // In tenths of a millimetre
62 wxString m_paperName;
63
64 private:
65 DECLARE_DYNAMIC_CLASS(wxPrintPaperType)
66 };
67
68 WX_DECLARE_STRING_HASH_MAP(wxPrintPaperType*, wxStringToPrintPaperTypeHashMap);
69
70 class WXDLLIMPEXP_FWD_CORE wxPrintPaperTypeList;
71
72 class WXDLLIMPEXP_CORE wxPrintPaperDatabase
73 {
74 public:
75 wxPrintPaperDatabase();
76 ~wxPrintPaperDatabase();
77
78 void CreateDatabase();
79 void ClearDatabase();
80
81 void AddPaperType(wxPaperSize paperId, const wxString& name, int w, int h);
82 void AddPaperType(wxPaperSize paperId, int platformId, const wxString& name, int w, int h);
83
84 // Find by name
85 wxPrintPaperType *FindPaperType(const wxString& name);
86
87 // Find by size id
88 wxPrintPaperType *FindPaperType(wxPaperSize id);
89
90 // Find by platform id
91 wxPrintPaperType *FindPaperTypeByPlatformId(int id);
92
93 // Find by size
94 wxPrintPaperType *FindPaperType(const wxSize& size);
95
96 // Convert name to size id
97 wxPaperSize ConvertNameToId(const wxString& name);
98
99 // Convert size id to name
100 wxString ConvertIdToName(wxPaperSize paperId);
101
102 // Get the paper size
103 wxSize GetSize(wxPaperSize paperId);
104
105 // Get the paper size
106 wxPaperSize GetSize(const wxSize& size);
107
108 //
109 wxPrintPaperType* Item(size_t index) const;
110 size_t GetCount() const;
111 private:
112 wxStringToPrintPaperTypeHashMap* m_map;
113 wxPrintPaperTypeList* m_list;
114 // DECLARE_DYNAMIC_CLASS(wxPrintPaperDatabase)
115 };
116
117 extern WXDLLIMPEXP_DATA_CORE(wxPrintPaperDatabase*) wxThePrintPaperDatabase;
118
119
120 #endif
121 // _WX_PAPERH__