| 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" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 const SkColor kTabTitleColor_Inactive = SkColorSetRGB(0x64, 0x64, 0x64); | 33 const SkColor kTabTitleColor_Inactive = SkColorSetRGB(0x64, 0x64, 0x64); |
| 34 const SkColor kTabTitleColor_Active = SK_ColorBLACK; | 34 const SkColor kTabTitleColor_Active = SK_ColorBLACK; |
| 35 const SkColor kTabTitleColor_Hovered = SK_ColorBLACK; | 35 const SkColor kTabTitleColor_Hovered = SK_ColorBLACK; |
| 36 const SkColor kTabBorderColor = SkColorSetRGB(0xC8, 0xC8, 0xC8); | 36 const SkColor kTabBorderColor = SkColorSetRGB(0xC8, 0xC8, 0xC8); |
| 37 const SkScalar kTabBorderThickness = 1.0f; | 37 const SkScalar kTabBorderThickness = 1.0f; |
| 38 | 38 |
| 39 const gfx::Font::Weight kHoverWeight = gfx::Font::Weight::NORMAL; | 39 const gfx::Font::Weight kHoverWeight = gfx::Font::Weight::NORMAL; |
| 40 const gfx::Font::Weight kActiveWeight = gfx::Font::Weight::BOLD; | 40 const gfx::Font::Weight kActiveWeight = gfx::Font::Weight::BOLD; |
| 41 const gfx::Font::Weight kInactiveWeight = gfx::Font::Weight::NORMAL; | 41 const gfx::Font::Weight kInactiveWeight = gfx::Font::Weight::NORMAL; |
| 42 | 42 |
| 43 const int kHarmonyTabStripVerticalPad = 16; | |
| 44 const int kHarmonyTabStripTabHeight = 40; | 43 const int kHarmonyTabStripTabHeight = 40; |
| 45 | 44 |
| 46 } // namespace | 45 } // namespace |
| 47 | 46 |
| 48 namespace views { | 47 namespace views { |
| 49 | 48 |
| 50 // static | 49 // static |
| 51 const char TabbedPane::kViewClassName[] = "TabbedPane"; | 50 const char TabbedPane::kViewClassName[] = "TabbedPane"; |
| 52 | 51 |
| 53 // A subclass of Tab that implements the Harmony visual styling. | 52 // A subclass of Tab that implements the Harmony visual styling. |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 } | 379 } |
| 381 | 380 |
| 382 Tab* TabStrip::GetTabAtDeltaFromSelected(int delta) const { | 381 Tab* TabStrip::GetTabAtDeltaFromSelected(int delta) const { |
| 383 int index = (GetSelectedTabIndex() + delta) % child_count(); | 382 int index = (GetSelectedTabIndex() + delta) % child_count(); |
| 384 if (index < 0) | 383 if (index < 0) |
| 385 index += child_count(); | 384 index += child_count(); |
| 386 return GetTabAtIndex(index); | 385 return GetTabAtIndex(index); |
| 387 } | 386 } |
| 388 | 387 |
| 389 MdTabStrip::MdTabStrip() { | 388 MdTabStrip::MdTabStrip() { |
| 390 BoxLayout* layout = | 389 BoxLayout* layout = new BoxLayout(BoxLayout::kHorizontal, 0, 0, 0); |
| 391 new BoxLayout(BoxLayout::kHorizontal, 0, kHarmonyTabStripVerticalPad, 0); | |
| 392 layout->set_main_axis_alignment(BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER); | 390 layout->set_main_axis_alignment(BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER); |
| 393 layout->set_cross_axis_alignment(BoxLayout::CROSS_AXIS_ALIGNMENT_STRETCH); | 391 layout->set_cross_axis_alignment(BoxLayout::CROSS_AXIS_ALIGNMENT_STRETCH); |
| 394 layout->SetDefaultFlex(1); | 392 layout->SetDefaultFlex(1); |
| 395 SetLayoutManager(layout); | 393 SetLayoutManager(layout); |
| 396 | 394 |
| 397 // These durations are taken from the Paper Tabs source: | 395 // These durations are taken from the Paper Tabs source: |
| 398 // https://github.com/PolymerElements/paper-tabs/blob/master/paper-tabs.html | 396 // https://github.com/PolymerElements/paper-tabs/blob/master/paper-tabs.html |
| 399 // See |selectionBar.expand| and |selectionBar.contract|. | 397 // See |selectionBar.expand| and |selectionBar.contract|. |
| 400 const int kExpandAnimationDurationMs = 150; | 398 const int kExpandAnimationDurationMs = 150; |
| 401 expand_animation_.reset(new gfx::LinearAnimation(this)); | 399 expand_animation_.reset(new gfx::LinearAnimation(this)); |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 | 619 |
| 622 View* TabbedPane::GetSelectedTabContentView() { | 620 View* TabbedPane::GetSelectedTabContentView() { |
| 623 return GetSelectedTab() ? GetSelectedTab()->contents() : nullptr; | 621 return GetSelectedTab() ? GetSelectedTab()->contents() : nullptr; |
| 624 } | 622 } |
| 625 | 623 |
| 626 void TabbedPane::GetAccessibleNodeData(ui::AXNodeData* node_data) { | 624 void TabbedPane::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
| 627 node_data->role = ui::AX_ROLE_TAB_LIST; | 625 node_data->role = ui::AX_ROLE_TAB_LIST; |
| 628 } | 626 } |
| 629 | 627 |
| 630 } // namespace views | 628 } // namespace views |
| OLD | NEW |