void OnToolRadioButtonChecked(object sender, CheckEventArgs e) { if (!e.IsChecked) return; if (CurrentTool != null) { CurrentTool.Reset(); RemoveWidget(CurrentTool); } String toolName = ((RadioButton.Item)sender).Name; CurrentTool = Tools[toolName]; ToolConfigurableBox.SetCurrentConfiguration(toolName); AddWidget(CurrentTool, false, false); }
void AddTool(Tool tool) { tool.SetMapBox(MapBox); Tools.Add(tool.Name, tool); ToolRadioButton.AddButton(tool.IconTexture, OnToolRadioButtonChecked, LabeledWidget.EMode.Right, tool.Name); }
void MapHandler_Closed(Widget sender, CloseEventArgs e) { Closed -= new CloseEventHandler(MapHandler_Closed); CurrentTool = TmpCurrentTool; ToolMainBox.Seal(false); }
public override void Open(OpeningInfo openingInfo = null) { base.Open(openingInfo); if (openingInfo == null) return; if (!openingInfo.IsValid(1)) return; String mode = openingInfo.GetArg<String>("Mode"); switch (mode) { case "PointCreatorMode": ToolMainBox.Seal(); Closed += new CloseEventHandler(MapHandler_Closed); TmpCurrentTool = CurrentTool; CurrentTool = null; break; } }