OLD | NEW |
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/controls/tabbed_pane/native_tabbed_pane_win.h" | 5 #include "views/controls/tabbed_pane/native_tabbed_pane_win.h" |
6 | 6 |
7 #include <vssym32.h> | 7 #include <vssym32.h> |
8 | 8 |
9 #include "app/l10n_util_win.h" | 9 #include "app/l10n_util_win.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/stl_util-inl.h" | 12 #include "base/stl_util-inl.h" |
13 #include "gfx/canvas_skia.h" | 13 #include "gfx/canvas.h" |
14 #include "gfx/font.h" | 14 #include "gfx/font.h" |
15 #include "gfx/native_theme_win.h" | 15 #include "gfx/native_theme_win.h" |
16 #include "views/controls/tabbed_pane/tabbed_pane.h" | 16 #include "views/controls/tabbed_pane/tabbed_pane.h" |
17 #include "views/fill_layout.h" | 17 #include "views/fill_layout.h" |
18 #include "views/widget/root_view.h" | 18 #include "views/widget/root_view.h" |
19 #include "views/widget/widget_win.h" | 19 #include "views/widget/widget_win.h" |
20 | 20 |
21 namespace views { | 21 namespace views { |
22 | 22 |
23 // A background object that paints the tab panel background which may be | 23 // A background object that paints the tab panel background which may be |
24 // rendered by the system visual styles system. | 24 // rendered by the system visual styles system. |
25 class TabBackground : public Background { | 25 class TabBackground : public Background { |
26 public: | 26 public: |
27 explicit TabBackground() { | 27 explicit TabBackground() { |
28 // TMT_FILLCOLORHINT returns a color value that supposedly | 28 // TMT_FILLCOLORHINT returns a color value that supposedly |
29 // approximates the texture drawn by PaintTabPanelBackground. | 29 // approximates the texture drawn by PaintTabPanelBackground. |
30 SkColor tab_page_color = | 30 SkColor tab_page_color = |
31 gfx::NativeTheme::instance()->GetThemeColorWithDefault( | 31 gfx::NativeTheme::instance()->GetThemeColorWithDefault( |
32 gfx::NativeTheme::TAB, TABP_BODY, 0, TMT_FILLCOLORHINT, | 32 gfx::NativeTheme::TAB, TABP_BODY, 0, TMT_FILLCOLORHINT, |
33 COLOR_3DFACE); | 33 COLOR_3DFACE); |
34 SetNativeControlColor(tab_page_color); | 34 SetNativeControlColor(tab_page_color); |
35 } | 35 } |
36 virtual ~TabBackground() {} | 36 virtual ~TabBackground() {} |
37 | 37 |
38 virtual void Paint(gfx::Canvas* canvas, View* view) const { | 38 virtual void Paint(gfx::Canvas* canvas, View* view) const { |
39 HDC dc = canvas->AsCanvasSkia()->beginPlatformPaint(); | 39 HDC dc = canvas->beginPlatformPaint(); |
40 RECT r = {0, 0, view->width(), view->height()}; | 40 RECT r = {0, 0, view->width(), view->height()}; |
41 gfx::NativeTheme::instance()->PaintTabPanelBackground(dc, &r); | 41 gfx::NativeTheme::instance()->PaintTabPanelBackground(dc, &r); |
42 canvas->AsCanvasSkia()->endPlatformPaint(); | 42 canvas->endPlatformPaint(); |
43 } | 43 } |
44 | 44 |
45 private: | 45 private: |
46 DISALLOW_COPY_AND_ASSIGN(TabBackground); | 46 DISALLOW_COPY_AND_ASSIGN(TabBackground); |
47 }; | 47 }; |
48 | 48 |
49 //////////////////////////////////////////////////////////////////////////////// | 49 //////////////////////////////////////////////////////////////////////////////// |
50 // NativeTabbedPaneWin, public: | 50 // NativeTabbedPaneWin, public: |
51 | 51 |
52 NativeTabbedPaneWin::NativeTabbedPaneWin(TabbedPane* tabbed_pane) | 52 NativeTabbedPaneWin::NativeTabbedPaneWin(TabbedPane* tabbed_pane) |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 //////////////////////////////////////////////////////////////////////////////// | 326 //////////////////////////////////////////////////////////////////////////////// |
327 // NativeTabbedPaneWrapper, public: | 327 // NativeTabbedPaneWrapper, public: |
328 | 328 |
329 // static | 329 // static |
330 NativeTabbedPaneWrapper* NativeTabbedPaneWrapper::CreateNativeWrapper( | 330 NativeTabbedPaneWrapper* NativeTabbedPaneWrapper::CreateNativeWrapper( |
331 TabbedPane* tabbed_pane) { | 331 TabbedPane* tabbed_pane) { |
332 return new NativeTabbedPaneWin(tabbed_pane); | 332 return new NativeTabbedPaneWin(tabbed_pane); |
333 } | 333 } |
334 | 334 |
335 } // namespace views | 335 } // namespace views |
OLD | NEW |