OLD | NEW |
---|---|
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 "chrome/browser/ui/views/wrench_menu.h" | 5 #include "chrome/browser/ui/views/wrench_menu.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
291 l10n_util::GetStringUTF16(string_id)); | 291 l10n_util::GetStringUTF16(string_id)); |
292 button->SetAccessibleName( | 292 button->SetAccessibleName( |
293 GetAccessibleNameForWrenchMenuItem(menu_model_, index, acc_string_id)); | 293 GetAccessibleNameForWrenchMenuItem(menu_model_, index, acc_string_id)); |
294 button->set_focusable(true); | 294 button->set_focusable(true); |
295 button->set_request_focus_on_press(false); | 295 button->set_request_focus_on_press(false); |
296 button->set_tag(index); | 296 button->set_tag(index); |
297 button->SetEnabled(menu_model_->IsEnabledAt(index)); | 297 button->SetEnabled(menu_model_->IsEnabledAt(index)); |
298 button->set_prefix_type(TextButton::PREFIX_HIDE); | 298 button->set_prefix_type(TextButton::PREFIX_HIDE); |
299 MenuButtonBackground* bg = new MenuButtonBackground(type); | 299 MenuButtonBackground* bg = new MenuButtonBackground(type); |
300 button->set_background(bg); | 300 button->set_background(bg); |
301 #if defined(OS_WIN) && !defined(USE_AURA) | |
301 button->SetEnabledColor(MenuConfig::instance().text_color); | 302 button->SetEnabledColor(MenuConfig::instance().text_color); |
sky
2012/04/30 20:52:05
Instead of this, initialize text_color in menu_con
jennyz
2012/04/30 21:23:09
Done.
| |
303 #endif | |
302 if (background) | 304 if (background) |
303 *background = bg; | 305 *background = bg; |
304 button->set_border(new MenuButtonBorder()); | 306 button->set_border(new MenuButtonBorder()); |
305 button->set_alignment(TextButton::ALIGN_CENTER); | 307 button->set_alignment(TextButton::ALIGN_CENTER); |
306 button->SetFont(views::MenuConfig::instance().font); | 308 button->SetFont(views::MenuConfig::instance().font); |
307 button->ClearMaxTextSize(); | 309 button->ClearMaxTextSize(); |
308 AddChildView(button); | 310 AddChildView(button); |
309 return button; | 311 return button; |
310 } | 312 } |
311 | 313 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
400 decrement_button_(NULL), | 402 decrement_button_(NULL), |
401 fullscreen_button_(NULL), | 403 fullscreen_button_(NULL), |
402 zoom_label_width_(0) { | 404 zoom_label_width_(0) { |
403 decrement_button_ = CreateButtonWithAccName( | 405 decrement_button_ = CreateButtonWithAccName( |
404 IDS_ZOOM_MINUS2, MenuButtonBackground::LEFT_BUTTON, decrement_index, | 406 IDS_ZOOM_MINUS2, MenuButtonBackground::LEFT_BUTTON, decrement_index, |
405 NULL, IDS_ACCNAME_ZOOM_MINUS2); | 407 NULL, IDS_ACCNAME_ZOOM_MINUS2); |
406 | 408 |
407 zoom_label_ = new Label( | 409 zoom_label_ = new Label( |
408 l10n_util::GetStringFUTF16Int(IDS_ZOOM_PERCENT, 100)); | 410 l10n_util::GetStringFUTF16Int(IDS_ZOOM_PERCENT, 100)); |
409 zoom_label_->SetAutoColorReadabilityEnabled(false); | 411 zoom_label_->SetAutoColorReadabilityEnabled(false); |
412 #if defined(OS_WIN) && !defined(USE_AURA) | |
410 zoom_label_->SetEnabledColor(MenuConfig::instance().text_color); | 413 zoom_label_->SetEnabledColor(MenuConfig::instance().text_color); |
414 #endif | |
411 zoom_label_->SetHorizontalAlignment(Label::ALIGN_RIGHT); | 415 zoom_label_->SetHorizontalAlignment(Label::ALIGN_RIGHT); |
412 MenuButtonBackground* center_bg = | 416 MenuButtonBackground* center_bg = |
413 new MenuButtonBackground(MenuButtonBackground::CENTER_BUTTON); | 417 new MenuButtonBackground(MenuButtonBackground::CENTER_BUTTON); |
414 zoom_label_->set_background(center_bg); | 418 zoom_label_->set_background(center_bg); |
415 zoom_label_->set_border(new MenuButtonBorder()); | 419 zoom_label_->set_border(new MenuButtonBorder()); |
416 zoom_label_->SetFont(MenuConfig::instance().font); | 420 zoom_label_->SetFont(MenuConfig::instance().font); |
417 AddChildView(zoom_label_); | 421 AddChildView(zoom_label_); |
418 zoom_label_width_ = MaxWidthForZoomLabel(); | 422 zoom_label_width_ = MaxWidthForZoomLabel(); |
419 | 423 |
420 increment_button_ = CreateButtonWithAccName( | 424 increment_button_ = CreateButtonWithAccName( |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
914 bookmark_menu_delegate_.reset( | 918 bookmark_menu_delegate_.reset( |
915 new BookmarkMenuDelegate(browser_->profile(), | 919 new BookmarkMenuDelegate(browser_->profile(), |
916 NULL, | 920 NULL, |
917 parent, | 921 parent, |
918 first_bookmark_command_id_)); | 922 first_bookmark_command_id_)); |
919 bookmark_menu_delegate_->Init( | 923 bookmark_menu_delegate_->Init( |
920 this, bookmark_menu_, model->bookmark_bar_node(), 0, | 924 this, bookmark_menu_, model->bookmark_bar_node(), 0, |
921 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS, | 925 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS, |
922 bookmark_utils::LAUNCH_WRENCH_MENU); | 926 bookmark_utils::LAUNCH_WRENCH_MENU); |
923 } | 927 } |
OLD | NEW |