public CharSheetSkillsUi() { var detailsDoc = WidgetDoc.Load("ui/char_skills.json"); Container = detailsDoc.GetRootContainer(); Container.SetMouseMsgHandler(msg => { // Forward mouse wheel messages to the scrollbar if ((msg.flags & MouseEventFlag.ScrollWheelChange) != 0) { _scrollbar.HandleMouseMessage(msg); } return(true); }); Container.Name = "char_skills_ui_main_window"; Container.Visible = false; _skillRanks = detailsDoc.GetTextContent("skill-ranks-label"); _attributeBonus = detailsDoc.GetTextContent("skill-attribute-bonus-label"); _attributeType = detailsDoc.GetTextContent("skill-attribute-type-label"); _miscBonus = detailsDoc.GetTextContent("skill-misc-bonus-label"); _total = detailsDoc.GetTextContent("skill-total-label"); HideSkillDetails(); for (var i = 0; i < 20; i++) { var button = new SkillButton(new Rectangle(1, 1 + 13 * i, 156, 13)); button.OnMouseEnter += _ => ShowSkillDetails(button); button.OnMouseExit += _ => HideSkillDetails(); button.SetMouseMsgHandler(msg => { if ((msg.flags & MouseEventFlag.ScrollWheelChange) != 0) { return(_scrollbar.HandleMouseMessage(msg)); } return(false); }); Container.Add(button); _skillButtons[i] = button; } if (VisibleSkills.Length > _skillButtons.Length) { _scrollbar = new WidgetScrollBar(new Rectangle(160, -4, 13, 267)); _scrollbar.SetMin(0); _scrollbar.Max = VisibleSkills.Length - _skillButtons.Length; Container.Add(_scrollbar); _scrollbar.SetValueChangeHandler((value) => UpdateSkillButtons()); } UpdateSkillButtons(); }