public void initialize( Table table, Skin skin ) { table.getRowDefaults().setPadTop( 10 ); table.add( name.Replace( "PostProcessor", string.Empty ) ).getElement<Label>().setFontScale( 1f ).setFontColor( new Color( 241, 156, 0 ) ); // if we have a component, stick a bool for enabled here if( target != null ) { _enabledCheckbox = new CheckBox( string.Empty, skin ); _enabledCheckbox.programmaticChangeEvents = false; if( target is Component ) _enabledCheckbox.isChecked = ( (Component)target ).enabled; else if( target is PostProcessor ) _enabledCheckbox.isChecked = ((PostProcessor)target ).enabled; _enabledCheckbox.onChanged += newValue => { if( target is Component ) ((Component)target).enabled = newValue; else if( target is PostProcessor ) ( (PostProcessor)target ).enabled = newValue; }; table.add( _enabledCheckbox ).right(); } table.row(); foreach( var i in _inspectors ) { i.initialize( table, skin ); table.row(); } }
public override void initialize( Table table, Skin skin ) { // add a header var label = table.add( createNameLabel( table, skin ) ).setColspan( 2 ).getElement<Label>(); label.setStyle( label.getStyle().clone() ).setFontColor( new Color( 228, 228, 76 ) ); table.row().setPadLeft( 15 ); // figure out which fiedls and properties are useful to add to the inspector var fields = ReflectionUtils.getFields( _valueType ); foreach( var field in fields ) { if( !field.IsPublic && IEnumerableExt.count( field.GetCustomAttributes<InspectableAttribute>() ) == 0 ) continue; var inspector = getInspectorForType( field.FieldType, _target, field ); if( inspector != null ) { inspector.setStructTarget( _target, this, field ); inspector.initialize( table, skin ); _inspectors.Add( inspector ); table.row().setPadLeft( 15 ); } } var properties = ReflectionUtils.getProperties( _valueType ); foreach( var prop in properties ) { if( !prop.CanRead || !prop.CanWrite ) continue; if( ( !prop.GetMethod.IsPublic || !prop.SetMethod.IsPublic ) && IEnumerableExt.count( prop.GetCustomAttributes<InspectableAttribute>() ) == 0 ) continue; var inspector = getInspectorForType( prop.PropertyType, _target, prop ); if( inspector != null ) { inspector.setStructTarget( _target, this, prop ); inspector.initialize( table, skin ); _inspectors.Add( inspector ); table.row().setPadLeft( 15 ); } } }
public override void initialize( Table table, Skin skin ) { // we either have a getter that gets a Material or an Effedt var effect = _valueType == typeof( Material ) ? getValue<Material>().effect : getValue<Effect>(); if( effect == null ) return; // add a header and indent our cells table.add( effect.GetType().Name ).setColspan( 2 ).getElement<Label>().setFontColor( new Color( 228, 228, 76 ) ); table.row().setPadLeft( 15 ); // figure out which properties are useful to add to the inspector var effectProps = ReflectionUtils.getProperties( effect.GetType() ); foreach( var prop in effectProps ) { if( prop.DeclaringType == typeof( Effect ) ) continue; if( !prop.CanRead || !prop.CanWrite || prop.Name == "Name" ) continue; if( ( !prop.GetMethod.IsPublic || !prop.SetMethod.IsPublic ) && IEnumerableExt.count( prop.GetCustomAttributes<InspectableAttribute>() ) == 0 ) continue; var inspector = getInspectorForType( prop.PropertyType, effect, prop ); if( inspector != null ) { inspector.setTarget( effect, prop ); inspector.initialize( table, skin ); _inspectors.Add( inspector ); table.row().setPadLeft( 15 ); } } table.row(); }
public void setRow() { table.row(); }