示例#1
0
        public DockToolbarPanel(DockToolbarFrame parentFrame, Placement placement)
        {
            //		ResizeMode = ResizeMode.Immediate;
            Placement = placement;
            switch (placement)
            {
            case Placement.Top:
                this.orientation = Orientation.Horizontal;
                break;

            case Placement.Bottom:
                this.orientation = Orientation.Horizontal;
                break;

            case Placement.Left:
                this.orientation = Orientation.Vertical;
                break;

            case Placement.Right:
                this.orientation = Orientation.Vertical;
                break;
            }

            this.parentFrame = parentFrame;
        }
        public ArrowWindow(DockToolbarFrame frame, Direction dir) : base(Gtk.WindowType.Popup)
        {
            SkipTaskbarHint = true;
            Decorated       = false;
            TransientFor    = frame.TopWindow;

            direction = dir;
            arrow     = CreateArrow();
            if (direction == Direction.Up || direction == Direction.Down)
            {
                width  = PointerWidth;
                height = LineLength + PointerLength + 1;
            }
            else
            {
                height = PointerWidth;
                width  = LineLength + PointerLength + 1;
            }

            // Create the mask for the arrow

            Gdk.Color black, white;
            black       = new Gdk.Color(0, 0, 0);
            black.Pixel = 1;
            white       = new Gdk.Color(255, 255, 255);
            white.Pixel = 0;

            Gdk.Pixmap pm = new Pixmap(this.GdkWindow, width, height, 1);
            Gdk.GC     gc = new Gdk.GC(pm);
            gc.Background = white;
            gc.Foreground = white;
            pm.DrawRectangle(gc, true, 0, 0, width, height);

            gc.Foreground = black;
            pm.DrawPolygon(gc, false, arrow);
            pm.DrawPolygon(gc, true, arrow);

            this.ShapeCombineMask(pm, 0, 0);

            Realize();

            redgc            = new Gdk.GC(GdkWindow);
            redgc.RgbFgColor = new Gdk.Color(255, 0, 0);

            Resize(width, height);
        }
示例#3
0
		public ArrowWindow (DockToolbarFrame frame, Direction dir): base (Gtk.WindowType.Popup)
		{
			SkipTaskbarHint = true;
			Decorated = false;
			TransientFor = frame.TopWindow;

			direction = dir;
			arrow = CreateArrow ();
			if (direction == Direction.Up || direction == Direction.Down) {
				 width = PointerWidth;
				 height = LineLength + PointerLength + 1;
			} else {
				 height = PointerWidth;
				 width = LineLength + PointerLength + 1;
			}
			
			// Create the mask for the arrow
			
			Gdk.Color black, white;
			black = new Gdk.Color (0, 0, 0);
			black.Pixel = 1;
			white = new Gdk.Color (255, 255, 255);
			white.Pixel = 0;
			
			Gdk.Pixmap pm = new Pixmap (this.GdkWindow, width, height, 1);
			Gdk.GC gc = new Gdk.GC (pm);
			gc.Background = white;
			gc.Foreground = white;
			pm.DrawRectangle (gc, true, 0, 0, width, height);
			
			gc.Foreground = black;
			pm.DrawPolygon (gc, false, arrow);
			pm.DrawPolygon (gc, true, arrow);
			
			this.ShapeCombineMask (pm, 0, 0);
			
			Realize ();
			
			redgc = new Gdk.GC (GdkWindow);
	   		redgc.RgbFgColor = new Gdk.Color (255, 0, 0);
			
			Resize (width, height);
		}
		public DockToolbarPanel (DockToolbarFrame parentFrame, Placement placement)
		{
	//		ResizeMode = ResizeMode.Immediate;
			Placement = placement;
			switch (placement) {
				case Placement.Top:
					this.orientation = Orientation.Horizontal;
					break;
				case Placement.Bottom:
					this.orientation = Orientation.Horizontal;
					break;
				case Placement.Left:
					this.orientation = Orientation.Vertical;
					break;
				case Placement.Right:
					this.orientation = Orientation.Vertical;
					break;
			}
			
			this.parentFrame = parentFrame;
		}
        void CreateComponents()
        {
            fullViewVBox = new VBox (false, 0);
            rootWidget = fullViewVBox;

            InstallMenuBar ();
            Realize ();
            toolbar = DesktopService.CreateMainToolbar (this);
            DesktopService.SetMainWindowDecorations (this);
            var toolbarBox = new HBox ();
            fullViewVBox.PackStart (toolbarBox, false, false, 0);
            toolbarFrame = new CommandFrame (IdeApp.CommandService);

            fullViewVBox.PackStart (toolbarFrame, true, true, 0);

            // Create the docking widget and add it to the window.
            dock = new DockFrame ();

            dock.CompactGuiLevel = ((int)IdeApp.Preferences.WorkbenchCompactness) + 1;
            IdeApp.Preferences.WorkbenchCompactnessChanged += delegate {
                dock.CompactGuiLevel = ((int)IdeApp.Preferences.WorkbenchCompactness) + 1;
            };

            /* Side bar is experimental. Disabled for now
            HBox hbox = new HBox ();
            VBox sideBox = new VBox ();
            sideBox.PackStart (new SideBar (workbench, Orientation.Vertical), false, false, 0);
            hbox.PackStart (sideBox, false, false, 0);
            hbox.ShowAll ();
            sideBox.NoShowAll = true;
            hbox.PackStart (dock, true, true, 0);
            DockBar bar = dock.ExtractDockBar (PositionType.Left);
            bar.AlwaysVisible = true;
            sideBox.PackStart (bar, true, true, 0);
            toolbarFrame.AddContent (hbox);
            */

            toolbarFrame.AddContent (dock);

            // Create the notebook for the various documents.
            tabControl = new SdiDragNotebook (this);

            DockNotebook.ActiveNotebookChanged += delegate {
                OnActiveWindowChanged (null, null);
            };

            Add (fullViewVBox);
            fullViewVBox.ShowAll ();
            bottomBar = new MonoDevelopStatusBar ();
            fullViewVBox.PackEnd (bottomBar, false, true, 0);
            bottomBar.ShowAll ();
            toolbarBox.PackStart (this.toolbar, true, true, 0);

            // In order to get the correct bar height we need to calculate the tab size using the
            // correct style (the style of the window). At this point the widget is not yet a child
            // of the window, so its style is not yet the correct one.
            tabControl.InitSize ();
            var barHeight = tabControl.BarHeight;

            // The main document area
            documentDockItem = dock.AddItem ("Documents");
            documentDockItem.Behavior = DockItemBehavior.Locked;
            documentDockItem.Expand = true;
            documentDockItem.DrawFrame = false;
            documentDockItem.Label = GettextCatalog.GetString ("Documents");
            documentDockItem.Content = new DockNotebookContainer (tabControl, true);

            DockVisualStyle style = new DockVisualStyle ();
            style.PadTitleLabelColor = Styles.PadLabelColor;
            style.PadBackgroundColor = Styles.PadBackground;
            style.InactivePadBackgroundColor = Styles.InactivePadBackground;
            style.PadTitleHeight = barHeight;
            dock.DefaultVisualStyle = style;

            style = new DockVisualStyle ();
            style.PadTitleLabelColor = Styles.PadLabelColor;
            style.PadTitleHeight = barHeight;
            style.ShowPadTitleIcon = false;
            style.UppercaseTitles = false;
            style.ExpandedTabs = true;
            style.PadBackgroundColor = Styles.BrowserPadBackground;
            style.InactivePadBackgroundColor = Styles.InactiveBrowserPadBackground;
            style.TreeBackgroundColor = Styles.BrowserPadBackground;
            dock.SetDockItemStyle ("ProjectPad", style);
            dock.SetDockItemStyle ("ClassPad", style);

            //			dock.SetRegionStyle ("Documents/Left", style);
            //dock.SetRegionStyle ("Documents/Right", style);

            //			style = new DockVisualStyle ();
            //			style.SingleColumnMode = true;
            //			dock.SetRegionStyle ("Documents/Left;Documents/Right", style);
            //			dock.SetDockItemStyle ("Documents", style);

            // Add some hiden items to be used as position reference
            DockItem dit = dock.AddItem ("__left");
            dit.DefaultLocation = "Documents/Left";
            dit.Behavior = DockItemBehavior.Locked;
            dit.DefaultVisible = false;

            dit = dock.AddItem ("__right");
            dit.DefaultLocation = "Documents/Right";
            dit.Behavior = DockItemBehavior.Locked;
            dit.DefaultVisible = false;

            dit = dock.AddItem ("__top");
            dit.DefaultLocation = "Documents/Top";
            dit.Behavior = DockItemBehavior.Locked;
            dit.DefaultVisible = false;

            dit = dock.AddItem ("__bottom");
            dit.DefaultLocation = "Documents/Bottom";
            dit.Behavior = DockItemBehavior.Locked;
            dit.DefaultVisible = false;

            if (MonoDevelop.Core.Platform.IsMac)
                bottomBar.HasResizeGrip = true;
            else {
                if (GdkWindow != null && GdkWindow.State == Gdk.WindowState.Maximized)
                    bottomBar.HasResizeGrip = false;
                SizeAllocated += delegate {
                    if (GdkWindow != null)
                        bottomBar.HasResizeGrip = GdkWindow.State != Gdk.WindowState.Maximized;
                };
            }

            // create DockItems for all the pads
            ExtensionNodeList padCodons = AddinManager.GetExtensionNodes (viewContentPath);
            foreach (ExtensionNode node in padCodons)
                ShowPadNode (node);

            try {
                if (System.IO.File.Exists (configFile)) {
                    dock.LoadLayouts (configFile);
                    foreach (string layout in dock.Layouts) {
                        if (!layouts.Contains (layout) && !layout.EndsWith (fullViewModeTag))
                            layouts.Add (layout);
                    }
                }
            } catch (Exception ex) {
                LoggingService.LogError (ex.ToString ());
            }
        }
 internal virtual void RestorePosition(DockToolbarFrame frame, DockToolbar bar)
 {
 }
		void CreateComponents ()
		{
			fullViewVBox = new VBox (false, 0);
			rootWidget = fullViewVBox;
			
			InstallMenuBar ();
			
			toolbarFrame = new CommandFrame (IdeApp.CommandService);
			fullViewVBox.PackStart (toolbarFrame, true, true, 0);
			
			foreach (DockToolbar t in toolbars)
				toolbarFrame.AddBar (t);
			
			// Create the docking widget and add it to the window.
			dock = new DockFrame ();
			
			dock.CompactGuiLevel = ((int)IdeApp.Preferences.WorkbenchCompactness) + 1;
			IdeApp.Preferences.WorkbenchCompactnessChanged += delegate {
				dock.CompactGuiLevel = ((int)IdeApp.Preferences.WorkbenchCompactness) + 1;
			};
			
			/* Side bar is experimental. Disabled for now
			HBox hbox = new HBox ();
			VBox sideBox = new VBox ();
			sideBox.PackStart (new SideBar (workbench, Orientation.Vertical), false, false, 0);
			hbox.PackStart (sideBox, false, false, 0);
			hbox.ShowAll ();
			sideBox.NoShowAll = true;
			hbox.PackStart (dock, true, true, 0);
			DockBar bar = dock.ExtractDockBar (PositionType.Left);
			bar.AlwaysVisible = true;
			sideBox.PackStart (bar, true, true, 0);
			toolbarFrame.AddContent (hbox);
			*/

			toolbarFrame.AddContent (dock);
			
			// Create the notebook for the various documents.
			tabControl = new SdiDragNotebook (dock.ShadedContainer);
			tabControl.Scrollable = true;
			tabControl.SwitchPage += OnActiveWindowChanged;
			tabControl.PageAdded += delegate { OnActiveWindowChanged (null, null); };
			tabControl.PageRemoved += delegate { OnActiveWindowChanged (null, null); };
		
			tabControl.ButtonPressEvent += delegate(object sender, ButtonPressEventArgs e) {
				int tab = tabControl.FindTabAtPosition (e.Event.XRoot, e.Event.YRoot);
				if (tab < 0)
					return;
				tabControl.CurrentPage = tab;
				if (e.Event.Type == Gdk.EventType.TwoButtonPress)
					ToggleFullViewMode ();
			};
			
			this.tabControl.PopupMenu += delegate {
				ShowPopup ();
			};
			this.tabControl.ButtonReleaseEvent += delegate (object sender, Gtk.ButtonReleaseEventArgs e) {
				int tab = tabControl.FindTabAtPosition (e.Event.XRoot, e.Event.YRoot);
				if (tab < 0)
					return;
				if (e.Event.Button == 3)
					ShowPopup ();
			};
			
			tabControl.TabsReordered += new TabsReorderedHandler (OnTabsReordered);

			// The main document area
			documentDockItem = dock.AddItem ("Documents");
			documentDockItem.Behavior = DockItemBehavior.Locked;
			documentDockItem.Expand = true;
			documentDockItem.DrawFrame = false;
			documentDockItem.Label = GettextCatalog.GetString ("Documents");
			documentDockItem.Content = tabControl;
			
			// Add some hiden items to be used as position reference
			DockItem dit = dock.AddItem ("__left");
			dit.DefaultLocation = "Documents/Left";
			dit.Behavior = DockItemBehavior.Locked;
			dit.DefaultVisible = false;
			
			dit = dock.AddItem ("__right");
			dit.DefaultLocation = "Documents/Right";
			dit.Behavior = DockItemBehavior.Locked;
			dit.DefaultVisible = false;
			
			dit = dock.AddItem ("__top");
			dit.DefaultLocation = "Documents/Top";
			dit.Behavior = DockItemBehavior.Locked;
			dit.DefaultVisible = false;
			
			dit = dock.AddItem ("__bottom");
			dit.DefaultLocation = "Documents/Bottom";
			dit.Behavior = DockItemBehavior.Locked;
			dit.DefaultVisible = false;

			Add (fullViewVBox);
			fullViewVBox.ShowAll ();
			
			fullViewVBox.PackEnd (this.StatusBar, false, true, 0);
			
			if (MonoDevelop.Core.PropertyService.IsMac)
				this.StatusBar.HasResizeGrip = true;
			else {
				if (GdkWindow != null && GdkWindow.State == Gdk.WindowState.Maximized)
					IdeApp.Workbench.StatusBar.HasResizeGrip = false;
				SizeAllocated += delegate {
					if (GdkWindow != null)
						IdeApp.Workbench.StatusBar.HasResizeGrip = GdkWindow.State != Gdk.WindowState.Maximized;
				};
			}

			// create DockItems for all the pads
			foreach (PadCodon content in padContentCollection)
				AddPad (content, content.DefaultPlacement, content.DefaultStatus);
			
			try {
				if (System.IO.File.Exists (configFile)) {
					dock.LoadLayouts (configFile);
					foreach (string layout in dock.Layouts) {
						if (!layouts.Contains (layout) && !layout.EndsWith (fullViewModeTag))
							layouts.Add (layout);
					}
				}
			} catch (Exception ex) {
				LoggingService.LogError (ex.ToString ());
			}
		}
 internal void SetParentFrame(DockToolbarFrame frame)
 {
     parentFrame = frame;
     grip.Show();
 }
示例#9
0
		internal void SetParentFrame (DockToolbarFrame frame)
		{
			parentFrame = frame;
			grip.Show ();
		}
示例#10
0
		public FloatingDock (DockToolbarFrame frame): base (Gtk.WindowType.Toplevel)
		{
			SkipTaskbarHint = true;
			Decorated = false;
			TransientFor = frame.TopWindow;
		}
 public FloatingDock(DockToolbarFrame frame) : base(Gtk.WindowType.Toplevel)
 {
     SkipTaskbarHint = true;
     Decorated       = false;
     TransientFor    = frame.TopWindow;
 }
示例#12
0
		internal override void RestorePosition (DockToolbarFrame frame, DockToolbar bar)
		{
			frame.FloatBar (bar, orientation, x, y);
		}
 internal override void RestorePosition(DockToolbarFrame frame, DockToolbar bar)
 {
     frame.FloatBar(bar, orientation, x, y);
 }
示例#14
0
 internal override void RestorePosition(DockToolbarFrame frame, DockToolbar bar)
 {
     frame.DockToolbar(bar, placement, dockOffset, dockRow);
 }
示例#15
0
		internal virtual void RestorePosition (DockToolbarFrame frame, DockToolbar bar) {}
示例#16
0
		internal override void RestorePosition (DockToolbarFrame frame, DockToolbar bar)
		{
			frame.DockToolbar (bar, placement, dockOffset, dockRow);
		}