void GLUI_RadioGroup::draw_group( int translate ) { GLUI_DRAWINGSENTINAL_IDIOM GLUI_RadioButton *button; this->int_val = int_val; glMatrixMode(GL_MODELVIEW ); button = (GLUI_RadioButton*) first_child(); while( button != NULL ) { glPushMatrix(); if (translate) { button->translate_to_origin(); } else { glTranslatef(button->x_abs-x_abs, button->y_abs-y_abs,0.0); } if ( button->int_val ) button->draw_checked(); else button->draw_unchecked(); glPopMatrix(); button = (GLUI_RadioButton*) button->next(); } }
void GLUI_RadioGroup::draw() { if ( NOT can_draw() ) return; GLUI_DRAWINGSENTINAL_IDIOM GLUI_RadioButton *button; this->int_val = int_val; glMatrixMode(GL_MODELVIEW ); button = (GLUI_RadioButton*) first_child(); while( button != NULL ) { if ( button->int_val ) button->draw_checked(); else button->draw_unchecked(); button = (GLUI_RadioButton*) button->next(); } }
void GLUI_RadioGroup::draw_group( int translate ) { GLUI_RadioButton *button; int state, orig; if ( NOT can_draw() ) return; orig = set_to_glut_window(); if ( translate ) state = glui->set_front_draw_buffer(); this->int_val = int_val; glMatrixMode(GL_MODELVIEW ); button = (GLUI_RadioButton*) first_child(); while( button != NULL ) { if ( translate ) { glPushMatrix(); button->translate_to_origin(); } if ( button->int_val ) button->draw_checked(); else button->draw_unchecked(); if ( translate ) glPopMatrix(); button = (GLUI_RadioButton*) button->next(); } if ( translate ) glui->restore_draw_buffer(state); restore_window(orig); }
void GLUI_RadioGroup::set_selected( int int_val ) { GLUI_RadioButton *button; this->int_val = int_val; button = (GLUI_RadioButton*) first_child(); while( button != NULL ) { if ( int_val == -1 ) { /*** All buttons in group are deselected ***/ button->set_int_val(0); } else if ( int_val == button->user_id ) { /*** This is selected button ***/ button->set_int_val(1); } else { /*** This is NOT selected button ***/ button->set_int_val(0); } button = (GLUI_RadioButton*) button->next(); } glutPostRedisplay(); }