summaryrefslogtreecommitdiffstats
path: root/ui/views/rendering/border.h
blob: e1b196f061184a623c78d04ff9c08816493feb8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_VIEWS_BORDER_H_
#define UI_VIEWS_BORDER_H_

#include "base/logging.h"
#include "gfx/insets.h"
#include "third_party/skia/include/core/SkColor.h"

namespace gfx {
class Canvas;
}

namespace ui {

class View;

////////////////////////////////////////////////////////////////////////////////
// Border class
//
//  A class that provides padding for a View. Subclass to provide custom
//  rendering of the Border. Insets determine the size of border.
//
class Border {
 public:
  virtual ~Border();

  // Create various common border types.
  static Border* CreateSolidBorder(int thickness, SkColor color);
  static Border* CreateTransparentBorder(const gfx::Insets& insets);

  gfx::Insets insets() const { return insets_; }
  void set_insets(const gfx::Insets& insets) { insets_ = insets; }

  virtual void Paint(const View* view, gfx::Canvas* canvas) const;

 protected:
  Border();

 private:
  gfx::Insets insets_;

  DISALLOW_COPY_AND_ASSIGN(Border);
};

}  // namespace ui

#endif  // UI_VIEWS_BORDER_H_