]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/paper.h
Implement SelectAll for OSX WebKit.
[wxWidgets.git] / include / wx / paper.h
... / ...
CommitLineData
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// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_PAPERH__
13#define _WX_PAPERH__
14
15#include "wx/defs.h"
16#include "wx/event.h"
17#include "wx/cmndata.h"
18#include "wx/intl.h"
19#include "wx/hashmap.h"
20
21/*
22 * Paper type: see defs.h for wxPaperSize enum.
23 * A wxPrintPaperType can have an id and a name, or just a name and wxPAPER_NONE,
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
33class WXDLLIMPEXP_CORE wxPrintPaperType: public wxObject
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
41 inline wxString GetName() const { return wxGetTranslation(m_paperName); }
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
69WX_DECLARE_STRING_HASH_MAP(wxPrintPaperType*, wxStringToPrintPaperTypeHashMap);
70
71class WXDLLIMPEXP_FWD_CORE wxPrintPaperTypeList;
72
73class WXDLLIMPEXP_CORE wxPrintPaperDatabase
74{
75public:
76 wxPrintPaperDatabase();
77 ~wxPrintPaperDatabase();
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
109 //
110 wxPrintPaperType* Item(size_t index) const;
111 size_t GetCount() const;
112private:
113 wxStringToPrintPaperTypeHashMap* m_map;
114 wxPrintPaperTypeList* m_list;
115 // DECLARE_DYNAMIC_CLASS(wxPrintPaperDatabase)
116};
117
118extern WXDLLIMPEXP_DATA_CORE(wxPrintPaperDatabase*) wxThePrintPaperDatabase;
119
120
121#endif
122 // _WX_PAPERH__