Exemple #1
0
        private void UpdatePreview()
        {
            this.navigatorElement.Preview.Image = null;
            if (this.previewBitmap != null)
            {
                this.previewBitmap.Dispose();
                this.previewBitmap = null;
            }

            DockWindow window  = (DockWindow)this.selectedItem.Tag;
            Control    toPrint = window;

            //check whether custom preview image is provided
            if (window.DockManager != null && this.Visible)
            {
                DockWindowSnapshotEventArgs args = new DockWindowSnapshotEventArgs(window);
                window.DockManager.OnQuickNavigatorSnapshotNeeded(args);
                if (args.SnapShot != null)
                {
                    this.navigatorElement.Preview.Image = args.SnapShot;
                    return;
                }
            }

            //check for empty size or not yet displayed panel
            //if so, try to update the pane, so that we may take a snapshot
            if (!toPrint.IsHandleCreated && this.settings.ForceSnapshot)
            {
                DockTabStrip parentStrip = window.DockTabStrip;
                if (parentStrip != null)
                {
                    bool visible   = window.Visible;
                    bool canUpdate = parentStrip.CanUpdateChildIndex;

                    //prevent SetChildIndex notifications
                    parentStrip.CanUpdateChildIndex = false;
                    window.CreateControl();
                    window.Visible = true;
                    window.Bounds  = parentStrip.TabPanelBounds;
                    window.Visible = visible;
                    parentStrip.CanUpdateChildIndex = canUpdate;
                }
            }

            //for some reason bounds are still empty, do nothing
            if (toPrint.Width <= 0 || toPrint.Height <= 0)
            {
                return;
            }

            //capture the image of the selected pane
            Size sz = this.settings.PreviewSize;

            this.previewBitmap = new Bitmap(sz.Width, sz.Height, PixelFormat.Format32bppArgb);
            toPrint.DrawToBitmap(this.previewBitmap, new Rectangle(Point.Empty, sz));

            this.navigatorElement.Preview.Image = this.previewBitmap;
        }
Exemple #2
0
        internal void UpdateActiveState(bool active)
        {
            DockTabStrip strip = this.DockTabStrip;

            if (strip != null)
            {
                strip.UpdateActiveWindow(this, active);
            }
        }
Exemple #3
0
        /// <summary>
        /// Releases previous redock state.
        /// Current implementation simply notifies the referenced <see cref="DockTabStrip">DockTabStrip</see> that it is not a redock target anymore.
        /// </summary>
        /// <param name="oldState"></param>
        protected void RemovePreviousState(RedockState oldState)
        {
            DockTabStrip oldStrip = oldState.TargetStrip;

            if (oldStrip != null)
            {
                oldStrip.IsRedockTarget = false;
            }
        }
Exemple #4
0
        internal override void CopyTo(DockTabStrip clone)
        {
            base.CopyTo(clone);

            ToolTabStrip toolClone = clone as ToolTabStrip;

            if (toolClone != null)
            {
                toolClone.autoHidePosition = this.autoHidePosition;
            }
        }
Exemple #5
0
        /// <summary>
        /// Ensures that the window is currently visible on its hosting <see cref="DockTabStrip">DockTabStrip</see>.
        /// </summary>
        public void EnsureVisible()
        {
            DockTabStrip strip = (DockTabStrip)this.TabStrip;

            if (strip == null)
            {
                return;
            }

            strip.SuspendStripNotifications(false, true);
            //strip.SelectTabItem(this.TabStripItem);
            strip.ActiveWindow = this;
            strip.ResumeStripNotifications(false, true);
            strip.UpdateTabSelection(true);
        }
Exemple #6
0
        internal void RemovePlaceHolders()
        {
            foreach (DockWindowPlaceholder holder in ControlHelper.GetChildControls <DockWindowPlaceholder>(this.dockContainer, true))
            {
                DockTabStrip parent = holder.DockTabStrip;
                Debug.Assert(parent != null, "Invalid parent for a DockWindowPlaceHolder");
                if (parent == null)
                {
                    continue;
                }

                int index = parent.TabPanels.IndexOf(holder);

                ToolWindow actualWindow = new ToolWindow(holder.DockWindowText);
                actualWindow.Name = holder.DockWindowName;

                holder.Dispose();

                parent.TabPanels.Insert(index, actualWindow);
            }
        }
Exemple #7
0
        /// <summary>
        /// Adds the menu items, related to the tabbed groups in the DocumentContainer
        /// </summary>
        /// <param name="window"></param>
        /// <param name="items"></param>
        private void AddTabbedGroupMenuItems(DockWindow window, List <RadMenuItemBase> items)
        {
            DockTabStrip strip = window.DockTabStrip;

            if (strip == null)
            {
                return;
            }

            RadDockLocalizationProvider localizationProvider = RadDockLocalizationProvider.CurrentProvider;

            if (strip.TabPanels.Count > 1)
            {
                items.Add(new RadMenuSeparatorItem());
                items.Add(this.CreateMenuItem(window, NewHTabGroup, localizationProvider.GetLocalizedString(RadDockStringId.ContextMenuNewHorizontalTabGroup)));
                items.Add(this.CreateMenuItem(window, NewVTabGroup, localizationProvider.GetLocalizedString(RadDockStringId.ContextMenuNewVerticalTabGroup)));
            }

            bool canMoveBack    = this.DockManager.GetPreviousDocumentStrip(window) != null;
            bool canMoveForward = this.DockManager.GetNextDocumentStrip(window) != null;

            if (canMoveBack || canMoveForward)
            {
                items.Add(new RadMenuSeparatorItem());
            }

            if (canMoveBack)
            {
                items.Add(this.CreateMenuItem(window, MoveToPrevTabGroup, localizationProvider.GetLocalizedString(RadDockStringId.ContextMenuMoveToPreviousTabGroup)));
            }

            if (canMoveForward)
            {
                items.Add(this.CreateMenuItem(window, MoveToNextTabGroup, localizationProvider.GetLocalizedString(RadDockStringId.ContextMenuMoveToNextTabGroup)));
            }
        }
Exemple #8
0
        private void Initialize()
        {
            DockWindow window = this.DockWindow;

            if (window == null)
            {
                return;
            }

            DockTabStrip tabStrip = (DockTabStrip)window.TabStrip;

            //no strip, state could not be saved
            if (tabStrip == null)
            {
                return;
            }

            Debug.Assert(tabStrip != null, "Not a valid tabstrip");
            tabStrip.IsRedockTarget = true;
            this.tabIndex           = tabStrip.TabPanels.IndexOf(window);

            this.sizeInfo    = new SplitPanelSizeInfo(tabStrip.SizeInfo);
            this.targetStrip = new WeakReference(tabStrip);
        }
Exemple #9
0
 internal void OnSelectedTabChanged(DockTabStrip strip)
 {
     this.UpdateCaptions(true);
 }
Exemple #10
0
 /// <summary>
 /// Copies the settings of the current strip to the target one. Currently the SizeInfo member is copied.
 /// </summary>
 /// <param name="clone"></param>
 internal virtual void CopyTo(DockTabStrip clone)
 {
     clone.SizeInfo.Copy(this.SizeInfo);
 }