public GeneralGrid(List <string> title, int type = 0, int selectTab = 0) { if (title == null) { return; } this.contentBox = type != 0 ? (Box) new VBox() : (Box) new HBox(); for (int tag = 0; tag < title.Count; ++tag) { this.AddPropertyTab(this.contentBox, new TabLabel(title[tag]), tag, selectTab); } Table table = new Table(1U, 1U, false); table.BorderWidth = 1U; TabLabel tabLabel = new TabLabel(""); tabLabel.ModifyBg(StateType.Normal, WindowStyle.WindowColor3B); table.Attach((Widget)tabLabel, 0U, 1U, 0U, 1U, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0U, 0U); table.ShowAll(); this.contentBox.PackStart((Widget)table, true, true, 0U); ((Box.BoxChild) this.contentBox[(Widget)table]).Position = 2; this.contentBox.ShowAll(); this.Add((Widget)this.contentBox); this.ShowAll(); this.ModifyBg(StateType.Normal, WindowStyle.WindowLineColor); }
private void AddPropertyTab(Box box, TabLabel tab, int tag = 0, int selectTab = 0) { Alignment alignment = new Alignment(0.5f, 0.5f, 1f, 1f); alignment.LeftPadding = tag != 0 ? 1U : 0U; if (selectTab == tag) { alignment.BottomPadding = 0U; tab.ModifyBg(StateType.Normal, WindowStyle.WindowPanelColor); } else { alignment.BottomPadding = 1U; tab.ModifyBg(StateType.Normal, WindowStyle.WindowColor3B); } alignment.TopPadding = 1U; tab.WidthRequest = 76; tab.Tag = tag; alignment.Add((Widget)tab); alignment.ShowAll(); box.PackStart((Widget)alignment, false, false, 0U); ((Box.BoxChild)box[(Widget)tab]).Position = this.propertyTabs.Count; alignment.Show(); tab.Click += new EventHandler(this.tab_Click); }
private void TabLabel_ButtonPressEvent(object o, ButtonPressEventArgs args) { if (this.Click == null) { return; } Box parent = this.Parent.Parent as Box; if (parent != null) { foreach (Widget child1 in parent.Children) { Alignment alignment = child1 as Alignment; if (alignment != null) { TabLabel child2 = alignment.Children[0] as TabLabel; if (child2.Tag == this.Tag) { alignment.BottomPadding = 0U; child2.ModifyBg(StateType.Normal, WindowStyle.WindowPanelColor); } else { alignment.BottomPadding = 1U; child2.ModifyBg(StateType.Normal, WindowStyle.WindowColor3B); } } } } this.Click((object)this, new EventArgs()); }