Ejemplo n.º 1
0
        /// <summary>
		/// Construtor.
		/// </summary>
		/// <param name="parentLocation">Parent location</param>
		/// <param name="parentName">Parent name</param>
		/// <param name="name">Name</param>
		/// <param name="shortcut">Shortcut</param>
		/// <param name="text">Text</param>
		/// <param name="enabled">Enabled</param>
		/// <param name="visible">Visible</param>
		/// <param name="isChecked">Check state</param>
		/// <param name="executed">Execute event handler</param>
		internal CheckedMenuNode( MenuItemLocation parentLocation, string parentName, string name, int shortcut, string text, bool enabled, bool visible, bool isChecked, EventHandler executed ): 
			base(parentLocation,
		                      parentName,
		                      name,
		                      shortcut,
		                      text, 
		                      enabled,
		                      visible,
                              isChecked,
		                      executed) {
		}
Ejemplo n.º 2
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="parentLocation">Parent location</param>
 /// <param name="parentName">Parent name</param>
 internal SeparatorMenuNode(MenuItemLocation parentLocation, string parentName) :
     base(parentLocation,
                      parentName,
                      "SepMenu" + (count++),
                      0,
                      "-",
                      true,
                      true,
    false,
                      null)
 {
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="parentLocation">Parent location</param>
 /// <param name="parentName">Parent name</param>
 /// <param name="name">Name</param>
 /// <param name="text">Text</param>
 internal EmptyMenuNode(MenuItemLocation parentLocation, string parentName, string name, string text) :
     base(parentLocation,
                      parentName,
                      name,
                      0,
                      text,
                      true,
                      true,
                      false,
                      null)
 {
 }
    public MenuItemDefinitionAttribute(string name, string path)
    {
        if (string.IsNullOrEmpty(name))
        {
            throw new ArgumentException($"'{nameof(name)}' cannot be null or empty.", nameof(name));
        }

        if (string.IsNullOrEmpty(path))
        {
            throw new ArgumentException($"'{nameof(path)}' cannot be null or empty.", nameof(path));
        }

        Name = name;

        Location = new MenuItemLocation(path);
    }
Ejemplo n.º 5
0
		///<summary>
		///Constructor.
		///</summary>
		/// <param name="parentLocation">Parent location</param>
		/// <param name="parentName">Parent name</param>
		/// <param name="name">Name</param>
		/// <param name="shortcut">Shortcut</param>
		/// <param name="text">Text</param>
		/// <param name="enabled">Enabled</param>
		/// <param name="visible">Visible</param>
		/// <param name="isChecked">Check state</param>
		/// <param name="executed">Execute event handler</param>
		protected CustomMenuNode( MenuItemLocation parentLocation, string parentName, string name, int shortcut, string text, bool enabled, bool visible, bool isChecked, EventHandler executed ): base(name) {
			this.text = text;
			this.enabled = enabled;
			this.visible = visible;
			this.executed += executed;
			this.shortcut = shortcut;
			this.parentName = parentName;
            this.isChecked = isChecked;
			// This.help = new HelpString(this);
			switch(parentLocation) {
				case MenuItemLocation.After:
					this.parentLocation = OTAMenuItemLocation.otamlAfter;
					break;
				case MenuItemLocation.Before:
					this.parentLocation = OTAMenuItemLocation.otamlBefore;
					break;
				case MenuItemLocation.Child:
					this.parentLocation = OTAMenuItemLocation.otamlChild;
					break;
				default:
					this.parentLocation = OTAMenuItemLocation.otamlChild;
					break;
			}
		}		
Ejemplo n.º 6
0
        ///// <summary>
        ///// Creates a menu object.
        ///// </summary>
        ///// <param name="parentLocation"></param>
        ///// <param name="parentName"></param>
        ///// <param name="name"></param>
        ///// <param name="shortcut"></param>
        ///// <param name="text"></param>
        ///// <param name="executeEvent"></param>
        ///// <returns></returns>
        //protected static Elements.ICustomMenuNode CreateOTACustomAction(MenuItemLocation parentLocation,
        //        string parentName,
        //        string name,
        //        int shortcut,
        //        string text,
        //        EventHandler executeEvent)
        //{
        //    return CreateActionMenu(parentLocation, parentName, name, shortcut, text, executeEvent);
        //}

        ///<summary>
        ///Creates a separator menu.
        ///</summary>
        ///<param name="parentLocation">Parent location</param>
        ///<param name="parentName">Parent name</param>
        ///<returns>
        ///Created SeparatorMenu object.
        ///</returns>
        protected static Elements.ICustomMenuNode CreateSeparatorMenu(MenuItemLocation parentLocation,
                string parentName)
        {
            Trace.Assert(parentName != null);

            LoggingService.EnterMethod();
            Elements.SeparatorMenuNode separator = new Elements.SeparatorMenuNode(parentLocation, parentName);
            LoggingService.LeaveMethod();

            return separator;
        }
Ejemplo n.º 7
0
        ///<summary>
        ///Creates an empty menu.
        ///</summary>
        ///<param name="parentLocation">Parent location</param>
        ///<param name="parentName">Parent name</param>
        ///<param name="name">Name</param>
        ///<param name="text">Text</param>
        ///<returns>
        ///Created EmptyMenu object.
        ///</returns>
        protected static Elements.ICustomMenuNode CreateEmptyMenu(
            MenuItemLocation parentLocation,
            string parentName,
            string name,
            string text)
        {
            Trace.Assert(parentName != null);
            Trace.Assert(name != null);
            Trace.Assert(text != null);

            LoggingService.EnterMethod();
            Elements.EmptyMenuNode emptyMenuNode = new Elements.EmptyMenuNode(parentLocation, parentName, name, text);
            LoggingService.LeaveMethod();

            return emptyMenuNode;
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="parentLocation"></param>
        /// <param name="parentName"></param>
        /// <param name="name"></param>
        /// <param name="shortcut"></param>
        /// <param name="text"></param>
        /// <param name="isChecked"></param>
        /// <param name="executeEvent"></param>
        /// <returns></returns>
        protected static Elements.ICustomMenuNode CreateCheckedMenu(MenuItemLocation parentLocation,
                string parentName,
                string name,
                int shortcut,
                string text,
                bool isChecked,
                EventHandler executeEvent)
        {
            Trace.Assert(parentName != null);
            Trace.Assert(name != null);
            Trace.Assert(text != null);

            LoggingService.EnterMethod();
            Elements.CheckedMenuNode result =
                new Elements.CheckedMenuNode(parentLocation,
                                               parentName,
                                               name,
                                               shortcut,
                                               text,
                                               true,
                                               true,
                                               isChecked,
                                               executeEvent);

            LoggingService.LeaveMethod();

            return result;
        }
Ejemplo n.º 9
0
		private void AddCommonMenus( MenuItemLocation _Location, string parent ) {
			RegisterMenu(CreateEmptyMenu(
				_Location,
				parent,
				MenuLeXtudio,
				MenuTextLeXtudio)
			            );
			RegisterMenu(CreateEmptyMenu(
				MenuItemLocation.Child,
				MenuLeXtudio,
				MenuOptions,
				MenuTextOptions)
			            );
			RegisterMenu(CreateSeparatorMenu(MenuItemLocation.Before,
			                                 MenuOptions));
			RegisterMenu(CreateActionMenu(MenuItemLocation.Child,
			                              MenuOptions,
			                              MenuPreferencesReload,
			                              0,
			                              MenuTextPreferencesReload,
			                              new EventHandler(DoReloadPreferences)));
			RegisterMenu(CreateActionMenu(MenuItemLocation.Child,
			                              MenuOptions,
			                              MenuShortcutsReload,
			                              0,
			                              MenuTextShortcutsReload,
			                              new EventHandler(DoReloadShortcuts)));
			RegisterMenu(CreateSeparatorMenu(MenuItemLocation.Child,
			                                 MenuOptions));
			RegisterMenu(CreateActionMenu(MenuItemLocation.Child,
			                              MenuOptions,
			                              MenuShortcuts,
			                              0,
			                              MenuTextShortcuts,
			                              new EventHandler(DoShortcuts)));
			RegisterMenu(CreateActionMenu(MenuItemLocation.Child,
			                              MenuOptions,
			                              MenuPreferences,
			                              0,
			                              MenuTextPreferences,
			                              new EventHandler(DoPreferences)));
			RegisterMenu(
				CreateActionMenu(
					MenuItemLocation.After,
					MenuOptions,
					MenuAbout,
					0,
					MenuTextAbout,
					new EventHandler(DoAbout)
				)
			);
			RegisterMenu(
				CreateActionMenu(
					MenuItemLocation.After,
					MenuOptions,
					"CBCSendComments",
					0,
					"Send Your Comments",
					new EventHandler(DoSendComments)
				)
			);
			RegisterMenu(
				CreateActionMenu(
					MenuItemLocation.After,
					MenuOptions,
					"CBCManual",
					0,
					"User Manual",
					new EventHandler(DoManual)
				)
			);
		}