コード例 #1
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));
        }
コード例 #2
0
 private Tab FindTab(TabContent content)
 {
     foreach (Tab tab in tabs)
     {
         if (tab.Content.Equals(content))
         {
             return(tab);
         }
     }
     return(null);
 }
コード例 #3
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();
        }
コード例 #4
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();
            }
        }
コード例 #5
0
 public Tab(TabCaption caption, TabContent content)
 {
     this.Caption = caption;
     this.Content = content;
 }