Fix typo in 9b54bd30006c008b4a951331b273613d5bac3abf
[pm.git] / widget / gtk / nsPaperPS.h
blob1acc1780cc0bc4b1962e1393c13978f6a0457152
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ex: set tabstop=8 softtabstop=4 shiftwidth=4 expandtab: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 #ifndef _PAPERPS_H_
9 #define _PAPERPS_H_
11 #include "nsDebug.h"
13 struct nsPaperSizePS_ {
14 const char *name;
15 float width_mm;
16 float height_mm;
17 bool isMetric; // Present to the user in metric, if possible
20 class nsPaperSizePS {
21 public:
22 /** ---------------------------------------------------
23 * Constructor
25 nsPaperSizePS() { mCurrent = 0; }
27 /** ---------------------------------------------------
28 * @return true if the cursor points past the last item.
30 bool AtEnd() { return mCurrent >= mCount; }
32 /** ---------------------------------------------------
33 * Position the cursor at the beginning of the paper size list.
34 * @return VOID
36 void First() { mCurrent = 0; }
38 /** ---------------------------------------------------
39 * Advance the cursor to the next item.
40 * @return VOID
42 void Next() {
43 NS_ASSERTION(!AtEnd(), "Invalid current item");
44 mCurrent++;
47 /** ---------------------------------------------------
48 * Point the cursor to the entry with the given paper name.
49 * @return true if pointing to a valid entry.
51 bool Find(const char *aName);
53 /** ---------------------------------------------------
54 * @return a pointer to the name of the current paper size
56 const char *Name() {
57 NS_PRECONDITION(!AtEnd(), "Invalid current item");
58 return mList[mCurrent].name;
61 /** ---------------------------------------------------
62 * @return the width of the page in millimeters
64 float Width_mm() {
65 NS_PRECONDITION(!AtEnd(), "Invalid current item");
66 return mList[mCurrent].width_mm;
69 /** ---------------------------------------------------
70 * @return the height of the page in millimeters
72 float Height_mm() {
73 NS_PRECONDITION(!AtEnd(), "Invalid current item");
74 return mList[mCurrent].height_mm;
77 /** ---------------------------------------------------
78 * @return true if the paper should be presented to
79 * the user in metric units.
81 bool IsMetric() {
82 NS_PRECONDITION(!AtEnd(), "Invalid current item");
83 return mList[mCurrent].isMetric;
86 private:
87 unsigned int mCurrent;
88 static const nsPaperSizePS_ mList[];
89 static const unsigned int mCount;
92 #endif