OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_VIEWS_BUBBLE_BUBBLE_BORDER_2_H_ | 5 #ifndef UI_VIEWS_BUBBLE_BUBBLE_BORDER_2_H_ |
6 #define UI_VIEWS_BUBBLE_BUBBLE_BORDER_2_H_ | 6 #define UI_VIEWS_BUBBLE_BUBBLE_BORDER_2_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "ui/gfx/shadow_value.h" | 10 #include "ui/gfx/shadow_value.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 void set_arrow_height(int arrow_height) { arrow_height_ = arrow_height; } | 41 void set_arrow_height(int arrow_height) { arrow_height_ = arrow_height; } |
42 int arrow_height() const { return arrow_height_; } | 42 int arrow_height() const { return arrow_height_; } |
43 | 43 |
44 void set_arrow_width(int arrow_width) { arrow_width_ = arrow_width; } | 44 void set_arrow_width(int arrow_width) { arrow_width_ = arrow_width; } |
45 int arrow_width() const { return arrow_width_; } | 45 int arrow_width() const { return arrow_width_; } |
46 | 46 |
47 void SetShadow(gfx::ShadowValue shadow); | 47 void SetShadow(gfx::ShadowValue shadow); |
48 | 48 |
49 // views::BubbleBorder overrides: | 49 // views::BubbleBorder overrides: |
50 int GetBorderThickness() const OVERRIDE; | 50 virtual int GetBorderThickness() const OVERRIDE; |
51 | 51 |
52 protected: | 52 protected: |
53 void PaintBackground(gfx::Canvas* canvas, | 53 void PaintBackground(gfx::Canvas* canvas, |
54 const gfx::Rect& bounds) const; | 54 const gfx::Rect& bounds) const; |
55 | 55 |
56 private: | 56 private: |
57 // Gets arrow offset based on arrow location and |offset_|. | 57 // Gets arrow offset based on arrow location and |offset_|. |
58 int GetArrowOffset() const; | 58 int GetArrowOffset() const; |
59 | 59 |
60 // views::BubbleBorder overrides: | 60 // views::BubbleBorder overrides: |
61 virtual void GetInsets(gfx::Insets* insets) const OVERRIDE; | 61 virtual void GetInsets(gfx::Insets* insets) const OVERRIDE; |
62 virtual gfx::Rect GetBounds(const gfx::Rect& position_relative_to, | 62 virtual gfx::Rect GetBounds(const gfx::Rect& position_relative_to, |
63 const gfx::Size& contents_size) const OVERRIDE; | 63 const gfx::Size& contents_size) const OVERRIDE; |
64 void GetInsetsForArrowLocation(gfx::Insets* insets, | 64 virtual void GetInsetsForArrowLocation( |
65 ArrowLocation arrow_loc) const OVERRIDE; | 65 gfx::Insets* insets, |
| 66 ArrowLocation arrow_loc) const OVERRIDE; |
66 | 67 |
67 // views::Border overrides: | 68 // views::Border overrides: |
68 virtual void Paint(const View& view, | 69 virtual void Paint(const View& view, |
69 gfx::Canvas* canvas) const OVERRIDE; | 70 gfx::Canvas* canvas) const OVERRIDE; |
70 | 71 |
71 int corner_radius_; | 72 int corner_radius_; |
72 int border_size_; | 73 int border_size_; |
73 int arrow_height_; | 74 int arrow_height_; |
74 int arrow_width_; | 75 int arrow_width_; |
75 SkColor background_color_; | 76 SkColor background_color_; |
76 SkColor border_color_; | 77 SkColor border_color_; |
77 | 78 |
78 // Offset in pixels by which the arrow is shifted relative the default middle | 79 // Offset in pixels by which the arrow is shifted relative the default middle |
79 // position. If the arrow is placed horizontally (at top or bottom), the |x_| | 80 // position. If the arrow is placed horizontally (at top or bottom), the |x_| |
80 // component of |offset_| specifies the offset, else, the |y_| component. | 81 // component of |offset_| specifies the offset, else, the |y_| component. |
81 gfx::Point offset_; | 82 gfx::Point offset_; |
82 | 83 |
83 gfx::ShadowValues shadows_; | 84 gfx::ShadowValues shadows_; |
84 | 85 |
85 DISALLOW_COPY_AND_ASSIGN(BubbleBorder2); | 86 DISALLOW_COPY_AND_ASSIGN(BubbleBorder2); |
86 }; | 87 }; |
87 | 88 |
88 } // namespace views | 89 } // namespace views |
89 | 90 |
90 #endif // UI_VIEWS_BUBBLE_BUBBLE_BORDER_2_H_ | 91 #endif // UI_VIEWS_BUBBLE_BUBBLE_BORDER_2_H_ |
OLD | NEW |