/// <summary> /// The panel content. /// </summary> public void AddContent(string title, Content content) { ContentButton button = new ContentButton (title, content); box.PackStart (button, false, false, 0); box.PackStart (new VSeparator (), false, false, 2); if (first_button) { button.Active = true; first_button = false; } button.Toggled += button_toggled; }
//a button was toggled private void button_toggled(object o, EventArgs args) { ContentButton active_button = (ContentButton)o; if (selected_button == active_button && active_button.Active == false) active_button.Active = true; if (active_button.Active == false || active_button == selected_button) return; selected_button = active_button; foreach (Widget widget in box.Children) { if (widget is ContentButton) { ContentButton button = (ContentButton)widget; if (button != active_button) button.Active = false; } } if (ButtonToggled != null) ButtonToggled (active_button.PanelContent); }