Esempio n. 1
0
        public Id CopyWithZone(IntPtr aZone)
        {
            BookmarkData copy = new BookmarkData();

            copy.iBookmark = iBookmark;
            return(copy);
        }
Esempio n. 2
0
        public void TableViewDidClickRow(NSTableView aView, int aCol, int aRow)
        {
            if (!iDragging)
            {
                // extended delegate function that is called on a mouse up - see
                // the TableViewClickable implementation below
                if (aRow == -1)
                {
                    // ignore clicks on the table background
                    return;
                }
                else
                {
                    // browse to the selected bookmark
                    BookmarkData data = iBookmarks.ObjectAtIndex((uint)aRow).CastAs <BookmarkData>();
                    iBrowser.Browse(data.Bookmark.BreadcrumbTrail);
                }

                // always close the popover
                if (EventClose != null)
                {
                    EventClose(this, EventArgs.Empty);
                }
            }
            iDragging = false;
        }
Esempio n. 3
0
        public void DeleteBookmark(Id aSender)
        {
            Assert.Check(ViewTable.ClickedRow >= 0);

            BookmarkData data = iBookmarks.ObjectAtIndex((uint)ViewTable.ClickedRow).CastAs <BookmarkData>();

            iBookmarkManager.Remove(data.Bookmark);
        }
Esempio n. 4
0
        private void ModelChanged(object sender, EventArgs e)
        {
            iBookmarks.Release();
            iBookmarks = new NSMutableArray();

            foreach (Bookmark b in iBookmarkManager.Bookmarks)
            {
                BookmarkData data = new BookmarkData(b);
                iBookmarks.AddObject(data);
                data.Release();
            }

            WillChangeValueForKey(NSString.StringWithUTF8String("bookmarks"));
            DidChangeValueForKey(NSString.StringWithUTF8String("bookmarks"));
        }
Esempio n. 5
0
        public void Draw(NSRect aCellFrame, NSView aControlView)
        {
            BookmarkData item = ObjectValue.CastAs <BookmarkData>();

            // create attributes for the title and subtitle text
            NSMutableParagraphStyle style = new NSMutableParagraphStyle();

            style.SetParagraphStyle(NSParagraphStyle.DefaultParagraphStyle);
            style.SetLineBreakMode(NSLineBreakMode.NSLineBreakByTruncatingTail);

            NSDictionary titleAttr = NSDictionary.DictionaryWithObjectsAndKeys(FontManager.FontMedium, NSAttributedString.NSFontAttributeName,
                                                                               NSColor.WhiteColor, NSAttributedString.NSForegroundColorAttributeName,
                                                                               style, NSAttributedString.NSParagraphStyleAttributeName,
                                                                               null);
            NSDictionary subtitleAttr = NSDictionary.DictionaryWithObjectsAndKeys(FontManager.FontSmall, NSAttributedString.NSFontAttributeName,
                                                                                  NSColor.WhiteColor, NSAttributedString.NSForegroundColorAttributeName,
                                                                                  style, NSAttributedString.NSParagraphStyleAttributeName,
                                                                                  null);

            style.Release();

            NSPoint pt = aCellFrame.origin;

            // draw title
            NSString title = NSString.StringWithUTF8String(item.Bookmark.Title);

            title.DrawAtPointWithAttributes(pt, titleAttr);

            NSSize size = title.SizeWithAttributes(titleAttr);

            pt.y += size.height;

            // draw breadcrumb
            List <string> titleTrail = new List <string>();

            foreach (Breadcrumb bc in item.Bookmark.BreadcrumbTrail)
            {
                titleTrail.Add(bc.Title);
            }
            string   breadcrumb  = string.Join("/", titleTrail.ToArray());
            NSString breadcrumb2 = NSString.StringWithUTF8String(breadcrumb);

            breadcrumb2.DrawAtPointWithAttributes(pt, subtitleAttr);
        }