Add event for SectionWidget expand/collapse
This commit is contained in:
parent
9866aba124
commit
e0478fc8c8
1 changed files with 4 additions and 0 deletions
|
|
@ -27,6 +27,7 @@ of the authors and should not be interpreted as representing official policies,
|
|||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Agg.VertexSource;
|
||||
|
|
@ -41,6 +42,8 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
protected ExpandCheckboxButton checkbox;
|
||||
protected GuiWidget rightAlignedContent;
|
||||
|
||||
public event EventHandler<bool> ExpandedChanged;
|
||||
|
||||
private bool setContentVAnchor;
|
||||
|
||||
public SectionWidget(string sectionTitle, GuiWidget sectionContent, ThemeConfig theme, GuiWidget rightAlignedContent = null, int headingPointSize = -1, bool expandingContent = true, bool expanded = true, string serializationKey = null, bool defaultExpansion = false, bool setContentVAnchor = true)
|
||||
|
|
@ -76,6 +79,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
if (expandingContent)
|
||||
{
|
||||
ContentPanel.Visible = checkbox.Checked;
|
||||
this.ExpandedChanged?.Invoke(this, checkbox.Checked);
|
||||
}
|
||||
// TODO: Remove this Height = 10 and figure out why the layout engine is not sizing these correctly without this.
|
||||
ContentPanel.Height = 10;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue