Exemplo n.º 1
0
        void Show(IToolWindowContent content, AppToolWindowLocation location, bool active, bool focus)
        {
            if (content == null)
            {
                throw new ArgumentNullException();
            }
            var t = GetToolWindowGroup(content);

            if (t != null)
            {
                if (active)
                {
                    t.Item2.ActiveTabContent = content;
                }
                if (focus)
                {
                    t.Item2.SetFocus(content);
                }
                return;
            }

            var g = GetOrCreateGroup(location);

            g.Add(content);
            SaveLocationAndActivate(g, content, location, active, focus);
        }
Exemplo n.º 2
0
        public void MoveTo(IToolWindowGroup destGroup, IToolWindowContent content)
        {
            if (destGroup == null)
            {
                throw new ArgumentNullException(nameof(destGroup));
            }
            if (content == null)
            {
                throw new ArgumentNullException(nameof(content));
            }
            var impl = GetTabContentImpl(content);

            Debug.Assert(impl != null);
            if (impl == null)
            {
                throw new InvalidOperationException();
            }
            if (destGroup == this)
            {
                return;
            }
            var destGroupImpl = destGroup as ToolWindowGroup;

            if (destGroupImpl == null)
            {
                throw new InvalidOperationException();
            }

            impl.PrepareMove();
            Close(impl);

            impl = new TabContentImpl(destGroupImpl, content);
            impl.PrepareMove();
            destGroupImpl.TabGroup.Add(impl);
        }
Exemplo n.º 3
0
 public TabContentImpl(ToolWindowGroup owner, IToolWindowContent content)
 {
     this.elementZoomer = new TabElementZoomer();
     this.owner         = owner;
     this.Content       = content;
     AddEvents();
 }
Exemplo n.º 4
0
 public void Show(IToolWindowContent content, AppToolWindowLocation?location)
 {
     if (content == null)
     {
         throw new ArgumentNullException();
     }
     Show(content, GetLocation(content.Guid, location), true, true);
 }
Exemplo n.º 5
0
 void SaveLocationAndActivate(IToolWindowGroup g, IToolWindowContent content, AppToolWindowLocation location, bool active, bool focus)
 {
     if (active)
     {
         g.ActiveTabContent = content;
     }
     if (focus)
     {
         g.SetFocus(content);
     }
     savedLocations[content.Guid] = location;
 }
Exemplo n.º 6
0
        public bool CanMove(IToolWindowContent content, AppToolWindowLocation location)
        {
            var t = GetToolWindowGroup(content);

            location = Convert(location);
            if (t == null || t.Item1.Location == location)
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 7
0
 void Window_Disposed(object sender, EventArgs e)
 {
     if (_session != null)
     {
         _session.SmartWindowManager.OnActiveWindowChanged -= _viewerChangedHandler;
     }
     _viewerChangedHandler = null;
     _onWindowClosed       = null;
     if (_content != null)
     {
         _content.Free();
         _content = null;
     }
 }
Exemplo n.º 8
0
 Tuple <ToolWindowUI, IToolWindowGroup> GetToolWindowGroup(IToolWindowContent content)
 {
     foreach (var ui in this.toolWindowUIs.Values)
     {
         foreach (var g in ui.ToolWindowGroupManager.TabGroups)
         {
             if (g.TabContents.Contains(content))
             {
                 return(Tuple.Create(ui, g));
             }
         }
     }
     return(null);
 }
Exemplo n.º 9
0
        public void SetFocus(IToolWindowContent content)
        {
            if (content == null)
            {
                throw new ArgumentNullException();
            }
            var impl = GetTabContentImpl(content);

            Debug.Assert(impl != null);
            if (impl == null)
            {
                return;
            }
            tabGroup.SetFocus(impl);
        }
Exemplo n.º 10
0
        public void Close(IToolWindowContent content)
        {
            if (content == null)
            {
                throw new ArgumentNullException();
            }
            var t = GetToolWindowGroup(content);

            Debug.Assert(t != null);
            if (t == null)
            {
                throw new InvalidOperationException();
            }
            t.Item2.Close(content);
        }
Exemplo n.º 11
0
        public void Move(IToolWindowContent content, AppToolWindowLocation location)
        {
            var t = GetToolWindowGroup(content);

            location = Convert(location);
            if (t == null || t.Item1.Location == location)
            {
                return;
            }

            var g = GetOrCreateGroup(location);

            t.Item2.MoveTo(g, content);
            SaveLocationAndActivate(g, content, location, true, true);
        }
Exemplo n.º 12
0
        public void Close(IToolWindowContent content)
        {
            if (content == null)
            {
                throw new ArgumentNullException(nameof(content));
            }
            var impl = GetTabContentImpl(content);

            Debug.Assert(impl != null);
            if (impl == null)
            {
                return;
            }
            TabGroup.Close(impl);
        }
Exemplo n.º 13
0
 public ToolWindowBase()
 {
     InitializeComponent();
     _content = GetToolWindowContent();
     if (_content != null)
     {
         (_content as Control).Dock = DockStyle.Fill;
         this.Controls.Add(_content as Control);
         //_content.Apply(_session);
         _viewerChangedHandler = new OnActiveWindowChangedHandler(
             (sender, oldv, newv) =>
         {
             _content.Apply(_session);
         }
             );
     }
     this.Disposed += new EventHandler(Window_Disposed);
 }
Exemplo n.º 14
0
 public void Add(IToolWindowContent content) => TabGroup.Add(new TabContentImpl(this, content));
Exemplo n.º 15
0
 TabContentImpl GetTabContentImpl(IToolWindowContent content) => TabContentImpls.FirstOrDefault(a => a.Content == content);
Exemplo n.º 16
0
 public bool IsShown(IToolWindowContent content)
 {
     return GetToolWindowGroup(content) != null;
 }
Exemplo n.º 17
0
 public void SetFocus(IToolWindowContent content)
 {
     if (content == null)
         throw new ArgumentNullException();
     var impl = GetTabContentImpl(content);
     Debug.Assert(impl != null);
     if (impl == null)
         return;
     tabGroup.SetFocus(impl);
 }
Exemplo n.º 18
0
 TabContentImpl GetTabContentImpl(IToolWindowContent content)
 {
     return TabContentImpls.FirstOrDefault(a => a.Content == content);
 }
Exemplo n.º 19
0
 protected override IToolWindowContent GetToolWindowContent()
 {
     _toolWindowContent = new FeatureListContent();
     return(_toolWindowContent);
 }
Exemplo n.º 20
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="tabGroup">Tab group</param>
 /// <param name="selected">Selected content or null</param>
 /// <param name="unselected">Unselected content or null</param>
 public ToolWindowSelectedEventArgs(IToolWindowGroup tabGroup, IToolWindowContent selected, IToolWindowContent unselected)
 {
     this.TabGroup = tabGroup;
     this.Selected = selected;
     this.Unselected = unselected;
 }
Exemplo n.º 21
0
 TabContentImpl GetTabContentImpl(IToolWindowContent content)
 {
     return(TabContentImpls.FirstOrDefault(a => a.Content == content));
 }
Exemplo n.º 22
0
        void Show(IToolWindowContent content, AppToolWindowLocation location, bool active, bool focus)
        {
            if (content == null)
                throw new ArgumentNullException();
            var t = GetToolWindowGroup(content);
            if (t != null) {
                if (active)
                    t.Item2.ActiveTabContent = content;
                if (focus)
                    t.Item2.SetFocus(content);
                return;
            }

            var g = GetOrCreateGroup(location);
            g.Add(content);
            SaveLocationAndActivate(g, content, location, active, focus);
        }
Exemplo n.º 23
0
 void SaveLocationAndActivate(IToolWindowGroup g, IToolWindowContent content, AppToolWindowLocation location, bool active, bool focus)
 {
     if (active)
         g.ActiveTabContent = content;
     if (focus)
         g.SetFocus(content);
     savedLocations[content.Guid] = location;
 }
Exemplo n.º 24
0
 Tuple<ToolWindowUI, IToolWindowGroup> GetToolWindowGroup(IToolWindowContent content)
 {
     foreach (var ui in this.toolWindowUIs.Values) {
         foreach (var g in ui.ToolWindowGroupManager.TabGroups) {
             if (g.TabContents.Contains(content))
                 return Tuple.Create(ui, g);
         }
     }
     return null;
 }
Exemplo n.º 25
0
 public void Show(IToolWindowContent content, AppToolWindowLocation? location)
 {
     if (content == null)
         throw new ArgumentNullException();
     Show(content, GetLocation(content.Guid, location), true, true);
 }
Exemplo n.º 26
0
        public void Move(IToolWindowContent content, AppToolWindowLocation location)
        {
            var t = GetToolWindowGroup(content);
            location = Convert(location);
            if (t == null || t.Item1.Location == location)
                return;

            var g = GetOrCreateGroup(location);
            t.Item2.MoveTo(g, content);
            SaveLocationAndActivate(g, content, location, true, true);
        }
Exemplo n.º 27
0
 public TabContentImpl(ToolWindowGroup owner, IToolWindowContent content)
 {
     this.owner = owner;
     this.content = content;
     AddEvents();
 }
Exemplo n.º 28
0
        public void MoveTo(IToolWindowGroup destGroup, IToolWindowContent content)
        {
            if (destGroup == null || content == null)
                throw new ArgumentNullException();
            var impl = GetTabContentImpl(content);
            Debug.Assert(impl != null);
            if (impl == null)
                throw new InvalidOperationException();
            if (destGroup == this)
                return;
            var destGroupImpl = destGroup as ToolWindowGroup;
            if (destGroupImpl == null)
                throw new InvalidOperationException();

            impl.PrepareMove();
            Close(impl);

            impl = new TabContentImpl(destGroupImpl, content);
            impl.PrepareMove();
            destGroupImpl.tabGroup.Add(impl);
        }
Exemplo n.º 29
0
 public ToolWindowContentState Save(IToolWindowContent c)
 {
     this.Guid = c.Guid;
     return(this);
 }
Exemplo n.º 30
0
 public bool IsShown(IToolWindowContent content) => GetToolWindowGroup(content) != null;
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="tabGroup">Tab group</param>
 /// <param name="selected">Selected content or null</param>
 /// <param name="unselected">Unselected content or null</param>
 public ToolWindowSelectedEventArgs(IToolWindowGroup tabGroup, IToolWindowContent selected, IToolWindowContent unselected)
 {
     this.TabGroup   = tabGroup;
     this.Selected   = selected;
     this.Unselected = unselected;
 }
Exemplo n.º 32
0
		public TabContentImpl(ToolWindowGroup owner, IToolWindowContent content) {
			this.elementScaler = new TabElementScaler();
			this.owner = owner;
			this.content = content;
			AddEvents();
		}
Exemplo n.º 33
0
 public bool IsShown(IToolWindowContent content)
 {
     return(GetToolWindowGroup(content) != null);
 }
Exemplo n.º 34
0
 public TabContentImpl(ToolWindowGroup owner, IToolWindowContent content)
 {
     this.owner   = owner;
     this.content = content;
     AddEvents();
 }
Exemplo n.º 35
0
 public ToolWindowContentState Save(IToolWindowContent c)
 {
     this.Guid = c.Guid;
     return this;
 }
Exemplo n.º 36
0
 public void Close(IToolWindowContent content)
 {
     if (content == null)
         throw new ArgumentNullException();
     var t = GetToolWindowGroup(content);
     Debug.Assert(t != null);
     if (t == null)
         throw new InvalidOperationException();
     t.Item2.Close(content);
 }
Exemplo n.º 37
0
        public bool CanMove(IToolWindowContent content, AppToolWindowLocation location)
        {
            var t = GetToolWindowGroup(content);
            location = Convert(location);
            if (t == null || t.Item1.Location == location)
                return false;

            return true;
        }
Exemplo n.º 38
0
 public void Add(IToolWindowContent content)
 {
     tabGroup.Add(new TabContentImpl(this, content));
 }