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

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

Issue 2655553003: Native themes: Add menu separator part (Closed)
Patch Set: item->separator Created 3 years, 10 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 | « 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 const gfx::Rect& rect, 257 const gfx::Rect& rect,
258 const ExtraParams& extra) const { 258 const ExtraParams& extra) const {
259 if (rect.IsEmpty()) 259 if (rect.IsEmpty())
260 return; 260 return;
261 261
262 switch (part) { 262 switch (part) {
263 case kMenuPopupGutter: 263 case kMenuPopupGutter:
264 PaintMenuGutter(canvas, rect); 264 PaintMenuGutter(canvas, rect);
265 return; 265 return;
266 case kMenuPopupSeparator: 266 case kMenuPopupSeparator:
267 PaintMenuSeparator(canvas, rect); 267 PaintMenuSeparator(canvas, *extra.menu_separator.paint_rect);
268 return; 268 return;
269 case kMenuPopupBackground: 269 case kMenuPopupBackground:
270 PaintMenuBackground(canvas, rect); 270 PaintMenuBackground(canvas, rect);
271 return; 271 return;
272 case kMenuItemBackground: 272 case kMenuItemBackground:
273 CommonThemePaintMenuItemBackground(this, canvas, state, rect, 273 CommonThemePaintMenuItemBackground(this, canvas, state, rect,
274 extra.menu_item); 274 extra.menu_item);
275 return; 275 return;
276 default: 276 default:
277 break; 277 break;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 case kMenuPopupArrow: 422 case kMenuPopupArrow:
423 PaintMenuArrow(hdc, state, rect, extra.menu_arrow); 423 PaintMenuArrow(hdc, state, rect, extra.menu_arrow);
424 return; 424 return;
425 case kMenuPopupBackground: 425 case kMenuPopupBackground:
426 PaintMenuBackground(hdc, rect); 426 PaintMenuBackground(hdc, rect);
427 return; 427 return;
428 case kMenuPopupGutter: 428 case kMenuPopupGutter:
429 PaintMenuGutter(hdc, rect); 429 PaintMenuGutter(hdc, rect);
430 return; 430 return;
431 case kMenuPopupSeparator: 431 case kMenuPopupSeparator:
432 PaintMenuSeparator(hdc, rect); 432 PaintMenuSeparator(hdc, *extra.menu_separator.paint_rect);
433 return; 433 return;
434 case kMenuItemBackground: 434 case kMenuItemBackground:
435 PaintMenuItemBackground(hdc, state, rect, extra.menu_item); 435 PaintMenuItemBackground(hdc, state, rect, extra.menu_item);
436 return; 436 return;
437 case kProgressBar: 437 case kProgressBar:
438 PaintProgressBar(hdc, rect, extra.progress_bar); 438 PaintProgressBar(hdc, rect, extra.progress_bar);
439 return; 439 return;
440 case kPushButton: 440 case kPushButton:
441 PaintPushButton(hdc, part, state, rect, extra.button); 441 PaintPushButton(hdc, part, state, rect, extra.button);
442 return; 442 return;
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 // "4 / 13" is same as IE10 in classic theme. 859 // "4 / 13" is same as IE10 in classic theme.
860 int padding = (inner_rect.right - inner_rect.left) * 4 / 13; 860 int padding = (inner_rect.right - inner_rect.left) * 4 / 13;
861 InflateRect(&inner_rect, -padding, -padding); 861 InflateRect(&inner_rect, -padding, -padding);
862 int color_index = state == kDisabled ? COLOR_GRAYTEXT : COLOR_WINDOWTEXT; 862 int color_index = state == kDisabled ? COLOR_GRAYTEXT : COLOR_WINDOWTEXT;
863 FillRect(hdc, &inner_rect, GetSysColorBrush(color_index)); 863 FillRect(hdc, &inner_rect, GetSysColorBrush(color_index));
864 } 864 }
865 865
866 return S_OK; 866 return S_OK;
867 } 867 }
868 868
869 HRESULT NativeThemeWin::PaintMenuSeparator( 869 HRESULT NativeThemeWin::PaintMenuSeparator(HDC hdc,
870 HDC hdc, 870 const gfx::Rect& rect) const {
871 const gfx::Rect& rect) const {
872 RECT rect_win = rect.ToRECT(); 871 RECT rect_win = rect.ToRECT();
873 872
874 HANDLE handle = GetThemeHandle(MENU); 873 HANDLE handle = GetThemeHandle(MENU);
875 if (handle && draw_theme_) { 874 if (handle && draw_theme_) {
876 // Delta is needed for non-classic to move separator up slightly. 875 // Delta is needed for non-classic to move separator up slightly.
877 --rect_win.top; 876 --rect_win.top;
878 --rect_win.bottom; 877 --rect_win.bottom;
879 return draw_theme_(handle, hdc, MENU_POPUPSEPARATOR, MPI_NORMAL, &rect_win, 878 return draw_theme_(handle, hdc, MENU_POPUPSEPARATOR, MPI_NORMAL, &rect_win,
880 NULL); 879 NULL);
881 } 880 }
(...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after
2102 break; 2101 break;
2103 case LAST: 2102 case LAST:
2104 NOTREACHED(); 2103 NOTREACHED();
2105 break; 2104 break;
2106 } 2105 }
2107 theme_handles_[theme_name] = handle; 2106 theme_handles_[theme_name] = handle;
2108 return handle; 2107 return handle;
2109 } 2108 }
2110 2109
2111 } // namespace ui 2110 } // 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