1 // EditTemplateGroupDialog.cs
3 // This file was derived from a file from #Develop.
5 // Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com>
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.
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.
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
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
;
35 Gtk
.Entry templateExtensionsTextBox
;
37 public CodeTemplateGroup CodeTemplateGroup
{
39 return codeTemplateGroup
;
43 public EditTemplateGroupDialog(CodeTemplateGroup codeTemplateGroup
, string titlePrefix
)
45 this.codeTemplateGroup
= codeTemplateGroup
;
46 this.titlePrefix
= titlePrefix
;
47 InitializeComponents();
51 void AcceptEvent(object sender
, EventArgs e
)
53 codeTemplateGroup
.ExtensionStrings
= templateExtensionsTextBox
.Text
.Split(';');
56 CancelEvent(sender
, EventArgs
.Empty
);
59 void CancelEvent(object sender
, EventArgs e
)
64 void InitializeComponents()
66 // set up this actual dialog
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)");
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
);