public void AddTab(ITdiTab tab, int after = -1) { if(tab.FailInitialize) { logger.Warn ("Вкладка <{0}> не добавлена, так как сообщает что построена с ошибкой(Свойство FailInitialize) .", tab.TabName ); return; } HBox box = new HBox (); Label nameLable = new Label (tab.TabName); box.Add (nameLable); Gtk.Image closeImage = new Gtk.Image (Stock.Close, IconSize.Menu); Button closeButton = new Button (closeImage); closeButton.Relief = ReliefStyle.None; closeButton.Clicked += OnCloseButtonClicked; closeButton.ModifierStyle.Xthickness = 0; closeButton.ModifierStyle.Ythickness = 0; box.Add (closeButton); box.ShowAll (); var journalTab = tab as ITdiJournal; if (journalTab != null && ((journalTab.UseSlider == null && DefaultUseSlider) || journalTab.UseSlider.Value)) { TdiSliderTab slider = new TdiSliderTab ((ITdiJournal)tab); tab = slider; } tab.CloseTab += HandleCloseTab; tab.TabNameChanged += OnTabNameChanged; _tabs.Add (new TdiTabInfo (tab, nameLable)); var vbox = new TabVBox (tab); int inserted; if (after >= 0) inserted = this.InsertPage (vbox, box, after + 1); else inserted = this.AppendPage (vbox, box); tab.TabParent = this; vbox.Show (); this.ShowTabs = true; if(TabAdded!=null) TabAdded(this, new TabAddedEventArgs(tab)); this.CurrentPage = inserted; logger.Debug("Добавлена вкладка '{0}'", tab.TabName); }
public void AddSlaveTab(ITdiTab masterTab, ITdiTab slaveTab) { TdiTabInfo info = _tabs.Find (t => t.TdiTab == masterTab); if (info == null) throw new NullReferenceException ("Мастер вкладка не найдена в списке активных вкладок."); var journalTab = slaveTab as ITdiJournal; if (journalTab != null && ((journalTab.UseSlider == null && DefaultUseSlider) || journalTab.UseSlider.Value)) { TdiSliderTab slider = new TdiSliderTab ((ITdiJournal)slaveTab); slaveTab = slider; } info.SlaveTabs.Add (slaveTab); this.AddTab (slaveTab, masterTab); var addedTabInfo = _tabs.Find (t => t.TdiTab == slaveTab); addedTabInfo.MasterTabInfo = info; OnTabNameChanged (slaveTab, new TdiTabNameChangedEventArgs (slaveTab.TabName)); }