public PropertiesFormButton(EditInterface editInterface, EditInterfaceCommand command, GuiFrameworkUICallback uiCallback, Widget parent) { this.editInterface = editInterface; this.uiCallback = uiCallback; this.command = command; button = (Button)parent.createWidgetT("Button", "Button", 0, 0, ButtonWidth, ButtonHeight, Align.Default, ""); button.Caption = command.Name; button.ForwardMouseWheelToParent = true; layoutContainer = new MyGUILayoutContainer(button); button.MouseButtonClick += new MyGUIEvent(button_MouseButtonClick); }
/// <summary> /// Get the EditInterface for this SimSceneDefinition. /// </summary> /// <returns>The EditInterface for this SimSceneDefinition.</returns> public EditInterface getEditInterface() { if (editInterface == null) { editInterface = ReflectedEditInterface.createEditInterface(this, ReflectedEditInterface.DefaultScanner, "Sim Scene", () => { if (hasSimSubSceneDefinitions()) { if (DefaultSubScene == null) { throw new ValidationException("Please specify one of the Subscenes as the default."); } if (!hasSimSubSceneDefinition(DefaultSubScene)) { throw new ValidationException("{0} is not a valid Subscene. Please specify an existing scene.", DefaultSubScene); } } }); editInterface.IconReferenceTag = EngineIcons.Scene; simElementEditor = new EditInterface("Sim Element Managers"); var elementManagerInterfaces = simElementEditor.createEditInterfaceManager <SimElementManagerDefinition>(); elementManagerInterfaces.addCommand(new EditInterfaceCommand("Destroy", destroySimElementManagerDefinition)); foreach (AddSimElementManagerCommand command in PluginManager.Instance.getCreateSimElementManagerCommands()) { simElementEditor.addCommand(new EditInterfaceCommand(command.Name, callback => { callback.getInputString("Enter a name.", delegate(String input, ref String errorPrompt) { if (input == null || input == "") { errorPrompt = "Please enter a non empty name."; return(false); } if (this.hasSimElementManagerDefinition(input)) { errorPrompt = "That name is already in use. Please provide another."; return(false); } SimElementManagerDefinition def = command.execute(input, callback); this.addSimElementManagerDefinition(def); return(true); }); })); } editInterface.addSubInterface(simElementEditor); subScenes = new EditInterface("Subscenes"); var subSceneInterfaces = subScenes.createEditInterfaceManager <SimSubSceneDefinition>(); subSceneInterfaces.addCommand(new EditInterfaceCommand("Destroy", destroySimSubSceneDefinition)); EditInterfaceCommand createSubSceneCommand = new EditInterfaceCommand("Create Subscene", createSimSubSceneDefinition); subScenes.addCommand(createSubSceneCommand); editInterface.addSubInterface(subScenes); foreach (SimElementManagerDefinition elementDef in elementManagers) { createEditInterface(elementDef); } foreach (SimSubSceneDefinition subSceneDef in subSceneDefinitions.Values) { createEditInterface(subSceneDef); } } return(editInterface); }