| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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(OS_LINUX) |
| 8 #include <gdk/gdk.h> | 8 #include <gdk/gdk.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| 11 #include "app/gfx/canvas.h" | 11 #include "app/gfx/canvas.h" |
| 12 #include "skia/ext/skia_utils_win.h" | 12 #include "skia/ext/skia_utils_win.h" |
| 13 #include "views/background.h" | 13 #include "views/background.h" |
| 14 | 14 |
| 15 namespace views { | 15 namespace views { |
| 16 | 16 |
| 17 // Size of the divider in pixels. | 17 // Size of the divider in pixels. |
| 18 static const int kDividerSize = 4; | 18 static const int kDividerSize = 4; |
| 19 | 19 |
| 20 SingleSplitView::SingleSplitView(View* leading, | 20 SingleSplitView::SingleSplitView(View* leading, |
| 21 View* trailing, | 21 View* trailing, |
| 22 Orientation orientation) | 22 Orientation orientation) |
| 23 : is_horizontal_(orientation == HORIZONTAL_SPLIT), | 23 : is_horizontal_(orientation == HORIZONTAL_SPLIT), |
| 24 divider_offset_(-1) { | 24 divider_offset_(-1) { |
| 25 AddChildView(leading); | 25 AddChildView(leading); |
| 26 AddChildView(trailing); | 26 AddChildView(trailing); |
| 27 #if defined(OS_WIN) |
| 27 set_background( | 28 set_background( |
| 28 views::Background::CreateSolidBackground( | 29 views::Background::CreateSolidBackground( |
| 29 skia::COLORREFToSkColor(GetSysColor(COLOR_3DFACE)))); | 30 skia::COLORREFToSkColor(GetSysColor(COLOR_3DFACE)))); |
| 31 #endif |
| 30 } | 32 } |
| 31 | 33 |
| 32 void SingleSplitView::Layout() { | 34 void SingleSplitView::Layout() { |
| 33 if (GetChildViewCount() != 2) | 35 if (GetChildViewCount() != 2) |
| 34 return; | 36 return; |
| 35 | 37 |
| 36 View* leading = GetChildViewAt(0); | 38 View* leading = GetChildViewAt(0); |
| 37 View* trailing = GetChildViewAt(1); | 39 View* trailing = GetChildViewAt(1); |
| 38 | 40 |
| 39 if (!leading->IsVisible() && !trailing->IsVisible()) | 41 if (!leading->IsVisible() && !trailing->IsVisible()) |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 divider_relative_offset = | 159 divider_relative_offset = |
| 158 x - GetChildViewAt(UILayoutIsRightToLeft() ? 1 : 0)->width(); | 160 x - GetChildViewAt(UILayoutIsRightToLeft() ? 1 : 0)->width(); |
| 159 } else { | 161 } else { |
| 160 divider_relative_offset = y - GetChildViewAt(0)->height(); | 162 divider_relative_offset = y - GetChildViewAt(0)->height(); |
| 161 } | 163 } |
| 162 return (divider_relative_offset >= 0 && | 164 return (divider_relative_offset >= 0 && |
| 163 divider_relative_offset < kDividerSize); | 165 divider_relative_offset < kDividerSize); |
| 164 } | 166 } |
| 165 | 167 |
| 166 } // namespace views | 168 } // namespace views |
| OLD | NEW |