19 lines
414 B
Go
19 lines
414 B
Go
|
package naive
|
||
|
|
||
|
import (
|
||
|
"github.com/progrium/darwinkit/helper/action"
|
||
|
"github.com/progrium/darwinkit/macos/appkit"
|
||
|
"github.com/progrium/darwinkit/objc"
|
||
|
)
|
||
|
|
||
|
func (bv ButtonView) toNative() appkit.IView {
|
||
|
nb := appkit.NewButtonWithTitle(bv.Content.Value())
|
||
|
if eff, ok := bv.Content.(*Effect[string]); ok {
|
||
|
eff.OnChange(nb.SetTitle)
|
||
|
}
|
||
|
action.Set(nb, func(sender objc.Object) {
|
||
|
bv.OnClick()
|
||
|
})
|
||
|
return nb
|
||
|
}
|