示例#1
0
 /// <summary>
 /// Registers a control with the control host service</summary>
 /// <param name="controlHostService">Control host service</param>
 /// <param name="control">Control</param>
 /// <param name="name">Control name</param>
 /// <param name="description">Control description</param>
 /// <param name="group">Initial location of control on main form</param>
 /// <param name="id">Unique ID for control</param>
 /// <param name="client">Client that owns control, or null</param>
 /// <returns>IControlInfo for registered control</returns>
 public static IControlInfo RegisterControl(
     this IControlHostService controlHostService,
     object control,
     string name,
     string description,
     Sce.Atf.Applications.StandardControlGroup group,
     string id,
     IControlHostClient client)
 {
     var def = new ControlDef() { Name = name, Description = description, Group = group, Id = id };
     return controlHostService.RegisterControl(def, control, client);
 }
示例#2
0
 /// <summary>
 /// Registers a control with the control host service</summary>
 /// <param name="controlHostService">Control host service</param>
 /// <param name="control">Control</param>
 /// <param name="name">Control name</param>
 /// <param name="description">Control description</param>
 /// <param name="group">Initial location of control on main form</param>
 /// <param name="id">Unique ID for control</param>
 /// <param name="client">Client that owns control, or null</param>
 /// <returns>IControlInfo for registered control</returns>
 public static IControlInfo RegisterControl(
     this IControlHostService controlHostService,
     object control,
     string name,
     string description,
     Sce.Atf.Applications.StandardControlGroup group,
     string id,
     IControlHostClient client)
 {
     var def = new ControlDef() { Name = name, Description = description, Group = group, Id = id };
     return controlHostService.RegisterControl(def, control, client);
 }
示例#3
0
        /// <summary>
        /// Finishes initializing component by subscribing to event and registering control.</summary>
        public virtual void Initialize()
        {
            ContextRegistry.ActiveContextChanged += contextRegistry_ActiveContextChanged;

            m_controlDef = new ControlDef()
            {
                Name        = "Property Editor".Localize(),
                Description = "Edits selected object properties".Localize(),
                Group       = StandardControlGroup.Right,
                Id          = s_propertyGridId.ToString()
            };
            ControlHostService.RegisterControl(m_controlDef, m_propertyGridView, this);
        }
示例#4
0
        /// <summary>
        /// Finishes initializing component by subscribing to event and registering control.</summary>
        public virtual void Initialize()
        {
            ContextRegistry.ActiveContextChanged += contextRegistry_ActiveContextChanged;

            m_controlDef = new ControlDef()
            {
                Name = "Property Editor".Localize(),
                Description = "Edits selected object properties".Localize(),
                Group = StandardControlGroup.Right,
                Id = s_propertyGridId.ToString()
            };
            ControlHostService.RegisterControl(m_controlDef, m_propertyGridView, this);
        }
示例#5
0
        /// <summary>
        /// Finishes initializing component by creating ListView and registering the control</summary>
        void IInitializable.Initialize()
        {
            m_resourceListView = new ResourceListView();

            m_resourcesControlDef = new ControlDef()
            {
                Name = "Resources".Localize(),
                Description = "Resources for selected Event".Localize(),
                Group = StandardControlGroup.Bottom,
                Id = s_resourceListEditorId.ToString()
            };

            m_controlHostService.RegisterControl(m_resourcesControlDef, m_resourceListView, this);
        }
示例#6
0
        /// <summary>
        /// Registers a control with the control host service</summary>
        /// <param name="def">Control definition</param>
        /// <param name="control">Control</param>
        /// <param name="client">Client that owns the control and receives notifications
        /// about its status, or null if no notifications are needed</param>
        /// <returns>IControlInfo for registered control</returns>
        public IControlInfo RegisterControl(ControlDef def, object control, IControlHostClient client)
        {
            Requires.NotNull(def, "def");
            Requires.NotNull(control, "control");
            Requires.NotNullOrEmpty(def.Id, "def.Id");
            Requires.NotNull(client, "client");

            if (m_registeredContents.Any <ControlInfo>(x => x.Id == def.Id))
            {
                throw new ArgumentException("Content with id " + def.Id + " already registered");
            }

            IDockContent dockContent = m_dockPanel.RegisterContent(control, def.Id, ControlGroupToDockTo(def.Group));

            dockContent.IsFocusedChanged += new EventHandler <BooleanArgs>(DockContent_IsFocusedChanged);

            ControlInfo contentInfo = new ControlInfo(def.Name, def.Description, def.Id, def.Group, def.ImageSourceKey, dockContent, client);

            m_registeredContents.Add(contentInfo);

            if (m_commandService != null)
            {
                var command = m_commandService.RegisterCommand(
                    new CommandDef(
                        dockContent,
                        StandardMenu.Window,
                        StandardCommandGroup.WindowDocuments,
                        contentInfo.Name,
                        null,
                        "Activate Control".Localize(),
                        null, null, CommandVisibility.Menu),
                    this);

                contentInfo.Command = command;
            }

            ActivateClient(client, true);

            Show(control);

            return(contentInfo);
        }
示例#7
0
        /// <summary>
        /// Registers a control with the control host service</summary>
        /// <param name="def">Control definition</param>
        /// <param name="control">Control</param>
        /// <param name="client">Client that owns the control and receives notifications
        /// about its status, or null if no notifications are needed</param>
        /// <returns>IControlInfo for registered control</returns>
        public IControlInfo RegisterControl(ControlDef def, object control, IControlHostClient client)
        {
            Requires.NotNull(def, "def");
            Requires.NotNull(control, "control");
            Requires.NotNullOrEmpty(def.Id, "def.Id");
            Requires.NotNull(client, "client");

            if (m_registeredContents.Any<ControlInfo>(x => x.Id == def.Id))
                throw new ArgumentException("Content with id " + def.Id + " already registered");

            IDockContent dockContent = m_dockPanel.RegisterContent(control, def.Id, ControlGroupToDockTo(def.Group));
            dockContent.IsFocusedChanged += DockContent_IsFocusedChanged;
            dockContent.Closing += DockContentOnClosing; 
            ControlInfo contentInfo = new ControlInfo(def.Name, def.Description, def.Id, def.Group, def.ImageSourceKey, dockContent, client);

            m_registeredContents.Add(contentInfo);

            if (m_commandService != null)
            {
                contentInfo.Command = m_commandService.RegisterCommand(
                    dockContent,
                    StandardMenu.Window,
                    StandardCommandGroup.WindowDocuments,
                    contentInfo.Name,
                    "Activate Control".Localize(),
                    Keys.None, null, CommandVisibility.Menu,
                    this).GetCommandItem();
            }

            ActivateClient(client, true);

            return contentInfo;
        }