| OLD | NEW |
| 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/views/controls/tabbed_pane/native_tabbed_pane_win.h" | 5 #include "ui/views/controls/tabbed_pane/native_tabbed_pane_win.h" |
| 6 | 6 |
| 7 #include <vssym32.h> | 7 #include <vssym32.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| 11 #include "ui/base/l10n/l10n_util_win.h" | 11 #include "ui/base/l10n/l10n_util_win.h" |
| 12 #include "ui/base/native_theme/native_theme_win.h" | |
| 13 #include "ui/base/resource/resource_bundle.h" | 12 #include "ui/base/resource/resource_bundle.h" |
| 14 #include "ui/base/win/hwnd_util.h" | 13 #include "ui/base/win/hwnd_util.h" |
| 15 #include "ui/gfx/canvas.h" | 14 #include "ui/gfx/canvas.h" |
| 16 #include "ui/gfx/font.h" | 15 #include "ui/gfx/font.h" |
| 16 #include "ui/gfx/native_theme_win.h" |
| 17 #include "ui/views/controls/tabbed_pane/tabbed_pane.h" | 17 #include "ui/views/controls/tabbed_pane/tabbed_pane.h" |
| 18 #include "ui/views/controls/tabbed_pane/tabbed_pane_listener.h" | 18 #include "ui/views/controls/tabbed_pane/tabbed_pane_listener.h" |
| 19 #include "ui/views/layout/fill_layout.h" | 19 #include "ui/views/layout/fill_layout.h" |
| 20 #include "ui/views/widget/root_view.h" | 20 #include "ui/views/widget/root_view.h" |
| 21 #include "ui/views/widget/widget.h" | 21 #include "ui/views/widget/widget.h" |
| 22 | 22 |
| 23 namespace views { | 23 namespace views { |
| 24 | 24 |
| 25 // A background object that paints the tab panel background which may be | 25 // A background object that paints the tab panel background which may be |
| 26 // rendered by the system visual styles system. | 26 // rendered by the system visual styles system. |
| 27 class TabBackground : public Background { | 27 class TabBackground : public Background { |
| 28 public: | 28 public: |
| 29 explicit TabBackground() { | 29 explicit TabBackground() { |
| 30 // TMT_FILLCOLORHINT returns a color value that supposedly | 30 // TMT_FILLCOLORHINT returns a color value that supposedly |
| 31 // approximates the texture drawn by PaintTabPanelBackground. | 31 // approximates the texture drawn by PaintTabPanelBackground. |
| 32 SkColor tab_page_color = | 32 SkColor tab_page_color = |
| 33 ui::NativeThemeWin::instance()->GetThemeColorWithDefault( | 33 gfx::NativeThemeWin::instance()->GetThemeColorWithDefault( |
| 34 ui::NativeThemeWin::TAB, TABP_BODY, 0, TMT_FILLCOLORHINT, | 34 gfx::NativeThemeWin::TAB, TABP_BODY, 0, TMT_FILLCOLORHINT, |
| 35 COLOR_3DFACE); | 35 COLOR_3DFACE); |
| 36 SetNativeControlColor(tab_page_color); | 36 SetNativeControlColor(tab_page_color); |
| 37 } | 37 } |
| 38 virtual ~TabBackground() {} | 38 virtual ~TabBackground() {} |
| 39 | 39 |
| 40 virtual void Paint(gfx::Canvas* canvas, View* view) const { | 40 virtual void Paint(gfx::Canvas* canvas, View* view) const { |
| 41 gfx::Rect r(0, 0, view->width(), view->height()); | 41 gfx::Rect r(0, 0, view->width(), view->height()); |
| 42 ui::NativeTheme::ExtraParams extra; | 42 gfx::NativeTheme::ExtraParams extra; |
| 43 ui::NativeTheme::instance()->Paint( | 43 gfx::NativeTheme::instance()->Paint( |
| 44 canvas->sk_canvas(), ui::NativeTheme::kTabPanelBackground, | 44 canvas->sk_canvas(), gfx::NativeTheme::kTabPanelBackground, |
| 45 ui::NativeTheme::kNormal, r, extra); | 45 gfx::NativeTheme::kNormal, r, extra); |
| 46 } | 46 } |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 DISALLOW_COPY_AND_ASSIGN(TabBackground); | 49 DISALLOW_COPY_AND_ASSIGN(TabBackground); |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 // Custom layout manager that takes care of sizing and displaying the tab pages. | 52 // Custom layout manager that takes care of sizing and displaying the tab pages. |
| 53 class TabLayout : public LayoutManager { | 53 class TabLayout : public LayoutManager { |
| 54 public: | 54 public: |
| 55 TabLayout() {} | 55 TabLayout() {} |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 //////////////////////////////////////////////////////////////////////////////// | 398 //////////////////////////////////////////////////////////////////////////////// |
| 399 // NativeTabbedPaneWrapper, public: | 399 // NativeTabbedPaneWrapper, public: |
| 400 | 400 |
| 401 // static | 401 // static |
| 402 NativeTabbedPaneWrapper* NativeTabbedPaneWrapper::CreateNativeWrapper( | 402 NativeTabbedPaneWrapper* NativeTabbedPaneWrapper::CreateNativeWrapper( |
| 403 TabbedPane* tabbed_pane) { | 403 TabbedPane* tabbed_pane) { |
| 404 return new NativeTabbedPaneWin(tabbed_pane); | 404 return new NativeTabbedPaneWin(tabbed_pane); |
| 405 } | 405 } |
| 406 | 406 |
| 407 } // namespace views | 407 } // namespace views |
| OLD | NEW |