コード例 #1
0
        /// <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;
                }
            }
        }
コード例 #2
0
ファイル: Tool.cs プロジェクト: mateuscezar/netgore
        /// <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);
                }
            }
        }
コード例 #3
0
ファイル: Tool.cs プロジェクト: wtfcolt/game
        /// <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);
                }
            }
        }
コード例 #4
0
ファイル: Tool.cs プロジェクト: mateuscezar/netgore
        /// <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;
            }
        }