| 250 int64_t ui_radiobuttons_get(UiInteger *i) { |
250 int64_t ui_radiobuttons_get(UiInteger *i) { |
| 251 NSMutableArray *buttons = (__bridge NSMutableArray*)i->obj; |
251 NSMutableArray *buttons = (__bridge NSMutableArray*)i->obj; |
| 252 int64_t index = 0; |
252 int64_t index = 0; |
| 253 for(UiRadioButton *b in buttons) { |
253 for(UiRadioButton *b in buttons) { |
| 254 if([b cell].state != 0) { |
254 if([b cell].state != 0) { |
| 255 i->value = index; |
255 i->value = index + 1; |
| 256 break; |
256 break; |
| 257 } |
257 } |
| 258 index++; |
258 index++; |
| 259 } |
259 } |
| 260 return index; |
260 return i->value; |
| 261 } |
261 } |
| 262 |
262 |
| 263 void ui_radiobuttons_set(UiInteger *i, int64_t value) { |
263 void ui_radiobuttons_set(UiInteger *i, int64_t value) { |
| 264 NSMutableArray *buttons = (__bridge NSMutableArray*)i->obj; |
264 NSMutableArray *buttons = (__bridge NSMutableArray*)i->obj; |
| 265 int64_t index = 0; |
265 int64_t index = 1; |
| 266 for(UiRadioButton *b in buttons) { |
266 for(UiRadioButton *b in buttons) { |
| 267 if(index == value) { |
267 if(index == value) { |
| 268 [b cell].state = NSControlStateValueOn; |
268 [b cell].state = NSControlStateValueOn; |
| 269 } else { |
269 } else { |
| 270 [b cell].state = NSControlStateValueOff; |
270 [b cell].state = NSControlStateValueOff; |