Beispiel #1
0
 public TabPanel(Panel panel, IFactory factory, ITabContent tabContent)
 {
     _factory   = factory;
     _panel     = panel;
     TabContent = tabContent;
     InitializeComponent();
 }
Beispiel #2
0
 public SetFocusWhenVisible(TabGroup tabGroup, ITabContent content, UIElement uiElem, Action action)
 {
     this.tabGroup            = tabGroup;
     this.content             = content;
     this.uiElem              = uiElem;
     this.action              = action;
     uiElem.IsVisibleChanged += uiElem_IsVisibleChanged;
 }
Beispiel #3
0
        void Remove(ITabContent content)
        {
            int index = IndexOf(content);

            if (index >= 0)
            {
                RemoveTabItem((TabItemImpl)tabControl.Items[index]);
            }
        }
 public bool Remove(ITabContent item)
 {
     if (!Pages.Contains(item))
     {
         return(false);
     }
     _timePages.Remove(item);
     return(true);
 }
        public IDocumentTab TryGetDocumentTab(ITabContent content)
        {
            var impl = content as TabContentImpl;

            if (impl == null)
            {
                return(null);
            }
            return(GetTabGroup(impl) == null ? null : impl);
        }
Beispiel #6
0
        void SetFocus2(ITabContent content)
        {
            var fel = content.FocusedElement;

            if (fel == null)
            {
                fel = content.UIObject as IInputElement;
            }
            var sv = fel as ScrollViewer;

            if (sv != null)
            {
                fel = sv.Content as IInputElement ?? fel;
            }

            var focusable = content as IFocusable;

            if (focusable != null && focusable.CanFocus)
            {
                var uiel = fel as UIElement;
                if (uiel != null && !uiel.IsVisible)
                {
                    new SetFocusWhenVisible(this, content, uiel, () => {
                        if (wpfFocusService.CanFocus)
                        {
                            focusable.Focus();
                        }
                    });
                }
                else
                {
                    if (wpfFocusService.CanFocus)
                    {
                        focusable.Focus();
                    }
                }
            }
            else
            {
                if (fel == null || !fel.Focusable)
                {
                    return;
                }

                var uiel = fel as UIElement;
                if (uiel != null && !uiel.IsVisible)
                {
                    new SetFocusWhenVisible(this, content, uiel, () => SetFocusNoChecks(fel));
                }
                else
                {
                    SetFocusNoChecks(fel);
                }
            }
        }
        public void Add(ITabContent item)
        {
            Task timeOut = new Task(() =>
            {
                Task.Delay(TimeOut).Wait();
                //item.Dispose();
            });

            //timeOut.ConfigureAwait()
            _timePages.Add(item, timeOut);
        }
Beispiel #8
0
 TabItemImpl GetTabItemImpl(ITabContent content)
 {
     foreach (TabItemImpl impl in tabControl.Items)
     {
         if (impl.TabContent == content)
         {
             return(impl);
         }
     }
     return(null);
 }
Beispiel #9
0
        public void SetFocus(ITabContent content)
        {
            if (content == null)
            {
                throw new ArgumentNullException(nameof(content));
            }
            var impl = GetTabItemImpl(content);

            tabControl.SelectedItem = impl ?? throw new InvalidOperationException();
            tabGroupService.SetActive(this);
            SetFocus2(impl.TabContent);
        }
Beispiel #10
0
        public void Add(ITabContent content)
        {
            if (content == null)
            {
                throw new ArgumentNullException(nameof(content));
            }
            var impl = new TabItemImpl(this, content, options.TabItemStyle);

            AddEvents(impl);
            content.OnVisibilityChanged(TabContentVisibilityEvent.Added);
            UpdateState(impl);
            AddToTabControl(impl, tabControl.Items.Count);
        }
Beispiel #11
0
 public TabItemImpl(TabGroup tabGroup, ITabContent tabContent, object objStyle)
 {
     this.tabGroup    = tabGroup;
     this.tabContent  = tabContent;
     this.Content     = tabContent.UIObject;
     this.theHeader   = new TheHeader(this);
     this.DataContext = theHeader;
     this.Header      = theHeader;
     this.AllowDrop   = true;
     this.AddHandler(GotKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(GotKeyboardFocus2), true);
     this.AddHandler(LostKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(LostKeyboardFocus2), true);
     this.SetStyle(objStyle ?? "FileTabGroupTabItemStyle");
     AddEvents();
 }
Beispiel #12
0
        void ITabGroup.Close(ITabContent content)
        {
            if (content == null)
            {
                throw new ArgumentNullException(nameof(content));
            }
            var impl = GetTabItemImpl(content);

            if (impl == null)
            {
                throw new InvalidOperationException();
            }
            Close(impl);
        }
Beispiel #13
0
 public TabItemImpl(TabGroup tabGroup, ITabContent tabContent, object objStyle)
 {
     this.tabGroup = tabGroup;
     this.tabContent = tabContent;
     this.Content = tabContent.UIObject;
     this.theHeader = new TheHeader(this);
     this.DataContext = theHeader;
     this.Header = theHeader;
     this.AllowDrop = true;
     this.AddHandler(GotKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(GotKeyboardFocus2), true);
     this.AddHandler(LostKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(LostKeyboardFocus2), true);
     this.SetStyle(objStyle ?? "FileTabGroupTabItemStyle");
     AddEvents();
 }
Beispiel #14
0
 int IndexOf(ITabContent content)
 {
     if (content == null)
     {
         throw new ArgumentNullException(nameof(content));
     }
     for (int i = 0; i < tabControl.Items.Count; i++)
     {
         var ti = (TabItemImpl)tabControl.Items[i];
         if (ti.TabContent == content)
         {
             return(i);
         }
     }
     Debug.Fail(string.Format("Couldn't find {0}", content));
     return(-1);
 }
Beispiel #15
0
        bool IsActiveTab(ITabContent content)
        {
            var impl = GetTabItemImpl(content);

            if (impl == null)
            {
                return(false);
            }
            if (impl != ActiveTabItemImpl)
            {
                return(false);
            }
            if (TabGroupService.ActiveTabGroup != this)
            {
                return(false);
            }
            if (TabGroupService.TabService.ActiveTabGroupService != TabGroupService)
            {
                return(false);
            }

            return(true);
        }
Beispiel #16
0
        bool IsActiveTab(ITabContent content)
        {
            var impl = GetTabItemImpl(content);

            if (impl == null)
            {
                return(false);
            }
            if (impl != ActiveTabItemImpl)
            {
                return(false);
            }
            if (TabGroupManager.ActiveTabGroup != this)
            {
                return(false);
            }
            if (TabGroupManager.TabManager.ActiveTabGroupManager != TabGroupManager)
            {
                return(false);
            }

            return(true);
        }
Beispiel #17
0
        void SetFocus2(ITabContent content)
        {
            var fel = content.FocusedElement;

            if (fel == null)
            {
                fel = content.UIObject as IInputElement;
            }
            if (fel is ScrollViewer sv)
            {
                fel = sv.Content as IInputElement ?? fel;
            }

            if (content is IFocusable focusable && focusable.CanFocus)
            {
                if (fel is UIElement uiel && !uiel.IsVisible)
                {
                    new SetFocusWhenVisible(this, content, uiel, () => {
                        if (wpfFocusService.CanFocus)
                        {
                            focusable.Focus();
                        }
                    });
                }
Beispiel #18
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 TabSelectedEventArgs(ITabGroup tabGroup, ITabContent selected, ITabContent unselected)
 {
     TabGroup   = tabGroup;
     Selected   = selected;
     Unselected = unselected;
 }
Beispiel #19
0
 void Remove(ITabContent content)
 {
     int index = IndexOf(content);
     if (index >= 0)
         RemoveTabItem((TabItemImpl)tabControl.Items[index]);
 }
Beispiel #20
0
 int IndexOf(ITabContent content)
 {
     if (content == null)
         throw new ArgumentNullException();
     for (int i = 0; i < tabControl.Items.Count; i++) {
         var ti = (TabItemImpl)tabControl.Items[i];
         if (ti.TabContent == content)
             return i;
     }
     Debug.Fail(string.Format("Couldn't find {0}", content));
     return -1;
 }
Beispiel #21
0
 public void SetFocus(ITabContent content)
 {
     if (content == null)
         throw new ArgumentNullException();
     var impl = GetTabItemImpl(content);
     if (impl == null)
         throw new InvalidOperationException();
     tabControl.SelectedItem = impl;
     tabGroupManager.SetActive(this);
     SetFocus2(impl.TabContent);
 }
Beispiel #22
0
 public void Add(ITabContent content)
 {
     if (content == null)
         throw new ArgumentNullException();
     var impl = new TabItemImpl(this, content, options.TabItemStyle);
     AddEvents(impl);
     content.OnVisibilityChanged(TabContentVisibilityEvent.Added);
     UpdateState(impl);
     AddToTabControl(impl, tabControl.Items.Count);
 }
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="attached">true if attached, false if detached</param>
		/// <param name="tabContent">Tab content</param>
		public TabContentAttachedEventArgs(bool attached, ITabContent tabContent) {
			this.Attached = attached;
			this.TabContent = tabContent;
		}
 /// <summary>Static getter for Body</summary>
 public static Our.Umbraco.Vorto.Models.VortoValue <IHtmlString> GetBody(ITabContent that)
 {
     return(that.GetPropertyValue <Our.Umbraco.Vorto.Models.VortoValue <IHtmlString> >("body"));
 }
Beispiel #25
0
 public SetFocusWhenVisible(TabGroup tabGroup, ITabContent content, UIElement uiElem, Action action)
 {
     this.tabGroup = tabGroup;
     this.content = content;
     this.uiElem = uiElem;
     this.action = action;
     uiElem.IsVisibleChanged += uiElem_IsVisibleChanged;
 }
Beispiel #26
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="attached">true if attached, false if detached</param>
 /// <param name="tabContent">Tab content</param>
 public TabContentAttachedEventArgs(bool attached, ITabContent tabContent)
 {
     this.Attached   = attached;
     this.TabContent = tabContent;
 }
 public void Start(ITabContent item)
 {
 }
 public void Stop(ITabContent item)
 {
     //_timePages[item]
 }
Beispiel #29
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 TabSelectedEventArgs(ITabGroup tabGroup, ITabContent selected, ITabContent unselected) {
			this.TabGroup = tabGroup;
			this.Selected = selected;
			this.Unselected = unselected;
		}
Beispiel #30
0
 static ToolWindowContent GetToolWindowContent(ITabContent selected) => ((TabContentImpl)selected)?.Content;
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="attached">true if attached, false if detached</param>
		/// <param name="tabContent">Tab content</param>
		public TabContentAttachedEventArgs(bool attached, ITabContent tabContent) {
			Attached = attached;
			TabContent = tabContent;
		}
 /// <summary>Static getter for Title</summary>
 public static Our.Umbraco.Vorto.Models.VortoValue <string> GetTitle(ITabContent that)
 {
     return(that.GetPropertyValue <Our.Umbraco.Vorto.Models.VortoValue <string> >("title"));
 }
		static ToolWindowContent GetToolWindowContent(ITabContent selected) => ((TabContentImpl)selected)?.Content;
Beispiel #34
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="attached">true if attached, false if detached</param>
 /// <param name="tabContent">Tab content</param>
 public TabContentAttachedEventArgs(bool attached, ITabContent tabContent)
 {
     Attached   = attached;
     TabContent = tabContent;
 }
 static IToolWindowContent GetToolWindowContent(ITabContent selected)
 {
     return(selected == null ? null : ((TabContentImpl)selected).Content);
 }
Beispiel #36
0
 void ITabGroup.Close(ITabContent content)
 {
     if (content == null)
         throw new ArgumentNullException();
     var impl = GetTabItemImpl(content);
     if (impl == null)
         throw new InvalidOperationException();
     Close(impl);
 }
Beispiel #37
0
		bool IsActiveTab(ITabContent content) {
			var impl = GetTabItemImpl(content);
			if (impl == null)
				return false;
			if (impl != ActiveTabItemImpl)
				return false;
			if (TabGroupService.ActiveTabGroup != this)
				return false;
			if (TabGroupService.TabService.ActiveTabGroupService != TabGroupService)
				return false;

			return true;
		}
Beispiel #38
0
 TabItemImpl GetTabItemImpl(ITabContent content)
 {
     foreach (TabItemImpl impl in tabControl.Items) {
         if (impl.TabContent == content)
             return impl;
     }
     return 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 TabSelectedEventArgs(ITabGroup tabGroup, ITabContent selected, ITabContent unselected)
 {
     this.TabGroup   = tabGroup;
     this.Selected   = selected;
     this.Unselected = unselected;
 }
Beispiel #40
0
        bool IsActiveTab(ITabContent content)
        {
            var impl = GetTabItemImpl(content);
            if (impl == null)
                return false;
            if (impl != ActiveTabItemImpl)
                return false;
            if (TabGroupManager.ActiveTabGroup != this)
                return false;
            if (TabGroupManager.TabManager.ActiveTabGroupManager != TabGroupManager)
                return false;

            return true;
        }
 public abstract void Show(ITabContent tabContent = null);
Beispiel #42
0
        void SetFocus2(ITabContent content)
        {
            var fel = content.FocusedElement;
            if (fel == null)
                fel = content.UIObject as IInputElement;
            var sv = fel as ScrollViewer;
            if (sv != null)
                fel = sv.Content as IInputElement ?? fel;

            var focusable = content as IFocusable;
            if (focusable != null && focusable.CanFocus) {
                var uiel = fel as UIElement;
                if (uiel != null && !uiel.IsVisible)
                    new SetFocusWhenVisible(this, content, uiel, () => {
                        if (wpfFocusManager.CanFocus)
                            focusable.Focus();
                    });
                else {
                    if (wpfFocusManager.CanFocus)
                        focusable.Focus();
                }
            }
            else {
                if (fel == null || !fel.Focusable)
                    return;

                var uiel = fel as UIElement;
                if (uiel != null && !uiel.IsVisible)
                    new SetFocusWhenVisible(this, content, uiel, () => SetFocusNoChecks(fel));
                else
                    SetFocusNoChecks(fel);
            }
        }
 public void Restart(ITabContent item)
 {
 }
		/// <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 TabSelectedEventArgs(ITabGroup tabGroup, ITabContent selected, ITabContent unselected) {
			TabGroup = tabGroup;
			Selected = selected;
			Unselected = unselected;
		}
 static IToolWindowContent GetToolWindowContent(ITabContent selected)
 {
     return selected == null ? null : ((TabContentImpl)selected).Content;
 }