Default to "middle" vertical alignment for our controls.

git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@499 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Michael Bayne
2007-11-13 23:11:55 +00:00
parent 7ef4ef92dd
commit b8b63f9e28
@@ -25,8 +25,8 @@ import mx.core.Container;
import mx.core.UIComponent; import mx.core.UIComponent;
import mx.containers.Grid; import mx.containers.Grid;
import mx.containers.GridItem;
import mx.containers.GridRow; import mx.containers.GridRow;
import mx.containers.HBox;
import com.threerings.flex.GridUtil; import com.threerings.flex.GridUtil;
@@ -66,14 +66,22 @@ public /*abstract*/ class FlexGameConfigurator extends GameConfigurator
* to the game, but do not directly alter the game config, so that all the controls are added * to the game, but do not directly alter the game config, so that all the controls are added
* in a uniform manner and are well aligned. * in a uniform manner and are well aligned.
*/ */
public function addControl (label :UIComponent, control :UIComponent) :void public function addControl (label :UIComponent, control :UIComponent,
verticalAlign :String = "middle") :void
{ {
if (_gridRow == null) { if (_gridRow == null) {
_gridRow = new GridRow(); _gridRow = new GridRow();
_grid.addChild(_gridRow); _grid.addChild(_gridRow);
} }
GridUtil.addToRow(_gridRow, label);
GridUtil.addToRow(_gridRow, control); var item :GridItem = GridUtil.addToRow(_gridRow, label);
item.setStyle("verticalAlign", verticalAlign);
if (_gridRow.numChildren > 1) {
item.setStyle("paddingLeft", 15);
}
item = GridUtil.addToRow(_gridRow, control);
item.setStyle("verticalAlign", verticalAlign);
if (_gridRow.numChildren == _columns * 2) { if (_gridRow.numChildren == _columns * 2) {
_gridRow = null; _gridRow = null;
} }