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/resource/resource_bundle.h" | 12 #include "ui/base/resource/resource_bundle.h" |
13 #include "ui/events/keycodes/keyboard_codes.h" | 13 #include "ui/events/keycodes/keyboard_codes.h" |
14 #include "ui/gfx/canvas.h" | 14 #include "ui/gfx/canvas.h" |
15 #include "ui/gfx/font_list.h" | 15 #include "ui/gfx/font_list.h" |
16 #include "ui/views/controls/label.h" | 16 #include "ui/views/controls/label.h" |
17 #include "ui/views/controls/tabbed_pane/tabbed_pane_listener.h" | 17 #include "ui/views/controls/tabbed_pane/tabbed_pane_listener.h" |
18 #include "ui/views/layout/layout_manager.h" | 18 #include "ui/views/layout/layout_manager.h" |
| 19 #include "ui/views/style/platform_style.h" |
19 #include "ui/views/widget/widget.h" | 20 #include "ui/views/widget/widget.h" |
20 | 21 |
21 namespace { | 22 namespace { |
22 | 23 |
23 // TODO(markusheintz|msw): Use NativeTheme colors. | 24 // TODO(markusheintz|msw): Use NativeTheme colors. |
24 const SkColor kTabTitleColor_Inactive = SkColorSetRGB(0x64, 0x64, 0x64); | 25 const SkColor kTabTitleColor_Inactive = SkColorSetRGB(0x64, 0x64, 0x64); |
25 const SkColor kTabTitleColor_Active = SK_ColorBLACK; | 26 const SkColor kTabTitleColor_Active = SK_ColorBLACK; |
26 const SkColor kTabTitleColor_Hovered = SK_ColorBLACK; | 27 const SkColor kTabTitleColor_Hovered = SK_ColorBLACK; |
27 const SkColor kTabBorderColor = SkColorSetRGB(0xC8, 0xC8, 0xC8); | 28 const SkColor kTabBorderColor = SkColorSetRGB(0xC8, 0xC8, 0xC8); |
28 const SkScalar kTabBorderThickness = 1.0f; | 29 const SkScalar kTabBorderThickness = 1.0f; |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 } else { | 261 } else { |
261 canvas->sk_canvas()->drawLine(0, line_y, line_end, line_y, paint); | 262 canvas->sk_canvas()->drawLine(0, line_y, line_end, line_y, paint); |
262 } | 263 } |
263 } | 264 } |
264 | 265 |
265 TabbedPane::TabbedPane() | 266 TabbedPane::TabbedPane() |
266 : listener_(NULL), | 267 : listener_(NULL), |
267 tab_strip_(new TabStrip(this)), | 268 tab_strip_(new TabStrip(this)), |
268 contents_(new View()), | 269 contents_(new View()), |
269 selected_tab_index_(-1) { | 270 selected_tab_index_(-1) { |
270 SetFocusable(true); | 271 PlatformStyle::SetControlStyleFocus(this); |
271 AddChildView(tab_strip_); | 272 AddChildView(tab_strip_); |
272 AddChildView(contents_); | 273 AddChildView(contents_); |
273 } | 274 } |
274 | 275 |
275 TabbedPane::~TabbedPane() {} | 276 TabbedPane::~TabbedPane() {} |
276 | 277 |
277 int TabbedPane::GetTabCount() { | 278 int TabbedPane::GetTabCount() { |
278 DCHECK_EQ(tab_strip_->child_count(), contents_->child_count()); | 279 DCHECK_EQ(tab_strip_->child_count(), contents_->child_count()); |
279 return contents_->child_count(); | 280 return contents_->child_count(); |
280 } | 281 } |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 selected_tab->NotifyAccessibilityEvent( | 392 selected_tab->NotifyAccessibilityEvent( |
392 ui::AX_EVENT_FOCUS, true); | 393 ui::AX_EVENT_FOCUS, true); |
393 } | 394 } |
394 } | 395 } |
395 | 396 |
396 void TabbedPane::GetAccessibleState(ui::AXViewState* state) { | 397 void TabbedPane::GetAccessibleState(ui::AXViewState* state) { |
397 state->role = ui::AX_ROLE_TAB_LIST; | 398 state->role = ui::AX_ROLE_TAB_LIST; |
398 } | 399 } |
399 | 400 |
400 } // namespace views | 401 } // namespace views |
OLD | NEW |