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

Side by Side Diff: ui/views/controls/button/menu_button.h

Issue 639893003: Unify MenuButton Pushed state logic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Formatting Created 6 years, 2 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
« no previous file with comments | « no previous file | ui/views/controls/button/menu_button.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 } 58 }
59 const gfx::ImageSkia* menu_marker() const { return menu_marker_; } 59 const gfx::ImageSkia* menu_marker() const { return menu_marker_; }
60 60
61 const gfx::Point& menu_offset() const { return menu_offset_; } 61 const gfx::Point& menu_offset() const { return menu_offset_; }
62 void set_menu_offset(int x, int y) { menu_offset_.SetPoint(x, y); } 62 void set_menu_offset(int x, int y) { menu_offset_.SetPoint(x, y); }
63 63
64 // Activate the button (called when the button is pressed). 64 // Activate the button (called when the button is pressed).
65 virtual bool Activate(); 65 virtual bool Activate();
66 66
67 // Overridden from View: 67 // Overridden from View:
68 virtual gfx::Size GetPreferredSize() const override; 68 gfx::Size GetPreferredSize() const override;
69 virtual const char* GetClassName() const override; 69 const char* GetClassName() const override;
70 virtual void OnPaint(gfx::Canvas* canvas) override; 70 void OnPaint(gfx::Canvas* canvas) override;
71 virtual bool OnMousePressed(const ui::MouseEvent& event) override; 71 bool OnMousePressed(const ui::MouseEvent& event) override;
72 virtual void OnMouseReleased(const ui::MouseEvent& event) override; 72 void OnMouseReleased(const ui::MouseEvent& event) override;
73 virtual void OnMouseEntered(const ui::MouseEvent& event) override; 73 void OnMouseEntered(const ui::MouseEvent& event) override;
74 virtual void OnMouseExited(const ui::MouseEvent& event) override; 74 void OnMouseExited(const ui::MouseEvent& event) override;
75 virtual void OnMouseMoved(const ui::MouseEvent& event) override; 75 void OnMouseMoved(const ui::MouseEvent& event) override;
76 virtual void OnGestureEvent(ui::GestureEvent* event) override; 76 void OnGestureEvent(ui::GestureEvent* event) override;
77 virtual bool OnKeyPressed(const ui::KeyEvent& event) override; 77 bool OnKeyPressed(const ui::KeyEvent& event) override;
78 virtual bool OnKeyReleased(const ui::KeyEvent& event) override; 78 bool OnKeyReleased(const ui::KeyEvent& event) override;
79 virtual void GetAccessibleState(ui::AXViewState* state) override; 79 void GetAccessibleState(ui::AXViewState* state) override;
80 80
81 protected: 81 protected:
82 // Paint the menu marker image. 82 // Paint the menu marker image.
83 void PaintMenuMarker(gfx::Canvas* canvas); 83 void PaintMenuMarker(gfx::Canvas* canvas);
84 84
85 // Overridden from LabelButton: 85 // Overridden from LabelButton:
86 virtual gfx::Rect GetChildAreaBounds() override; 86 gfx::Rect GetChildAreaBounds() override;
87
88 // Overridden from CustomButton:
89 bool ShouldEnterPushedState(const ui::Event& event) override;
87 90
88 // Offset of the associated menu position. 91 // Offset of the associated menu position.
89 gfx::Point menu_offset_; 92 gfx::Point menu_offset_;
90 93
91 private: 94 private:
92 friend class PressedLock; 95 friend class PressedLock;
93 96
94 // Increment/decrement the number of "pressed" locks this button has, and 97 // Increment/decrement the number of "pressed" locks this button has, and
95 // set the state accordingly. 98 // set the state accordingly.
96 void IncrementPressedLocked(); 99 void IncrementPressedLocked();
(...skipping 28 matching lines...) Expand all
125 int pressed_lock_count_; 128 int pressed_lock_count_;
126 129
127 base::WeakPtrFactory<MenuButton> weak_factory_; 130 base::WeakPtrFactory<MenuButton> weak_factory_;
128 131
129 DISALLOW_COPY_AND_ASSIGN(MenuButton); 132 DISALLOW_COPY_AND_ASSIGN(MenuButton);
130 }; 133 };
131 134
132 } // namespace views 135 } // namespace views
133 136
134 #endif // UI_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_ 137 #endif // UI_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/button/menu_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698