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

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

Issue 873513002: [Views] Make MenuButton track its desired state while pressed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 gfx::Rect GetChildAreaBounds() override; 86 gfx::Rect GetChildAreaBounds() override;
87 87
88 // Overridden from CustomButton: 88 // Overridden from CustomButton:
89 bool ShouldEnterPushedState(const ui::Event& event) override; 89 bool ShouldEnterPushedState(const ui::Event& event) override;
90 void StateChanged() override;
90 91
91 // Offset of the associated menu position. 92 // Offset of the associated menu position.
92 gfx::Point menu_offset_; 93 gfx::Point menu_offset_;
93 94
94 private: 95 private:
95 friend class PressedLock; 96 friend class PressedLock;
96 97
97 // Increment/decrement the number of "pressed" locks this button has, and 98 // Increment/decrement the number of "pressed" locks this button has, and
98 // set the state accordingly. 99 // set the state accordingly.
99 void IncrementPressedLocked(); 100 void IncrementPressedLocked();
(...skipping 20 matching lines...) Expand all
120 // The down arrow used to differentiate the menu button from normal buttons. 121 // The down arrow used to differentiate the menu button from normal buttons.
121 const gfx::ImageSkia* menu_marker_; 122 const gfx::ImageSkia* menu_marker_;
122 123
123 // If non-null the destuctor sets this to true. This is set while the menu is 124 // If non-null the destuctor sets this to true. This is set while the menu is
124 // showing and used to detect if the menu was deleted while running. 125 // showing and used to detect if the menu was deleted while running.
125 bool* destroyed_flag_; 126 bool* destroyed_flag_;
126 127
127 // The current number of "pressed" locks this button has. 128 // The current number of "pressed" locks this button has.
128 int pressed_lock_count_; 129 int pressed_lock_count_;
129 130
131 // True if the button was in a disabled state when a menu was run, and should
132 // return to it once the press is complete. This can happen if, e.g., we
133 // programmatically show a menu on a disabled button.
134 bool should_disable_after_press_;
135
130 base::WeakPtrFactory<MenuButton> weak_factory_; 136 base::WeakPtrFactory<MenuButton> weak_factory_;
131 137
132 DISALLOW_COPY_AND_ASSIGN(MenuButton); 138 DISALLOW_COPY_AND_ASSIGN(MenuButton);
133 }; 139 };
134 140
135 } // namespace views 141 } // namespace views
136 142
137 #endif // UI_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_ 143 #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