| 1 | /* |
| 2 | * Copyright 2014 Haiku, Inc. All rights reserved. |
| 3 | * Distributed under the terms of the MIT License. |
| 4 | * |
| 5 | * Authors: |
| 6 | * Augustin Cavalier, waddlesplash@gmail.com |
| 7 | * |
| 8 | * Corresponds to: |
| 9 | * headers/os/interface/Size.h hrev48620 |
| 10 | * src/kits/interface/Size.cpp hrev48620 |
| 11 | */ |
| 12 | |
| 13 | |
| 14 | /*! |
| 15 | \file Size.h |
| 16 | \ingroup interface |
| 17 | \ingroup libbe |
| 18 | \brief BSize class definition and related enum definition. |
| 19 | */ |
| 20 | |
| 21 | |
| 22 | /*! |
| 23 | \var B_SIZE_UNSET |
| 24 | |
| 25 | A meaningless size value. |
| 26 | |
| 27 | \since Haiku R1 |
| 28 | */ |
| 29 | |
| 30 | |
| 31 | /*! |
| 32 | \var B_SIZE_UNLIMITED |
| 33 | |
| 34 | The largest possible size value. |
| 35 | |
| 36 | \since Haiku R1 |
| 37 | */ |
| 38 | |
| 39 | |
| 40 | /*! |
| 41 | \class BSize |
| 42 | \ingroup interface |
| 43 | \ingroup libbe |
| 44 | \brief A two-dimensional size. |
| 45 | |
| 46 | \since Haiku R1 |
| 47 | */ |
| 48 | |
| 49 | |
| 50 | /*! |
| 51 | \var BSize::width |
| 52 | \brief The horizontal dimension. |
| 53 | |
| 54 | \since Haiku R1 |
| 55 | */ |
| 56 | |
| 57 | |
| 58 | /*! |
| 59 | \var BSize::height |
| 60 | \brief The vertical dimension. |
| 61 | |
| 62 | \since Haiku R1 |
| 63 | */ |
| 64 | |
| 65 | |
| 66 | /*! |
| 67 | \fn inline BSize::BSize() |
| 68 | \brief Initializes a BSize object with both dimensions set to \c B_SIZE_UNSET. |
| 69 | |
| 70 | \see BSize::Set() |
| 71 | |
| 72 | \since Haiku R1 |
| 73 | */ |
| 74 | |
| 75 | |
| 76 | /*! |
| 77 | \fn inline BSize::BSize(float width, float height) |
| 78 | \brief Initializes a BSize object with the specified \a width and |
| 79 | \a height values. |
| 80 | |
| 81 | \param width The \a width value to set. |
| 82 | \param height The \a height value to set. |
| 83 | |
| 84 | \since Haiku R1 |
| 85 | */ |
| 86 | |
| 87 | |
| 88 | /*! |
| 89 | \fn inline BSize::BSize(const BSize& other) |
| 90 | \brief Initializes a BSize object from another BSize. |
| 91 | |
| 92 | \param other The BSize object to copy from. |
| 93 | |
| 94 | \since Haiku R1 |
| 95 | */ |
| 96 | |
| 97 | |
| 98 | /*! |
| 99 | \fn inline float BSize::Width() const |
| 100 | \brief Gets the \a width of the BSize object. |
| 101 | |
| 102 | \returns BSize::width |
| 103 | |
| 104 | \since Haiku R1 |
| 105 | */ |
| 106 | |
| 107 | |
| 108 | /*! |
| 109 | \fn inline float BSize::Height() const |
| 110 | \brief Gets the \a height of the BSize object. |
| 111 | |
| 112 | \returns BSize::height |
| 113 | |
| 114 | \since Haiku R1 |
| 115 | */ |
| 116 | |
| 117 | |
| 118 | /*! |
| 119 | \fn inline void BSize::Set(float width, float height) |
| 120 | \brief Sets the \a width and \a height values of a BSize object. |
| 121 | |
| 122 | \param width The \a width value to set. |
| 123 | \param height The \a height value to set. |
| 124 | |
| 125 | \since Haiku R1 |
| 126 | */ |
| 127 | |
| 128 | |
| 129 | /*! |
| 130 | \fn inline void BSize::SetWidth(float width) |
| 131 | \brief Sets the \a width value of a BSize object. |
| 132 | |
| 133 | \param width The \a width value to set. |
| 134 | |
| 135 | \since Haiku R1 |
| 136 | */ |
| 137 | |
| 138 | |
| 139 | /*! |
| 140 | \fn inline void BSize::SetHeight(float height) |
| 141 | \brief Sets the \a height value of a BSize object. |
| 142 | |
| 143 | \param height The \a height value to set. |
| 144 | |
| 145 | \since Haiku R1 |
| 146 | */ |
| 147 | |
| 148 | |
| 149 | /*! |
| 150 | \fn inline int32 BSize::IntegerWidth() const |
| 151 | \brief Returns the \a width value of a BSize object as an \a int32. |
| 152 | |
| 153 | \returns BSize::width, cast to an \a int32. |
| 154 | |
| 155 | \warning This may lose precision! |
| 156 | |
| 157 | \since Haiku R1 |
| 158 | */ |
| 159 | |
| 160 | |
| 161 | /*! |
| 162 | \fn inline int32 BSize::IntegerHeight() const |
| 163 | \brief Returns the \a height value of a BSize object as an \a int32. |
| 164 | |
| 165 | \returns BSize::height, cast to an \a int32. |
| 166 | |
| 167 | \warning This may lose precision! |
| 168 | |
| 169 | \since Haiku R1 |
| 170 | */ |
| 171 | |
| 172 | |
| 173 | /*! |
| 174 | \fn inline bool BSize::IsWidthSet() const |
| 175 | \brief Checks if the BSize::width is not \c B_SIZE_UNSET. |
| 176 | |
| 177 | \returns \c true if the width is set, \c false otherwise. |
| 178 | |
| 179 | \since Haiku R1 |
| 180 | */ |
| 181 | |
| 182 | |
| 183 | /*! |
| 184 | \fn inline bool BSize::IsHeightSet() const |
| 185 | \brief Checks if the BSize::height is not \c B_SIZE_UNSET. |
| 186 | |
| 187 | \returns \c true if the height is set, \c false otherwise. |
| 188 | |
| 189 | \since Haiku R1 |
| 190 | */ |
| 191 | |
| 192 | |
| 193 | /*! |
| 194 | \name Operators |
| 195 | */ |
| 196 | |
| 197 | |
| 198 | //! @{ |
| 199 | |
| 200 | |
| 201 | /*! |
| 202 | \fn inline BSize& BSize::operator=(const BSize& other) |
| 203 | \brief Initializes a BSize object from another BSize by overloading |
| 204 | the = operator. |
| 205 | |
| 206 | \param other The BSize object to copy from. |
| 207 | |
| 208 | \since Haiku R1 |
| 209 | */ |
| 210 | |
| 211 | |
| 212 | /*! |
| 213 | \fn bool BSize::operator!=(const BSize& other) const |
| 214 | \brief Returns whether or not the width and height values of the BSize |
| 215 | objects differ. |
| 216 | |
| 217 | \return \c true if the width or height values differ, \c false otherwise. |
| 218 | |
| 219 | \since Haiku R1 |
| 220 | */ |
| 221 | |
| 222 | |
| 223 | /*! |
| 224 | \fn bool BSize::operator==(const BSize& other) const |
| 225 | \brief Returns whether or not the width and height values of the BSize |
| 226 | objects are equal. |
| 227 | |
| 228 | \return \c true if the width and height values are equal, \c false otherwise. |
| 229 | |
| 230 | \since Haiku R1 |
| 231 | */ |
| 232 | |
| 233 | |
| 234 | //! @} |