public override float get( Element context ) { if( context is ILayout ) return ( (ILayout)context ).preferredWidth; return context == null ? 0 : context.width; }
public ScrollPane( Element widget, ScrollPaneStyle style ) { Assert.isNotNull( style, "style cannot be null" ); transform = true; _style = style; setWidget( widget ); setSize( 150, 150 ); }
public SplitPane( Element firstWidget, Element secondWidget, SplitPaneStyle style, bool vertical = false ) { setStyle( style ); setFirstWidget( firstWidget ); setSecondWidget( secondWidget ); _vertical = vertical; setSize( preferredWidth, preferredHeight ); }
public override float get( Element context ) { return value; }
public override float get( Element element ) { return delegateElement.height * percent; }
/// <summary> /// Returns a value that is a percentage of the specified elements's height. The context element is ignored. /// </summary> static public Value percentHeight( float percent, Element delegateElement ) { return new PercentHeightDelegateValue() { delegateElement = delegateElement, percent = percent }; }
public SplitPane setFirstWidget( Element firstWidget ) { if( _firstWidget != null ) removeElement( _firstWidget ); _firstWidget = firstWidget; if( _firstWidget != null ) addElement( _firstWidget ); invalidate(); return this; }
public ScrollPane( Element widget, Skin skin, string styleName ) : this( widget, skin.get<ScrollPaneStyle>( styleName ) ) { }
public ScrollPane( Element widget ) : this( widget, new ScrollPaneStyle() ) { }
public override bool removeElement( Element element ) { if( !base.removeElement( element ) ) return false; var cell = getCell( element ); if( cell != null ) cell.element = null; return true; }
/// <summary> /// Adds a new cell to the table with the specified element. /// </summary> /// <param name="element">element.</param> public Cell add( Element element ) { var cell = obtainCell(); cell.element = element; // the row was ended for layout, not by the user, so revert it. if( _implicitEndRow ) { _implicitEndRow = false; _rows--; _cells.Last().endRow = false; } var cellCount = _cells.Count; if( cellCount > 0 ) { // Set cell column and row. var lastCell = _cells.Last(); if( !lastCell.endRow ) { cell.column = lastCell.column + lastCell.colspan.Value; cell.row = lastCell.row; } else { cell.column = 0; cell.row = lastCell.row + 1; } // set the index of the cell above. if( cell.row > 0 ) { for( var i = cellCount - 1; i >= 0; i-- ) { var other = _cells[i]; for( int column = other.column, nn = column + other.colspan.Value; column < nn; column++ ) { if( column == cell.column ) { cell.cellAboveIndex = i; goto outer; } } } outer: {} } } else { cell.column = 0; cell.row = 0; } _cells.Add( cell ); cell.set( _cellDefaults ); if( cell.column < _columnDefaults.Count ) { var columnCell = _columnDefaults[cell.column]; if( columnCell != null ) cell.merge( columnCell ); } cell.merge( _rowDefaults ); if( element != null ) addElement( element ); return cell; }
public override float get( Element context ) { var background = ( (Table)context )._background; return background == null ? 0 : background.rightWidth; }
public override float get( Element context ) { var background = ( (Table)context )._background; return background == null ? 0 : background.bottomHeight; }
public SplitPane( Element firstWidget, Element secondWidget, IDrawable handle, bool vertical = false ) : this( firstWidget, secondWidget, new SplitPaneStyle( handle ), vertical ) {}
public SplitPane setSecondWidget( Element secondWidget ) { if( _secondWidget != null ) removeElement( _secondWidget ); _secondWidget = secondWidget; if( _secondWidget != null ) addElement( _secondWidget ); invalidate(); return this; }
public override float get( Element context ) { if( context is ILayout ) return ( (ILayout)context ).preferredHeight; return context == null ? 0 : context.height; }
/// <summary> /// Sets the {@link Element} embedded in this scroll pane /// </summary> /// <returns>The widget.</returns> /// <param name="widget">Widget.</param> public ScrollPane setWidget( Element widget ) { if( _widget != null ) removeElement( _widget ); _widget = widget; if( widget != null ) addElement( widget ); return this; }
/// <summary> /// Returns the cell for the specified element in this table, or null. /// </summary> /// <returns>The cell.</returns> /// <param name="element">element.</param> public Cell getCell( Element element ) { for( int i = 0, n = _cells.Count; i < n; i++ ) { var c = _cells[i]; if( c.element == element ) return c; } return null; }
public ScrollPane( Element widget, Skin skin ) : this( widget, skin.get<ScrollPaneStyle>() ) { }
/// <summary> /// context May be null /// </summary> /// <param name="context">Context.</param> abstract public float get( Element context );
public override float get( Element element ) { return delegateElement.width * percent; }
/// <summary> /// Converts coordinates for this element to those of a parent element. The ascendant does not need to be a direct parent /// </summary> /// <returns>The to ascendant coordinates.</returns> /// <param name="ascendant">Ascendant.</param> /// <param name="localCoords">Local coords.</param> public Vector2 localToAscendantCoordinates( Element ascendant, Vector2 localCoords ) { Element element = this; while( element != null ) { localCoords = element.localToParentCoordinates( localCoords ); element = element.parent; if( element == ascendant ) break; } return localCoords; }