Ejemplo n.º 1
0
        private void TabCaption_ClosedTab(object sender, EventArgs e)
        {
            TabCaption caption = (TabCaption)sender;
            Tab        tab     = FindTab(caption);

            DisposeTab(tab);
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 3
0
        public void RemoveTab(Tab tab)
        {
            TabCaption tabCaption = tab.Caption;

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

            if (caption.IsSelected())
            {
                SelectTab(tab);
            }
        }
Ejemplo n.º 5
0
        public void RemoveSelectedTab()
        {
            TabCaption selectedTab = captions.GetSelectedTab();
            Tab        tab         = FindTab(selectedTab);

            if (tab != null)
            {
                DisposeTab(tab);
            }
        }
Ejemplo n.º 6
0
 private Tab FindTab(TabCaption item)
 {
     foreach (Tab tab in tabs)
     {
         if (tab.Caption.Equals(item))
         {
             return(tab);
         }
     }
     return(null);
 }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
            }
        }
Ejemplo n.º 9
0
 public void SetSelectedTab(TabCaption selectedTab)
 {
     this.selectedTab = selectedTab;
     this.selectedTab.SetSelected(true);
 }
Ejemplo n.º 10
0
 public void RemoveTab(TabCaption item)
 {
     tabsPane.Controls.Remove(item);
 }
Ejemplo n.º 11
0
 public void AddTab(TabCaption item)
 {
     tabsPane.Controls.Add(item);
 }
Ejemplo n.º 12
0
 public Tab(TabCaption caption, TabContent content)
 {
     this.Caption = caption;
     this.Content = content;
 }