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 "ui/base/accessibility/accessible_view_state.h" | 8 #include "ui/base/accessibility/accessible_view_state.h" |
9 #include "ui/events/keycodes/keyboard_codes.h" | 9 #include "ui/events/keycodes/keyboard_codes.h" |
10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 SkPaint paint; | 226 SkPaint paint; |
227 paint.setStyle(SkPaint::kStroke_Style); | 227 paint.setStyle(SkPaint::kStroke_Style); |
228 paint.setColor(kTabBorderColor); | 228 paint.setColor(kTabBorderColor); |
229 paint.setStrokeWidth(kTabBorderThickness); | 229 paint.setStrokeWidth(kTabBorderThickness); |
230 canvas->DrawPath(path, paint); | 230 canvas->DrawPath(path, paint); |
231 } else { | 231 } else { |
232 canvas->sk_canvas()->drawLine(0, line_y, line_end, line_y, paint); | 232 canvas->sk_canvas()->drawLine(0, line_y, line_end, line_y, paint); |
233 } | 233 } |
234 } | 234 } |
235 | 235 |
236 TabbedPane::TabbedPane(bool draw_border) | 236 TabbedPane::TabbedPane() |
237 : listener_(NULL), | 237 : listener_(NULL), |
238 tab_strip_(new TabStrip(this)), | 238 tab_strip_(new TabStrip(this)), |
239 contents_(new View()), | 239 contents_(new View()), |
240 selected_tab_index_(-1) { | 240 selected_tab_index_(-1) { |
241 set_focusable(true); | 241 set_focusable(true); |
242 AddChildView(tab_strip_); | 242 AddChildView(tab_strip_); |
243 AddChildView(contents_); | 243 AddChildView(contents_); |
244 if (draw_border) { | |
245 contents_->set_border(Border::CreateSolidSidedBorder(0, | |
246 kTabBorderThickness, | |
247 kTabBorderThickness, | |
248 kTabBorderThickness, | |
249 kTabBorderColor)); | |
250 } | |
251 } | 244 } |
252 | 245 |
253 TabbedPane::~TabbedPane() {} | 246 TabbedPane::~TabbedPane() {} |
254 | 247 |
255 int TabbedPane::GetTabCount() { | 248 int TabbedPane::GetTabCount() { |
256 DCHECK_EQ(tab_strip_->child_count(), contents_->child_count()); | 249 DCHECK_EQ(tab_strip_->child_count(), contents_->child_count()); |
257 return contents_->child_count(); | 250 return contents_->child_count(); |
258 } | 251 } |
259 | 252 |
260 View* TabbedPane::GetSelectedTab() { | 253 View* TabbedPane::GetSelectedTab() { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 selected_tab->NotifyAccessibilityEvent( | 362 selected_tab->NotifyAccessibilityEvent( |
370 ui::AccessibilityTypes::EVENT_FOCUS, true); | 363 ui::AccessibilityTypes::EVENT_FOCUS, true); |
371 } | 364 } |
372 } | 365 } |
373 | 366 |
374 void TabbedPane::GetAccessibleState(ui::AccessibleViewState* state) { | 367 void TabbedPane::GetAccessibleState(ui::AccessibleViewState* state) { |
375 state->role = ui::AccessibilityTypes::ROLE_PAGETABLIST; | 368 state->role = ui::AccessibilityTypes::ROLE_PAGETABLIST; |
376 } | 369 } |
377 | 370 |
378 } // namespace views | 371 } // namespace views |
OLD | NEW |