/// <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; }
/// <summary> /// Creates bottom bar /// </summary> /// <returns>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 (OptionsManager.Instance.Options.PageNumberVisible) { sliderWidth -= PageNumberLabelSize.Width; } var pageSliderFrame = new RectangleF(5, 10, sliderWidth, 20); mSlider = new UISlider(pageSliderFrame); mSlider.MinValue = 1; mSlider.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; mSlider.ValueChanged += delegate { OpenDocumentPage((int)mSlider.Value); }; bottomBar.AddSubview(mSlider); // Create page number view if (OptionsManager.Instance.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); mPageNumberLabel = new UILabel(pageNumberLabelFrame); mPageNumberLabel.AutosizesSubviews = false; mPageNumberLabel.AutoresizingMask = UIViewAutoresizing.None; mPageNumberLabel.TextAlignment = UITextAlignment.Center; mPageNumberLabel.BackgroundColor = UIColor.Clear; mPageNumberLabel.TextColor = UIColor.White; mPageNumberLabel.Font = UIFont.SystemFontOfSize(16.0f); mPageNumberLabel.ShadowOffset = new SizeF(0.0f, 1.0f); mPageNumberLabel.ShadowColor = UIColor.Black; mPageNumberLabel.AdjustsFontSizeToFitWidth = true; mPageNumberLabel.MinimumFontSize = 12.0f; pageNumberView.AddSubview(mPageNumberLabel); bottomBar.AddSubview(pageNumberView); } return bottomBar; }