| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/single_split_view.h" | 5 #include "ui/views/controls/single_split_view.h" |
| 6 | 6 |
| 7 #include "skia/ext/skia_utils_win.h" | 7 #include "skia/ext/skia_utils_win.h" |
| 8 #include "ui/base/accessibility/accessible_view_state.h" | 8 #include "ui/base/accessibility/accessible_view_state.h" |
| 9 #include "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
| 10 #include "ui/views/background.h" | 10 #include "ui/views/background.h" |
| 11 #include "ui/views/controls/single_split_view_listener.h" | 11 #include "ui/views/controls/single_split_view_listener.h" |
| 12 | 12 |
| 13 #if defined(USE_AURA) | 13 #if defined(USE_AURA) |
| 14 #include "ui/aura/cursor.h" | 14 #include "ui/base/cursor/cursor.h" |
| 15 #endif | 15 #endif |
| 16 | 16 |
| 17 namespace views { | 17 namespace views { |
| 18 | 18 |
| 19 // static | 19 // static |
| 20 const char SingleSplitView::kViewClassName[] = | 20 const char SingleSplitView::kViewClassName[] = |
| 21 "ui/views/controls/SingleSplitView"; | 21 "ui/views/controls/SingleSplitView"; |
| 22 | 22 |
| 23 // Size of the divider in pixels. | 23 // Size of the divider in pixels. |
| 24 static const int kDividerSize = 4; | 24 static const int kDividerSize = 4; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 else | 88 else |
| 89 height += kDividerSize; | 89 height += kDividerSize; |
| 90 return gfx::Size(width, height); | 90 return gfx::Size(width, height); |
| 91 } | 91 } |
| 92 | 92 |
| 93 gfx::NativeCursor SingleSplitView::GetCursor(const MouseEvent& event) { | 93 gfx::NativeCursor SingleSplitView::GetCursor(const MouseEvent& event) { |
| 94 if (!IsPointInDivider(event.location())) | 94 if (!IsPointInDivider(event.location())) |
| 95 return gfx::kNullCursor; | 95 return gfx::kNullCursor; |
| 96 #if defined(USE_AURA) | 96 #if defined(USE_AURA) |
| 97 return is_horizontal_ ? | 97 return is_horizontal_ ? |
| 98 aura::kCursorEastWestResize : aura::kCursorNorthSouthResize; | 98 ui::kCursorEastWestResize : ui::kCursorNorthSouthResize; |
| 99 #elif defined(OS_WIN) | 99 #elif defined(OS_WIN) |
| 100 static HCURSOR we_resize_cursor = LoadCursor(NULL, IDC_SIZEWE); | 100 static HCURSOR we_resize_cursor = LoadCursor(NULL, IDC_SIZEWE); |
| 101 static HCURSOR ns_resize_cursor = LoadCursor(NULL, IDC_SIZENS); | 101 static HCURSOR ns_resize_cursor = LoadCursor(NULL, IDC_SIZENS); |
| 102 return is_horizontal_ ? we_resize_cursor : ns_resize_cursor; | 102 return is_horizontal_ ? we_resize_cursor : ns_resize_cursor; |
| 103 #endif | 103 #endif |
| 104 } | 104 } |
| 105 | 105 |
| 106 void SingleSplitView::CalculateChildrenBounds( | 106 void SingleSplitView::CalculateChildrenBounds( |
| 107 const gfx::Rect& bounds, | 107 const gfx::Rect& bounds, |
| 108 gfx::Rect* leading_bounds, | 108 gfx::Rect* leading_bounds, |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 const gfx::Rect& bounds) const { | 243 const gfx::Rect& bounds) const { |
| 244 int primary_axis_size = GetPrimaryAxisSize(bounds.width(), bounds.height()); | 244 int primary_axis_size = GetPrimaryAxisSize(bounds.width(), bounds.height()); |
| 245 if (divider_offset < 0) | 245 if (divider_offset < 0) |
| 246 // primary_axis_size may < kDividerSize during initial layout. | 246 // primary_axis_size may < kDividerSize during initial layout. |
| 247 return std::max(0, (primary_axis_size - kDividerSize) / 2); | 247 return std::max(0, (primary_axis_size - kDividerSize) / 2); |
| 248 return std::min(divider_offset, | 248 return std::min(divider_offset, |
| 249 std::max(primary_axis_size - kDividerSize, 0)); | 249 std::max(primary_axis_size - kDividerSize, 0)); |
| 250 } | 250 } |
| 251 | 251 |
| 252 } // namespace views | 252 } // namespace views |
| OLD | NEW |