示例#1
0
        private void TabCaption_ClosedTab(object sender, EventArgs e)
        {
            TabCaption caption = (TabCaption)sender;
            Tab        tab     = FindTab(caption);

            DisposeTab(tab);
        }
示例#2
0
        public static Tab CreateTab(String url)
        {
            Browser     browser     = BrowserFactory.Create(BrowserType);
            BrowserView browserView = new WinFormsBrowserView(browser);

            browser.DialogHandler      = new WinFormsDefaultDialogHandler((Control)browserView);
            browser.DownloadHandler    = new WinFormsDefaultDownloadHandler((Control)browserView);
            browser.ContextMenuHandler = new WinFormsDefaultContextMenuHandler((Control)browserView, true);
            browser.Preferences.FireKeyboardEventsEnabled = false;
            browser.Preferences.FireMouseEventsEnabled    = false;

            TabContent tabContent = new TabContent(browserView);

            TabCaption tabCaption = new TabCaption();

            tabCaption.SetTitle("about:blank");

            tabContent.PropertyChangeEvent += delegate(string propertyName,
                                                       object oldValue, object newValue)
            {
                tabCaption.SetTitle(newValue.ToString());
            };

            browserView.Browser.LoadURL(url);
            return(new Tab(tabCaption, tabContent));
        }
示例#3
0
        public void RemoveTab(Tab tab)
        {
            TabCaption tabCaption = tab.Caption;

            captions.RemoveTab(tabCaption);
            tabs.Remove(tab);
            UpdateWidthForHeaders();
        }
示例#4
0
        private void TabCaption_SelectedTab(object sender, EventArgs e)
        {
            TabCaption caption = (TabCaption)sender;
            Tab        tab     = FindTab(caption);

            if (caption.IsSelected())
            {
                SelectTab(tab);
            }
        }
示例#5
0
        public void RemoveSelectedTab()
        {
            TabCaption selectedTab = captions.GetSelectedTab();
            Tab        tab         = FindTab(selectedTab);

            if (tab != null)
            {
                DisposeTab(tab);
            }
        }
示例#6
0
 private Tab FindTab(TabCaption item)
 {
     foreach (Tab tab in tabs)
     {
         if (tab.Caption.Equals(item))
         {
             return(tab);
         }
     }
     return(null);
 }
示例#7
0
        public void AddTab(Tab tab)
        {
            TabCaption caption = tab.Caption;

            caption.ClosedTab   += TabCaption_ClosedTab;
            caption.SelectedTab += TabCaption_SelectedTab;

            TabContent content = tab.Content;

            captions.AddTab(caption);
            tabs.Add(tab);
            UpdateWidthForHeaders();
        }
示例#8
0
        public void SelectTab(Tab tab)
        {
            TabCaption tabCaption  = tab.Caption;
            TabCaption selectedTab = captions.GetSelectedTab();

            if (selectedTab != null && !selectedTab.Equals(tabCaption))
            {
                selectedTab.SetSelected(false);
            }
            captions.SetSelectedTab(tabCaption);
            if (!tabCaption.IsSelected())
            {
                TabContent content = tab.Content;
                contentContainer.Controls.Remove(content);
            }
            else
            {
                TabContent content = tab.Content;
                contentContainer.Controls.Clear();
                contentContainer.Controls.Add(content);
                content.Focus();
            }
        }
示例#9
0
 public void SetSelectedTab(TabCaption selectedTab)
 {
     this.selectedTab = selectedTab;
     this.selectedTab.SetSelected(true);
 }
示例#10
0
 public void RemoveTab(TabCaption item)
 {
     tabsPane.Controls.Remove(item);
 }
示例#11
0
 public void AddTab(TabCaption item)
 {
     tabsPane.Controls.Add(item);
 }
示例#12
0
 public Tab(TabCaption caption, TabContent content)
 {
     this.Caption = caption;
     this.Content = content;
 }