diff options
author | Jeremie Laval <jeremie.laval@gmail.com> | 2012-02-14 23:25:59 +0400 |
---|---|---|
committer | Jeremie Laval <jeremie.laval@gmail.com> | 2012-02-15 21:29:50 +0400 |
commit | 986afa593b9f4e4d485bdc9f29a40a1d61c4c682 (patch) | |
tree | 19a81c393e96b748f08b6d3d947f6be7c08b3630 /BookmarkPopover.cs | |
parent | d5b32e3670d5749f539a7a6d01c33e1b2f7d03cd (diff) |
[macdoc] Add bookmark support
Diffstat (limited to 'BookmarkPopover.cs')
-rw-r--r-- | BookmarkPopover.cs | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/BookmarkPopover.cs b/BookmarkPopover.cs new file mode 100644 index 0000000..97d772b --- /dev/null +++ b/BookmarkPopover.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using MonoMac.Foundation; +using MonoMac.AppKit; + +namespace macdoc +{ + public partial class BookmarkPopover : MonoMac.AppKit.NSView + { + public class BookmarkEventArgs : EventArgs + { + public string Name { get; set; } + public string Notes { get; set; } + } + + public event EventHandler<BookmarkEventArgs> Done; + public event EventHandler Delete; + + public BookmarkPopover (IntPtr handle) : base (handle) + { + Initialize (); + } + + [Export ("initWithCoder:")] + public BookmarkPopover (NSCoder coder) : base (coder) + { + Initialize (); + } + + public void PostInitialization () + { + nameField.StringValue = Name ?? string.Empty; + notesField.PlaceholderString = "You can add additional notes to this bookmark if you wish"; + doneButton.Activated += (sender, e) => Done (this, new BookmarkEventArgs () { Name = nameField.StringValue, Notes = notesField.StringValue }); + deleteButton.Activated += (sender, e) => Delete (this, EventArgs.Empty); + } + + void Initialize () + { + } + + public string Name { + get; + set; + } + } +} + |