internal DockNotebookTab(DockNotebook notebook, TabStrip strip) { if (AccessibilityElementProxy.Enabled) { Accessible = AccessibilityElementProxy.ButtonElementProxy(); Accessible.PerformPress += OnPressTab; // FIXME Should Role descriptions be translated? Accessible.SetRole(AtkCocoa.Roles.AXRadioButton, "tab"); Accessible.GtkParent = strip; Accessible.PerformShowMenu += OnShowMenu; Accessible.Identifier = "DockNotebook.Tab"; CloseButtonAccessible = AccessibilityElementProxy.ButtonElementProxy(); CloseButtonAccessible.PerformPress += OnPressCloseButton; CloseButtonAccessible.SetRole(AtkCocoa.Roles.AXButton); CloseButtonAccessible.GtkParent = strip; CloseButtonAccessible.PerformShowMenu += OnCloseButtonShowMenu; CloseButtonAccessible.Title = Core.GettextCatalog.GetString("Close document"); CloseButtonAccessible.Identifier = "DockNotebook.Tab.CloseButton"; Accessible.AddAccessibleChild(CloseButtonAccessible); } this.notebook = notebook; this.strip = strip; }
void PlaceInHoverNotebook(DockNotebook notebook, DockNotebookTab tab, Rectangle allocation, int ox, int oy) { var window = (SdiWorkspaceWindow)tab.Content; var newTab = hoverNotebook.AddTab(window); window.SetDockNotebook(hoverNotebook, newTab); window.SelectWindow(); }
public DockNotebookContainer(DockNotebook tabControl, bool isMasterTab = false) { this.isMasterTab = isMasterTab; this.tabControl = tabControl; Child = tabControl; if (!isMasterTab) { tabControl.PageRemoved += HandlePageRemoved; } }
public void RemoveTab(MonoDevelop.Components.DockNotebook.DockNotebook tabControl, int pageNum, bool animate) { try { this.LockActiveWindowChangeEvent(); IDocumentWindow activeWorkbenchWindow = this.ActiveWorkbenchWindow; tabControl.RemoveTab(pageNum, animate); } finally { this.UnlockActiveWindowChangeEvent(); } }
static void PlaceInFloatingFrame(DockNotebook notebook, DockNotebookTab tab, Rectangle allocation, int ox, int oy) { var newWindow = new DockWindow(); var newNotebook = newWindow.Container.GetFirstNotebook(); var newTab = newNotebook.AddTab(); var workspaceWindow = (SdiWorkspaceWindow)tab.Content; newTab.Content = workspaceWindow; newWindow.Title = DefaultWorkbench.GetTitle(workspaceWindow); workspaceWindow.SetDockNotebook(newNotebook, newTab); newWindow.Move(ox - w / 2, oy - h / 2); newWindow.Resize(w, h); newWindow.ShowAll(); DockNotebook.ActiveNotebook = newNotebook; }
public DocumentWindow(MainWindow workbench, IViewContentExtend content, MonoDevelop.Components.DockNotebook.DockNotebook tabControl, DockNotebookTab tabLabel) { this.workbench = workbench; this.tabControl = tabControl; this.content = content; this.tab = tabLabel; this.tabPage = content.Control; content.WorkbenchWindow = (IDocumentWindow)this; this.box = new VBox(); this.box.PackStart(content.Control, true, true, 0U); this.box.Show(); this.Add((Widget)this.box); content.ContentNameChanged += new EventHandler(this.SetTitleEvent); content.DirtyChanged += new EventHandler(this.HandleDirtyChanged); content.ContentChanged += new EventHandler(this.OnContentChanged); content.BeforeSave += new EventHandler(this.OnBeforeSave); this.SetTitleEvent((object)null, (EventArgs)null); }
public void PlaceWindow(DockNotebook notebook) { try { IdeApp.Workbench.LockActiveWindowChangeEvent(); var allocation = Allocation; Destroy(); if (placementDelegate != null) { var tab = notebook.CurrentTab; notebook.RemoveTab(tab.Index, true); placementDelegate(notebook, tab, allocation, curX, curY); } else { ((SdiWorkspaceWindow)frame.Content).SelectWindow(); } } finally { IdeApp.Workbench.UnlockActiveWindowChangeEvent(); } }
/// <summary> /// Returns the previous notebook in the same window /// </summary> public DockNotebook GetPreviousNotebook(DockNotebook current) { var container = (DockNotebookContainer)current.Parent; var rootContainer = current.Container; if (container == rootContainer) { return(null); } Widget curChild = container; var paned = (Paned)container.Parent; do { if (paned.Child2 == curChild) { return(((DockNotebookContainer)paned.Child1).GetLastNotebook()); } curChild = paned; paned = paned.Parent as Paned; }while (paned != null); return(null); }
public TabStrip(DockNotebook notebook) { if (notebook == null) { throw new ArgumentNullException("notebook"); } Accessible.SetRole(AtkCocoa.Roles.AXTabGroup); // Handle focus for the tabs. CanFocus = true; TabWidth = 125; TargetWidth = 125; tracker = new MouseTracker(this); GtkWorkarounds.FixContainerLeak(this); innerBox = new HBox(false, 0); innerBox.Accessible.SetShouldIgnore(true); Add(innerBox); this.notebook = notebook; WidgetFlags |= Gtk.WidgetFlags.AppPaintable; Events |= EventMask.PointerMotionMask | EventMask.LeaveNotifyMask | EventMask.ButtonPressMask; var arr = new Xwt.ImageView(tabbarPrevImage); arr.HeightRequest = arr.WidthRequest = 10; var alignment = new Alignment(0.5f, 0.5f, 0.0f, 0.0f); alignment.Add(arr.ToGtkWidget()); PreviousButton = new Button(alignment); PreviousButton.TooltipText = Core.GettextCatalog.GetString("Switch to previous document"); PreviousButton.Relief = ReliefStyle.None; PreviousButton.CanDefault = false; PreviousButton.CanFocus = true; PreviousButton.Accessible.Name = "DockNotebook.Tabstrip.PreviousButton"; PreviousButton.Accessible.SetTitle(Core.GettextCatalog.GetString("Previous document")); PreviousButton.Accessible.Description = Core.GettextCatalog.GetString("Switch to previous document"); arr = new Xwt.ImageView(tabbarNextImage); arr.HeightRequest = arr.WidthRequest = 10; alignment = new Alignment(0.5f, 0.5f, 0.0f, 0.0f); alignment.Add(arr.ToGtkWidget()); NextButton = new Button(alignment); NextButton.TooltipText = Core.GettextCatalog.GetString("Switch to next document"); NextButton.Relief = ReliefStyle.None; NextButton.CanDefault = false; NextButton.CanFocus = true; NextButton.Accessible.Name = "DockNotebook.Tabstrip.NextButton"; NextButton.Accessible.SetTitle(Core.GettextCatalog.GetString("Next document")); NextButton.Accessible.Description = Core.GettextCatalog.GetString("Switch to next document"); DropDownButton = new MenuButton(); DropDownButton.TooltipText = Core.GettextCatalog.GetString("Document List"); DropDownButton.Relief = ReliefStyle.None; DropDownButton.CanDefault = false; DropDownButton.CanFocus = true; DropDownButton.Accessible.Name = "DockNotebook.Tabstrip.DocumentListButton"; DropDownButton.Accessible.SetTitle(Core.GettextCatalog.GetString("Document list")); DropDownButton.Accessible.Description = Core.GettextCatalog.GetString("Display the document list menu"); PreviousButton.ShowAll(); PreviousButton.NoShowAll = true; NextButton.ShowAll(); NextButton.NoShowAll = true; DropDownButton.ShowAll(); PreviousButton.Name = "MonoDevelop.DockNotebook.BarButton"; NextButton.Name = "MonoDevelop.DockNotebook.BarButton"; DropDownButton.Name = "MonoDevelop.DockNotebook.BarButton"; innerBox.PackStart(PreviousButton, false, false, 0); innerBox.PackStart(NextButton, false, false, 0); innerBox.PackEnd(DropDownButton, false, false, 0); tracker.HoveredChanged += (sender, e) => { if (!tracker.Hovered) { SetHighlightedTab(null); UpdateTabWidth(tabEndX - tabStartX); QueueDraw(); } }; foreach (var tab in notebook.Tabs) { Accessible.AddAccessibleElement(tab.Accessible); } UpdateAccessibilityTabs(); notebook.PageAdded += PageAddedHandler; notebook.PageRemoved += PageRemovedHandler; notebook.TabsReordered += PageReorderedHandler; closingTabs = new Dictionary <int, DockNotebookTab> (); }
internal DockNotebookTab(DockNotebook notebook, TabStrip strip) { this.notebook = notebook; this.strip = strip; }
public void ShowPlaceholder(int x, int y) { hoverNotebook = null; // TODO: Handle z-ordering of floating windows. int ox = 0, oy = 0; foreach (var notebook in allNotebooks) { if (notebook.GdkWindow == null) { continue; } int ox2, oy2; notebook.ParentWindow.GetOrigin(out ox2, out oy2); var alloc = notebook.Allocation; ox2 += alloc.X; ox2 += alloc.Y; if (ox2 <= x && x <= ox2 + alloc.Width && oy2 <= y && y <= oy2 + alloc.Height) { hoverNotebook = notebook; TransientFor = (Gtk.Window)hoverNotebook.Toplevel; ox = ox2; oy = oy2; break; } } if (CanPlaceInHoverNotebook()) { var container = hoverNotebook.Container; var alloc = hoverNotebook.Allocation; var targetTabCount = hoverNotebook.TabCount; var overTabStrip = y <= oy + hoverNotebook.BarHeight; if (hoverNotebook.Tabs.Contains(frame)) { targetTabCount--; // Current is going to be removed, so it doesn't count } if (targetTabCount > 0 && x <= ox + alloc.Width / 3 && !overTabStrip) { if (container.AllowLeftInsert) { Relocate( ox, oy, alloc.Width / 2, alloc.Height, false ); placementDelegate = delegate(DockNotebook arg1, DockNotebookTab tab, Rectangle allocation2, int x2, int y2) { var window = (SdiWorkspaceWindow)tab.Content; container.InsertLeft(window); window.SelectWindow(); }; return; } } if (targetTabCount > 0 && x >= ox + alloc.Width - alloc.Width / 3 && !overTabStrip) { if (container.AllowRightInsert) { Relocate( ox + alloc.Width / 2, oy, alloc.Width / 2, alloc.Height, false ); placementDelegate = delegate(DockNotebook arg1, DockNotebookTab tab, Rectangle allocation2, int x2, int y2) { var window = (SdiWorkspaceWindow)tab.Content; container.InsertRight(window); window.SelectWindow(); }; return; } } Relocate( ox, oy, alloc.Width, alloc.Height, false ); if (!hoverNotebook.Tabs.Contains(frame)) { placementDelegate = PlaceInHoverNotebook; } else { placementDelegate = null; } return; } Hide(); placementDelegate = PlaceInFloatingFrame; titleWindow.SetDectorated(true); }
private void ShowPopup(MonoDevelop.Components.DockNotebook.DockNotebook arg1, int arg2, EventButton arg3) { this.tabControl.CurrentTabIndex = arg2; CommandManager.Main.ShowContextMenu((Widget)this.tabControl, arg3, FileTabCommand.TabPopupMenu, (object)null); }
private void CreateComponents() { this.fullViewVBox = new VBox(false, 0); this.rootWidget = (Gtk.Container) this.fullViewVBox; this.Realize(); this.toolbar = MainWindowPartFactory.CreateMainToolbarWidget(); HBox hbox1 = new HBox(false, 0); this.fullViewVBox.PackStart((Widget)hbox1, false, false, 0U); this.toolbarFrame = new DockToolbarFrame(); this.fullViewVBox.PackStart((Widget)this.toolbarFrame, true, true, 0U); this.dock = new DockFrame(); this.dock.DefaultItemWidth = (int)byte.MaxValue; this.dock.CompactGuiLevel = 2; this.toolbarFrame.ModifyBg(StateType.Normal, new Gdk.Color(byte.MaxValue, (byte)0, (byte)0)); this.toolbarFrame.AddContent((Widget)this.dock); this.tabControl = new MonoDevelop.Components.DockNotebook.DockNotebook(); this.tabControl.NavigationButtonsVisible = false; this.tabControl.SwitchPage += new EventHandler(this.OnActiveWindowChanged); this.tabControl.PageRemoved += new EventHandler(this.OnActiveWindowChanged); this.tabControl.PageAdded += new EventHandler(this.OnActiveWindowChanged); this.tabControl.TabClosed += new EventHandler <TabEventArgs>(this.CloseClicked); this.tabControl.TabActivated += (EventHandler <TabEventArgs>)((sender, e) => this.ToggleFullViewMode()); this.tabControl.DoPopupMenu = new System.Action <MonoDevelop.Components.DockNotebook.DockNotebook, int, EventButton>(this.ShowPopup); this.tabControl.TabsReordered += new TabsReorderedHandler(this.OnTabsReordered); MonoDevelop.Components.DockNotebook.DockNotebook.ActiveNotebookChanged += (EventHandler)((param0, param1) => this.OnActiveWindowChanged((object)null, (EventArgs)null)); this.Add((Widget)this.fullViewVBox); this.fullViewVBox.ShowAll(); HBox hbox2 = new HBox(false, 0); this.bottomBar = MainWindowPartFactory.CreateMainStatus(); this.bottomBar.Show(); hbox2.PackStart(this.bottomBar, true, true, 0U); this.fullViewVBox.PackEnd((Widget)hbox2, false, false, 0U); hbox2.ShowAll(); hbox1.PackStart(this.toolbar, true, true, 0U); this.tabControl.InitSize(); int barHeight = this.tabControl.BarHeight; this.documentDockItem = this.dock.AddItem("Documents"); this.documentDockItem.Behavior = DockItemBehavior.Locked; this.documentDockItem.Expand = true; this.documentDockItem.DrawFrame = false; this.documentDockItem.Label = "Documents"; this.documentDockItem.Content = (Widget)this.tabControl; this.documentDockItem.ContentVisibleChanged += new EventHandler(this.DockTabControlVisibleChanged); this.dock.DefaultVisualStyle = new DockVisualStyle() { PadTitleLabelColor = new Gdk.Color?(Styles.PadLabelColor), PadBackgroundColor = new Gdk.Color?(Styles.PadBackground), InactivePadBackgroundColor = new Gdk.Color?(Styles.InactivePadBackground), PadTitleHeight = new int?(barHeight) }; DockVisualStyle style1 = new DockVisualStyle(); style1.PadTitleLabelColor = new Gdk.Color?(Styles.PadLabelColor); style1.PadTitleHeight = new int?(barHeight); style1.ShowPadTitleIcon = new bool?(false); style1.UppercaseTitles = new bool?(false); style1.ExpandedTabs = new bool?(true); style1.PadBackgroundColor = new Gdk.Color?(Styles.BrowserPadBackground); style1.InactivePadBackgroundColor = new Gdk.Color?(Styles.InactiveBrowserPadBackground); style1.TreeBackgroundColor = new Gdk.Color?(Styles.BrowserPadBackground); this.dock.SetDockItemStyle("ProjectPad", style1); this.dock.SetDockItemStyle("ClassPad", style1); this.dock.SetRegionStyle("Documents/Left", style1); this.dock.SetRegionStyle("Documents/Right", style1); DockVisualStyle style2 = new DockVisualStyle(); style2.SingleColumnMode = new bool?(true); this.dock.SetRegionStyle("Documents/Left;Documents/Right", style2); this.dock.SetDockItemStyle("Documents", style2); DockItem dockItem1 = this.dock.AddItem("__left"); dockItem1.DefaultLocation = "Documents/Left"; dockItem1.Behavior = DockItemBehavior.Locked; dockItem1.DefaultVisible = false; DockItem dockItem2 = this.dock.AddItem("__bottom"); dockItem2.DefaultLocation = "Documents/Bottom"; dockItem2.Behavior = DockItemBehavior.Locked; dockItem2.DefaultVisible = false; DockItem dockItem3 = this.dock.AddItem("__right"); dockItem3.DefaultLocation = "Documents/Right"; dockItem3.Behavior = DockItemBehavior.Locked; dockItem3.DefaultVisible = false; DockItem dockItem4 = this.dock.AddItem("__top"); dockItem4.DefaultLocation = "Documents/Top"; dockItem4.Behavior = DockItemBehavior.Locked; dockItem4.DefaultVisible = false; foreach (ExtensionNode extensionNode in AddinManager.GetExtensionNodes("/CocoStudio/Ide/Pads")) { this.ShowPadNode(extensionNode); } this.InitializeLayout("DefaultLayout"); this.LoadLayoutFromFile(MainWindow.configFile); }
public DockNotebookChangedArgs (DockNotebook notebook) { Notebook = notebook; }
public TabStrip(DockNotebook notebook) { if (notebook == null) { throw new ArgumentNullException("notebook"); } TabWidth = 125; TargetWidth = 125; tracker = new MouseTracker(this); GtkWorkarounds.FixContainerLeak(this); this.notebook = notebook; WidgetFlags |= Gtk.WidgetFlags.AppPaintable; Events |= EventMask.PointerMotionMask | EventMask.LeaveNotifyMask | EventMask.ButtonPressMask; var arr = new Xwt.ImageView(tabbarPrevImage); arr.HeightRequest = arr.WidthRequest = 10; var alignment = new Alignment(0.5f, 1, 0.0f, 0.0f); alignment.Add(arr.ToGtkWidget()); PreviousButton = new Button(alignment); PreviousButton.Relief = ReliefStyle.None; PreviousButton.CanDefault = PreviousButton.CanFocus = false; arr = new Xwt.ImageView(tabbarNextImage); arr.HeightRequest = arr.WidthRequest = 10; alignment = new Alignment(0.5f, 1, 0.0f, 0.0f); alignment.Add(arr.ToGtkWidget()); NextButton = new Button(alignment); NextButton.Relief = ReliefStyle.None; NextButton.CanDefault = NextButton.CanFocus = false; DropDownButton = new MenuButton(); DropDownButton.Relief = ReliefStyle.None; DropDownButton.CanDefault = DropDownButton.CanFocus = false; PreviousButton.ShowAll(); NextButton.ShowAll(); DropDownButton.ShowAll(); PreviousButton.Name = "MonoDevelop.DockNotebook.BarButton"; NextButton.Name = "MonoDevelop.DockNotebook.BarButton"; DropDownButton.Name = "MonoDevelop.DockNotebook.BarButton"; PreviousButton.Parent = this; NextButton.Parent = this; DropDownButton.Parent = this; children.Add(PreviousButton); children.Add(NextButton); children.Add(DropDownButton); tracker.HoveredChanged += (sender, e) => { if (!tracker.Hovered) { SetHighlightedTab(null); UpdateTabWidth(tabEndX - tabStartX); QueueDraw(); } }; notebook.PageAdded += (sender, e) => QueueResize(); notebook.PageRemoved += (sender, e) => QueueResize(); closingTabs = new Dictionary <int, DockNotebookTab> (); }
public DockNotebookChangedArgs(DockNotebook notebook) { Notebook = notebook; }
internal DockNotebookTab (DockNotebook notebook, TabStrip strip) { this.notebook = notebook; this.strip = strip; }