Beispiel #1
0
 private void onToolChanged(Tool tool)
 {
     if (tool == Tool)
     {
         button.BackColor = Selected;
         button.Select();
     }
     else
         button.BackColor = NotSelected;
 }
Beispiel #2
0
        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;
        }
Beispiel #3
0
        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();
        }