void HandleBtnDockClicked(object sender, EventArgs e) { Gtk.Widget w; if (CurrentContainer.FrameNotebook.Visible == true) { w = CurrentContainer.removePage(this); //remove Page //Console.WriteLine(w.GetType().ToString()); } else { w = PanedBox.removeItem(this); //remove Item //Console.WriteLine(w.GetType().ToString()); } DockItemContainer container = (w as DockItemContainer); MainWindow.Instance.removeWidget(container.CurrentWidget as DockableWidget); DockItemContainer dc = w as DockItemContainer; Widget cw = dc.CurrentWidget; dc.removeCurrentWidget(); cw.Parent = null; MainWindow.Instance.showAsPopupWindow(cw as DockableWidget); w.Destroy(); }
/// <summary> /// Hides the notebook and switches to paned mode /// </summary> /// <param name='newalign'> /// Newalign. /// </param> public void hideNotebook(ItemAlignment newalign) { List <Widget> widgets = new List <Widget>(20); for (int i = (notebook.NPages - 1); i > -1; i--) { Widget w = notebook.GetNthPage(i); notebook.RemovePage(i); w.Parent = null; widgets.Add(w); } notebook.Visible = false; PanedBox.removeItem(notebook); foreach (Widget w in widgets) { DockItemContainer dc = w as DockItemContainer; if (dc != null) { dc.CurrentContainer = null; addItem(dc, newalign); } } Mode = ViewMode.PanedBox; }
void HandleBtnCloseClicked(object sender, EventArgs e) { Gtk.Widget w; if (CurrentContainer.FrameNotebook.Visible == true) { w = CurrentContainer.removePage(this); //remove Page //Console.WriteLine(w.GetType().ToString()); } else { w = PanedBox.removeItem(this); //remove Item //Console.WriteLine(w.GetType().ToString()); } DockItemContainer container = (w as DockItemContainer); MainWindow.Instance.removeWidget(container.CurrentWidget as DockableWidget); w.Destroy(); }
void HeaderButtonRelease(object ob, Gtk.ButtonReleaseEventArgs args) { //Console.WriteLine("HeaderButtonRelease"); if (args.Event.Button == 1) { Frame.HidePlaceholder(); if (header.Window != null) { header.Window.Cursor = handCursor; } if (Frame.TargetContainer != null) { //check if we are in notebook mode // if ((CurrentContainer != null) && (CurrentContainer.FrameNotebook.Visible == true)) // { // //notebok mode // if ((frame.TargetContainer == CurrentContainer) && (frame.TargetAlign != ItemAlignment.Center)) // { // //switch to paned mode // CurrentContainer.hideNotebook(frame.TargetAlign); // } else // { // CurrentContainer.removePage(this); // } // // // // } else // { // //panedbox mode // // PanedBox.removeItem(this); // // // } //check if we have to remove something if ((CurrentContainer != null) && (Frame.TargetContainer != CurrentContainer)) { if (CurrentContainer.FrameNotebook.Visible == true) { CurrentContainer.removePage(this); //remove Page } else { PanedBox.removeItem(this); //remove Item } } //Console.WriteLine("alg:" + frame.TargetAlign); //add the new item if (Frame.TargetContainer.FrameNotebook.Visible == true) { this.Reparent(null); this.Parent = null; //Console.WriteLine("add1 " + this.Name + " to " + Frame.TargetContainer.Name); frame.TargetContainer.addPage(this, Frame.TargetAlign); this.Visible = true; } else { this.Reparent(null); //Console.WriteLine("add2 " + this.Name + " to " + Frame.TargetContainer.Name); Frame.TargetContainer.addItem(this, Frame.TargetAlign); this.Visible = true; } } } }
/// <summary> /// switch to notebook mode /// </summary> /// <exception cref='Exception'> /// Represents errors that occur during application execution. /// </exception> protected void addPages() { if (notebook.Visible) { throw new Exception("this should not happen"); //TODO } else { //Console.WriteLine("addPages()"); List <PanedBox> lst = ChildBoxes; int pos = 0; notebook.Visible = false; foreach (PanedBox pb in lst) { Widget w = PanedBox.removeItem(pb.Widget1); if (w != null) { String title = w.Name; DockItemContainer dc = w as DockItemContainer; if (dc != null) { if (dc.CurrentWidget != null) { if (dc.CurrentWidget is DockableWidget) { if (!String.IsNullOrEmpty(((DockableWidget)dc.CurrentWidget).Title)) { title = ((DockableWidget)dc.CurrentWidget).Title; } } } } Gtk.Label lbl2 = new Gtk.Label(title); //w.Parent = null; //w.Reparent(notebook); Gtk.Container c = (w.Parent as Gtk.Container); if (c != null) { c.Remove(w); } //Console.WriteLine("insert page: " + w.Name + " visible: " + w.Visible); //Console.WriteLine("notebook: " + notebook.Visible); notebook.InsertPage(w, lbl2, pos); pos++; } else { throw new Exception("item " + w.Name + "is to in the panedbox"); } } Widget first = removeItem(Widget1); String tt2 = first.Name; if (first is DockItemContainer) { DockItemContainer dc = first as DockItemContainer; if (!String.IsNullOrEmpty(((DockableWidget)dc.CurrentWidget).Title)) { tt2 = ((DockableWidget)dc.CurrentWidget).Title; } } Gtk.Label lbl = new Gtk.Label(tt2); notebook.Visible = true; //Console.WriteLine("insert page: " + first.Name + " visible: " + first.Visible); //Console.WriteLine("notebook: " + notebook.Visible); notebook.InsertPage(first, lbl, pos); AddItem(notebook); notebook.Page = 0; Mode = ViewMode.Notebook; } }