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/tabbed_pane.h" | 5 #include "ui/views/controls/tabbed_pane/tabbed_pane.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "third_party/skia/include/core/SkPaint.h" | 9 #include "third_party/skia/include/core/SkPaint.h" |
10 #include "third_party/skia/include/core/SkPath.h" | 10 #include "third_party/skia/include/core/SkPath.h" |
11 #include "ui/accessibility/ax_view_state.h" | 11 #include "ui/accessibility/ax_view_state.h" |
12 #include "ui/base/default_style.h" | 12 #include "ui/base/default_style.h" |
13 #include "ui/base/resource/resource_bundle.h" | 13 #include "ui/base/resource/resource_bundle.h" |
14 #include "ui/events/keycodes/keyboard_codes.h" | 14 #include "ui/events/keycodes/keyboard_codes.h" |
15 #include "ui/gfx/canvas.h" | 15 #include "ui/gfx/canvas.h" |
16 #include "ui/gfx/font_list.h" | 16 #include "ui/gfx/font_list.h" |
17 #include "ui/views/controls/label.h" | 17 #include "ui/views/controls/label.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/layout_manager.h" | 19 #include "ui/views/layout/layout_manager.h" |
| 20 #include "ui/views/style/platform_style.h" |
20 #include "ui/views/widget/widget.h" | 21 #include "ui/views/widget/widget.h" |
21 | 22 |
22 namespace { | 23 namespace { |
23 | 24 |
24 // TODO(markusheintz|msw): Use NativeTheme colors. | 25 // TODO(markusheintz|msw): Use NativeTheme colors. |
25 const SkColor kTabTitleColor_Inactive = SkColorSetRGB(0x64, 0x64, 0x64); | 26 const SkColor kTabTitleColor_Inactive = SkColorSetRGB(0x64, 0x64, 0x64); |
26 const SkColor kTabTitleColor_Active = SK_ColorBLACK; | 27 const SkColor kTabTitleColor_Active = SK_ColorBLACK; |
27 const SkColor kTabTitleColor_Hovered = SK_ColorBLACK; | 28 const SkColor kTabTitleColor_Hovered = SK_ColorBLACK; |
28 const SkColor kTabBorderColor = SkColorSetRGB(0xC8, 0xC8, 0xC8); | 29 const SkColor kTabBorderColor = SkColorSetRGB(0xC8, 0xC8, 0xC8); |
29 const SkScalar kTabBorderThickness = 1.0f; | 30 const SkScalar kTabBorderThickness = 1.0f; |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 } else { | 271 } else { |
271 canvas->sk_canvas()->drawLine(0, line_y, line_end, line_y, paint); | 272 canvas->sk_canvas()->drawLine(0, line_y, line_end, line_y, paint); |
272 } | 273 } |
273 } | 274 } |
274 | 275 |
275 TabbedPane::TabbedPane() | 276 TabbedPane::TabbedPane() |
276 : listener_(NULL), | 277 : listener_(NULL), |
277 tab_strip_(new TabStrip(this)), | 278 tab_strip_(new TabStrip(this)), |
278 contents_(new View()), | 279 contents_(new View()), |
279 selected_tab_index_(-1) { | 280 selected_tab_index_(-1) { |
280 SetFocusable(true); | 281 PlatformStyle::ConfigureFocus(PlatformStyle::CONTROL::TABBED_PANE, this); |
281 AddChildView(tab_strip_); | 282 AddChildView(tab_strip_); |
282 AddChildView(contents_); | 283 AddChildView(contents_); |
283 } | 284 } |
284 | 285 |
285 TabbedPane::~TabbedPane() {} | 286 TabbedPane::~TabbedPane() {} |
286 | 287 |
287 int TabbedPane::GetTabCount() { | 288 int TabbedPane::GetTabCount() { |
288 DCHECK_EQ(tab_strip_->child_count(), contents_->child_count()); | 289 DCHECK_EQ(tab_strip_->child_count(), contents_->child_count()); |
289 return contents_->child_count(); | 290 return contents_->child_count(); |
290 } | 291 } |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 selected_tab->NotifyAccessibilityEvent( | 402 selected_tab->NotifyAccessibilityEvent( |
402 ui::AX_EVENT_FOCUS, true); | 403 ui::AX_EVENT_FOCUS, true); |
403 } | 404 } |
404 } | 405 } |
405 | 406 |
406 void TabbedPane::GetAccessibleState(ui::AXViewState* state) { | 407 void TabbedPane::GetAccessibleState(ui::AXViewState* state) { |
407 state->role = ui::AX_ROLE_TAB_LIST; | 408 state->role = ui::AX_ROLE_TAB_LIST; |
408 } | 409 } |
409 | 410 |
410 } // namespace views | 411 } // namespace views |
OLD | NEW |