Exemplo n.º 1
0
		internal DockNotebookTab (DockNotebook notebook, TabStrip strip)
		{
			this.notebook = notebook;
			this.strip = strip;
		}
Exemplo n.º 2
0
 internal DockNotebookTab(DockNotebook notebook, TabStrip strip)
 {
     this.notebook = notebook;
     this.strip    = strip;
 }
Exemplo n.º 3
0
        public DockNotebook()
        {
            pagesCol = new ReadOnlyCollection <DockNotebookTab> (pages);
            AddEvents((Int32)(EventMask.AllEventsMask));

            tabStrip = new TabStrip(this);

            PackStart(tabStrip, false, false, 0);

            contentBox = new EventBox();
            PackStart(contentBox, true, true, 0);

            ShowAll();

            tabStrip.Visible = DockNotebookManager.TabStripVisible;
            DockNotebookManager.TabStripVisibleChanged += (o, e) => tabStrip.Visible = DockNotebookManager.TabStripVisible;

            contentBox.NoShowAll = true;

            tabStrip.DropDownButton.Sensitive = false;

            tabStrip.DropDownButton.MenuCreator = delegate {
                Gtk.Menu menu = new Menu();
                foreach (var tab in pages)
                {
                    var mi = new Gtk.ImageMenuItem("");
                    menu.Insert(mi, -1);
                    var label = (Gtk.AccelLabel)mi.Child;
                    if (tab.Markup != null)
                    {
                        label.Markup = tab.Markup;
                    }
                    else
                    {
                        label.Text = tab.Text;
                    }
                    var locTab = tab;
                    mi.Activated += delegate {
                        CurrentTab = locTab;
                    };
                }
                menu.ShowAll();
                return(menu);
            };

            Gtk.Drag.DestSet(this, Gtk.DestDefaults.Motion | Gtk.DestDefaults.Highlight | Gtk.DestDefaults.Drop, targetEntryTypes, Gdk.DragAction.Copy);
            DragDataReceived += new Gtk.DragDataReceivedHandler(OnDragDataReceived);

            DragMotion += delegate {
                // Bring this window to the front. Otherwise, the drop may end being done in another window that overlaps this one
                if (!Platform.IsWindows)
                {
                    var window = ((Gtk.Window)Toplevel);
                    if (window is DockWindow)
                    {
                        window.Present();
                    }
                }
            };

            allNotebooks.Add(this);
        }