Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Side by Side Diff: views/controls/button/button_dropdown.h

Issue 126092: Begin to upgrade BackForwardMenuModelViews to use new menu API.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 7
8 #include "base/task.h" 8 #include "base/task.h"
9 #include "views/controls/button/image_button.h" 9 #include "views/controls/button/image_button.h"
10 #include "views/controls/menu/menu.h" 10 #include "views/controls/menu/menu_2.h"
11 11
12 namespace views { 12 namespace views {
13 13
14 //////////////////////////////////////////////////////////////////////////////// 14 ////////////////////////////////////////////////////////////////////////////////
15 // 15 //
16 // ButtonDropDown 16 // ButtonDropDown
17 // 17 //
18 // A button class that when pressed (and held) or pressed (and drag down) will 18 // A button class that when pressed (and held) or pressed (and drag down) will
19 // display a menu 19 // display a menu
20 // 20 //
21 //////////////////////////////////////////////////////////////////////////////// 21 ////////////////////////////////////////////////////////////////////////////////
22 class ButtonDropDown : public ImageButton { 22 class ButtonDropDown : public ImageButton {
23 public: 23 public:
24 ButtonDropDown(ButtonListener* listener, Menu::Delegate* menu_delegate); 24 ButtonDropDown(ButtonListener* listener, Menu2Model* model);
25 virtual ~ButtonDropDown(); 25 virtual ~ButtonDropDown();
26 26
27 // Accessibility accessors, overridden from View. 27 // Accessibility accessors, overridden from View.
28 virtual bool GetAccessibleDefaultAction(std::wstring* action); 28 virtual bool GetAccessibleDefaultAction(std::wstring* action);
29 virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); 29 virtual bool GetAccessibleRole(AccessibilityTypes::Role* role);
30 virtual bool GetAccessibleState(AccessibilityTypes::State* state); 30 virtual bool GetAccessibleState(AccessibilityTypes::State* state);
31 31
32 private: 32 private:
33 // Overridden from Button 33 // Overridden from Button
34 virtual bool OnMousePressed(const MouseEvent& e); 34 virtual bool OnMousePressed(const MouseEvent& e);
35 virtual void OnMouseReleased(const MouseEvent& e, bool canceled); 35 virtual void OnMouseReleased(const MouseEvent& e, bool canceled);
36 virtual bool OnMouseDragged(const MouseEvent& e); 36 virtual bool OnMouseDragged(const MouseEvent& e);
37 37
38 // Overridden from View. Used to display the right-click menu, as triggered 38 // Overridden from View. Used to display the right-click menu, as triggered
39 // by the keyboard, for instance. Using the member function ShowDropDownMenu 39 // by the keyboard, for instance. Using the member function ShowDropDownMenu
40 // for the actual display. 40 // for the actual display.
41 virtual void ShowContextMenu(int x, 41 virtual void ShowContextMenu(int x,
42 int y, 42 int y,
43 bool is_mouse_gesture); 43 bool is_mouse_gesture);
44 44
45 // Internal function to show the dropdown menu 45 // Internal function to show the dropdown menu
46 void ShowDropDownMenu(gfx::NativeView window); 46 void ShowDropDownMenu(gfx::NativeView window);
47 47
48 // Specifies who to delegate populating the menu 48 // The model that populates the attached menu.
49 Menu::Delegate* menu_delegate_; 49 Menu2Model* model_;
50 scoped_ptr<Menu2> menu_;
50 51
51 // Y position of mouse when left mouse button is pressed 52 // Y position of mouse when left mouse button is pressed
52 int y_position_on_lbuttondown_; 53 int y_position_on_lbuttondown_;
53 54
54 // A factory for tasks that show the dropdown context menu for the button. 55 // A factory for tasks that show the dropdown context menu for the button.
55 ScopedRunnableMethodFactory<ButtonDropDown> show_menu_factory_; 56 ScopedRunnableMethodFactory<ButtonDropDown> show_menu_factory_;
56 57
57 DISALLOW_COPY_AND_ASSIGN(ButtonDropDown); 58 DISALLOW_COPY_AND_ASSIGN(ButtonDropDown);
58 }; 59 };
59 60
60 } // namespace views 61 } // namespace views
61 62
62 #endif // VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ 63 #endif // VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698