1// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef UI_GFX_GEOMETRY_INSETS_H_
6#define UI_GFX_GEOMETRY_INSETS_H_
7
8#include <string>
9
10#include "build/build_config.h"
11#include "ui/gfx/geometry/insets_base.h"
12#include "ui/gfx/geometry/insets_f.h"
13#include "ui/gfx/gfx_export.h"
14
15namespace gfx {
16
17// An integer version of gfx::Insets.
18class GFX_EXPORT Insets : public InsetsBase<Insets, int> {
19 public:
20  Insets();
21  Insets(int top, int left, int bottom, int right);
22
23  ~Insets();
24
25  Insets Scale(float scale) const {
26    return Scale(scale, scale);
27  }
28
29  Insets Scale(float x_scale, float y_scale) const {
30    return Insets(static_cast<int>(top() * y_scale),
31                  static_cast<int>(left() * x_scale),
32                  static_cast<int>(bottom() * y_scale),
33                  static_cast<int>(right() * x_scale));
34  }
35
36  operator InsetsF() const {
37    return InsetsF(top(), left(), bottom(), right());
38  }
39
40  // Returns a string representation of the insets.
41  std::string ToString() const;
42};
43
44#if !defined(COMPILER_MSVC) && !defined(__native_client__)
45extern template class InsetsBase<Insets, int>;
46#endif
47
48}  // namespace gfx
49
50#endif  // UI_GFX_GEOMETRY_INSETS_H_
51