| OLD | NEW |
| (Empty) |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef ASH_COMMON_SHELF_OVERFLOW_BUTTON_H_ | |
| 6 #define ASH_COMMON_SHELF_OVERFLOW_BUTTON_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "ui/gfx/geometry/rect.h" | |
| 10 #include "ui/gfx/image/image_skia.h" | |
| 11 #include "ui/views/controls/button/custom_button.h" | |
| 12 | |
| 13 namespace ash { | |
| 14 class ShelfView; | |
| 15 class WmShelf; | |
| 16 | |
| 17 // Shelf overflow chevron button. | |
| 18 class OverflowButton : public views::CustomButton { | |
| 19 public: | |
| 20 // |shelf_view| is the view containing this button. | |
| 21 OverflowButton(ShelfView* shelf_view, WmShelf* wm_shelf); | |
| 22 ~OverflowButton() override; | |
| 23 | |
| 24 void OnShelfAlignmentChanged(); | |
| 25 void OnOverflowBubbleShown(); | |
| 26 void OnOverflowBubbleHidden(); | |
| 27 | |
| 28 // Updates background and schedules a paint. | |
| 29 void UpdateShelfItemBackground(SkColor color); | |
| 30 | |
| 31 private: | |
| 32 // views::CustomButton: | |
| 33 void OnPaint(gfx::Canvas* canvas) override; | |
| 34 std::unique_ptr<views::InkDrop> CreateInkDrop() override; | |
| 35 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override; | |
| 36 bool ShouldEnterPushedState(const ui::Event& event) override; | |
| 37 void NotifyClick(const ui::Event& event) override; | |
| 38 std::unique_ptr<views::InkDropMask> CreateInkDropMask() const override; | |
| 39 | |
| 40 // Helper functions to paint the background and foreground of the button | |
| 41 // at |bounds|. | |
| 42 void PaintBackground(gfx::Canvas* canvas, const gfx::Rect& bounds); | |
| 43 void PaintForeground(gfx::Canvas* canvas, const gfx::Rect& bounds); | |
| 44 | |
| 45 // Calculates the bounds of the overflow button based on the shelf alignment. | |
| 46 gfx::Rect CalculateButtonBounds() const; | |
| 47 | |
| 48 // Used for bottom shelf alignment. | |
| 49 gfx::ImageSkia bottom_image_; | |
| 50 | |
| 51 // Cached rotations of |bottom_image_| used for left and right shelf | |
| 52 // alignments. | |
| 53 gfx::ImageSkia left_image_; | |
| 54 gfx::ImageSkia right_image_; | |
| 55 | |
| 56 ShelfView* shelf_view_; | |
| 57 WmShelf* wm_shelf_; | |
| 58 | |
| 59 // Color used to paint the background. | |
| 60 SkColor background_color_; | |
| 61 | |
| 62 DISALLOW_COPY_AND_ASSIGN(OverflowButton); | |
| 63 }; | |
| 64 | |
| 65 } // namespace ash | |
| 66 | |
| 67 #endif // ASH_COMMON_SHELF_OVERFLOW_BUTTON_H_ | |
| OLD | NEW |