Beispiel #1
0
        /// <summary>
        /// Creates the toolbar.
        /// </summary>
        /// <returns>The toolbar view.</returns>
        protected virtual UIView _CreateToolbar()
        {
            // Create toolbar
            var toolBarFrame = View.Bounds;

            toolBarFrame.X     += BarPaddingH;
            toolBarFrame.Y     += BarPaddingV;
            toolBarFrame.Width -= BarPaddingH * 2;
            toolBarFrame.Height = ToolbarHeight;
            var toolBar = new UIXToolbarView(toolBarFrame, 0.92f, 0.32f, 0.8f);

            toolBar.AutoresizingMask = UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleWidth;

            var btnFrame = new RectangleF(FirstToolButtonLeft, FirstToolButtonTop, ToolButtonSize, ToolButtonSize);

            // Create toolbar buttons
            _CreateToolbarButton(toolBar, DocumentActionTypes.NavigateToFirstPage, ref btnFrame, "Images/Toolbar/NavigateToFirst48.png", _OpenFirstPage);
            _CreateToolbarButton(toolBar, DocumentActionTypes.NavigateToPriorPage, ref btnFrame, "Images/Toolbar/NavigateToPrior48.png", _OpenPriorPage);
            _BtnNavigateToPage = _CreateToolbarButton(toolBar, DocumentActionTypes.NavigateToPage, ref btnFrame, "Images/Toolbar/NavigateToPage48.png", () => {
                var view = new GotoPageViewController(p => OpenDocumentPage((int)p));
                _PresentPopover(view, _BtnNavigateToPage.Frame);
            });
            _CreateToolbarButton(toolBar, DocumentActionTypes.NavigateToNextPage, ref btnFrame, "Images/Toolbar/NavigateToNext48.png", _OpenNextPage);
            _CreateToolbarButton(toolBar, DocumentActionTypes.NavigateToLastPage, ref btnFrame, "Images/Toolbar/NavigateToLast48.png", _OpenLastPage);
            _CreateToolbarSeparator(ref btnFrame);

            _CreateToolbarButton(toolBar, DocumentActionTypes.ZoomOut, ref btnFrame, "Images/Toolbar/ZoomOut48.png", ZoomOut);
            _CreateToolbarButton(toolBar, DocumentActionTypes.ZoomIn, ref btnFrame, "Images/Toolbar/ZoomIn48.png", _ZoomIn);
            _CreateToolbarSeparator(ref btnFrame);

            _BtnNote = _CreateToolbarButton(toolBar, DocumentActionTypes.Note, ref btnFrame, "Images/Toolbar/Note48.png", () => {
                var note = MgrAccessor.DocumentNoteMgr.Load(_DocumentId);
                var view = new NoteViewController(note, null);
                _PresentPopover(view, _BtnNote.Frame);
            });
            _BtnBookmarksList = _CreateToolbarButton(toolBar, DocumentActionTypes.Bookmarks, ref btnFrame, "Images/Toolbar/BookmarksList48.png", () => {
                var bookmarks = MgrAccessor.DocumentBookmarkMgr.LoadList(_DocumentId);
                var view      = new BookmarksViewController(_DocumentId, bookmarks, PDFDocument.CurrentPageNumber, p => OpenDocumentPage((int)p));
                _PresentPopover(view, _BtnBookmarksList.Frame);
            });
            _BtnThumbs = _CreateToolbarButton(toolBar, DocumentActionTypes.Thumbs, ref btnFrame, "Images/Toolbar/Thumbs48.png", () => {
                var view = new ThumbsViewController(View.Bounds.Width, p => OpenDocumentPage((int)p));
                _PresentPopover(view, _BtnThumbs.Frame);
                view.InitThumbs();
            });
            _CreateToolbarSeparator(ref btnFrame);

            _BtnAutoWidth  = _CreateToolbarButton(toolBar, DocumentActionTypes.AutoWidth, ref btnFrame, _GetImagePathForButton(DocumentActionTypes.AutoWidth), () => SetAutoWidth());
            _BtnAutoHeight = _CreateToolbarButton(toolBar, DocumentActionTypes.AutoHeight, ref btnFrame, _GetImagePathForButton(DocumentActionTypes.AutoHeight), () => SetAutoHeight());
            _CreateToolbarSeparator(ref btnFrame);

            // Create user defined toolbar items
            _CreateUserDefinedToolbarItems(toolBar, ref btnFrame);

            return(toolBar);
        }
        /// <summary>
        /// Creates toolbar
        /// </summary>
        /// <returns>Toolbar view</returns>
        protected virtual UIView CreateToolbar()
        {
            // Create toolbar
            var toolBarFrame = View.Bounds;
            toolBarFrame.X += BarPaddingH;
            toolBarFrame.Y += BarPaddingV;
            toolBarFrame.Width -= BarPaddingH * 2;
            toolBarFrame.Height = ToolbarHeight;
            var toolBar = new UIXToolbarView(toolBarFrame, 0.92f, 0.32f, 0.8f);
            toolBar.AutoresizingMask = UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleWidth;

            // Create toolbar buttons
            var btnFrame = new RectangleF(FirstToolButtonLeft, FirstToolButtonTop, ToolButtonSize, ToolButtonSize);
            CreateToolbarButton(toolBar, ref btnFrame, "Images/Toolbar/NavigateToFirst48.png", delegate {
                OpenFirstPage();
            });
            CreateToolbarButton(toolBar, ref btnFrame, "Images/Toolbar/NavigateToPrior48.png", delegate {
                OpenPriorPage();
            });
            mBtnNavigateToPage = CreateToolbarButton(toolBar, ref btnFrame, "Images/Toolbar/NavigateToPage48.png", delegate {
                var view = new GotoPageViewController(p => { OpenDocumentPage((int)p); });
                PresentPopover(view, mBtnNavigateToPage.Frame);
            });
            CreateToolbarButton(toolBar, ref btnFrame, "Images/Toolbar/NavigateToNext48.png", delegate {
                OpenNextPage();
            });
            CreateToolbarButton(toolBar, ref btnFrame, "Images/Toolbar/NavigateToLast48.png", delegate {
                OpenLastPage();
            });
            CreateToolbarButton(toolBar, ref btnFrame, "Images/Toolbar/ZoomOut48.png", delegate {
                ZoomOut();
            });
            CreateToolbarButton(toolBar, ref btnFrame, "Images/Toolbar/ZoomIn48.png", delegate {
                ZoomIn();
            });
            if (OptionsManager.Instance.Options.NoteBtnVisible) {
                mBtnNote = CreateToolbarButton(toolBar, ref btnFrame, "Images/Toolbar/Note48.png", delegate {
                    var note = DocumentNoteManager.Instance.LoadNote(mDocumentId);
                    var view = new NoteViewController(note, p => { /* Noting */ });
                    PresentPopover(view, mBtnNote.Frame);
                });
            }
            if (OptionsManager.Instance.Options.BookmarksBtnVisible) {
                mBtnBookmarksList = CreateToolbarButton(toolBar, ref btnFrame, "Images/Toolbar/BookmarksList48.png", delegate {
                    var bookmarks = DocumentBookmarkManager.Instance.LoadBookmarks(mDocumentId);
                    var view = new BookmarksViewController(mDocumentId, bookmarks, PDFDocument.CurrentPageNumber, p => { OpenDocumentPage((int)p); });
                    PresentPopover(view, mBtnBookmarksList.Frame);
                });
            }
            if (OptionsManager.Instance.Options.ThumbsBtnVisible) {
                mBtnThumbs = CreateToolbarButton(toolBar, ref btnFrame, "Images/Toolbar/Thumbs32.png", delegate {
                    var view = new ThumbsViewController(View.Bounds.Width, p => { OpenDocumentPage((int)p); });
                    PresentPopover(view, mBtnThumbs.Frame);
                    view.InitThumbs();
                });
            }
            return toolBar;
        }