| 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_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_ | 5 #ifndef UI_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_ |
| 6 #define UI_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_ | 6 #define UI_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 const char* GetClassName() const override; | 77 const char* GetClassName() const override; |
| 78 void OnPaint(gfx::Canvas* canvas) override; | 78 void OnPaint(gfx::Canvas* canvas) override; |
| 79 bool OnMousePressed(const ui::MouseEvent& event) override; | 79 bool OnMousePressed(const ui::MouseEvent& event) override; |
| 80 void OnMouseReleased(const ui::MouseEvent& event) override; | 80 void OnMouseReleased(const ui::MouseEvent& event) override; |
| 81 void OnMouseEntered(const ui::MouseEvent& event) override; | 81 void OnMouseEntered(const ui::MouseEvent& event) override; |
| 82 void OnMouseExited(const ui::MouseEvent& event) override; | 82 void OnMouseExited(const ui::MouseEvent& event) override; |
| 83 void OnMouseMoved(const ui::MouseEvent& event) override; | 83 void OnMouseMoved(const ui::MouseEvent& event) override; |
| 84 void OnGestureEvent(ui::GestureEvent* event) override; | 84 void OnGestureEvent(ui::GestureEvent* event) override; |
| 85 bool OnKeyPressed(const ui::KeyEvent& event) override; | 85 bool OnKeyPressed(const ui::KeyEvent& event) override; |
| 86 bool OnKeyReleased(const ui::KeyEvent& event) override; | 86 bool OnKeyReleased(const ui::KeyEvent& event) override; |
| 87 void GetAccessibleState(ui::AXViewState* state) override; | 87 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; |
| 88 | 88 |
| 89 protected: | 89 protected: |
| 90 // Paint the menu marker image. | 90 // Paint the menu marker image. |
| 91 void PaintMenuMarker(gfx::Canvas* canvas); | 91 void PaintMenuMarker(gfx::Canvas* canvas); |
| 92 | 92 |
| 93 // Overridden from LabelButton: | 93 // Overridden from LabelButton: |
| 94 gfx::Rect GetChildAreaBounds() override; | 94 gfx::Rect GetChildAreaBounds() override; |
| 95 | 95 |
| 96 // Overridden from CustomButton: | 96 // Overridden from CustomButton: |
| 97 bool IsTriggerableEvent(const ui::Event& event) override; | 97 bool IsTriggerableEvent(const ui::Event& event) override; |
| 98 bool ShouldEnterPushedState(const ui::Event& event) override; | 98 bool ShouldEnterPushedState(const ui::Event& event) override; |
| 99 void StateChanged() override; | 99 void StateChanged() override; |
| 100 void NotifyClick(const ui::Event& event) override; | 100 void NotifyClick(const ui::Event& event) override; |
| 101 | 101 |
| 102 // Offset of the associated menu position. | 102 // Offset of the associated menu position. |
| 103 gfx::Point menu_offset_; | 103 gfx::Point menu_offset_; |
| 104 | 104 |
| 105 private: | 105 private: |
| 106 friend class PressedLock; | 106 friend class PressedLock; |
| 107 | 107 |
| 108 // Increment/decrement the number of "pressed" locks this button has, and | 108 // Increment/decrement the number of "pressed" locks this button has, and |
| 109 // set the state accordingly. The ink drop is snapped to the final ACTIVATED | 109 // set the state accordingly. The ink drop is snapped to the final ACTIVATED |
| 110 // state if |snap_ink_drop_to_activated| is true, otherwise the ink drop will | 110 // state if |snap_ink_drop_to_activated| is true, otherwise the ink drop will |
| 111 // be animated to the ACTIVATED state. | 111 // be animated to the ACTIVATED node_data. |
| 112 void IncrementPressedLocked(bool snap_ink_drop_to_activated); | 112 void IncrementPressedLocked(bool snap_ink_drop_to_activated); |
| 113 void DecrementPressedLocked(); | 113 void DecrementPressedLocked(); |
| 114 | 114 |
| 115 // Compute the maximum X coordinate for the current screen. MenuButtons | 115 // Compute the maximum X coordinate for the current screen. MenuButtons |
| 116 // use this to make sure a menu is never shown off screen. | 116 // use this to make sure a menu is never shown off screen. |
| 117 int GetMaximumScreenXCoordinate(); | 117 int GetMaximumScreenXCoordinate(); |
| 118 | 118 |
| 119 // We use a time object in order to keep track of when the menu was closed. | 119 // We use a time object in order to keep track of when the menu was closed. |
| 120 // The time is used for simulating menu behavior for the menu button; that | 120 // The time is used for simulating menu behavior for the menu button; that |
| 121 // is, if the menu is shown and the button is pressed, we need to close the | 121 // is, if the menu is shown and the button is pressed, we need to close the |
| (...skipping 27 matching lines...) Expand all Loading... |
| 149 bool should_disable_after_press_; | 149 bool should_disable_after_press_; |
| 150 | 150 |
| 151 base::WeakPtrFactory<MenuButton> weak_factory_; | 151 base::WeakPtrFactory<MenuButton> weak_factory_; |
| 152 | 152 |
| 153 DISALLOW_COPY_AND_ASSIGN(MenuButton); | 153 DISALLOW_COPY_AND_ASSIGN(MenuButton); |
| 154 }; | 154 }; |
| 155 | 155 |
| 156 } // namespace views | 156 } // namespace views |
| 157 | 157 |
| 158 #endif // UI_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_ | 158 #endif // UI_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_ |
| OLD | NEW |