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 "views/controls/single_split_view.h" | 5 #include "views/controls/single_split_view.h" |
6 | 6 |
7 #if defined(OS_LINUX) | 7 #if defined(TOOLKIT_USES_GTK) |
8 #include <gdk/gdk.h> | 8 #include <gdk/gdk.h> |
9 #endif | 9 #endif |
10 | 10 |
11 #include "skia/ext/skia_utils_win.h" | 11 #include "skia/ext/skia_utils_win.h" |
12 #include "ui/base/accessibility/accessible_view_state.h" | 12 #include "ui/base/accessibility/accessible_view_state.h" |
13 #include "ui/gfx/canvas.h" | 13 #include "ui/gfx/canvas.h" |
14 #include "views/background.h" | 14 #include "views/background.h" |
15 | 15 |
16 #if defined(OS_LINUX) | 16 #if defined(TOOLKIT_USES_GTK) |
17 #include "ui/gfx/gtk_util.h" | 17 #include "ui/gfx/gtk_util.h" |
18 #endif | 18 #endif |
19 | 19 |
20 namespace views { | 20 namespace views { |
21 | 21 |
22 // static | 22 // static |
23 const char SingleSplitView::kViewClassName[] = | 23 const char SingleSplitView::kViewClassName[] = |
24 "views/controls/SingleSplitView"; | 24 "views/controls/SingleSplitView"; |
25 | 25 |
26 // Size of the divider in pixels. | 26 // Size of the divider in pixels. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 return gfx::Size(width, height); | 93 return gfx::Size(width, height); |
94 } | 94 } |
95 | 95 |
96 gfx::NativeCursor SingleSplitView::GetCursor(const MouseEvent& event) { | 96 gfx::NativeCursor SingleSplitView::GetCursor(const MouseEvent& event) { |
97 if (!IsPointInDivider(event.location())) | 97 if (!IsPointInDivider(event.location())) |
98 return NULL; | 98 return NULL; |
99 #if defined(OS_WIN) | 99 #if 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 #elif defined(USE_AURA) | 103 #elif defined(TOOLKIT_USES_GTK) |
| 104 return gfx::GetCursor(is_horizontal_ ? GDK_SB_H_DOUBLE_ARROW : |
| 105 GDK_SB_V_DOUBLE_ARROW); |
| 106 #else |
104 // TODO(saintlou): | 107 // TODO(saintlou): |
105 return NULL; | 108 return NULL; |
106 #elif defined(OS_LINUX) | |
107 return gfx::GetCursor(is_horizontal_ ? GDK_SB_H_DOUBLE_ARROW : | |
108 GDK_SB_V_DOUBLE_ARROW); | |
109 #endif | 109 #endif |
110 } | 110 } |
111 | 111 |
112 void SingleSplitView::CalculateChildrenBounds( | 112 void SingleSplitView::CalculateChildrenBounds( |
113 const gfx::Rect& bounds, | 113 const gfx::Rect& bounds, |
114 gfx::Rect* leading_bounds, | 114 gfx::Rect* leading_bounds, |
115 gfx::Rect* trailing_bounds) const { | 115 gfx::Rect* trailing_bounds) const { |
116 bool is_leading_visible = has_children() && child_at(0)->IsVisible(); | 116 bool is_leading_visible = has_children() && child_at(0)->IsVisible(); |
117 bool is_trailing_visible = child_count() > 1 && child_at(1)->IsVisible(); | 117 bool is_trailing_visible = child_count() > 1 && child_at(1)->IsVisible(); |
118 | 118 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 const gfx::Rect& bounds) const { | 249 const gfx::Rect& bounds) const { |
250 int primary_axis_size = GetPrimaryAxisSize(bounds.width(), bounds.height()); | 250 int primary_axis_size = GetPrimaryAxisSize(bounds.width(), bounds.height()); |
251 if (divider_offset < 0) | 251 if (divider_offset < 0) |
252 // primary_axis_size may < kDividerSize during initial layout. | 252 // primary_axis_size may < kDividerSize during initial layout. |
253 return std::max(0, (primary_axis_size - kDividerSize) / 2); | 253 return std::max(0, (primary_axis_size - kDividerSize) / 2); |
254 return std::min(divider_offset, | 254 return std::min(divider_offset, |
255 std::max(primary_axis_size - kDividerSize, 0)); | 255 std::max(primary_axis_size - kDividerSize, 0)); |
256 } | 256 } |
257 | 257 |
258 } // namespace views | 258 } // namespace views |
OLD | NEW |