Skip to content
This repository has been archived by the owner on Dec 31, 2022. It is now read-only.

Commit

Permalink
Merge pull request #143 from JetSetIlly/RadioButtonInt
Browse files Browse the repository at this point in the history
added RadioButtonInt()
  • Loading branch information
dertseha authored Feb 27, 2021
2 parents 2d2d232 + 1f6cbe5 commit ebf5e2d
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Widgets.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,26 @@ func RadioButton(id string, active bool) bool {
return C.iggRadioButton(idArg, castBool(active)) != 0
}

// RadioButtonInt modifies integer v. Returns true if it is selected.
//
// The radio button will be set if v == button. Useful for groups of radio
// buttons. In the example below, "radio b" will be selected.
//
// v := 1
// imgui.RadioButtonInt("radio a", &v, 0)
// imgui.RadioButtonInt("radio b", &v, 1)
// imgui.RadioButtonInt("radio c", &v, 2)
//
func RadioButtonInt(id string, v *int, button int) bool {
idArg, idFin := wrapString(id)
defer idFin()
ok := C.iggRadioButton(idArg, castBool(button == *v)) != 0
if ok {
*v = button
}
return ok
}

// Bullet draws a small circle and keeps the cursor on the same line.
// Advance cursor x position by TreeNodeToLabelSpacing(), same distance that TreeNode() uses.
func Bullet() {
Expand Down

0 comments on commit ebf5e2d

Please sign in to comment.