33
44package debugui
55
6+ // Button creates a button widget with the given label.
7+ //
8+ // Button returns true if the button has been clicked, otherwise false.
9+ //
10+ // A Button control is uniquely determined by its call location.
11+ // Function calls made in different locations will create different controls.
12+ // If you want to generate different controls with the same function call in a loop (such as a for loop), use [IDScope].
613func (c * Context ) Button (label string ) bool {
714 pc := caller ()
815 var res bool
@@ -66,11 +73,20 @@ func (c *Context) SliderF(value *float64, lo, hi float64, step float64, digits i
6673 return res
6774}
6875
69- func (c * Context ) Header (label string , expanded bool , f func ()) {
76+ // Header creates a header widget with the given label.
77+ //
78+ // initialExpansion specifies whether the header is initially expanded.
79+ // f is called to render the content of the header.
80+ // The content is only rendered when the header is expanded.
81+ //
82+ // A Header control is uniquely determined by its call location.
83+ // Function calls made in different locations will create different controls.
84+ // If you want to generate different controls with the same function call in a loop (such as a for loop), use [IDScope].
85+ func (c * Context ) Header (label string , initialExpansion bool , f func ()) {
7086 pc := caller ()
7187 c .wrapError (func () error {
7288 var opt option
73- if expanded {
89+ if initialExpansion {
7490 opt |= optionExpanded
7591 }
7692 if err := c .header (label , false , opt , pc , func () error {
@@ -83,6 +99,11 @@ func (c *Context) Header(label string, expanded bool, f func()) {
8399 })
84100}
85101
102+ // TreeNode creates a tree node widget with the given label.
103+ //
104+ // A TreeNode control is uniquely determined by its call location.
105+ // Function calls made in different locations will create different controls.
106+ // If you want to generate different controls with the same function call in a loop (such as a for loop), use [IDScope].
86107func (c * Context ) TreeNode (label string , f func ()) {
87108 pc := caller ()
88109 c .wrapError (func () error {
0 commit comments