public void CreateNewNote() { Logger.Debug("Creating a new note"); NoteWidget noteWidget = new NoteWidget(null); noteWidget.TextChanged += OnNoteTextChanged; noteWidget.DeleteButtonClicked += OnDeleteButtonClicked; noteWidget.EditCanceled += OnEditCanceled; targetVBox.PackStart(noteWidget, false, false, 0); noteWidget.FocusTextArea(); noteWidget.SaveButton.Sensitive = false; noteWidget.Show(); }
public NoteDialog(Gtk.Window parentWindow, ITask task) : base() { this.ParentWindow = parentWindow.GdkWindow; this.task = task; this.Title = String.Format(Catalog.GetString("Notes for: {0:s}"), task.Text); this.HasSeparator = false; this.SetSizeRequest(500, 320); this.Icon = Utilities.GetIcon("tasque", 16); //this.Flags = Gtk.DialogFlags.DestroyWithParent; sw.VscrollbarPolicy = Gtk.PolicyType.Automatic; sw.HscrollbarPolicy = Gtk.PolicyType.Never; sw.BorderWidth = 0; sw.CanFocus = true; sw.Show(); Gtk.EventBox innerEb = new Gtk.EventBox(); innerEb.BorderWidth = 0; targetVBox = new Gtk.VBox(); targetVBox.BorderWidth = 5; targetVBox.Show(); innerEb.Add(targetVBox); innerEb.Show(); if (task.Notes != null) { foreach (var note in task.Notes) { NoteWidget noteWidget = new NoteWidget(note); noteWidget.TextChanged += OnNoteTextChanged; noteWidget.DeleteButtonClicked += OnDeleteButtonClicked; noteWidget.EditCanceled += OnEditCanceled; noteWidget.Show(); targetVBox.PackStart(noteWidget, false, false, 0); } } sw.AddWithViewport(innerEb); sw.Show(); VBox.PackStart(sw, true, true, 0); if (task.NoteSupport == NoteSupport.Multiple) { addButton = new Gtk.Button(Gtk.Stock.Add); addButton.Show(); this.ActionArea.PackStart(addButton); addButton.Clicked += OnAddButtonClicked; } AddButton(Gtk.Stock.Close, Gtk.ResponseType.Close); Response += delegate(object sender, Gtk.ResponseArgs args) { // Hide the window. The TaskWindow watches for when the // dialog is hidden and will take care of the rest. Hide(); }; }