/// <summary> /// Initializes a new instance of the <see cref="Tool"/> class. /// </summary> /// <param name="toolManager">The <see cref="ToolManager"/>.</param> /// <param name="settings">The <see cref="ToolSettings"/> to use to create this <see cref="Tool"/>.</param> /// <exception cref="ArgumentNullException"><paramref name="toolManager"/> is null.</exception> /// <exception cref="ArgumentNullException"><paramref name="settings"/> is null.</exception> protected Tool(ToolManager toolManager, ToolSettings settings) { if (toolManager == null) throw new ArgumentNullException("toolManager"); if (settings == null) throw new ArgumentNullException("settings"); settings.Lock(); // Set the properties _toolManager = toolManager; _settings = settings; _toolBarControl = ToolBar.CreateToolControl(this, ToolSettings.ToolBarControlType); if (ToolBarControl != null) { // Set the default image ToolBarControl.ControlSettings.Image = ToolSettings.DisabledImage ?? ToolSettings.DefaultImage; // If an image is set, then default to showing only the image if (ToolBarControl.ControlSettings.Image != null) ToolBarControl.ControlSettings.DisplayStyle = ToolStripItemDisplayStyle.Image; // Bind help if (!string.IsNullOrEmpty(settings.HelpName) && !string.IsNullOrEmpty(settings.HelpWikiPage)) { EditorHelpManager.Instance.Add((ToolStripItem)ToolBarControl, settings.HelpName, settings.HelpWikiPage); } } }
/// <summary> /// Initializes a new instance of the <see cref="Tool"/> class. /// </summary> /// <param name="toolManager">The <see cref="ToolManager"/>.</param> /// <param name="settings">The <see cref="ToolSettings"/> to use to create this <see cref="Tool"/>.</param> /// <exception cref="ArgumentNullException"><paramref name="toolManager"/> is null.</exception> /// <exception cref="ArgumentNullException"><paramref name="settings"/> is null.</exception> protected Tool(ToolManager toolManager, ToolSettings settings) { if (toolManager == null) { throw new ArgumentNullException("toolManager"); } if (settings == null) { throw new ArgumentNullException("settings"); } settings.Lock(); // Set the properties _toolManager = toolManager; _settings = settings; _toolBarControl = ToolBar.CreateToolControl(this, ToolSettings.ToolBarControlType); if (ToolBarControl != null) { // Set the default image ToolBarControl.ControlSettings.Image = ToolSettings.DisabledImage ?? ToolSettings.DefaultImage; // If an image is set, then default to showing only the image if (ToolBarControl.ControlSettings.Image != null) { ToolBarControl.ControlSettings.DisplayStyle = ToolStripItemDisplayStyle.Image; } // Bind help if (!string.IsNullOrEmpty(settings.HelpName) && !string.IsNullOrEmpty(settings.HelpWikiPage)) { EditorHelpManager.Instance.Add((ToolStripItem)ToolBarControl, settings.HelpName, settings.HelpWikiPage); } } }
/// <summary> /// Initializes a new instance of the <see cref="Tool"/> class. /// </summary> /// <param name="toolManager">The <see cref="ToolManager"/>.</param> /// <param name="settings">The <see cref="ToolSettings"/> to use to create this <see cref="Tool"/>.</param> /// <exception cref="ArgumentNullException"><paramref name="toolManager"/> is null.</exception> /// <exception cref="ArgumentNullException"><paramref name="settings"/> is null.</exception> protected Tool(ToolManager toolManager, ToolSettings settings) { if (toolManager == null) throw new ArgumentNullException("toolManager"); if (settings == null) throw new ArgumentNullException("settings"); settings.Lock(); // Set the properties _toolManager = toolManager; _settings = settings; _toolBarControl = ToolBar.CreateToolControl(this, ToolSettings.ToolBarControlType); if (ToolBarControl != null) { // Set the default image ToolBarControl.ControlSettings.Image = ToolSettings.DisabledImage ?? ToolSettings.DefaultImage; // If an image is set, then default to showing only the image if (ToolBarControl.ControlSettings.Image != null) ToolBarControl.ControlSettings.DisplayStyle = ToolStripItemDisplayStyle.Image; } }
/// <summary> /// Initializes a new instance of the <see cref="MapCursorToolBase"/> class. /// </summary> /// <param name="toolManager">The <see cref="ToolManager"/>.</param> /// <param name="settings">The <see cref="ToolSettings"/> to use to create this <see cref="Tool"/>.</param> /// <exception cref="ArgumentNullException"><paramref name="toolManager"/> is null.</exception> /// <exception cref="ArgumentNullException"><paramref name="settings"/> is null.</exception> protected MapCursorToolBase(ToolManager toolManager, ToolSettings settings) : base(toolManager, ModifyToolSettings(settings)) { ShowObjectToolTip = true; }
/// <summary> /// Modifies the <see cref="ToolSettings"/> as it is passed to the base class constructor. /// </summary> /// <param name="settings">The <see cref="ToolSettings"/>.</param> /// <returns>The <see cref="ToolSettings"/></returns> static ToolSettings ModifyToolSettings(ToolSettings settings) { settings.ToolBarVisibility = ToolBarVisibility.Map; settings.EnabledToolsGroup = _enabledToolsGroup; settings.EnabledByDefault = false; return settings; }
/// <summary> /// Initializes a new instance of the <see cref="MapToolBase"/> class. /// </summary> /// <param name="toolManager">The <see cref="ToolManager"/>.</param> /// <param name="settings">The <see cref="ToolSettings"/> to use to create this <see cref="Tool"/>.</param> /// <exception cref="ArgumentNullException"><paramref name="toolManager"/> is null.</exception> /// <exception cref="ArgumentNullException"><paramref name="settings"/> is null.</exception> protected MapToolBase(ToolManager toolManager, ToolSettings settings) : base(toolManager, settings) { }