| 0: | // SharpToolBar.cs | |
| 1: | // Copyright (c) 2000 Mike Krueger | |
| 2: | // | |
| 3: | // This program is free software; you can redistribute it and/or modify | |
| 4: | // it under the terms of the GNU General Public License as published by | |
| 5: | // the Free Software Foundation; either version 2 of the License, or | |
| 6: | // (at your option) any later version. | |
| 7: | // | |
| 8: | // This program is distributed in the hope that it will be useful, | |
| 9: | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 10: | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 11: | // GNU General Public License for more details. | |
| 12: | // | |
| 13: | // You should have received a copy of the GNU General Public License | |
| 14: | // along with this program; if not, write to the Free Software | |
| 15: | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 16: | ||
| 17: | using System; | |
| 18: | using System.Windows.Forms; | |
| 19: | using System.Drawing; | |
| 20: | ||
| 21: | using SharpDevelop.Tool.Data; | |
| 22: | using SharpDevelop.Actions; | |
| 23: | using SharpDevelop.Actions.Menu; | |
| 24: | ||
| 25: | namespace SharpDevelop.Gui.Components { | |
| 26: | ||
| 27: | public class ToolBarButtonSeperator : ToolBarButton | |
| 28: | { | |
| 29: | public ToolBarButtonSeperator() | |
| 30: | { | |
| 31: | Style = ToolBarButtonStyle.Separator; | |
| 32: | Tag = null; | |
| 33: | } | |
| 34: | } | |
| 35: | ||
| 36: | public class RichToolBarButton : ToolBarButton | |
| 37: | { | |
| 38: | public RichToolBarButton(String text, int imageindex, object evt) | |
| 39: | { | |
| 40: | ToolTipText = text; | |
| 41: | ImageIndex = imageindex; | |
| 42: | Tag = evt; | |
| 43: | } | |
| 44: | } | |
| 45: | ||
| 46: | public class SharpToolBar : ToolBar | |
| 47: | { | |
| 48: | MainWindow mainwindow; | |
| 49: | public SharpToolBar(MainWindow mainwindow) | |
| 50: | { | |
| 51: | this.mainwindow = mainwindow; | |
| 52: | Appearance = ToolBarAppearance.Flat; | |
| 53: | ImageList = new ImageList(); | |
| 54: | ||
| 55: | ImageList.Images.Add(Resource.GetBitmap("Icons.16x16.NewDocumentIcon")); | |
| 56: | ImageList.Images.Add(Resource.GetBitmap("Icons.16x16.CutIcon")); | |
| 57: | ImageList.Images.Add(Resource.GetBitmap("Icons.16x16.DeleteIcon")); | |
| 58: | ImageList.Images.Add(Resource.GetBitmap("Icons.16x16.OpenFileIcon")); | |
| 59: | ImageList.Images.Add(Resource.GetBitmap("Icons.16x16.PasteIcon")); | |
| 60: | ImageList.Images.Add(Resource.GetBitmap("Icons.16x16.RedoIcon")); | |
| 61: | ImageList.Images.Add(Resource.GetBitmap("Icons.16x16.SaveIcon")); | |
| 62: | ImageList.Images.Add(Resource.GetBitmap("Icons.16x16.UndoIcon")); | |
| 63: | ImageList.Images.Add(Resource.GetBitmap("Icons.16x16.CopyIcon")); | |
| 64: | ||
| 65: | Buttons.Add(new RichToolBarButton("New", 0, new NewFile())); | |
| 66: | Buttons.Add(new RichToolBarButton("Open", 3, new OpenFile())); | |
| 67: | Buttons.Add(new RichToolBarButton("Save", 6, new SaveFile())); | |
| 68: | Buttons.Add(new ToolBarButtonSeperator()); | |
| 69: | ||
| 70: | Buttons.Add(new RichToolBarButton("Cut", 1, new CutAction())); | |
| 71: | Buttons.Add(new RichToolBarButton("Copy", 8, new CopyAction())); | |
| 72: | Buttons.Add(new RichToolBarButton("Paste", 4, new PasteAction())); | |
| 73: | Buttons.Add(new RichToolBarButton("Delete", 2, new DeleteAction())); | |
| 74: | Buttons.Add(new ToolBarButtonSeperator()); | |
| 75: | ||
| 76: | Buttons.Add(new RichToolBarButton("Undo", 7, new UndoAction())); | |
| 77: | Buttons.Add(new RichToolBarButton("Redo", 5, new RedoAction())); | |
| 78: | ButtonClick += new ToolBarButtonClickEventHandler(ToolBarClickEvent); | |
| 79: | } | |
| 80: | ||
| 81: | ||
| 82: | void ToolBarClickEvent(object sender, ToolBarButtonClickEventArgs e) | |
| 83: | { | |
| 84: | if (e.Button.Tag != null) { | |
| 85: | ISdPlugin action = (ISdPlugin)e.Button.Tag; | |
| 86: | action.Execute(mainwindow); | |
| 87: | } | |
| 88: | } | |
| 89: | } | |
| 90: | } |
This page was automatically generated by SharpDevelop.