| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_VIEWS_BUBBLE_BORDER_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_BUBBLE_BORDER_H_ |
| 6 #define CHROME_BROWSER_VIEWS_BUBBLE_BORDER_H_ | 6 #define CHROME_BROWSER_VIEWS_BUBBLE_BORDER_H_ |
| 7 | 7 |
| 8 #include "third_party/skia/include/core/SkColor.h" | 8 #include "third_party/skia/include/core/SkColor.h" |
| 9 #include "views/background.h" | 9 #include "views/background.h" |
| 10 #include "views/border.h" | 10 #include "views/border.h" |
| 11 | 11 |
| 12 class SkBitmap; | 12 class SkBitmap; |
| 13 | 13 |
| 14 // Renders a round-rect border, with optional arrow (off by default), and a | 14 // Renders a border, with optional arrow (off by default), and a custom |
| 15 // custom dropshadow. This can be used to produce floating "bubble" objects. | 15 // dropshadow. This can be used to produce floating "bubble" objects. |
| 16 // |
| 17 // If the arrow is on, the bubble has four round corner. If not, it has round |
| 18 // corners on the bottom and square corners on the top, and lacks a top border. |
| 16 class BubbleBorder : public views::Border { | 19 class BubbleBorder : public views::Border { |
| 17 public: | 20 public: |
| 18 // Possible locations for the (optional) arrow. | 21 // Possible locations for the (optional) arrow. |
| 19 enum ArrowLocation { | 22 enum ArrowLocation { |
| 20 NONE, | 23 NONE, |
| 21 TOP_LEFT, | 24 TOP_LEFT, |
| 22 TOP_RIGHT, | 25 TOP_RIGHT, |
| 23 BOTTOM_LEFT, | 26 BOTTOM_LEFT, |
| 24 BOTTOM_RIGHT | 27 BOTTOM_RIGHT |
| 25 }; | 28 }; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 64 |
| 62 // Overridden from views::Border: | 65 // Overridden from views::Border: |
| 63 virtual void GetInsets(gfx::Insets* insets) const; | 66 virtual void GetInsets(gfx::Insets* insets) const; |
| 64 | 67 |
| 65 private: | 68 private: |
| 66 // Loads images if necessary. | 69 // Loads images if necessary. |
| 67 static void InitClass(); | 70 static void InitClass(); |
| 68 | 71 |
| 69 virtual ~BubbleBorder() { } | 72 virtual ~BubbleBorder() { } |
| 70 | 73 |
| 71 // Returns true if there is an arrow and it is positioned on the top edge. | 74 // Returns true if there is an arrow and it is positioned on the bottom edge. |
| 72 bool arrow_is_top() const { | 75 bool arrow_is_bottom() const { |
| 73 return (arrow_location_ == TOP_LEFT) || (arrow_location_ == TOP_RIGHT); | 76 return (arrow_location_ == BOTTOM_LEFT) || |
| 77 (arrow_location_ == BOTTOM_RIGHT); |
| 74 } | 78 } |
| 75 | 79 |
| 76 // Returns true if there is an arrow and it is positioned on the left side. | 80 // Returns true if there is an arrow and it is positioned on the left side. |
| 77 bool arrow_is_left() const { | 81 bool arrow_is_left() const { |
| 78 return (arrow_location_ == TOP_LEFT) || (arrow_location_ == BOTTOM_LEFT); | 82 return (arrow_location_ == TOP_LEFT) || (arrow_location_ == BOTTOM_LEFT); |
| 79 } | 83 } |
| 80 | 84 |
| 81 // Overridden from views::Border: | 85 // Overridden from views::Border: |
| 82 virtual void Paint(const views::View& view, gfx::Canvas* canvas) const; | 86 virtual void Paint(const views::View& view, gfx::Canvas* canvas) const; |
| 83 | 87 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 110 // Background overrides. | 114 // Background overrides. |
| 111 virtual void Paint(gfx::Canvas* canvas, views::View* view) const; | 115 virtual void Paint(gfx::Canvas* canvas, views::View* view) const; |
| 112 | 116 |
| 113 private: | 117 private: |
| 114 BubbleBorder* border_; | 118 BubbleBorder* border_; |
| 115 | 119 |
| 116 DISALLOW_COPY_AND_ASSIGN(BubbleBackground); | 120 DISALLOW_COPY_AND_ASSIGN(BubbleBackground); |
| 117 }; | 121 }; |
| 118 | 122 |
| 119 #endif // CHROME_BROWSER_VIEWS_BUBBLE_BORDER_H_ | 123 #endif // CHROME_BROWSER_VIEWS_BUBBLE_BORDER_H_ |
| OLD | NEW |