Example #1
0
#pragma warning restore 1591

		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="sldr">Menu to configure options of</param>
		public Options(Menu menu)
		 : base()
		{
			this.Menu = menu;
			this.Position = new PositionOptions(this);
			this.Reset();
		}
Example #2
0
		public void ConfigureMenu(Menu mnu) {
			mnu
				.WithStyle("z-index", "1000")
				.Items()
					.Add("Home", "http://fluqi.apphb.com", Core.Icons.eIconClass.home)
					.AddDivider()
					.Add("File", Core.Icons.eIconClass.disk)
						.SubMenu()
							.Add("Open", Core.Icons.eIconClass.folder_open)
							.Add("Search", Core.Icons.eIconClass.search)
							.Add("Print", Core.Icons.eIconClass.print)
								.Configure()
									.SetDisabled()
								.Finish()
							.Add("Close", Core.Icons.eIconClass.close)
						.Back()
					.Add("Edit", Core.Icons.eIconClass.pencil)
						.SubMenu()
							.Add("Cut", Core.Icons.eIconClass.scissors)
							.Add("Copy", Core.Icons.eIconClass.copy)
							.Add("Paste", Core.Icons.eIconClass.clipboard)
						.Back()
				.Finish()
				.Rendering
					.SetPrettyRender(true)
				.Finish()
				.Options
					.SetDisabled(this.Disabled)
					.SetIcons(this.Icons)
					.Position
						.SetAt(this.At1, this.At2)
						.SetMy(this.My1, this.My2)
						.SetCollision(this.Collision1, this.Collision2)
					.Finish()		
				.Finish();

			if (this.showEvents) {
				mnu
					.Events
						.SetCreateEvent("return createEvent(event, ui);")
						.SetBlurEvent("return blurEvent(event, ui);")
						.SetSelectEvent("return selectEvent(event, ui);")
						.SetFocusEvent("return focusEvent(event, ui);")
					.Finish();
			}
			if (!this.prettyRender)
				mnu.Rendering.Compress();
			if (this.renderCSS)
				mnu.Rendering.ShowCSS();
		}
Example #3
0
		/// <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 Menu CreateMenu(this System.Web.UI.Page page, string id) {
			TextWriter writer = page.Response.Output;
			Menu newMenu = new Menu(writer, id);

			return newMenu;
		}
Example #4
0
		/// <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 Menu CreateMenu(this HtmlHelper html, string id) {
			TextWriter writer = html.ViewContext.Writer;
			Menu newMenu = new Menu(writer, id);

			return newMenu;
		}
Example #5
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="Menu">Menu object to call</param>
		public Methods(Menu menu) : base(menu)
		{
		}		
Example #6
0
		public string CSharpCode(Menu mnu) {
			jStringBuilder sb = new jStringBuilder(true/*includeWhitespace*/, 0);

			sb.AppendTabsLineIf("<%");
			sb.AppendTabsLineIf("Html.CreateMenu(\"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();
		}
Example #7
0
		public string JavaScriptCode(Menu mnu) {
			mnu.Rendering.SetPrettyRender(true);
			return mnu.GetStartUpScript();
		}
Example #8
0
		internal static void ForceRender(Menu m)
		{
			m.Render();
		}
Example #9
0
		internal static Menu SetupSimpleMenuObject(TextWriter writer) 
		{
			Menu m = new Menu(writer, "myMenu");

			return m;
		}
Example #10
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="menu">Menu object to configure events for</param>
		public Events(Menu menu)
		 : base()
		{
			this.Menu = menu;
			this.Reset();
		}
Example #11
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="menu">Menu object to set rendering options of</param>
		public Rendering(Menu menu)
		 : base()
		{
			this.Menu = menu;
		}
Example #12
0
		public string JavaScriptCode(Menu mnu) {
			return mnu.GetStartUpScript();
		}