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

Side by Side Diff: ui/native_theme/native_theme_win.cc

Issue 2345183002: Views: Draw Textfield selected text in gray when top-level Widget loses focus.
Patch Set: Fix rebase. Created 4 years, 1 month 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
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/native_theme/native_theme_win.h" 5 #include "ui/native_theme/native_theme_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <uxtheme.h> 9 #include <uxtheme.h>
10 #include <vsstyle.h> 10 #include <vsstyle.h>
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 case kColorId_TextfieldDefaultBackground: 556 case kColorId_TextfieldDefaultBackground:
557 return system_colors_[COLOR_WINDOW]; 557 return system_colors_[COLOR_WINDOW];
558 case kColorId_TextfieldReadOnlyColor: 558 case kColorId_TextfieldReadOnlyColor:
559 return system_colors_[COLOR_GRAYTEXT]; 559 return system_colors_[COLOR_GRAYTEXT];
560 case kColorId_TextfieldReadOnlyBackground: 560 case kColorId_TextfieldReadOnlyBackground:
561 return system_colors_[COLOR_3DFACE]; 561 return system_colors_[COLOR_3DFACE];
562 case kColorId_TextfieldSelectionColor: 562 case kColorId_TextfieldSelectionColor:
563 return system_colors_[COLOR_HIGHLIGHTTEXT]; 563 return system_colors_[COLOR_HIGHLIGHTTEXT];
564 case kColorId_TextfieldSelectionBackgroundFocused: 564 case kColorId_TextfieldSelectionBackgroundFocused:
565 return system_colors_[COLOR_HIGHLIGHT]; 565 return system_colors_[COLOR_HIGHLIGHT];
566 case kColorId_TextfieldSelectionBackgroundUnfocused:
567 return GetUnfocusedSelectionBackgroundColor();
566 568
567 // Tooltip 569 // Tooltip
568 case kColorId_TooltipBackground: 570 case kColorId_TooltipBackground:
569 case kColorId_TooltipText: 571 case kColorId_TooltipText:
570 NOTREACHED(); 572 NOTREACHED();
571 return gfx::kPlaceholderColor; 573 return gfx::kPlaceholderColor;
572 574
573 // Tree 575 // Tree
574 // NOTE: these aren't right for all themes, but as close as I could get. 576 // NOTE: these aren't right for all themes, but as close as I could get.
575 case kColorId_TreeBackground: 577 case kColorId_TreeBackground:
576 return system_colors_[COLOR_WINDOW]; 578 return system_colors_[COLOR_WINDOW];
577 case kColorId_TreeText: 579 case kColorId_TreeText:
578 return system_colors_[COLOR_WINDOWTEXT]; 580 return system_colors_[COLOR_WINDOWTEXT];
579 case kColorId_TreeSelectedText: 581 case kColorId_TreeSelectedText:
580 return system_colors_[COLOR_HIGHLIGHTTEXT]; 582 return system_colors_[COLOR_HIGHLIGHTTEXT];
581 case kColorId_TreeSelectedTextUnfocused: 583 case kColorId_TreeSelectedTextUnfocused:
582 return system_colors_[COLOR_BTNTEXT]; 584 return system_colors_[COLOR_BTNTEXT];
583 case kColorId_TreeSelectionBackgroundFocused: 585 case kColorId_TreeSelectionBackgroundFocused:
584 return system_colors_[COLOR_HIGHLIGHT]; 586 return system_colors_[COLOR_HIGHLIGHT];
585 case kColorId_TreeSelectionBackgroundUnfocused: 587 case kColorId_TreeSelectionBackgroundUnfocused:
586 return system_colors_[IsUsingHighContrastTheme() ? 588 return GetUnfocusedSelectionBackgroundColor();
587 COLOR_MENUHIGHLIGHT : COLOR_BTNFACE];
588 case kColorId_TreeArrow: 589 case kColorId_TreeArrow:
589 return system_colors_[COLOR_WINDOWTEXT]; 590 return system_colors_[COLOR_WINDOWTEXT];
590 591
591 // Table 592 // Table
592 case kColorId_TableBackground: 593 case kColorId_TableBackground:
593 return system_colors_[COLOR_WINDOW]; 594 return system_colors_[COLOR_WINDOW];
594 case kColorId_TableText: 595 case kColorId_TableText:
595 return system_colors_[COLOR_WINDOWTEXT]; 596 return system_colors_[COLOR_WINDOWTEXT];
596 case kColorId_TableSelectedText: 597 case kColorId_TableSelectedText:
597 return system_colors_[COLOR_HIGHLIGHTTEXT]; 598 return system_colors_[COLOR_HIGHLIGHTTEXT];
598 case kColorId_TableSelectedTextUnfocused: 599 case kColorId_TableSelectedTextUnfocused:
599 return system_colors_[COLOR_BTNTEXT]; 600 return system_colors_[COLOR_BTNTEXT];
600 case kColorId_TableSelectionBackgroundFocused: 601 case kColorId_TableSelectionBackgroundFocused:
601 return system_colors_[COLOR_HIGHLIGHT]; 602 return system_colors_[COLOR_HIGHLIGHT];
602 case kColorId_TableSelectionBackgroundUnfocused: 603 case kColorId_TableSelectionBackgroundUnfocused:
603 return system_colors_[IsUsingHighContrastTheme() ? 604 return GetUnfocusedSelectionBackgroundColor();
604 COLOR_MENUHIGHLIGHT : COLOR_BTNFACE];
605 case kColorId_TableGroupingIndicatorColor: 605 case kColorId_TableGroupingIndicatorColor:
606 return system_colors_[COLOR_GRAYTEXT]; 606 return system_colors_[COLOR_GRAYTEXT];
607 607
608 // Results Tables 608 // Results Tables
609 case kColorId_ResultsTableNormalBackground: 609 case kColorId_ResultsTableNormalBackground:
610 return system_colors_[COLOR_WINDOW]; 610 return system_colors_[COLOR_WINDOW];
611 case kColorId_ResultsTableHoveredBackground: 611 case kColorId_ResultsTableHoveredBackground:
612 return color_utils::AlphaBlend(system_colors_[COLOR_HIGHLIGHT], 612 return color_utils::AlphaBlend(system_colors_[COLOR_HIGHLIGHT],
613 system_colors_[COLOR_WINDOW], 0x40); 613 system_colors_[COLOR_WINDOW], 0x40);
614 case kColorId_ResultsTableSelectedBackground: 614 case kColorId_ResultsTableSelectedBackground:
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after
1994 case kTabPanelBackground: 1994 case kTabPanelBackground:
1995 case kTextField: 1995 case kTextField:
1996 case kTrackbarThumb: 1996 case kTrackbarThumb:
1997 case kTrackbarTrack: 1997 case kTrackbarTrack:
1998 case kMaxPart: 1998 case kMaxPart:
1999 NOTREACHED(); 1999 NOTREACHED();
2000 } 2000 }
2001 return 0; 2001 return 0;
2002 } 2002 }
2003 2003
2004 SkColor NativeThemeWin::GetUnfocusedSelectionBackgroundColor() const {
2005 return system_colors_[IsUsingHighContrastTheme() ? COLOR_MENUHIGHLIGHT
2006 : COLOR_BTNFACE];
2007 }
2008
2004 HRESULT NativeThemeWin::GetThemeInt(ThemeName theme, 2009 HRESULT NativeThemeWin::GetThemeInt(ThemeName theme,
2005 int part_id, 2010 int part_id,
2006 int state_id, 2011 int state_id,
2007 int prop_id, 2012 int prop_id,
2008 int *value) const { 2013 int *value) const {
2009 HANDLE handle = GetThemeHandle(theme); 2014 HANDLE handle = GetThemeHandle(theme);
2010 return (handle && get_theme_int_) ? 2015 return (handle && get_theme_int_) ?
2011 get_theme_int_(handle, part_id, state_id, prop_id, value) : E_NOTIMPL; 2016 get_theme_int_(handle, part_id, state_id, prop_id, value) : E_NOTIMPL;
2012 } 2017 }
2013 2018
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
2112 break; 2117 break;
2113 case LAST: 2118 case LAST:
2114 NOTREACHED(); 2119 NOTREACHED();
2115 break; 2120 break;
2116 } 2121 }
2117 theme_handles_[theme_name] = handle; 2122 theme_handles_[theme_name] = handle;
2118 return handle; 2123 return handle;
2119 } 2124 }
2120 2125
2121 } // namespace ui 2126 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698