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

Side by Side Diff: base/gfx/native_theme.cc

Issue 125109: Refactor the PlatformContext layer to have only one class. (Closed)
Patch Set: Created 11 years, 6 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 | « base/gfx/native_theme.h ('k') | chrome/browser/gtk/download_item_gtk.cc » ('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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "base/gfx/native_theme.h" 5 #include "base/gfx/native_theme.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <uxtheme.h> 8 #include <uxtheme.h>
9 #include <vsstyle.h> 9 #include <vsstyle.h>
10 #include <vssym32.h> 10 #include <vssym32.h>
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 return S_OK; 323 return S_OK;
324 } 324 }
325 325
326 HRESULT NativeTheme::PaintScrollbarTrack( 326 HRESULT NativeTheme::PaintScrollbarTrack(
327 HDC hdc, 327 HDC hdc,
328 int part_id, 328 int part_id,
329 int state_id, 329 int state_id,
330 int classic_state, 330 int classic_state,
331 RECT* target_rect, 331 RECT* target_rect,
332 RECT* align_rect, 332 RECT* align_rect,
333 skia::PlatformCanvasWin* canvas) const { 333 skia::PlatformCanvas* canvas) const {
334 HANDLE handle = GetThemeHandle(SCROLLBAR); 334 HANDLE handle = GetThemeHandle(SCROLLBAR);
335 if (handle && draw_theme_) 335 if (handle && draw_theme_)
336 return draw_theme_(handle, hdc, part_id, state_id, target_rect, NULL); 336 return draw_theme_(handle, hdc, part_id, state_id, target_rect, NULL);
337 337
338 // Draw it manually. 338 // Draw it manually.
339 const DWORD colorScrollbar = GetSysColor(COLOR_SCROLLBAR); 339 const DWORD colorScrollbar = GetSysColor(COLOR_SCROLLBAR);
340 const DWORD color3DFace = GetSysColor(COLOR_3DFACE); 340 const DWORD color3DFace = GetSysColor(COLOR_3DFACE);
341 if ((colorScrollbar != color3DFace) && 341 if ((colorScrollbar != color3DFace) &&
342 (colorScrollbar != GetSysColor(COLOR_WINDOW))) { 342 (colorScrollbar != GetSysColor(COLOR_WINDOW))) {
343 FillRect(hdc, target_rect, reinterpret_cast<HBRUSH>(COLOR_SCROLLBAR + 1)); 343 FillRect(hdc, target_rect, reinterpret_cast<HBRUSH>(COLOR_SCROLLBAR + 1));
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 // Classic just renders a flat color background. 394 // Classic just renders a flat color background.
395 FillRect(hdc, rect, reinterpret_cast<HBRUSH>(COLOR_3DFACE + 1)); 395 FillRect(hdc, rect, reinterpret_cast<HBRUSH>(COLOR_3DFACE + 1));
396 return S_OK; 396 return S_OK;
397 } 397 }
398 398
399 HRESULT NativeTheme::PaintTrackbar(HDC hdc, 399 HRESULT NativeTheme::PaintTrackbar(HDC hdc,
400 int part_id, 400 int part_id,
401 int state_id, 401 int state_id,
402 int classic_state, 402 int classic_state,
403 RECT* rect, 403 RECT* rect,
404 skia::PlatformCanvasWin* canvas) const { 404 skia::PlatformCanvas* canvas) const {
405 // Make the channel be 4 px thick in the center of the supplied rect. (4 px 405 // Make the channel be 4 px thick in the center of the supplied rect. (4 px
406 // matches what XP does in various menus; GetThemePartSize() doesn't seem to 406 // matches what XP does in various menus; GetThemePartSize() doesn't seem to
407 // return good values here.) 407 // return good values here.)
408 RECT channel_rect = *rect; 408 RECT channel_rect = *rect;
409 const int channel_thickness = 4; 409 const int channel_thickness = 4;
410 if (part_id == TKP_TRACK) { 410 if (part_id == TKP_TRACK) {
411 channel_rect.top += 411 channel_rect.top +=
412 ((channel_rect.bottom - channel_rect.top - channel_thickness) / 2); 412 ((channel_rect.bottom - channel_rect.top - channel_thickness) / 2);
413 channel_rect.bottom = channel_rect.top + channel_thickness; 413 channel_rect.bottom = channel_rect.top + channel_thickness;
414 } else if (part_id == TKP_TRACKVERT) { 414 } else if (part_id == TKP_TRACKVERT) {
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 handle = open_theme_(NULL, L"Window"); 701 handle = open_theme_(NULL, L"Window");
702 break; 702 break;
703 default: 703 default:
704 NOTREACHED(); 704 NOTREACHED();
705 } 705 }
706 theme_handles_[theme_name] = handle; 706 theme_handles_[theme_name] = handle;
707 return handle; 707 return handle;
708 } 708 }
709 709
710 } // namespace gfx 710 } // namespace gfx
OLDNEW
« no previous file with comments | « base/gfx/native_theme.h ('k') | chrome/browser/gtk/download_item_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698