private void OnButtonClick(object sender, ViewButtonClickEventArgs e)
 {
     switch (e.Button)
     {
     case ViewButtonType.Close:
         FindForm().Close();
         break;
     }
 }
Exemple #2
0
        private void OnViewButtonClick(object sender, ViewButtonClickEventArgs e)
        {
            switch (e.Button)
            {
            case ViewButtonType.ScrollTabsLeft:
                if (_firstTabIndex != 0)
                {
                    --_firstTabIndex;
                    ResetButtons();
                    Invalidate();
                }
                break;

            case ViewButtonType.ScrollTabsRight:
                if (_firstTabIndex < _tabs.Count - 1)
                {
                    ++_firstTabIndex;
                    ResetButtons();
                    Invalidate();
                }
                break;

            case ViewButtonType.TabsMenu:
            case ViewButtonType.TabsScrollMenu:
                if (_tabs.Count != 0)
                {
                    var menu = new ContextMenuStrip();
                    foreach (var tab in _tabs)
                    {
                        menu.Items.Add(
                            new ToolStripMenuItem(tab.Text, tab.Image,
                                                  (item, args) =>
                        {
                            var view = (ViewBase)((ToolStripMenuItem)item).Tag;
                            _viewHost.Activate(view);
                        })
                        {
                            Tag = tab.View,
                        });
                    }
                    Utility.MarkDropDownForAutoDispose(menu);
                    var viewButtonSize = Renderer.ViewButtonSize;
                    menu.Show(this,
                              Width - viewButtonSize - 1,
                              viewButtonSize + 4);
                }
                break;
            }
        }
Exemple #3
0
 private void OnButtonClick(object sender, ViewButtonClickEventArgs e)
 {
     switch(e.Button)
     {
         case ViewButtonType.Close:
             View.Close();
             break;
     }
 }
Exemple #4
0
 private void OnHeaderButtonClick(object sender, ViewButtonClickEventArgs e)
 {
     switch(e.Button)
     {
         case ViewButtonType.Close:
             if(_status == ViewHostStatus.Floating)
             {
                 ((Form)TopLevelControl).Close();
             }
             else
             {
                 if(_activeView != null)
                 {
                     var view = _activeView;
                     var index = _views.IndexOf(view);
                     if(index == _views.Count - 1)
                     {
                         --index;
                     }
                     else
                     {
                         ++index;
                     }
                     if(index >= 0)
                     {
                         SetActiveView(_views[index]);
                     }
                     view.Close();
                 }
             }
             break;
         case ViewButtonType.Pin:
             Pin();
             Activate();
             break;
         case ViewButtonType.Unpin:
             Unpin();
             break;
         case ViewButtonType.Maximize:
             MaximizeFloatingForm();
             break;
         case ViewButtonType.Normalize:
             NormalizeFloatingForm();
             break;
     }
 }