* Makefile.am:
[monodevelop.git] / extras / GtkSourceViewEditor / MonoDevelop.SourceEditor.Gui.Dialogs / EditTemplateGroupDialog.cs
blob58ef5b89fce003b3c7d993878bf2922f998412e6
1 // EditTemplateGroupDialog.cs
2 //
3 // This file was derived from a file from #Develop.
4 //
5 // Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com>
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 2 of the License, or
10 // (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 using System;
22 using System.IO;
24 using MonoDevelop.Ide.CodeTemplates;
25 using MonoDevelop.Core;
27 namespace MonoDevelop.SourceEditor.Gui.Dialogs
29 public class EditTemplateGroupDialog : Gtk.Dialog
31 CodeTemplateGroup codeTemplateGroup;
32 string titlePrefix = string.Empty;
34 // Gtk members
35 Gtk.Entry templateExtensionsTextBox;
37 public CodeTemplateGroup CodeTemplateGroup {
38 get {
39 return codeTemplateGroup;
43 public EditTemplateGroupDialog(CodeTemplateGroup codeTemplateGroup, string titlePrefix)
45 this.codeTemplateGroup = codeTemplateGroup;
46 this.titlePrefix = titlePrefix;
47 InitializeComponents();
48 this.ShowAll();
51 void AcceptEvent(object sender, EventArgs e)
53 codeTemplateGroup.ExtensionStrings = templateExtensionsTextBox.Text.Split(';');
55 // close the window
56 CancelEvent(sender, EventArgs.Empty);
59 void CancelEvent(object sender, EventArgs e)
61 this.Destroy();
64 void InitializeComponents()
66 // set up this actual dialog
67 this.Modal = true;
68 // FIXME: make this a resource in the resource file
69 this.Title = String.Format (GettextCatalog.GetString ("{0} Code Group"), titlePrefix);
71 // set up the dialog fields and add them
72 templateExtensionsTextBox = new Gtk.Entry();
73 templateExtensionsTextBox.ActivatesDefault = true;
74 // FIXME: make this a resource in the resource file
75 Gtk.Label label1 = new Gtk.Label("Extensions (; seperated)");
77 label1.Xalign = 0;
78 templateExtensionsTextBox.Text = string.Join(";", codeTemplateGroup.ExtensionStrings);
80 // FIXME: make the labels both part of the same sizing group so they have the same left and right rows.
81 Gtk.HBox hBox1 = new Gtk.HBox(false, 6);
82 hBox1.PackStart(label1, false, false, 6);
83 hBox1.PackStart(templateExtensionsTextBox, false, false, 6);
85 this.VBox.PackStart(hBox1, false, false, 6);
87 // set up the buttons and add them
88 this.DefaultResponse = Gtk.ResponseType.Ok;
89 Gtk.Button cancelButton = new Gtk.Button(Gtk.Stock.Cancel);
90 Gtk.Button okButton = new Gtk.Button(Gtk.Stock.Ok);
91 okButton.Clicked += new EventHandler(AcceptEvent);
92 cancelButton.Clicked += new EventHandler(CancelEvent);
93 this.AddActionWidget (cancelButton, Gtk.ResponseType.Cancel);
94 this.AddActionWidget (okButton, (int) Gtk.ResponseType.Ok);