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