Ejemplo n.º 1
0
        /// <summary>Close a tab.</summary>
        /// <param name="o">A widget appearing on the tab</param>
        public void CloseTabContaining(object o)
        {
            Notebook notebook = null;
            string   tabText  = null;
            int      tabPage  = GetTabOfWidget(o, ref notebook, ref tabText);

            if (tabPage > 0)
            {
                TabClosingEventArgs args = new TabClosingEventArgs();
                if (TabClosing != null)
                {
                    args.LeftTabControl = IsControlOnLeft(o);
                    args.Name           = tabText;
                    args.Index          = tabPage;
                    TabClosing.Invoke(this, args);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>User is closing a tab.</summary>
        private void OnCloseTabClick2(object sender, EventArgs e)
        {
            TabClosingEventArgs args = new TabClosingEventArgs();

            args.LeftTabControl = false;

            if (TabClosing != null)
            {
                args.Name  = tabControl2.SelectedTab.Text;
                args.Index = tabControl2.SelectedIndex;
                TabClosing.Invoke(this, args);
            }

            if (args.AllowClose && tabControl2.SelectedTab.Text != indexTabText)
            {
                tabControl2.TabPages.Remove(tabControl2.SelectedTab);
            }
        }
Ejemplo n.º 3
0
        public void on_eventbox1_button_press_event(object o, ButtonPressEventArgs e)
        {
            if (e.Event.Button == 2)
            {

                Notebook notebook = null;
                string tabText = null;
                int tabPage = GetTabOfWidget(o, ref notebook, ref tabText);
                if (tabPage > -1)
                    notebook.CurrentPage = tabPage;
                if (tabPage > 0)
                {
                    TabClosingEventArgs args = new TabClosingEventArgs();
                    if (TabClosing != null)
                    {
                        args.LeftTabControl = IsControlOnLeft(o);
                        args.Name = tabText;
                        args.Index = tabPage;
                        TabClosing.Invoke(this, args);
                    }
                    if (args.AllowClose)
                        notebook.RemovePage(tabPage);
                }
            }
        }
Ejemplo n.º 4
0
 /// <summary>Close a tab.</summary>
 /// <param name="o">A widget appearing on the tab</param>
 public void CloseTabContaining(object o)
 {
     Notebook notebook = null;
     string tabText = null;
     int tabPage = GetTabOfWidget(o, ref notebook, ref tabText);
     if (tabPage > 0)
     {
         TabClosingEventArgs args = new TabClosingEventArgs();
         if (TabClosing != null)
         {
             args.LeftTabControl = IsControlOnLeft(o);
             args.Name = tabText;
             args.Index = tabPage;
             TabClosing.Invoke(this, args);
         }
         if (args.AllowClose)
             notebook.RemovePage(tabPage);
     }
 }
Ejemplo n.º 5
0
        /// <summary>User is closing a tab.</summary>
        private void OnCloseTabClick2(object sender, EventArgs e)
        {
            TabClosingEventArgs args = new TabClosingEventArgs();
            args.LeftTabControl = false;

            if (TabClosing != null)
            {
                args.Name = tabControl2.SelectedTab.Text;
                args.Index = tabControl2.SelectedIndex;
                TabClosing.Invoke(this, args);
            }

            if (args.AllowClose && tabControl2.SelectedTab.Text != indexTabText)
                tabControl2.TabPages.Remove(tabControl2.SelectedTab);
        }