Exemplo n.º 1
0
        /**
         * @brief Tries to add a sulphur.editor.controls.TabWindow content to this control.
         * @param[in] window (TabWindow) Window whose content has to be copied over to this control.
         * @return True if window was added, false otherwise.
         * @see sulphur.editor.controls.TabWindow.
         * @remark If succesfull the window added will be closed.
         */
        public bool AddWindow(TabWindow window)
        {
            Point top_left = tab_panel_.TranslatePoint(new Point(0, 0), this);

            top_left = this.PointToScreen(top_left);
            Point bottom_right = new Point(top_left.X + tab_panel_.ActualWidth, top_left.Y + tab_panel_.ActualHeight);

            Point mouse = native.Win32.GetMousePosition();

            bool result = mouse.X > top_left.X && mouse.X <bottom_right.X && mouse.Y> top_left.Y && mouse.Y < bottom_right.Y;

            if (result == false)
            {
                return(result);
            }

            List <object> collection = window.GetTabs();

            window.UnparentTabs();
            foreach (object item in collection)
            {
                Items.Add(item);
                SelectedItem = item;
            }
            window.Close();
            return(true);
        }
Exemplo n.º 2
0
        /**
         * @brief Tries to dock a tabwindow to the control that is adorned by this adorner.
         * @param[in] window (sulphur.editor.controls.TabWindow) window to be docked.
         * @return (bool) True if window was docked, false otherwise.
         */
        public bool DockWindow(TabWindow window)
        {
            Point top_left = children[0].TranslatePoint(new Point(0, 0), this);

            top_left = PointToScreen(top_left);
            Point bottom_right = new Point(top_left.X + children[0].RenderSize.Width, top_left.Y + children[0].RenderSize.Height);

            Point mouse = native.Win32.GetMousePosition();

            bool result = mouse.X > top_left.X && mouse.X <bottom_right.X && mouse.Y> top_left.Y && mouse.Y < bottom_right.Y;

            if (result == false)
            {
                return(result);
            }

            List <object> collection = window.GetTabs();

            (window.Content as DynamicDockTabControl).Items.Clear();
            foreach (object item in collection)
            {
                (AdornedElement as DynamicDockTabControl).Items.Add(item);
                (AdornedElement as DynamicDockTabControl).SelectedItem = item;
            }
            window.Close();

            return(result);
        }
Exemplo n.º 3
0
        /**
         * @brief Called when the conditions for a drag are met.
         * This removes the currently selected tab from the control and puts it into a seperate window.
         * @param[in] item (DynamicDockTab) Item to be removed.
         * @see sulphur.editor.controls.TabWindow.
         */
        private void StartDrag(DynamicDockTab item)
        {
            if (Items.Count == 1 && allow_empty_ == false)
            {
                return;
            }

            Items.Remove(item);
            if (Items.Count != 0)
            {
                SelectedIndex = Items.Count - 1;
            }
            TabWindow window = new TabWindow(item);

            SubscriptionHandler.Register(window);
            window.Show();
            window.Focus();
            window.DragMove();
        }