Exemple #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);
        }
Exemple #2
0
        /// <summary>
        /// Creates the bottom bar.
        /// </summary>
        /// <returns>The bottom bar view.</returns>
        protected virtual UIView _CreateBottomBar()
        {
            // Create bottom bar
            var bottomBarFrame = View.Bounds;

            bottomBarFrame.X     += BarPaddingH;
            bottomBarFrame.Y      = bottomBarFrame.Size.Height - BarPaddingV - BottombarHeight;
            bottomBarFrame.Width -= BarPaddingH * 2;
            bottomBarFrame.Height = BottombarHeight;
            var bottomBar = new UIXToolbarView(bottomBarFrame, 0.92f, 0.32f, 0.8f);

            bottomBar.AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleWidth;

            // Create slider
            float sliderWidth = bottomBarFrame.Width - 15;

            if (MgrAccessor.OptionsMgr.Options.PageNumberVisible)
            {
                sliderWidth -= PageNumberLabelSize.Width;
            }
            var pageSliderFrame = new RectangleF(5, 10, sliderWidth, 20);

            _Slider                  = new UISlider(pageSliderFrame);
            _Slider.MinValue         = 1;
            _Slider.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
            _Slider.ValueChanged    += delegate {
                if (_PageNumberLabel != null)
                {
                    _PageNumberLabel.Text = string.Format(@"{0}/{1}", (int)_Slider.Value, PDFDocument.PageCount);
                }
            };
            _Slider.TouchUpInside += delegate(object sender, EventArgs e) {
                OpenDocumentPage((int)_Slider.Value);
            };
            bottomBar.AddSubview(_Slider);

            // Create page number view
            if (MgrAccessor.OptionsMgr.Options.PageNumberVisible)
            {
                var pageNumberViewFrame = new RectangleF(pageSliderFrame.Width + 10, 5, PageNumberLabelSize.Width, PageNumberLabelSize.Height);
                var pageNumberView      = new UIView(pageNumberViewFrame);
                pageNumberView.AutosizesSubviews      = false;
                pageNumberView.UserInteractionEnabled = false;
                pageNumberView.AutoresizingMask       = UIViewAutoresizing.FlexibleLeftMargin;
                pageNumberView.BackgroundColor        = UIColor.FromWhiteAlpha(0.4f, 0.5f);
                pageNumberView.Layer.CornerRadius     = 5.0f;
                pageNumberView.Layer.ShadowOffset     = new SizeF(0.0f, 0.0f);
                pageNumberView.Layer.ShadowPath       = UIBezierPath.FromRect(pageNumberView.Bounds).CGPath;
                pageNumberView.Layer.ShadowRadius     = 2.0f;
                pageNumberView.Layer.ShadowOpacity    = 1.0f;
                // Create page number label
                var pageNumberLabelFrame = RectangleFExtensions.Inset(pageNumberView.Bounds, 4.0f, 2.0f);
                _PageNumberLabel = new UILabel(pageNumberLabelFrame);
                _PageNumberLabel.AutosizesSubviews = false;
                _PageNumberLabel.AutoresizingMask  = UIViewAutoresizing.None;
                _PageNumberLabel.TextAlignment     = UITextAlignment.Center;
                _PageNumberLabel.BackgroundColor   = UIColor.Clear;
                _PageNumberLabel.TextColor         = UIColor.White;
                _PageNumberLabel.Font         = UIFont.SystemFontOfSize(16.0f);
                _PageNumberLabel.ShadowOffset = new SizeF(0.0f, 1.0f);
                _PageNumberLabel.ShadowColor  = UIColor.Black;
                _PageNumberLabel.AdjustsFontSizeToFitWidth = true;
                _PageNumberLabel.MinimumFontSize           = 12.0f;
                pageNumberView.AddSubview(_PageNumberLabel);
                bottomBar.AddSubview(pageNumberView);
            }
            return(bottomBar);
        }