Skip to content

Commit

Permalink
StyleCop documentation and workaround for bug with scrollViewer not r…
Browse files Browse the repository at this point in the history
…especting targetOffset when zero
  • Loading branch information
Greg Munn committed Jul 1, 2012
1 parent 7a26f86 commit 91fdd0e
Show file tree
Hide file tree
Showing 5 changed files with 253 additions and 63 deletions.
2 changes: 2 additions & 0 deletions MonoKit.iOS/MonoKit.iOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
<Compile Include="UI\Metro\UIPivotView.cs" />
<Compile Include="UI\Metro\UIPanoramaView.cs" />
<Compile Include="UI\Metro\UIPanoramaViewController.cs" />
<Compile Include="UI\Metro\PanoramaConstants.cs" />
<Compile Include="UI\Metro\ContentItem.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="UI\" />
Expand Down
81 changes: 81 additions & 0 deletions MonoKit.iOS/UI/Metro/ContentItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ContentItem.cs" company="sgmunn">
// (c) sgmunn 2012
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
// to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of
// the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
//

namespace MonoKit.Metro
{
using System;
using MonoTouch.UIKit;

/// <summary>
/// An item of content in a Panorama or Pivot
/// </summary>
public sealed class ContentItem
{
// todo: make disposable to let go of view ??

/// <summary>
/// function to create the view
/// </summary>
private Func<UIView> create;

/// <summary>
/// Initializes a new instance of the <see cref="MonoKit.Metro.ContentItem"/> class.
/// </summary>
/// <param name='title'>The title of the content</param>
/// <param name='create'>A function to create the view that represents the content</param>
/// <param name='width'>The desired width of the content, zero defaults to standard</param>
public ContentItem(string title, Func<UIView> create, float width)
{
this.Title = title;
this.create = create;

this.Width = width != 0 ? width : UIScreen.MainScreen.Bounds.Width - PanoramaConstants.NextContentItemPreviewSize;
}

/// <summary>
/// Gets the title for the content
/// </summary>
public string Title { get; private set; }

/// <summary>
/// Gets the width of the item
/// </summary>
public float Width { get; private set; }

// todo: get rid of this
/// <summary>
/// Gets the content that was previously created
/// </summary>
public UIView Content { get ; private set; }

/// <summary>
/// Creates the view for the item.
/// </summary>
/// <returns>
/// Returns a new UIView
/// </returns>
public UIView CreateView()
{
this.Content = this.create();
return this.Content;
}
}
}
57 changes: 57 additions & 0 deletions MonoKit.iOS/UI/Metro/PanoramaConstants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="PanoramaConstants.cs" company="sgmunn">
// (c) sgmunn 2012
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
// to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of
// the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
//

namespace MonoKit.Metro
{
using System;
using MonoTouch.UIKit;

/// <summary>
/// Constants for panorama views
/// </summary>
public static class PanoramaConstants
{
/// <summary>
/// The amount of the next content item that is visible
/// </summary>
public static float NextContentItemPreviewSize = 30;

/// <summary>
/// The name of the default font to use for titles
/// </summary>
public static string DefaultFontName = "Thonburi";

/// <summary>
/// The default font size for titles
/// </summary>
public static float DefaultFontSize = 46;

/// <summary>
/// The default text color for titles
/// </summary>
public static UIColor DefaultTextColor = UIColor.White;

/// <summary>
/// The left margin between content items and titles
/// </summary>
public static float LeftMargin = 5;
}
}
Loading

0 comments on commit 91fdd0e

Please sign in to comment.