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_APP_LIST_APP_LIST_BUBBLE_BORDER_H_ | 5 #ifndef UI_APP_LIST_APP_LIST_BUBBLE_BORDER_H_ |
6 #define UI_APP_LIST_APP_LIST_BUBBLE_BORDER_H_ | 6 #define UI_APP_LIST_APP_LIST_BUBBLE_BORDER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "ui/gfx/shadow_value.h" | 9 #include "ui/gfx/shadow_value.h" |
10 #include "ui/views/bubble/bubble_border.h" | 10 #include "ui/views/bubble/bubble_border_geometric.h" |
11 | 11 |
12 namespace app_list { | 12 namespace app_list { |
13 | 13 |
14 // A class to paint bubble border and background. | 14 // A class to paint bubble border and background. |
15 class AppListBubbleBorder : public views::BubbleBorder { | 15 class AppListBubbleBorder : public views::BubbleBorderGeometric { |
16 public: | 16 public: |
17 AppListBubbleBorder(views::View* app_list_view, | 17 AppListBubbleBorder(views::View* app_list_view, |
18 views::View* search_box_view); | 18 views::View* search_box_view); |
19 virtual ~AppListBubbleBorder(); | 19 virtual ~AppListBubbleBorder(); |
20 | 20 |
21 bool ArrowAtTopOrBottom() const; | |
22 bool ArrowOnLeftOrRight() const; | |
23 | |
24 void GetMask(const gfx::Rect& bounds, gfx::Path* mask) const; | |
25 | |
26 void set_offset(const gfx::Point& offset) { offset_ = offset; } | |
27 const gfx::Point& offset() const { return offset_; } | |
28 | |
29 private: | 21 private: |
30 // Gets arrow offset based on arrow location and |offset_|. | 22 // views::ImagelessBubbleBorder overrides: |
31 int GetArrowOffset() const; | |
32 | |
33 void PaintBackground(gfx::Canvas* canvas, | 23 void PaintBackground(gfx::Canvas* canvas, |
34 const gfx::Rect& bounds) const; | 24 const gfx::Rect& bounds) const; |
35 | 25 |
36 // views::BubbleBorder overrides: | |
37 virtual void GetInsets(gfx::Insets* insets) const OVERRIDE; | |
38 virtual gfx::Rect GetBounds(const gfx::Rect& position_relative_to, | |
39 const gfx::Size& contents_size) const OVERRIDE; | |
40 | |
41 // views::Border overrides: | |
42 virtual void Paint(const views::View& view, | |
43 gfx::Canvas* canvas) const OVERRIDE; | |
44 | |
45 // AppListView hosted inside this bubble. | 26 // AppListView hosted inside this bubble. |
46 const views::View* app_list_view_; // Owned by views hierarchy. | 27 const views::View* app_list_view_; // Owned by views hierarchy. |
47 | 28 |
48 // Children view of AppListView that needs to paint background. | 29 // Children view of AppListView that needs to paint background. |
49 const views::View* search_box_view_; // Owned by views hierarchy. | 30 const views::View* search_box_view_; // Owned by views hierarchy. |
50 | 31 |
51 // Offset in pixels relative the default middle position. | |
52 gfx::Point offset_; | |
53 | |
54 gfx::ShadowValues shadows_; | |
55 | |
56 DISALLOW_COPY_AND_ASSIGN(AppListBubbleBorder); | 32 DISALLOW_COPY_AND_ASSIGN(AppListBubbleBorder); |
57 }; | 33 }; |
58 | 34 |
59 } // namespace app_list | 35 } // namespace app_list |
60 | 36 |
61 #endif // UI_APP_LIST_APP_LIST_BUBBLE_BORDER_H_ | 37 #endif // UI_APP_LIST_APP_LIST_BUBBLE_BORDER_H_ |
OLD | NEW |