| 0: | // TabbedOptions.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.Drawing; | |
| 19: | using System.Collections; | |
| 20: | using System.ComponentModel; | |
| 21: | using System.Windows.Forms; | |
| 22: | using System.Xml; | |
| 23: | ||
| 24: | using SharpDevelop.Gui.Dialogs.OptionPanels; | |
| 25: | using SharpDevelop.Internal.Project; | |
| 26: | using SharpDevelop.Internal.Text; | |
| 27: | using SharpDevelop.Tool.Data; | |
| 28: | ||
| 29: | namespace SharpDevelop.Gui.Dialogs { | |
| 30: | ||
| 31: | public interface ISdOptionDialog | |
| 32: | { | |
| 33: | void AddOptionPanel(AbstractOptionPanel panel); | |
| 34: | } | |
| 35: | ||
| 36: | /// <summary> | |
| 37: | /// Basic "tabbed" options dialog | |
| 38: | /// </summary> | |
| 39: | public class TabbedOptions : System.Windows.Forms.Form, ISdOptionDialog | |
| 40: | { | |
| 41: | private System.ComponentModel.Container components; | |
| 42: | private System.Windows.Forms.Button cancelButton; | |
| 43: | private System.Windows.Forms.Button okButton; | |
| 44: | private System.Windows.Forms.TabControl tabControl1; | |
| 45: | ||
| 46: | ArrayList OptionPanels = new ArrayList(); | |
| 47: | ||
| 48: | void AcceptEvent(object sender, EventArgs e) | |
| 49: | { | |
| 50: | foreach (AbstractOptionPanel pane in OptionPanels) | |
| 51: | pane.Accept(); | |
| 52: | } | |
| 53: | ||
| 54: | public void AddOptionPanel(AbstractOptionPanel panel) | |
| 55: | { | |
| 56: | OptionPanels.Add(panel); | |
| 57: | TabPage page = new TabPage(); | |
| 58: | page.Text = panel.PanelName; | |
| 59: | page.Controls.Add(panel); | |
| 60: | panel.Dock = DockStyle.Fill; | |
| 61: | tabControl1.TabPages.Add(page); | |
| 62: | } | |
| 63: | ||
| 64: | public TabbedOptions(MainWindow window) | |
| 65: | { | |
| 66: | InitializeComponent(); | |
| 67: | ||
| 68: | okButton.Click += new EventHandler(AcceptEvent); | |
| 69: | MaximizeBox = MinimizeBox = false; | |
| 70: | ShowInTaskbar = false; | |
| 71: | StartPosition = FormStartPosition.CenterParent; | |
| 72: | Owner = window; | |
| 73: | Icon = null; | |
| 74: | } | |
| 75: | ||
| 76: | /// <summary> | |
| 77: | /// Clean up any resources being used. | |
| 78: | /// </summary> | |
| 79: | protected override void Dispose(bool disposing) | |
| 80: | { | |
| 81: | if (disposing) { | |
| 82: | if (components != null){ | |
| 83: | components.Dispose(); | |
| 84: | } | |
| 85: | } | |
| 86: | foreach (TabPage p in tabControl1.TabPages) | |
| 87: | p.Dispose(); | |
| 88: | base.Dispose(disposing); | |
| 89: | } | |
| 90: | ||
| 91: | private void InitializeComponent() | |
| 92: | { | |
| 93: | this.components = new System.ComponentModel.Container(); | |
| 94: | this.okButton = new System.Windows.Forms.Button(); | |
| 95: | this.cancelButton = new System.Windows.Forms.Button(); | |
| 96: | this.tabControl1 = new System.Windows.Forms.TabControl(); | |
| 97: | ||
| 98: | okButton.Location = new System.Drawing.Point(250 - 8, 308); | |
| 99: | okButton.Size = new System.Drawing.Size(74, 23); | |
| 100: | okButton.TabIndex = 1; | |
| 101: | okButton.Anchor = System.Windows.Forms.AnchorStyles.Bottom | AnchorStyles.Right; | |
| 102: | okButton.Text = Resource.GetString("Global.OKButtonText"); | |
| 103: | okButton.DialogResult = DialogResult.OK; | |
| 104: | ||
| 105: | cancelButton.Location = new System.Drawing.Point(332 - 8, 308); | |
| 106: | cancelButton.Size = new System.Drawing.Size(74, 23); | |
| 107: | cancelButton.TabIndex = 2; | |
| 108: | cancelButton.Anchor = System.Windows.Forms.AnchorStyles.Bottom | AnchorStyles.Right; | |
| 109: | cancelButton.Text = Resource.GetString("Global.CancelButtonText"); | |
| 110: | cancelButton.DialogResult = DialogResult.Cancel; | |
| 111: | ||
| 112: | this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); | |
| 113: | this.Text = Resource.GetString("Dialog.Options.ProjectOptions.DialogName"); | |
| 114: | ||
| 115: | this.AcceptButton = okButton; | |
| 116: | this.CancelButton = cancelButton; | |
| 117: | this.ClientSize = new System.Drawing.Size(408, 341); | |
| 118: | this.FormBorderStyle = FormBorderStyle.Sizable; | |
| 119: | ||
| 120: | // ControlBox = false; | |
| 121: | ||
| 122: | tabControl1.Location = new System.Drawing.Point(8, 8); | |
| 123: | tabControl1.Text = "tabControl1"; | |
| 124: | tabControl1.Size = new System.Drawing.Size(392, 296); | |
| 125: | tabControl1.SelectedIndex = 0; | |
| 126: | tabControl1.TabIndex = 0; | |
| 127: | tabControl1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom| AnchorStyles.Right |AnchorStyles.Left; | |
| 128: | ||
| 129: | this.Controls.Add(cancelButton); | |
| 130: | this.Controls.Add(okButton); | |
| 131: | this.Controls.Add(tabControl1); | |
| 132: | ||
| 133: | } | |
| 134: | } | |
| 135: | } |
This page was automatically generated by SharpDevelop.