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

Side by Side Diff: ui/views/controls/combobox/combobox.cc

Issue 2070623003: [MacViews] Show combobox menu popup at mouse press (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 4 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
« no previous file with comments | « no previous file | ui/views/style/platform_style.h » ('j') | ui/views/style/platform_style_mac.mm » ('J')
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 #include "ui/views/controls/combobox/combobox.h" 5 #include "ui/views/controls/combobox/combobox.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 return bounds; 103 return bounds;
104 } 104 }
105 105
106 // The transparent button which holds a button state but is not rendered. 106 // The transparent button which holds a button state but is not rendered.
107 class TransparentButton : public CustomButton { 107 class TransparentButton : public CustomButton {
108 public: 108 public:
109 TransparentButton(ButtonListener* listener) 109 TransparentButton(ButtonListener* listener)
110 : CustomButton(listener) { 110 : CustomButton(listener) {
111 SetAnimationDuration(LabelButton::kHoverAnimationDurationMs); 111 SetAnimationDuration(LabelButton::kHoverAnimationDurationMs);
112 SetFocusBehavior(FocusBehavior::NEVER); 112 SetFocusBehavior(FocusBehavior::NEVER);
113 set_notify_action(PlatformStyle::kMenuActivationAction);
114 set_request_focus_on_press(true);
tapted 2016/06/22 04:23:03 oh hang on a sec.. I just noticed the OnMousePress
113 } 115 }
114 ~TransparentButton() override {} 116 ~TransparentButton() override {}
115 117
116 bool OnMousePressed(const ui::MouseEvent& mouse_event) override {
117 parent()->RequestFocus();
118 return true;
119 }
120
121 double GetAnimationValue() const { 118 double GetAnimationValue() const {
122 return hover_animation().GetCurrentValue(); 119 return hover_animation().GetCurrentValue();
123 } 120 }
124 121
125 private: 122 private:
126 DISALLOW_COPY_AND_ASSIGN(TransparentButton); 123 DISALLOW_COPY_AND_ASSIGN(TransparentButton);
127 }; 124 };
128 125
129 // Returns the next or previous valid index (depending on |increment|'s value). 126 // Returns the next or previous valid index (depending on |increment|'s value).
130 // Skips separator or disabled indices. Returns -1 if there is no valid adjacent 127 // Skips separator or disabled indices. Returns -1 if there is no valid adjacent
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 } 891 }
895 892
896 int Combobox::GetArrowContainerWidth() const { 893 int Combobox::GetArrowContainerWidth() const {
897 int padding = style_ == STYLE_NORMAL 894 int padding = style_ == STYLE_NORMAL
898 ? PlatformStyle::kComboboxNormalArrowPadding * 2 895 ? PlatformStyle::kComboboxNormalArrowPadding * 2
899 : kActionLeftPadding + kActionRightPadding; 896 : kActionLeftPadding + kActionRightPadding;
900 return ArrowSize().width() + padding; 897 return ArrowSize().width() + padding;
901 } 898 }
902 899
903 } // namespace views 900 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/style/platform_style.h » ('j') | ui/views/style/platform_style_mac.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698