Example #1
0
		public void Inflate (SizeF size)
		{
			X -= size.Width;
			Y -= size.Height;
			Width += size.Width * 2;
			Height += size.Height * 2;
		}
Example #2
0
		public RectangleF (PointF origin, SizeF size)
		{
			X = origin.X;
			Y = origin.Y;
			Width = size.Width;
			Height = size.Height;
		}
		public DocumentThumbnailsView (CGRect frame)
			: base (frame, new UICollectionViewFlowLayout ())
		{
			Items = new List<DocumentsViewItem> ();
			SelectedDocuments = new ObservableCollection<string> ();
			SelectedDocuments.CollectionChanged += HandleSelectedDocumentsChanged;

			AlwaysBounceVertical = true;

			BackgroundColor = DocumentAppDelegate.Shared.Theme.DocumentsBackgroundColor;

			RegisterClassForCell (typeof(AddDocumentCell), AddId);
			RegisterClassForCell (typeof(DocumentThumbnailCell), FileId);
			RegisterClassForCell (typeof(DirectoryThumbnailCell), DirId);
			RegisterClassForCell (typeof(NotReadyThumbnailCell), NotReadyId);
			RegisterClassForCell (typeof(SortThumbnailCell), SortId);
			RegisterClassForCell (typeof(PatronCell), PatronId);

			if (ios8) {
				((UICollectionViewFlowLayout)this.CollectionViewLayout).EstimatedItemSize = new CGSize (88, 122);
			}

			Delegate = new DocumentThumbnailsViewDelegate ();
			DataSource = new DocumentThumbnailsViewDataSource ();

			Console.WriteLine ("UI {0}", UIDevice.CurrentDevice.UserInterfaceIdiom);

			var thumbWidth =
				UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone ?
				320.0f/3.0f - Margin - Margin/3.0f:
				768.0f/5.0f - Margin - Margin/5.0f;

			thumbWidth = (int)(thumbWidth + 0.5f);

			var thumbHeight = thumbWidth / DocumentAppDelegate.Shared.App.ThumbnailAspectRatio;

			thumbHeight = (int)(thumbHeight + 0.5f);

			ThumbnailSize = new Praeclarum.Graphics.SizeF ((float)thumbWidth, (float)thumbHeight);

//			Console.WriteLine ("THUMB SIZE = {0}", ThumbnailSize);
		}
		public virtual void DrawThumbnail (IDocument doc, IGraphics g, SizeF size, Theme theme)
		{
			g.SetColor (GetThumbnailBackgroundColor (theme));
			g.FillRect (new RectangleF (PointF.Empty, size));
		}