Inheritance: Core.ControlBase, IControlRenderer, IControl
Beispiel #1
0
#pragma warning restore 1591

		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="selectMenu">SelectMenu to configure options of</param>
		public Options(SelectMenu selectMenu)
		 : base()
		{
			this.SelectMenu = selectMenu;
			this.Position = new PositionOptions(this);
			this.Reset();
		}
Beispiel #2
0
		public void ConfigureSelectMenu(SelectMenu mnu) {
			mnu	
				.Items()
					.AddGroup("Slowly")
						.Add("Slower", "slower")
						.Add("Slow", "slow")
						.FinishGroup()
					.Add("Medium", "medium")
					.AddGroup("Fastly", true)
						.Add("Fast", "fast")
						.Add("Faster", "faster")						
						.FinishGroup()
				.Finish()
				.Rendering
					.SetPrettyRender(true)
				.Finish()
				.Options
					.SetDisabled(this.Disabled)
					.SetWidth(this.Width)
					.SetIcons(this.Icons)
				.Finish()
			;

			if (this.showEvents) {
				mnu
					.Events
						.SetChangeEvent("return changeEvent(event, ui);")
						.SetCloseEvent("return closeEvent(event, ui);")
						.SetCreateEvent("return createEvent(event, ui);")
						.SetFocusEvent("return focusEvent(event, ui);")
						.SetSelectEvent("return selectEvent(event, ui);")
						.SetOpenEvent("return openEvent(event, ui);")
					.Finish();
			}
			if (!this.prettyRender)
				mnu.Rendering.Compress();
			if (this.renderCSS)
				mnu.Rendering.ShowCSS();
		}
		/// <summary>
		/// Creates a Menu control that can be configured and later rendered on the page.
		/// </summary>
		/// <param name="page">WebForms page to render the control onto</param>
		/// <param name="id">ID to give to the accordion (must be unique on the page)</param>
		/// <returns>Created Menu control</returns>
		public static SelectMenu CreateMenu(this System.Web.UI.Page page, string id) {
			TextWriter writer = page.Response.Output;
			SelectMenu selectMenu = new SelectMenu(writer, id);

			return selectMenu;
		}
		/// <summary>
		/// Creates a Menu control that can be configured and later rendered on the page.
		/// </summary>
		/// <param name="html">Html helper (used to get the HttpResponse object to render onto)</param>
		/// <param name="id">ID to give to the accordion (must be unique on the page)</param>
		/// <returns>Created Menu control</returns>
		public static SelectMenu CreateSelectMenu(this HtmlHelper html, string id) {
			TextWriter writer = html.ViewContext.Writer;
			SelectMenu selectMenu = new SelectMenu(writer, id);

			return selectMenu;
		}
Beispiel #5
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="selectMenu">SelectMenu object to call</param>
		public Methods(SelectMenu selectMenu) : base(selectMenu)
		{
		}		
Beispiel #6
0
		internal static void ForceRender(SelectMenu m)
		{
			m.Render();
		}
Beispiel #7
0
		internal static SelectMenu SetupSimpleSelectMenuObject(TextWriter writer)
		{
			SelectMenu m = new SelectMenu(writer, "mySelectMenu");

			return m;
		}
Beispiel #8
0
		public string CSharpCode(SelectMenu mnu) {
			jStringBuilder sb = new jStringBuilder(true/*includeWhitespace*/, 0);

			sb.AppendTabsLineIf("<%");
			sb.AppendTabsLineIf("Html.CreateSelectMenu(\"mnu\")");

			string optionsCode = OptionsCSharpCode();
			string positionOptionsCode = PositionsCSharpCode();
			string showEventsCode = ShowEventsCSharpCode();
			string renderCode = base.RenderCSharpCode();
			bool showOptions = (optionsCode.Length > 0 || positionOptionsCode.Length > 0 || showEventsCode.Length > 0 || renderCode.Length > 0);
			
			if (showOptions) {
				sb.IncIndent();

				if (optionsCode.Length > 0 || positionOptionsCode.Length > 0) {
					sb.AppendTabsLineIf(".Options");
					sb.IncIndent();
					sb.Append(optionsCode);
					sb.DecIndent();
					sb.AppendTabsLineIf(".Finish()");
				}	
				if (positionOptionsCode.Length > 0) {
					sb.IncIndent();
					if (positionOptionsCode.Length > 0) {
						sb.AppendTabsLineIf(".Position");
						sb.Append(positionOptionsCode);
						sb.AppendTabsLineIf(".Finish()");
					}
					sb.DecIndent();
					sb.AppendTabsLineIf(".Finish()");
				}
				if (showEventsCode.Length > 0) {
					sb.AppendTabsLineIf(".Events");
					sb.IncIndent();
					sb.Append(showEventsCode);
					sb.DecIndent();
					sb.AppendTabsLineIf(".Finish()");
				}

				if (renderCode.Length > 0)
					sb.Append(renderCode);
				sb.DecIndent();
			}
			sb.AppendTabsLineIf(".Render();");
			sb.AppendTabsLineIf("%>");

			return sb.ToString();
		}
Beispiel #9
0
		public string JavaScriptCode(SelectMenu mnu) {
			mnu.Rendering.SetPrettyRender(true);
			return mnu.GetStartUpScript();
		}
Beispiel #10
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="selectMenu">SelectMenu object to configure events for</param>
		public Events(SelectMenu selectMenu)
		 : base()
		{
			this.SelectMenu = selectMenu;
			this.Reset();
		}
Beispiel #11
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="selectMenu">SelectMenu object to set rendering options of</param>
		public Rendering(SelectMenu selectMenu)
		 : base()
		{
			this.SelectMenu = selectMenu;
		}