diff options
Diffstat (limited to 'views/controls/single_split_view.cc')
-rw-r--r-- | views/controls/single_split_view.cc | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/views/controls/single_split_view.cc b/views/controls/single_split_view.cc index dadf4b2..7915171 100644 --- a/views/controls/single_split_view.cc +++ b/views/controls/single_split_view.cc @@ -21,7 +21,8 @@ SingleSplitView::SingleSplitView(View* leading, View* trailing, Orientation orientation) : is_horizontal_(orientation == HORIZONTAL_SPLIT), - divider_offset_(-1) { + divider_offset_(-1), + resize_leading_on_bounds_change_(true) { AddChildView(leading); AddChildView(trailing); #if defined(OS_WIN) @@ -31,6 +32,20 @@ SingleSplitView::SingleSplitView(View* leading, #endif } +void SingleSplitView::DidChangeBounds(const gfx::Rect& previous, + const gfx::Rect& current) { + if (resize_leading_on_bounds_change_) { + if (is_horizontal_) + divider_offset_ += current.width() - previous.width(); + else + divider_offset_ += current.height() - previous.height(); + + if (divider_offset_ < 0) + divider_offset_ = kDividerSize; + } + View::DidChangeBounds(previous, current); +} + void SingleSplitView::Layout() { if (GetChildViewCount() != 2) return; |