summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorButton.cs
blob: b4d0aa003dbdcc29c0356d575f0e99dd2e43790c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//-----------------------------------------------------------------------
// <copyright file="SelectorButton.cs" company="Outercurve Foundation">
//     Copyright (c) Outercurve Foundation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace DotNetOpenAuth.OpenId.RelyingParty {
	using System;
	using System.Diagnostics.Contracts;
	using System.Web.UI;

	/// <summary>
	/// A button that would appear in the <see cref="OpenIdSelector"/> control via its <see cref="OpenIdSelector.Buttons"/> collection.
	/// </summary>
	[ContractClass(typeof(SelectorButtonContract))]
	public abstract class SelectorButton {
		/// <summary>
		/// Initializes a new instance of the <see cref="SelectorButton"/> class.
		/// </summary>
		protected SelectorButton() {
		}

		/// <summary>
		/// Ensures that this button has been initialized to a valid state.
		/// </summary>
		/// <remarks>
		/// This is "internal" -- NOT "protected internal" deliberately.  It makes it impossible
		/// to derive from this class outside the assembly, which suits our purposes since the
		/// <see cref="OpenIdSelector"/> control is not designed for an extensible set of button types.
		/// </remarks>
		internal abstract void EnsureValid();

		/// <summary>
		/// Renders the leading attributes for the LI tag.
		/// </summary>
		/// <param name="writer">The writer.</param>
		protected internal abstract void RenderLeadingAttributes(HtmlTextWriter writer);

		/// <summary>
		/// Renders the content of the button.
		/// </summary>
		/// <param name="writer">The writer.</param>
		/// <param name="selector">The containing selector control.</param>
		protected internal abstract void RenderButtonContent(HtmlTextWriter writer, OpenIdSelector selector);
	}
}