public DesignerTopMenu() { AddDecorator( new StackContent( StackContent.StackMode.Horizontal, StackContent.OverflowMode.Flow ) ); m_menuOptions = new Dictionary<Button, MenuOption>(); foreach( string key in OPTIONS.Keys ) { Button button = new Button( key ); button.SetHeight( 95.0f, MetricsUnits.Percentage ); button.Clicked += HandleOptionSelected; m_menuOptions.Add( button, OPTIONS[ key ] ); AddChild( button ); } }
public BehaviorEditorSettingsControl() : base() { AddDecorator( new StackContent( StackContent.StackMode.Vertical, StackContent.OverflowMode.Flow ) ); AddChild( new Label( "Behavior ID:" ).SetMargin( 5.0f, 5.0f, 5.0f, 5.0f ).SetHeight( 24.0f ) ); m_treeIdField = (TextField)AddChild( new TextField().SetMargin( 5.0f, 0, 5.0f, 0 ).SetWidth( 100.0f, MetricsUnits.Percentage ) ); AddChild( new Label( "Output Path:" ).SetMargin( 5.0f, 5.0f, 5.0f, 5.0f ).SetHeight( 24.0f ) ); m_savePathField = ( TextField )AddChild( new TextField( EditorPrefs.HasKey( "BTE_SavePath" ) ? EditorPrefs.GetString( "BTE_SavePath" ) : "" ).SetMargin( 5.0f, 0.0f, 5.0f, 0.0f ).SetWidth( 100.0f, MetricsUnits.Percentage ) ); m_generateButton = (Button )AddChild( new Button( "Generate Behavior" ).SetMargin( 5.0f, 5.0f, 5.0f, 5.0f ).SetWidth( 100.0f, MetricsUnits.Percentage ) ); m_loadXmlButton = ( Button )AddChild( new Button( "Load Layout" ).SetMargin( 5.0f, 5.0f, 5.0f, 5.0f ).SetWidth( 100.0f, MetricsUnits.Percentage ) ); m_saveXmlButton = ( Button )AddChild( new Button( "Save Layout" ).SetMargin( 5.0f, 5.0f, 5.0f, 5.0f ).SetWidth( 100.0f, MetricsUnits.Percentage ) ); m_newBehaviorButton = ( Button )AddChild( new Button( "New Behavior" ).SetMargin( 5.0f, 5.0f, 5.0f, 5.0f ).SetWidth( 100.0f, MetricsUnits.Percentage ) ); m_generateButton.Enabled = false; m_treeIdField.ValueChange += m_treeIdField_ValueChange; m_savePathField.ValueChange += m_savePathField_ValueChange; }
protected override void OnInitialize() { title = "Toolbox"; m_buttonMapping = new Dictionary<Button, CachedControl>(); m_controlsCache = new ToolboxControlCache(); m_root = new Control(); m_root.AddDecorator( new StackContent( StackContent.StackMode.Vertical, StackContent.OverflowMode.Flow ) ); m_root.AddDecorator( new Scrollbars( true, false, true ) ); m_root.SetSize( 100.0f, 100.0f, Control.MetricsUnits.Percentage, Control.MetricsUnits.Percentage ); // Create category foldouts, index them by name so we can assign our controls Dictionary< string, FoldoutList > foldouts = new Dictionary<string, FoldoutList>(); foreach( string category in m_controlsCache.Categories ) { FoldoutList foldout = new FoldoutList( category, 4.0f, true ); foldout.SetWidth( 100.0f, Control.MetricsUnits.Percentage ); m_root.AddChild( foldout ); foldouts.Add( category, foldout ); } foreach( CachedControl c in m_controlsCache.Controls ) { Button button = new Button( c.name ); button.SetSize( 100.0f, CONTROL_DISPLAY_HEIGHT, Control.MetricsUnits.Percentage, Control.MetricsUnits.Pixel ); button.Clicked += HandleControlButtonClick; m_buttonMapping.Add( button, c ); foldouts[ c.category ].AddItem( button ); } AddChild( m_root ); }
private void AddButton() { Button b = new Button(); b.SetSize( BUTTON_SIZE, BUTTON_SIZE ); AddChild( b ); m_outputButtons.Add( b ); b.Clicked += OnOutputClicked; }