| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_UI_VIEWS_BUBBLE_BORDER_CONTENTS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_BUBBLE_BORDER_CONTENTS_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_BUBBLE_BORDER_CONTENTS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_BUBBLE_BORDER_CONTENTS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "views/bubble/bubble_border.h" | 9 #include "views/bubble/bubble_border.h" |
| 10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
| 11 #include "views/view.h" | 11 #include "views/view.h" |
| 12 | 12 |
| 13 // This is used to paint the border of the Bubble. Windows uses this via | 13 // This is used to paint the border of the Bubble. Windows uses this via |
| 14 // BorderWidgetWin, while others can use it directly in the bubble. | 14 // BorderWidgetWin, while others can use it directly in the bubble. |
| 15 class BorderContents : public views::View { | 15 class BorderContents : public views::View { |
| 16 public: | 16 public: |
| 17 BorderContents(); | 17 BorderContents(); |
| 18 | 18 |
| 19 // Must be called before this object can be used. | 19 // Must be called before this object can be used. |
| 20 void Init(); | 20 void Init(); |
| 21 | 21 |
| 22 // Sets the background color. | 22 // Sets the background color. |
| 23 void SetBackgroundColor(SkColor color); | 23 void SetBackgroundColor(SkColor color); |
| 24 | 24 |
| 25 // Sets the bubble alignment. |
| 26 void SetAlignment(views::BubbleBorder::BubbleAlignment alignment); |
| 27 |
| 25 // Given the size of the contents and the rect to point at, returns the bounds | 28 // Given the size of the contents and the rect to point at, returns the bounds |
| 26 // of both the border and the contents inside the bubble. | 29 // of both the border and the contents inside the bubble. |
| 27 // |arrow_location| specifies the preferred location for the arrow | 30 // |arrow_location| specifies the preferred location for the arrow |
| 28 // anchor. If the bubble does not fit on the monitor and | 31 // anchor. If the bubble does not fit on the monitor and |
| 29 // |allow_bubble_offscreen| is false, the arrow location may change so the | 32 // |allow_bubble_offscreen| is false, the arrow location may change so the |
| 30 // bubble shows entirely. | 33 // bubble shows entirely. |
| 31 virtual void SizeAndGetBounds( | 34 virtual void SizeAndGetBounds( |
| 32 const gfx::Rect& position_relative_to, // In screen coordinates | 35 const gfx::Rect& position_relative_to, // In screen coordinates |
| 33 views::BubbleBorder::ArrowLocation arrow_location, | 36 views::BubbleBorder::ArrowLocation arrow_location, |
| 34 bool allow_bubble_offscreen, | 37 bool allow_bubble_offscreen, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 // true, its width otherwise. | 82 // true, its width otherwise. |
| 80 static int GetInsetsLength(const gfx::Insets& insets, bool vertical); | 83 static int GetInsetsLength(const gfx::Insets& insets, bool vertical); |
| 81 | 84 |
| 82 // Margins between the content and the inside of the border, in pixels. | 85 // Margins between the content and the inside of the border, in pixels. |
| 83 gfx::Insets content_margins_; | 86 gfx::Insets content_margins_; |
| 84 | 87 |
| 85 DISALLOW_COPY_AND_ASSIGN(BorderContents); | 88 DISALLOW_COPY_AND_ASSIGN(BorderContents); |
| 86 }; | 89 }; |
| 87 | 90 |
| 88 #endif // CHROME_BROWSER_UI_VIEWS_BUBBLE_BORDER_CONTENTS_H_ | 91 #endif // CHROME_BROWSER_UI_VIEWS_BUBBLE_BORDER_CONTENTS_H_ |
| OLD | NEW |