Esempio n. 1
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);
            HitTestResult hitTestResult = this.HitTest(e.Location);

            if (hitTestResult == HitTestResult.TabItem)
            {
                FATabStripItem tabItemByPoint = this.GetTabItemByPoint(e.Location);
                if (tabItemByPoint != null)
                {
                    this.SelectedItem = tabItemByPoint;
                    base.Invalidate();
                }
                return;
            }
            if (e.Button != MouseButtons.Left)
            {
                return;
            }
            if (hitTestResult == HitTestResult.CloseButton)
            {
                if (this.SelectedItem != null)
                {
                    TabStripItemClosingEventArgs tabStripItemClosingEventArgs = new TabStripItemClosingEventArgs(this.SelectedItem);
                    this.OnTabStripItemClosing(tabStripItemClosingEventArgs);
                    if (!tabStripItemClosingEventArgs.Cancel && this.SelectedItem.CanClose)
                    {
                        this.RemoveTab(this.SelectedItem);
                        this.OnTabStripItemClosed(EventArgs.Empty);
                    }
                }
                base.Invalidate();
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Fires <see cref="TabStripItemClosing"/> event.
 /// </summary>
 /// <param name="e"></param>
 protected internal virtual void OnTabStripItemClosing(TabStripItemClosingEventArgs e)
 {
     if (TabStripItemClosing != null)
     {
         TabStripItemClosing(e);
     }
 }
Esempio n. 3
0
 protected internal virtual void OnTabStripItemClosing(TabStripItemClosingEventArgs e)
 {
     if (this.TabStripItemClosing == null)
     {
         return;
     }
     this.TabStripItemClosing(e);
 }
Esempio n. 4
0
        private void OnTabClosing(FarsiLibrary.Win.TabStripItemClosingEventArgs e)
        {
            // exit if invalid tab
            if (CurTab == null)
            {
                e.Cancel = true;
                return;
            }

            // add a blank tab if the very last tab is closed!
            if (TabPages.Items.Count <= 2)
            {
                AddBlankTab();
                //e.Cancel = true;
            }
        }
Esempio n. 5
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            if (e.Button != MouseButtons.Left)
            {
                return;
            }

            HitTestResult result = HitTest(e.Location);

            if (result == HitTestResult.MenuGlyph)
            {
                HandledEventArgs args = new HandledEventArgs(false);
                OnMenuItemsLoading(args);

                if (!args.Handled)
                {
                    OnMenuItemsLoad(EventArgs.Empty);
                }

                ShowMenu();
            }
            else if (result == HitTestResult.CloseButton)
            {
                if (SelectedItem != null)
                {
                    TabStripItemClosingEventArgs args = new TabStripItemClosingEventArgs(SelectedItem);
                    OnTabStripItemClosing(args);
                    if (!args.Cancel && SelectedItem.CanClose)
                    {
                        RemoveTab(SelectedItem);
                        OnTabStripItemClosed(EventArgs.Empty);
                    }
                }
            }
            else if (result == HitTestResult.TabItem)
            {
                FATabStripItem item = GetTabItemByPoint(e.Location);
                if (item != null)
                {
                    SelectedItem = item;
                }
            }

            Invalidate();
        }
Esempio n. 6
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);
            if (e.Button != MouseButtons.Left)
            {
                return;
            }
            switch (this.HitTest(e.Location))
            {
            case HitTestResult.CloseButton:
                if (this.SelectedItem != null)
                {
                    TabStripItemClosingEventArgs e1 = new TabStripItemClosingEventArgs(this.SelectedItem);
                    this.OnTabStripItemClosing(e1);
                    if (!e1.Cancel && this.SelectedItem.CanClose)
                    {
                        this.RemoveTab(this.SelectedItem);
                        this.OnTabStripItemClosed(EventArgs.Empty);
                        break;
                    }
                    break;
                }
                break;

            case HitTestResult.MenuGlyph:
                HandledEventArgs e2 = new HandledEventArgs(false);
                this.OnMenuItemsLoading(e2);
                if (!e2.Handled)
                {
                    this.OnMenuItemsLoad(EventArgs.Empty);
                }
                this.ShowMenu();
                break;

            case HitTestResult.TabItem:
                FATabStripItem tabItemByPoint = this.GetTabItemByPoint(e.Location);
                if (tabItemByPoint != null)
                {
                    this.SelectedItem = tabItemByPoint;
                    break;
                }
                break;
            }
            this.Invalidate();
        }
Esempio n. 7
0
        internal bool Close(TabStripItemClosingEventArgs e=null)
        {
            bool canClose = true;
            PlistEditControl edit = null;
            if (e == null)
            {
                edit = curEditor;
            }
            else
            {
                if (controls.ContainsKey(e.Item))
                {
                    edit = controls[e.Item];
                }
                else
                {
                    Debug.WriteLine("Err");
                    return false;
                }
            }

            if (!edit.Saved)
            {
                DialogResult dr = MessageBox.Show("Save [" + edit.Tab.Title + "]", "Confirm Close", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                switch (dr)
                {
                    case DialogResult.Cancel:
                        if(e!=null)
                        {
                            e.Cancel = true;
                        }
                        canClose = false;
                        break;

                    case DialogResult.No:
                        CloseTab(edit.Tab, e==null);
                        break;

                    default:
                        //Default Yes = Save first and close
                        Save(edit);
                        CloseTab(edit.Tab, e == null);
                        break;
                }

            }
            else
            {
                CloseTab(edit.Tab, e == null);
            }
            return canClose;
        }
Esempio n. 8
0
 private void tabStrip_TabStripItemClosing(TabStripItemClosingEventArgs e)
 {
     closedTabStrip = true;
     if (e.Item.Tag is OpenLibFileData)
     {
         //tabStrip.RemoveTab(e.Item);
         return;
     }
     bool cancel;
     if (e.Item.Tag is DialogData)
     {
         DialogData fileData = (DialogData)e.Item.Tag;
         CloseFile(fileData, e.Item, out cancel);
     }
     else
     {
         OpenFileData fileData = (OpenFileData)e.Item.Tag;
         CloseFile(fileData, out cancel);
     }
     e.Cancel = true;
 }
Esempio n. 9
0
        private void tabStrip_TabStripItemClosing(TabStripItemClosingEventArgs e)
        {
            Trace trace = CurrentTrace;
            bool result = !StopCurrentTrace();
            e.Cancel = result;

            if(!result && trace != null)
                _traceManager.DeleteProfiler(trace.Profiler);
        }
Esempio n. 10
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            if (e.Button != MouseButtons.Left)
                return;

            HitTestResult result = HitTest(e.Location);
            if(result == HitTestResult.MenuGlyph)
            {
                HandledEventArgs args = new HandledEventArgs(false);
                OnMenuItemsLoading(args);

                if (!args.Handled)
                    OnMenuItemsLoad(EventArgs.Empty);

                ShowMenu();
            }
            else if (result == HitTestResult.CloseButton)
            {
                if (SelectedItem != null)
                {
                    TabStripItemClosingEventArgs args = new TabStripItemClosingEventArgs(SelectedItem);
                    OnTabStripItemClosing(args);
                    if (!args.Cancel && SelectedItem.CanClose)
                    {
                        RemoveTab(SelectedItem);
                        OnTabStripItemClosed(EventArgs.Empty);
                    }
                }
            }
            else if(result == HitTestResult.TabItem)
            {
                FATabStripItem item = GetTabItemByPoint(e.Location);
                if (item != null)
                    SelectedItem = item;
            }

            Invalidate();
        }
Esempio n. 11
0
 /// <summary>
 /// Fires <see cref="TabStripItemClosing"/> event.
 /// </summary>
 /// <param name="e"></param>
 protected internal virtual void OnTabStripItemClosing(TabStripItemClosingEventArgs e)
 {
     if (TabStripItemClosing != null)
         TabStripItemClosing(e);
 }
Esempio n. 12
0
 private void faTabStripMain_TabStripItemClosing(TabStripItemClosingEventArgs e)
 {
     controller.Close(e);
 }
Esempio n. 13
0
 private void FaTabStrip1TabStripItemClosing(TabStripItemClosingEventArgs e)
 {
     _storedEntries.Remove(Convert.ToInt32(e.Item.Tag));
 }
Esempio n. 14
0
 private void tbStrip_TabStripItemClosing(TabStripItemClosingEventArgs e)
 {
     e.Cancel = !tryCloseTab(e.Item);
 }