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

Side by Side Diff: views/window/dialog_client_view.cc

Issue 2825018: Canvas refactoring part 3.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 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 | Annotate | Revision Log
« gfx/canvas.h ('K') | « views/widget/widget_win.cc ('k') | no next file » | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "views/window/dialog_client_view.h" 5 #include "views/window/dialog_client_view.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <uxtheme.h> 9 #include <uxtheme.h>
10 #include <vsstyle.h> 10 #include <vsstyle.h>
11 #else 11 #else
12 #include <gtk/gtk.h> 12 #include <gtk/gtk.h>
13 #endif 13 #endif
14 14
15 #include <algorithm> 15 #include <algorithm>
16 16
17 #include "app/l10n_util.h" 17 #include "app/l10n_util.h"
18 #include "app/resource_bundle.h" 18 #include "app/resource_bundle.h"
19 #include "base/keyboard_codes.h" 19 #include "base/keyboard_codes.h"
20 #include "gfx/canvas.h" 20 #include "gfx/canvas_skia.h"
21 #include "gfx/font.h" 21 #include "gfx/font.h"
22 #include "grit/app_strings.h" 22 #include "grit/app_strings.h"
23 #include "views/controls/button/native_button.h" 23 #include "views/controls/button/native_button.h"
24 #include "views/standard_layout.h" 24 #include "views/standard_layout.h"
25 #include "views/window/dialog_delegate.h" 25 #include "views/window/dialog_delegate.h"
26 #include "views/window/window.h" 26 #include "views/window/window.h"
27 27
28 #if defined(OS_WIN) 28 #if defined(OS_WIN)
29 #include "gfx/native_theme_win.h" 29 #include "gfx/native_theme_win.h"
30 #else 30 #else
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 } 411 }
412 } 412 }
413 413
414 //////////////////////////////////////////////////////////////////////////////// 414 ////////////////////////////////////////////////////////////////////////////////
415 // DialogClientView, private: 415 // DialogClientView, private:
416 416
417 void DialogClientView::PaintSizeBox(gfx::Canvas* canvas) { 417 void DialogClientView::PaintSizeBox(gfx::Canvas* canvas) {
418 if (window()->GetDelegate()->CanResize() || 418 if (window()->GetDelegate()->CanResize() ||
419 window()->GetDelegate()->CanMaximize()) { 419 window()->GetDelegate()->CanMaximize()) {
420 #if defined(OS_WIN) 420 #if defined(OS_WIN)
421 HDC dc = canvas->beginPlatformPaint(); 421 HDC dc = canvas->AsCanvasSkia()->beginPlatformPaint();
422 SIZE gripper_size = { 0, 0 }; 422 SIZE gripper_size = { 0, 0 };
423 gfx::NativeTheme::instance()->GetThemePartSize( 423 gfx::NativeTheme::instance()->GetThemePartSize(
424 gfx::NativeTheme::STATUS, dc, SP_GRIPPER, 1, NULL, TS_TRUE, 424 gfx::NativeTheme::STATUS, dc, SP_GRIPPER, 1, NULL, TS_TRUE,
425 &gripper_size); 425 &gripper_size);
426 426
427 // TODO(beng): (http://b/1085509) In "classic" rendering mode, there isn't 427 // TODO(beng): (http://b/1085509) In "classic" rendering mode, there isn't
428 // a theme-supplied gripper. We should probably improvise 428 // a theme-supplied gripper. We should probably improvise
429 // something, which would also require changing |gripper_size| 429 // something, which would also require changing |gripper_size|
430 // to have different default values, too... 430 // to have different default values, too...
431 size_box_bounds_ = GetLocalBounds(false); 431 size_box_bounds_ = GetLocalBounds(false);
432 size_box_bounds_.set_x(size_box_bounds_.right() - gripper_size.cx); 432 size_box_bounds_.set_x(size_box_bounds_.right() - gripper_size.cx);
433 size_box_bounds_.set_y(size_box_bounds_.bottom() - gripper_size.cy); 433 size_box_bounds_.set_y(size_box_bounds_.bottom() - gripper_size.cy);
434 RECT native_bounds = size_box_bounds_.ToRECT(); 434 RECT native_bounds = size_box_bounds_.ToRECT();
435 gfx::NativeTheme::instance()->PaintStatusGripper( 435 gfx::NativeTheme::instance()->PaintStatusGripper(
436 dc, SP_PANE, 1, 0, &native_bounds); 436 dc, SP_PANE, 1, 0, &native_bounds);
437 canvas->endPlatformPaint(); 437 canvas->AsCanvasSkia()->endPlatformPaint();
438 #else 438 #else
439 NOTIMPLEMENTED(); 439 NOTIMPLEMENTED();
440 // TODO(port): paint size box 440 // TODO(port): paint size box
441 #endif 441 #endif
442 } 442 }
443 } 443 }
444 444
445 int DialogClientView::GetButtonWidth(int button) const { 445 int DialogClientView::GetButtonWidth(int button) const {
446 DialogDelegate* dd = GetDialogDelegate(); 446 DialogDelegate* dd = GetDialogDelegate();
447 std::wstring button_label = dd->GetDialogButtonLabel( 447 std::wstring button_label = dd->GetDialogButtonLabel(
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 void DialogClientView::InitClass() { 562 void DialogClientView::InitClass() {
563 static bool initialized = false; 563 static bool initialized = false;
564 if (!initialized) { 564 if (!initialized) {
565 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 565 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
566 dialog_button_font_ = new gfx::Font(rb.GetFont(ResourceBundle::BaseFont)); 566 dialog_button_font_ = new gfx::Font(rb.GetFont(ResourceBundle::BaseFont));
567 initialized = true; 567 initialized = true;
568 } 568 }
569 } 569 }
570 570
571 } // namespace views 571 } // namespace views
OLDNEW
« gfx/canvas.h ('K') | « views/widget/widget_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698