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

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: added #if defined 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') | 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 #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);
113 } 114 }
114 ~TransparentButton() override {} 115 ~TransparentButton() override {}
115 116
117 #if defined(OS_MACOSX)
116 bool OnMousePressed(const ui::MouseEvent& mouse_event) override { 118 bool OnMousePressed(const ui::MouseEvent& mouse_event) override {
tapted 2016/06/23 00:54:29 nit: comment here like // Override OnMousePresse
spqchan 2016/06/28 17:05:59 Added the comment in. I'm a bit confused with what
tapted 2016/06/29 12:02:55 Yes - it should stay (just not on Mac). Sorry - ha
117 parent()->RequestFocus(); 119 parent()->RequestFocus();
120 CustomButton::OnMousePressed(mouse_event);
118 return true; 121 return true;
119 } 122 }
123 #endif
120 124
121 double GetAnimationValue() const { 125 double GetAnimationValue() const {
122 return hover_animation().GetCurrentValue(); 126 return hover_animation().GetCurrentValue();
123 } 127 }
124 128
125 private: 129 private:
126 DISALLOW_COPY_AND_ASSIGN(TransparentButton); 130 DISALLOW_COPY_AND_ASSIGN(TransparentButton);
127 }; 131 };
128 132
129 // Returns the next or previous valid index (depending on |increment|'s value). 133 // Returns the next or previous valid index (depending on |increment|'s value).
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 } 898 }
895 899
896 int Combobox::GetArrowContainerWidth() const { 900 int Combobox::GetArrowContainerWidth() const {
897 int padding = style_ == STYLE_NORMAL 901 int padding = style_ == STYLE_NORMAL
898 ? PlatformStyle::kComboboxNormalArrowPadding * 2 902 ? PlatformStyle::kComboboxNormalArrowPadding * 2
899 : kActionLeftPadding + kActionRightPadding; 903 : kActionLeftPadding + kActionRightPadding;
900 return ArrowSize().width() + padding; 904 return ArrowSize().width() + padding;
901 } 905 }
902 906
903 } // namespace views 907 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/style/platform_style.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698