| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 /** | |
| 6 * This view stacks three boxes -- one at the top, one at the bottom, and | |
| 7 * one that fills the remaining space between those two. | |
| 8 * | |
| 9 * +----------------------+ | |
| 10 * | topbar | | |
| 11 * +----------------------+ | |
| 12 * | | | |
| 13 * | | | |
| 14 * | | | |
| 15 * | | | |
| 16 * | middlebox | | |
| 17 * | | | |
| 18 * | | | |
| 19 * | | | |
| 20 * | | | |
| 21 * | | | |
| 22 * +----------------------+ | |
| 23 * | bottombar | | |
| 24 * +----------------------+ | |
| 25 * | |
| 26 * @constructor | |
| 27 */ | |
| 28 function TopMidBottomView(topView, midView, bottomView) { | |
| 29 View.call(this); | |
| 30 | |
| 31 this.topView_ = topView; | |
| 32 this.midView_ = midView; | |
| 33 this.bottomView_ = bottomView; | |
| 34 } | |
| 35 | |
| 36 inherits(TopMidBottomView, View); | |
| 37 | |
| 38 TopMidBottomView.prototype.setGeometry = function(left, top, width, height) { | |
| 39 TopMidBottomView.superClass_.setGeometry.call(this, left, top, width, height); | |
| 40 | |
| 41 // Calculate the vertical split points. | |
| 42 var topbarHeight = this.topView_.getHeight(); | |
| 43 var bottombarHeight = this.bottomView_.getHeight(); | |
| 44 var middleboxHeight = height - (topbarHeight + bottombarHeight); | |
| 45 | |
| 46 // Position the boxes using calculated split points. | |
| 47 this.topView_.setGeometry(left, top, width, topbarHeight); | |
| 48 this.midView_.setGeometry(left, this.topView_.getBottom(), | |
| 49 width, middleboxHeight); | |
| 50 this.bottomView_.setGeometry(left, this.midView_.getBottom(), | |
| 51 width, bottombarHeight); | |
| 52 }; | |
| 53 | |
| 54 TopMidBottomView.prototype.show = function(isVisible) { | |
| 55 TopMidBottomView.superClass_.show.call(this, isVisible); | |
| 56 this.topView_.show(isVisible); | |
| 57 this.midView_.show(isVisible); | |
| 58 this.bottomView_.show(isVisible); | |
| 59 }; | |
| OLD | NEW |