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

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

Issue 10829176: Update drop down menu look & feel (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up includes Created 8 years, 4 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) 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/native_combobox_views.h" 5 #include "ui/views/controls/combobox/native_combobox_views.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "grit/ui_resources.h" 9 #include "grit/ui_resources.h"
10 #include "ui/base/keycodes/keyboard_codes.h" 10 #include "ui/base/keycodes/keyboard_codes.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 namespace views { 51 namespace views {
52 52
53 const char NativeComboboxViews::kViewClassName[] = 53 const char NativeComboboxViews::kViewClassName[] =
54 "views/NativeComboboxViews"; 54 "views/NativeComboboxViews";
55 55
56 NativeComboboxViews::NativeComboboxViews(Combobox* combobox) 56 NativeComboboxViews::NativeComboboxViews(Combobox* combobox)
57 : combobox_(combobox), 57 : combobox_(combobox),
58 text_border_(new FocusableBorder()), 58 text_border_(new FocusableBorder()),
59 disclosure_arrow_(ui::ResourceBundle::GetSharedInstance().GetImageNamed( 59 disclosure_arrow_(ui::ResourceBundle::GetSharedInstance().GetImageNamed(
60 IDR_DISCLOSURE_ARROW).ToImageSkia()), 60 IDR_MENU_DROPARROW).ToImageSkia()),
sky 2012/08/06 22:57:59 Update the grd file and remove the image too.
Harry McCleave 2012/08/06 23:41:27 Done.
61 dropdown_open_(false), 61 dropdown_open_(false),
62 selected_index_(-1), 62 selected_index_(-1),
63 content_width_(0), 63 content_width_(0),
64 content_height_(0) { 64 content_height_(0) {
65 set_border(text_border_); 65 set_border(text_border_);
66 } 66 }
67 67
68 NativeComboboxViews::~NativeComboboxViews() { 68 NativeComboboxViews::~NativeComboboxViews() {
69 } 69 }
70 70
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 void NativeComboboxViews::ShowDropDownMenu() { 319 void NativeComboboxViews::ShowDropDownMenu() {
320 320
321 if (!dropdown_list_menu_runner_.get()) 321 if (!dropdown_list_menu_runner_.get())
322 UpdateFromModel(); 322 UpdateFromModel();
323 323
324 // Extend the menu to the width of the combobox. 324 // Extend the menu to the width of the combobox.
325 MenuItemView* menu = dropdown_list_menu_runner_->GetMenu(); 325 MenuItemView* menu = dropdown_list_menu_runner_->GetMenu();
326 SubmenuView* submenu = menu->CreateSubmenu(); 326 SubmenuView* submenu = menu->CreateSubmenu();
327 submenu->set_minimum_preferred_width(size().width()); 327 submenu->set_minimum_preferred_width(size().width());
328 328
329 #if defined(USE_AURA)
330 // Aura style is to have the menu over the bounds. Below bounds is default.
331 menu->set_menu_position(views::MenuItemView::POSITION_OVER_BOUNDS);
sky 2012/08/06 22:57:59 This code only exists for aura. IF it's not needed
Harry McCleave 2012/08/06 23:41:27 Done? (is the mergeing of [requested|actual]_menu_
332 #endif
333
334 gfx::Rect lb = GetLocalBounds(); 329 gfx::Rect lb = GetLocalBounds();
335 gfx::Point menu_position(lb.origin()); 330 gfx::Point menu_position(lb.origin());
336 View::ConvertPointToScreen(this, &menu_position); 331 View::ConvertPointToScreen(this, &menu_position);
337 if (menu_position.x() < 0) 332 if (menu_position.x() < 0)
338 menu_position.set_x(0); 333 menu_position.set_x(0);
339 334
340 gfx::Rect bounds(menu_position, lb.size()); 335 gfx::Rect bounds(menu_position, lb.size());
341 336
342 dropdown_open_ = true; 337 dropdown_open_ = true;
343 if (dropdown_list_menu_runner_->RunMenuAt( 338 if (dropdown_list_menu_runner_->RunMenuAt(
(...skipping 13 matching lines...) Expand all
357 352
358 #if defined(USE_AURA) 353 #if defined(USE_AURA)
359 // static 354 // static
360 NativeComboboxWrapper* NativeComboboxWrapper::CreateWrapper( 355 NativeComboboxWrapper* NativeComboboxWrapper::CreateWrapper(
361 Combobox* combobox) { 356 Combobox* combobox) {
362 return new NativeComboboxViews(combobox); 357 return new NativeComboboxViews(combobox);
363 } 358 }
364 #endif 359 #endif
365 360
366 } // namespace views 361 } // namespace views
OLDNEW
« no previous file with comments | « ui/resources/default_200_percent/ash/small_shadow_top_right.png ('k') | ui/views/controls/menu/menu_config_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698