OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "views/controls/tabbed_pane/tabbed_pane.h" | 5 #include "views/controls/tabbed_pane/tabbed_pane.h" |
6 | 6 |
7 #include "base/keyboard_codes.h" | 7 #include "base/keyboard_codes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "views/controls/native/native_view_host.h" | 9 #include "views/controls/native/native_view_host.h" |
10 #include "views/controls/tabbed_pane/native_tabbed_pane_wrapper.h" | 10 #include "views/controls/tabbed_pane/native_tabbed_pane_wrapper.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 } | 95 } |
96 | 96 |
97 void TabbedPane::LoadAccelerators() { | 97 void TabbedPane::LoadAccelerators() { |
98 // Ctrl+Shift+Tab | 98 // Ctrl+Shift+Tab |
99 AddAccelerator(views::Accelerator(base::VKEY_TAB, true, true, false)); | 99 AddAccelerator(views::Accelerator(base::VKEY_TAB, true, true, false)); |
100 // Ctrl+Tab | 100 // Ctrl+Tab |
101 AddAccelerator(views::Accelerator(base::VKEY_TAB, false, true, false)); | 101 AddAccelerator(views::Accelerator(base::VKEY_TAB, false, true, false)); |
102 } | 102 } |
103 | 103 |
104 void TabbedPane::Layout() { | 104 void TabbedPane::Layout() { |
105 if (native_tabbed_pane_) { | 105 if (native_tabbed_pane_) |
106 native_tabbed_pane_->GetView()->SetBounds(0, 0, width(), height()); | 106 native_tabbed_pane_->GetView()->SetBounds(0, 0, width(), height()); |
107 native_tabbed_pane_->GetView()->Layout(); | |
108 } | |
109 } | 107 } |
110 | 108 |
111 void TabbedPane::Focus() { | 109 void TabbedPane::Focus() { |
112 // Forward the focus to the wrapper. | 110 // Forward the focus to the wrapper. |
113 if (native_tabbed_pane_) | 111 if (native_tabbed_pane_) |
114 native_tabbed_pane_->SetFocus(); | 112 native_tabbed_pane_->SetFocus(); |
115 else | 113 else |
116 View::Focus(); // Will focus the RootView window (so we still get keyboard | 114 View::Focus(); // Will focus the RootView window (so we still get keyboard |
117 // messages). | 115 // messages). |
118 } | 116 } |
119 | 117 |
120 void TabbedPane::PaintFocusBorder(gfx::Canvas* canvas) { | 118 void TabbedPane::PaintFocusBorder(gfx::Canvas* canvas) { |
121 if (NativeViewHost::kRenderNativeControlFocus) | 119 if (NativeViewHost::kRenderNativeControlFocus) |
122 View::PaintFocusBorder(canvas); | 120 View::PaintFocusBorder(canvas); |
123 } | 121 } |
124 | 122 |
125 bool TabbedPane::GetAccessibleRole(AccessibilityTypes::Role* role) { | 123 bool TabbedPane::GetAccessibleRole(AccessibilityTypes::Role* role) { |
126 DCHECK(role); | 124 DCHECK(role); |
127 | 125 |
128 *role = AccessibilityTypes::ROLE_PAGETABLIST; | 126 *role = AccessibilityTypes::ROLE_PAGETABLIST; |
129 return true; | 127 return true; |
130 } | 128 } |
131 | 129 |
| 130 gfx::Size TabbedPane::GetPreferredSize() { |
| 131 return native_tabbed_pane_ ? |
| 132 native_tabbed_pane_->GetPreferredSize() : gfx::Size(); |
| 133 } |
| 134 |
132 } // namespace views | 135 } // namespace views |
OLD | NEW |