Exemplo n.º 1
0
 private void ShowExistingView(ViewBase view, bool activate)
 {
     if (activate)
     {
         view.Activate();
         if (_activeView != null)
         {
         }
         if (_activeView != view)
         {
             _activeView = view;
             ActiveViewChanged?.Invoke(this, EventArgs.Empty);
         }
     }
     else
     {
         view.Host.SetActiveView(view);
     }
 }
Exemplo n.º 2
0
 private void ShowExistingView(ViewBase view, bool activate)
 {
     if (activate)
     {
         view.Activate();
         if (_activeView != null)
         {
         }
         if (_activeView != view)
         {
             _activeView = view;
             ActiveViewChanged.Raise(this);
         }
     }
     else
     {
         view.Host.SetActiveView(view);
     }
 }
Exemplo n.º 3
0
 void TabActivated(object s, EventArgs args)
 {
     ShowActiveContent();
     ActiveViewChanged?.Invoke(this, EventArgs.Empty);
 }
 void Container_ActiveViewChanged(object sender, EventArgs e)
 {
     ActiveViewChanged?.Invoke(this, EventArgs.Empty);
 }
        public void SetCurrentMode(DocumentViewContainerMode mode, GtkShellDocumentViewItem newActive)
        {
            if (this.currentMode == mode)
            {
                return;
            }

            // Save current split sizes
            if (currentContainer is GtkShellDocumentViewContainerSplit split)
            {
                splitSizes = split.GetRelativeSplitSizes();
            }

            this.currentMode = mode;

            GtkShellDocumentViewItem        activeView = null;
            List <GtkShellDocumentViewItem> allViews   = null;

            if (currentContainer != null)
            {
                activeView = currentContainer.ActiveView;
                currentContainer.ActiveViewChanged -= Container_ActiveViewChanged;
                allViews = currentContainer.GetAllViews().ToList();
                currentContainer.Widget.Hide();
                currentContainer.RemoveAllViews();
            }

            if (mode == DocumentViewContainerMode.Tabs)
            {
                if (tabsContainer == null)
                {
                    tabsContainer = new GtkShellDocumentViewContainerTabs();
                    rootTabsBox.PackStart(tabsContainer.Widget, true, true, 0);
                }
                currentContainer = tabsContainer;
            }
            else
            {
                if (splitContainer == null)
                {
                    splitContainer = new GtkShellDocumentViewContainerSplit(mode);
                    rootTabsBox.PackStart(splitContainer.Widget, true, true, 0);
                }
                currentContainer = splitContainer;
                if (hasSplit)
                {
                    tabstrip.ActiveTab = tabstrip.TabCount - 1;
                }
            }

            if (allViews != null)
            {
                currentContainer.AddViews(allViews);
            }

            // Restore current split sizes
            if (splitSizes != null && currentContainer is GtkShellDocumentViewContainerSplit newSplit)
            {
                newSplit.SetRelativeSplitSizes(splitSizes);
            }

            currentContainer.ActiveView         = newActive ?? activeView;
            currentContainer.ActiveViewChanged += Container_ActiveViewChanged;
            currentContainer.Widget.Show();

            if (newActive != activeView)
            {
                ActiveViewChanged?.Invoke(this, EventArgs.Empty);
            }

            CurrentModeChanged?.Invoke(this, EventArgs.Empty);
        }
Exemplo n.º 6
0
 private void InvokeActiveViewChanged()
 {
     ActiveViewChanged?.Invoke(this, EventArgs.Empty);
 }
Exemplo n.º 7
0
 protected virtual void OnActiveViewChanged(ActiveViewChangedEventArgs e)
 {
     ActiveViewChanged?.Invoke(this, e);
 }
Exemplo n.º 8
0
        private void Finalize(ManagementView.SwipeResultAction action)
        {
            switch (action)
            {
            case ManagementView.SwipeResultAction.ReturnToCenter: {
                if (HasLeft(CurrentData))
                {
                    if (swipedTransforms.Count > 0)
                    {
                        cache.PushObject(swipedTransforms[0].gameObject);
                    }
                }
                if (HasRight(CurrentData))
                {
                    if (swipedTransforms.Count > 0)
                    {
                        cache.PushObject(swipedTransforms[swipedTransforms.Count - 1].gameObject);
                    }
                }
                swipedTransforms.Clear();
            }
            break;

            case ManagementView.SwipeResultAction.MoveToLeft: {
                if (HasLeft(CurrentData))
                {
                    cache.PushObject(swipedTransforms[0].gameObject);
                    cache.PushObject(swipedTransforms[1].gameObject);
                    var rightData = RightData(CurrentData);
                    var rightView = ChangeCurrentRect(swipedTransforms[2]);
                    Resetup(rightData, rightView);
                    ActiveViewChanged?.Invoke(CurrentView);
                    swipedTransforms.Clear();
                }
                else
                {
                    cache.PushObject(swipedTransforms[0].gameObject);
                    var rightData = RightData(CurrentData);
                    var rightRect = ChangeCurrentRect(swipedTransforms[1]);
                    Resetup(rightData, rightRect);
                    swipedTransforms.Clear();
                }
            }
            break;

            case ManagementView.SwipeResultAction.MoveToRight: {
                if (HasRight(CurrentData))
                {
                    cache.PushObject(swipedTransforms[2].gameObject);
                    cache.PushObject(swipedTransforms[1].gameObject);
                    var leftData = LeftData(CurrentData);
                    var leftRect = ChangeCurrentRect(swipedTransforms[0]);

                    Resetup(leftData, leftRect);
                    swipedTransforms.Clear();
                }
                else
                {
                    cache.PushObject(swipedTransforms[1].gameObject);
                    var leftData = LeftData(CurrentData);
                    var leftRect = ChangeCurrentRect(swipedTransforms[0]);
                    Resetup(leftData, leftRect);
                    swipedTransforms.Clear();
                }
            }
            break;
            }
        }
Exemplo n.º 9
0
 private void OnActiveViewChanged()
 {
     ActiveViewChanged?.Invoke(this, new ViewChangeEventArgs(GetView(DockingManager.ActiveContent)));
 }