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

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: Refactor to use SelectionController(Delegate). Unfinished! Created 4 years 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 | « ui/native_theme/native_theme_win.h ('k') | ui/views/BUILD.gn » ('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/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 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 case kColorId_TextfieldDefaultBackground: 546 case kColorId_TextfieldDefaultBackground:
547 return system_colors_[COLOR_WINDOW]; 547 return system_colors_[COLOR_WINDOW];
548 case kColorId_TextfieldReadOnlyColor: 548 case kColorId_TextfieldReadOnlyColor:
549 return system_colors_[COLOR_GRAYTEXT]; 549 return system_colors_[COLOR_GRAYTEXT];
550 case kColorId_TextfieldReadOnlyBackground: 550 case kColorId_TextfieldReadOnlyBackground:
551 return system_colors_[COLOR_3DFACE]; 551 return system_colors_[COLOR_3DFACE];
552 case kColorId_TextfieldSelectionColor: 552 case kColorId_TextfieldSelectionColor:
553 return system_colors_[COLOR_HIGHLIGHTTEXT]; 553 return system_colors_[COLOR_HIGHLIGHTTEXT];
554 case kColorId_TextfieldSelectionBackgroundFocused: 554 case kColorId_TextfieldSelectionBackgroundFocused:
555 return system_colors_[COLOR_HIGHLIGHT]; 555 return system_colors_[COLOR_HIGHLIGHT];
556 case kColorId_TextfieldSelectionBackgroundUnfocused:
557 return GetUnfocusedSelectionBackgroundColor();
556 558
557 // Tooltip 559 // Tooltip
558 case kColorId_TooltipBackground: 560 case kColorId_TooltipBackground:
559 case kColorId_TooltipText: 561 case kColorId_TooltipText:
560 NOTREACHED(); 562 NOTREACHED();
561 return gfx::kPlaceholderColor; 563 return gfx::kPlaceholderColor;
562 564
563 // Tree 565 // Tree
564 // NOTE: these aren't right for all themes, but as close as I could get. 566 // NOTE: these aren't right for all themes, but as close as I could get.
565 case kColorId_TreeBackground: 567 case kColorId_TreeBackground:
566 return system_colors_[COLOR_WINDOW]; 568 return system_colors_[COLOR_WINDOW];
567 case kColorId_TreeText: 569 case kColorId_TreeText:
568 return system_colors_[COLOR_WINDOWTEXT]; 570 return system_colors_[COLOR_WINDOWTEXT];
569 case kColorId_TreeSelectedText: 571 case kColorId_TreeSelectedText:
570 return system_colors_[COLOR_HIGHLIGHTTEXT]; 572 return system_colors_[COLOR_HIGHLIGHTTEXT];
571 case kColorId_TreeSelectedTextUnfocused: 573 case kColorId_TreeSelectedTextUnfocused:
572 return system_colors_[COLOR_BTNTEXT]; 574 return system_colors_[COLOR_BTNTEXT];
573 case kColorId_TreeSelectionBackgroundFocused: 575 case kColorId_TreeSelectionBackgroundFocused:
574 return system_colors_[COLOR_HIGHLIGHT]; 576 return system_colors_[COLOR_HIGHLIGHT];
575 case kColorId_TreeSelectionBackgroundUnfocused: 577 case kColorId_TreeSelectionBackgroundUnfocused:
576 return system_colors_[IsUsingHighContrastTheme() ? 578 return GetUnfocusedSelectionBackgroundColor();
577 COLOR_MENUHIGHLIGHT : COLOR_BTNFACE];
578 case kColorId_TreeArrow: 579 case kColorId_TreeArrow:
579 return system_colors_[COLOR_WINDOWTEXT]; 580 return system_colors_[COLOR_WINDOWTEXT];
580 581
581 // Table 582 // Table
582 case kColorId_TableBackground: 583 case kColorId_TableBackground:
583 return system_colors_[COLOR_WINDOW]; 584 return system_colors_[COLOR_WINDOW];
584 case kColorId_TableText: 585 case kColorId_TableText:
585 return system_colors_[COLOR_WINDOWTEXT]; 586 return system_colors_[COLOR_WINDOWTEXT];
586 case kColorId_TableSelectedText: 587 case kColorId_TableSelectedText:
587 return system_colors_[COLOR_HIGHLIGHTTEXT]; 588 return system_colors_[COLOR_HIGHLIGHTTEXT];
588 case kColorId_TableSelectedTextUnfocused: 589 case kColorId_TableSelectedTextUnfocused:
589 return system_colors_[COLOR_BTNTEXT]; 590 return system_colors_[COLOR_BTNTEXT];
590 case kColorId_TableSelectionBackgroundFocused: 591 case kColorId_TableSelectionBackgroundFocused:
591 return system_colors_[COLOR_HIGHLIGHT]; 592 return system_colors_[COLOR_HIGHLIGHT];
592 case kColorId_TableSelectionBackgroundUnfocused: 593 case kColorId_TableSelectionBackgroundUnfocused:
593 return system_colors_[IsUsingHighContrastTheme() ? 594 return GetUnfocusedSelectionBackgroundColor();
594 COLOR_MENUHIGHLIGHT : COLOR_BTNFACE];
595 case kColorId_TableGroupingIndicatorColor: 595 case kColorId_TableGroupingIndicatorColor:
596 return system_colors_[COLOR_GRAYTEXT]; 596 return system_colors_[COLOR_GRAYTEXT];
597 597
598 // Results Tables 598 // Results Tables
599 case kColorId_ResultsTableNormalBackground: 599 case kColorId_ResultsTableNormalBackground:
600 return system_colors_[COLOR_WINDOW]; 600 return system_colors_[COLOR_WINDOW];
601 case kColorId_ResultsTableHoveredBackground: 601 case kColorId_ResultsTableHoveredBackground:
602 return color_utils::AlphaBlend(system_colors_[COLOR_HIGHLIGHT], 602 return color_utils::AlphaBlend(system_colors_[COLOR_HIGHLIGHT],
603 system_colors_[COLOR_WINDOW], 0x40); 603 system_colors_[COLOR_WINDOW], 0x40);
604 case kColorId_ResultsTableSelectedBackground: 604 case kColorId_ResultsTableSelectedBackground:
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after
1984 case kTabPanelBackground: 1984 case kTabPanelBackground:
1985 case kTextField: 1985 case kTextField:
1986 case kTrackbarThumb: 1986 case kTrackbarThumb:
1987 case kTrackbarTrack: 1987 case kTrackbarTrack:
1988 case kMaxPart: 1988 case kMaxPart:
1989 NOTREACHED(); 1989 NOTREACHED();
1990 } 1990 }
1991 return 0; 1991 return 0;
1992 } 1992 }
1993 1993
1994 SkColor NativeThemeWin::GetUnfocusedSelectionBackgroundColor() const {
1995 return system_colors_[IsUsingHighContrastTheme() ? COLOR_MENUHIGHLIGHT
1996 : COLOR_BTNFACE];
1997 }
1998
1994 HRESULT NativeThemeWin::GetThemeInt(ThemeName theme, 1999 HRESULT NativeThemeWin::GetThemeInt(ThemeName theme,
1995 int part_id, 2000 int part_id,
1996 int state_id, 2001 int state_id,
1997 int prop_id, 2002 int prop_id,
1998 int *value) const { 2003 int *value) const {
1999 HANDLE handle = GetThemeHandle(theme); 2004 HANDLE handle = GetThemeHandle(theme);
2000 return (handle && get_theme_int_) ? 2005 return (handle && get_theme_int_) ?
2001 get_theme_int_(handle, part_id, state_id, prop_id, value) : E_NOTIMPL; 2006 get_theme_int_(handle, part_id, state_id, prop_id, value) : E_NOTIMPL;
2002 } 2007 }
2003 2008
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
2102 break; 2107 break;
2103 case LAST: 2108 case LAST:
2104 NOTREACHED(); 2109 NOTREACHED();
2105 break; 2110 break;
2106 } 2111 }
2107 theme_handles_[theme_name] = handle; 2112 theme_handles_[theme_name] = handle;
2108 return handle; 2113 return handle;
2109 } 2114 }
2110 2115
2111 } // namespace ui 2116 } // namespace ui
OLDNEW
« no previous file with comments | « ui/native_theme/native_theme_win.h ('k') | ui/views/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698