]> git.saurik.com Git - wxWidgets.git/blame - include/wx/paper.h
using Run of base class
[wxWidgets.git] / include / wx / paper.h
CommitLineData
33d28952 1/////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: wx/paper.h
33d28952
JS
3// Purpose: Paper database types and classes
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
33d28952 7// Copyright: (c) Julian Smart
7e548f6b 8// Licence: wxWindows licence
33d28952
JS
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_PAPERH__
12#define _WX_PAPERH__
13
33d28952
JS
14#include "wx/defs.h"
15#include "wx/event.h"
16#include "wx/cmndata.h"
f6bcfd97 17#include "wx/intl.h"
bdcade0a 18#include "wx/hashmap.h"
33d28952
JS
19
20/*
21 * Paper type: see defs.h for wxPaperSize enum.
9c110148 22 * A wxPrintPaperType can have an id and a name, or just a name and wxPAPER_NONE,
33d28952
JS
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
53a2db12 32class WXDLLIMPEXP_CORE wxPrintPaperType: public wxObject
33d28952
JS
33{
34public:
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
f6bcfd97 40 inline wxString GetName() const { return wxGetTranslation(m_paperName); }
33d28952
JS
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
57public:
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
64private:
65 DECLARE_DYNAMIC_CLASS(wxPrintPaperType)
66};
67
3f5c62f9 68WX_DECLARE_STRING_HASH_MAP(wxPrintPaperType*, wxStringToPrintPaperTypeHashMap);
bdcade0a 69
b5dbe15d 70class WXDLLIMPEXP_FWD_CORE wxPrintPaperTypeList;
222ed1d6 71
53a2db12 72class WXDLLIMPEXP_CORE wxPrintPaperDatabase
33d28952
JS
73{
74public:
75 wxPrintPaperDatabase();
222ed1d6 76 ~wxPrintPaperDatabase();
33d28952
JS
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
222ed1d6
MB
108 //
109 wxPrintPaperType* Item(size_t index) const;
110 size_t GetCount() const;
33d28952 111private:
222ed1d6
MB
112 wxStringToPrintPaperTypeHashMap* m_map;
113 wxPrintPaperTypeList* m_list;
114 // DECLARE_DYNAMIC_CLASS(wxPrintPaperDatabase)
33d28952
JS
115};
116
53a2db12 117extern WXDLLIMPEXP_DATA_CORE(wxPrintPaperDatabase*) wxThePrintPaperDatabase;
33d28952
JS
118
119
120#endif
121 // _WX_PAPERH__