Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Unified Diff: views/controls/single_split_view.cc

Issue 155214: Add 'preserve trailing view size' capability into the SingleSplitView.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « views/controls/single_split_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/single_split_view.cc
===================================================================
--- views/controls/single_split_view.cc (revision 20254)
+++ views/controls/single_split_view.cc (working copy)
@@ -21,7 +21,8 @@
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 @@
#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;
« no previous file with comments | « views/controls/single_split_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698