OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
10 #include <windows.h> | 10 #include <windows.h> |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 if (!label.empty()) | 49 if (!label.empty()) |
50 button_view->SetText(label); | 50 button_view->SetText(label); |
51 button_view->SetEnabled(delegate->IsDialogButtonEnabled(button)); | 51 button_view->SetEnabled(delegate->IsDialogButtonEnabled(button)); |
52 button_view->SetVisible(delegate->IsDialogButtonVisible(button)); | 52 button_view->SetVisible(delegate->IsDialogButtonVisible(button)); |
53 } | 53 } |
54 | 54 |
55 #if defined(OS_WIN) | 55 #if defined(OS_WIN) |
56 void FillViewWithSysColor(gfx::Canvas* canvas, View* view, COLORREF color) { | 56 void FillViewWithSysColor(gfx::Canvas* canvas, View* view, COLORREF color) { |
57 SkColor sk_color = | 57 SkColor sk_color = |
58 SkColorSetRGB(GetRValue(color), GetGValue(color), GetBValue(color)); | 58 SkColorSetRGB(GetRValue(color), GetGValue(color), GetBValue(color)); |
59 canvas->FillRectInt(sk_color, 0, 0, view->width(), view->height()); | 59 canvas->FillRect(sk_color, gfx::Rect(gfx::Point(), view->size())); |
Peter Kasting
2011/10/27 19:17:29
Nit: view->GetLocalBounds()
tfarina
2011/10/27 20:46:03
Done.
| |
60 } | 60 } |
61 #endif | 61 #endif |
62 | 62 |
63 // DialogButton ---------------------------------------------------------------- | 63 // DialogButton ---------------------------------------------------------------- |
64 | 64 |
65 // DialogButtons is used for the ok/cancel buttons of the window. DialogButton | 65 // DialogButtons is used for the ok/cancel buttons of the window. DialogButton |
66 // forwards AcceleratorPressed to the delegate. | 66 // forwards AcceleratorPressed to the delegate. |
67 | 67 |
68 class DialogButton : public NativeTextButton { | 68 class DialogButton : public NativeTextButton { |
69 public: | 69 public: |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
310 } | 310 } |
311 | 311 |
312 //////////////////////////////////////////////////////////////////////////////// | 312 //////////////////////////////////////////////////////////////////////////////// |
313 // DialogClientView, View overrides: | 313 // DialogClientView, View overrides: |
314 | 314 |
315 void DialogClientView::OnPaint(gfx::Canvas* canvas) { | 315 void DialogClientView::OnPaint(gfx::Canvas* canvas) { |
316 #if defined(OS_WIN) | 316 #if defined(OS_WIN) |
317 FillViewWithSysColor(canvas, this, GetSysColor(COLOR_3DFACE)); | 317 FillViewWithSysColor(canvas, this, GetSysColor(COLOR_3DFACE)); |
318 #elif defined(USE_WAYLAND) || defined(USE_AURA) | 318 #elif defined(USE_WAYLAND) || defined(USE_AURA) |
319 SkColor sk_color = SkColorSetARGB(200, 255, 255, 255); | 319 SkColor sk_color = SkColorSetARGB(200, 255, 255, 255); |
320 canvas->FillRectInt(sk_color, 0, 0, width(), height()); | 320 canvas->FillRect(sk_color, GetLocalBounds()); |
321 #else | 321 #else |
322 GtkWidget* widget = GetWidget()->GetNativeView(); | 322 GtkWidget* widget = GetWidget()->GetNativeView(); |
323 if (GTK_IS_WINDOW(widget)) { | 323 if (GTK_IS_WINDOW(widget)) { |
324 GtkStyle* window_style = gtk_widget_get_style(widget); | 324 GtkStyle* window_style = gtk_widget_get_style(widget); |
325 canvas->FillRectInt(gfx::GdkColorToSkColor( | 325 canvas->FillRect(gfx::GdkColorToSkColor(window_style->bg[GTK_STATE_NORMAL]), |
326 window_style->bg[GTK_STATE_NORMAL]), | 326 GetLocalBounds()); |
327 0, 0, width(), height()); | |
328 } | 327 } |
329 #endif | 328 #endif |
330 } | 329 } |
331 | 330 |
332 void DialogClientView::PaintChildren(gfx::Canvas* canvas) { | 331 void DialogClientView::PaintChildren(gfx::Canvas* canvas) { |
333 View::PaintChildren(canvas); | 332 View::PaintChildren(canvas); |
334 if (!GetWidget()->IsMaximized() && !GetWidget()->IsMinimized()) | 333 if (!GetWidget()->IsMaximized() && !GetWidget()->IsMinimized()) |
335 PaintSizeBox(canvas); | 334 PaintSizeBox(canvas); |
336 } | 335 } |
337 | 336 |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
582 void DialogClientView::InitClass() { | 581 void DialogClientView::InitClass() { |
583 static bool initialized = false; | 582 static bool initialized = false; |
584 if (!initialized) { | 583 if (!initialized) { |
585 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 584 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
586 dialog_button_font_ = new gfx::Font(rb.GetFont(ResourceBundle::BaseFont)); | 585 dialog_button_font_ = new gfx::Font(rb.GetFont(ResourceBundle::BaseFont)); |
587 initialized = true; | 586 initialized = true; |
588 } | 587 } |
589 } | 588 } |
590 | 589 |
591 } // namespace views | 590 } // namespace views |
OLD | NEW |