Ejemplo n.º 1
0
 public static void SetToMainwindowContent(IBWorkspace setItem)
 {
     foreach (IBWorkspace ws in AllIBWorkspace)
     {
         if (ws.IsMainWindowContent)
         {
             ws.Content = setItem.Content;
         }
     }
 }
Ejemplo n.º 2
0
        public void RemoveFromParent()
        {
            Panel       parent   = Parent as Panel;
            Window      parentW  = Parent as Window;
            IBWorkspace parentWS = Parent as IBWorkspace;

            if (parent != null)
            {
                parent.Children.Remove(this);
            }

            if (parentW != null)
            {
                parentW.Content = null;
            }

            if (parentWS != null)
            {
                parentWS.Content = null;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// このIBPanelを親のIBPanelから削除します
        /// </summary>
        public void RemoveIBPanel()
        {
            IBPanel parent = Parent as IBPanel;

            if (parent == null)
            {
                return;
            }

            IBPanel p = null;

            if (parent.P1 == this)
            {
                p = parent.P2;
            }
            else
            {
                p = parent.P1;
            }

            if (parent.P1 != null)
            {
                parent.P1.RemoveFromParent();
                parent.P1 = null;
            }

            if (parent.P2 != null)
            {
                parent.P2.RemoveFromParent();
                parent.P2 = null;
            }

            parent.Children.Clear();

            IBTabControl tc = null;

            if (p.Children.Count != 0)
            {
                tc = p.Children[0] as IBTabControl;
            }

            if (tc != null)
            {
                p.Children.Remove(tc);
                parent.Children.Add(tc);

                parent.TC = tc;

                parent.ColumnDefinitions.Clear();
                parent.RowDefinitions.Clear();
            }
            else
            {
                Window      parent_parentW  = parent.Parent as Window;
                IBPanel     parent_parentP  = parent.Parent as IBPanel;
                IBWorkspace parent_parentWS = parent.Parent as IBWorkspace;

                if (parent_parentW != null)
                {
                    parent_parentW.Content = p;
                }

                if (parent_parentP != null)
                {
                    parent_parentP.Children.Add(p);

                    IBPanel panel = null;
                    foreach (object o in parent_parentP.Children)
                    {
                        panel = o as IBPanel;
                        if (panel != null)
                        {
                            if (panel.Children.Count == 0)
                            {
                                break;
                            }
                        }
                    }
                    parent_parentP.Children.Remove(panel);
                }

                if (parent_parentWS != null)
                {
                    parent_parentWS.Content = p;
                }
            }
        }
        private void Border_Drop(object sender, DragEventArgs e)
        {
            IsDropping = false;

            if (e.Data.GetData(typeof(IBTabItem)) == null)
            {
                return;
            }

            IBTabItem ti = e.Data.GetData(typeof(IBTabItem)) as IBTabItem;

            if (ti == null)
            {
                throw new IBLayoutException("ドロップされたパネルを取得できません");
            }

            if (!ti.AllowDropToAnother)
            {
                return;
            }

            IBPanel parentPanel = Parent as IBPanel;

            if (parentPanel == null)
            {
                throw new IBLayoutException("IBPanelSplitter の親が IBPanel でありません");
            }

            IBWorkspace Workspace = parentPanel.GetVisualParent() as IBWorkspace;

            if (Workspace == null)
            {
                throw new IBLayoutException("IBWorkspace を取得できません");
            }

            IBTabControl parent_ti = ti.Parent as IBTabControl;

            if (parent_ti == null)
            {
                throw new IBLayoutException("IBTabItem の親が IBTabControl でありません");
            }

            IBPanel parent_parent_ti = parent_ti.Parent as IBPanel;

            if (parent_parent_ti == null)
            {
                throw new IBLayoutException("IBTabControl の親が IBPanel でありません");
            }

            if (parentPanel == parent_parent_ti && parent_ti.Items.Count == 1)
            {
                return;
            }


            IBTabControl tc2 = new IBTabControl();
            IBPanel      p   = new IBPanel();
            IBPanel      p1  = new IBPanel();

            p1 = Workspace.Content as IBPanel;
            p1.RemoveFromParent();
            p.Children.Add(p1);

            ti.RemoveFromParent();
            tc2.Items.Add(ti);

            if (HorizontalAlignment == HorizontalAlignment.Left)
            {
                p.P2         = p1;
                p.CurrentPos = p1.CurrentPos;
                p.AddIBTabControl(tc2, Position.left);
                Workspace.Content = p;
            }
            else if (HorizontalAlignment == HorizontalAlignment.Right)
            {
                p.P1         = p1;
                p.CurrentPos = p1.CurrentPos;
                p.AddIBTabControl(tc2, Position.right);
                Workspace.Content = p;
            }
            else if (VerticalAlignment == VerticalAlignment.Top)
            {
                p.P2         = p1;
                p.CurrentPos = p1.CurrentPos;
                p.AddIBTabControl(tc2, Position.top);
                Workspace.Content = p;
            }
            else if (VerticalAlignment == VerticalAlignment.Bottom)
            {
                p.P1         = p1;
                p.CurrentPos = p1.CurrentPos;
                p.AddIBTabControl(tc2, Position.bottom);
                Workspace.Content = p;
            }

            if (parent_ti.Items.Count == 0)
            {
                parent_parent_ti.RemoveIBPanel();
            }
        }