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