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); }
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); }
public TabContentImpl(ToolWindowGroup owner, IToolWindowContent content) { this.elementZoomer = new TabElementZoomer(); this.owner = owner; this.Content = content; AddEvents(); }
public void Show(IToolWindowContent content, AppToolWindowLocation?location) { if (content == null) { throw new ArgumentNullException(); } Show(content, GetLocation(content.Guid, location), true, true); }
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; }
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); }
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; } }
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); }
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); }
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); }
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); }
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); }
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); }
public void Add(IToolWindowContent content) => TabGroup.Add(new TabContentImpl(this, content));
TabContentImpl GetTabContentImpl(IToolWindowContent content) => TabContentImpls.FirstOrDefault(a => a.Content == content);
public bool IsShown(IToolWindowContent content) { return GetToolWindowGroup(content) != null; }
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); }
TabContentImpl GetTabContentImpl(IToolWindowContent content) { return TabContentImpls.FirstOrDefault(a => a.Content == content); }
protected override IToolWindowContent GetToolWindowContent() { _toolWindowContent = new FeatureListContent(); return(_toolWindowContent); }
/// <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; }
TabContentImpl GetTabContentImpl(IToolWindowContent content) { return(TabContentImpls.FirstOrDefault(a => a.Content == content)); }
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); }
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; }
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; }
public void Show(IToolWindowContent content, AppToolWindowLocation? location) { if (content == null) throw new ArgumentNullException(); Show(content, GetLocation(content.Guid, location), true, true); }
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); }
public TabContentImpl(ToolWindowGroup owner, IToolWindowContent content) { this.owner = owner; this.content = content; AddEvents(); }
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); }
public ToolWindowContentState Save(IToolWindowContent c) { this.Guid = c.Guid; return(this); }
public bool IsShown(IToolWindowContent content) => GetToolWindowGroup(content) != null;
public TabContentImpl(ToolWindowGroup owner, IToolWindowContent content) { this.elementScaler = new TabElementScaler(); this.owner = owner; this.content = content; AddEvents(); }
public bool IsShown(IToolWindowContent content) { return(GetToolWindowGroup(content) != null); }
public ToolWindowContentState Save(IToolWindowContent c) { this.Guid = c.Guid; return this; }
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); }
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; }
public void Add(IToolWindowContent content) { tabGroup.Add(new TabContentImpl(this, content)); }