OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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_SYSTEM_USER_BUTTON_FROM_VIEW_H_ |
| 6 #define ASH_SYSTEM_USER_BUTTON_FROM_VIEW_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 |
| 10 #include "ui/views/controls/button/custom_button.h" |
| 11 |
| 12 namespace ash { |
| 13 namespace tray { |
| 14 |
| 15 // This view is used to wrap it's content and transform it into button. |
| 16 class ButtonFromView : public views::CustomButton { |
| 17 public: |
| 18 ButtonFromView(views::View* content, |
| 19 views::ButtonListener* listener, |
| 20 bool highlight_on_hover); |
| 21 virtual ~ButtonFromView(); |
| 22 |
| 23 // Called when the border should remain even in the non highlighted state. |
| 24 void ForceBorderVisible(bool show); |
| 25 |
| 26 // Overridden from views::View |
| 27 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; |
| 28 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; |
| 29 |
| 30 // Check if the item is hovered. |
| 31 bool is_hovered_for_test() { return button_hovered_; } |
| 32 |
| 33 private: |
| 34 // Change the hover/active state of the "button" when the status changes. |
| 35 void ShowActive(); |
| 36 |
| 37 // Content of button. |
| 38 views::View* content_; |
| 39 |
| 40 // Whether button should be highligthed on hover. |
| 41 bool highlight_on_hover_; |
| 42 |
| 43 // True if button is hovered. |
| 44 bool button_hovered_; |
| 45 |
| 46 // True if the border should be always visible. |
| 47 bool show_border_; |
| 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(ButtonFromView); |
| 50 }; |
| 51 |
| 52 } // namespace tray |
| 53 } // namespace ash |
| 54 |
| 55 #endif // ASH_SYSTEM_USER_BUTTON_FROM_VIEW_H_ |
OLD | NEW |