private void onToolChanged(Tool tool) { if (tool == Tool) { button.BackColor = Selected; button.Select(); } else button.BackColor = NotSelected; }
public ToolButton(Tool tool, int x, int y, int num) { Tool = tool; Location = new Point(x, y); this.num = num; InitializeComponent(); button.BackgroundImage = Image.FromFile(Path.Combine(Ogmo.ProgramDirectory, @"Content\tools", Tool.Image)); toolTip.SetToolTip(button, Tool.Name + " (" + (num + 1).ToString() + ")"); button.BackColor = (tool == Ogmo.ToolsWindow.CurrentTool) ? Selected : NotSelected; //Events Ogmo.ToolsWindow.OnToolChanged += onToolChanged; }
public void SetTool(Tool tool) { if (CurrentTool == tool) return; //Set it! CurrentTool = tool; if (tool != null) tool.SwitchTo(); //Call the event if (OnToolChanged != null) OnToolChanged(tool); Ogmo.MainWindow.FocusEditor(); }