| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ | 5 #ifndef VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ |
| 6 #define VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ | 6 #define VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/task.h" | 9 #include "base/task.h" |
| 10 #include "views/controls/button/image_button.h" | 10 #include "views/controls/button/image_button.h" |
| 11 #include "views/controls/menu/menu_2.h" | 11 |
| 12 namespace ui { |
| 13 class MenuModel; |
| 14 } // namespace ui |
| 12 | 15 |
| 13 namespace views { | 16 namespace views { |
| 14 | 17 |
| 15 //////////////////////////////////////////////////////////////////////////////// | 18 //////////////////////////////////////////////////////////////////////////////// |
| 16 // | 19 // |
| 17 // ButtonDropDown | 20 // ButtonDropDown |
| 18 // | 21 // |
| 19 // A button class that when pressed (and held) or pressed (and drag down) will | 22 // A button class that when pressed (and held) or pressed (and drag down) will |
| 20 // display a menu | 23 // display a menu |
| 21 // | 24 // |
| (...skipping 22 matching lines...) Expand all Loading... |
| 44 // implementation, both left and right mouse buttons can trigger a change | 47 // implementation, both left and right mouse buttons can trigger a change |
| 45 // to the PUSHED state. | 48 // to the PUSHED state. |
| 46 virtual bool ShouldEnterPushedState(const MouseEvent& event) OVERRIDE; | 49 virtual bool ShouldEnterPushedState(const MouseEvent& event) OVERRIDE; |
| 47 | 50 |
| 48 private: | 51 private: |
| 49 // Internal function to show the dropdown menu | 52 // Internal function to show the dropdown menu |
| 50 void ShowDropDownMenu(gfx::NativeView window); | 53 void ShowDropDownMenu(gfx::NativeView window); |
| 51 | 54 |
| 52 // The model that populates the attached menu. | 55 // The model that populates the attached menu. |
| 53 ui::MenuModel* model_; | 56 ui::MenuModel* model_; |
| 54 scoped_ptr<Menu2> menu_; | |
| 55 | 57 |
| 56 // Y position of mouse when left mouse button is pressed | 58 // Y position of mouse when left mouse button is pressed |
| 57 int y_position_on_lbuttondown_; | 59 int y_position_on_lbuttondown_; |
| 58 | 60 |
| 59 // A factory for tasks that show the dropdown context menu for the button. | 61 // A factory for tasks that show the dropdown context menu for the button. |
| 60 ScopedRunnableMethodFactory<ButtonDropDown> show_menu_factory_; | 62 ScopedRunnableMethodFactory<ButtonDropDown> show_menu_factory_; |
| 61 | 63 |
| 62 DISALLOW_COPY_AND_ASSIGN(ButtonDropDown); | 64 DISALLOW_COPY_AND_ASSIGN(ButtonDropDown); |
| 63 }; | 65 }; |
| 64 | 66 |
| 65 } // namespace views | 67 } // namespace views |
| 66 | 68 |
| 67 #endif // VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ | 69 #endif // VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ |
| OLD | NEW |