| 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_SHELF_OVERFLOW_BUTTON_H_ | |
| 6 #define ASH_SHELF_OVERFLOW_BUTTON_H_ | |
| 7 | |
| 8 #include "ash/common/shelf/shelf_types.h" | |
| 9 #include "base/compiler_specific.h" | |
| 10 #include "base/macros.h" | |
| 11 #include "ui/gfx/image/image_skia.h" | |
| 12 #include "ui/views/controls/button/custom_button.h" | |
| 13 | |
| 14 namespace ash { | |
| 15 class InkDropButtonListener; | |
| 16 class Shelf; | |
| 17 | |
| 18 // Shelf overflow chevron button. | |
| 19 class OverflowButton : public views::CustomButton { | |
| 20 public: | |
| 21 OverflowButton(InkDropButtonListener* listener, Shelf* shelf); | |
| 22 ~OverflowButton() override; | |
| 23 | |
| 24 void OnShelfAlignmentChanged(); | |
| 25 | |
| 26 private: | |
| 27 // views::View: | |
| 28 void OnPaint(gfx::Canvas* canvas) override; | |
| 29 | |
| 30 // views::CustomButton: | |
| 31 void NotifyClick(const ui::Event& event) override; | |
| 32 | |
| 33 // Helper functions to paint the background and foreground of the button | |
| 34 // at |bounds|. | |
| 35 void PaintBackground(gfx::Canvas* canvas, const gfx::Rect& bounds); | |
| 36 void PaintForeground(gfx::Canvas* canvas, const gfx::Rect& bounds); | |
| 37 | |
| 38 // Returns the id of the asset to use for the button backgound based on the | |
| 39 // current shelf state. | |
| 40 // TODO(tdanderson): Remove this once the material design shelf is enabled | |
| 41 // by default. See crbug.com/614453. | |
| 42 int NonMaterialBackgroundImageId(); | |
| 43 | |
| 44 // Calculates the bounds of the overflow button based on the shelf alignment. | |
| 45 gfx::Rect CalculateButtonBounds(); | |
| 46 | |
| 47 // Used for bottom shelf alignment. |bottom_image_| points to | |
| 48 // |bottom_image_md_| for material design, otherwise it is points to a | |
| 49 // resource owned by the ResourceBundle. | |
| 50 // TODO(tdanderson): Remove the non-md code once the material design shelf is | |
| 51 // enabled by default. See crbug.com/614453. | |
| 52 const gfx::ImageSkia* bottom_image_; | |
| 53 gfx::ImageSkia bottom_image_md_; | |
| 54 | |
| 55 // Cached rotations of |bottom_image_| used for left and right shelf | |
| 56 // alignments. | |
| 57 gfx::ImageSkia left_image_; | |
| 58 gfx::ImageSkia right_image_; | |
| 59 | |
| 60 InkDropButtonListener* listener_; | |
| 61 Shelf* shelf_; | |
| 62 | |
| 63 DISALLOW_COPY_AND_ASSIGN(OverflowButton); | |
| 64 }; | |
| 65 | |
| 66 } // namespace ash | |
| 67 | |
| 68 #endif // ASH_SHELF_OVERFLOW_BUTTON_H_ | |
| OLD | NEW |