예제 #1
0
        public ToolStripItem CreateNodeUI(EventHandler nodeClicked)
        {
            RoomNodeControl control = new RoomNodeControl
            {
                DisplayName = DisplayName,
                IsVisible   = _visibleByDefault
            };

            if (_shouldHideCheckboxes)
            {
                control.HideCheckBoxes(true);
            }
            if (_control != null)
            {
                _control.OnNodeSelected     -= nodeClicked;
                _control.OnIsVisibleChanged -= control_OnVisibleChanged;
                _control.OnIsLockedChanged  -= control_OnLockedChanged;
            }
            control.OnNodeSelected     += nodeClicked;
            control.OnIsVisibleChanged += control_OnVisibleChanged;
            control.OnIsLockedChanged  += control_OnLockedChanged;
            ToolStripControlHost host = new ToolStripControlHost(control);

            control.Host = host;
            _control     = control;
            if (VisibleGroup != null)
            {
                VisibleGroup.Register(_control);
            }
            if (Layer == null)
            {
                IRoomEditorFilter parentFilter = FindFilter();
                if (parentFilter != null && !parentFilter.SupportVisibleItems)
                {
                    control.HideCheckBoxes(false);
                }
            }
            else
            {
                Layer.VisibleItems.Clear();
                Layer.VisibleItems.AddRange(Layer.GetItemsNames());
            }
            return(host);
            //return new ToolStripMenuItem(DisplayName, null, nodeClicked);
        }
예제 #2
0
 public void Register(RoomNodeControl control)
 {
     _controls.Add(control);
     control.OnIsVisibleChanged += (sender, eventArgs) =>
     {
         if (control.IsVisible)
         {
             foreach (RoomNodeControl controlToHide in _controls)
             {
                 if (controlToHide == control)
                 {
                     continue;
                 }
                 controlToHide.IsVisible = false;
             }
         }
     };
 }
예제 #3
0
파일: RoomEditNode.cs 프로젝트: toojays/ags
        public ToolStripItem CreateNodeUI(EventHandler nodeClicked)
        {
            RoomNodeControl control = new RoomNodeControl
            {
                DisplayName = DisplayName,
                IsVisible   = _initVisible,
                IsLocked    = _initLocked
            };

            if (_shouldHideCheckboxes)
            {
                control.HideCheckBoxes(true);
            }
            if (_control != null)
            {
                _control.OnNodeSelected     -= nodeClicked;
                _control.OnIsVisibleChanged -= control_OnVisibleChanged;
                _control.OnIsLockedChanged  -= control_OnLockedChanged;
            }
            control.OnNodeSelected     += nodeClicked;
            control.OnIsVisibleChanged += control_OnVisibleChanged;
            control.OnIsLockedChanged  += control_OnLockedChanged;
            ToolStripControlHost host = new ToolStripControlHost(control);

            control.Host = host;
            _control     = control;
            if (VisibleGroup != null)
            {
                VisibleGroup.Register(_control);
            }
            if (Layer == null)
            {
                IRoomEditorFilter parentFilter = FindFilter();
                if (parentFilter != null && !parentFilter.SupportVisibleItems)
                {
                    control.HideCheckBoxes(false);
                }
            }
            return(host);
        }