Example #1
0
GLUI_RadioGroup::GLUI_RadioGroup(GLUI_Node *parent,
                                 const char* name,
                                 int *value_ptr,
                                 int id, GLUI_CB cb ):
    GLUI_Container(name)

{
  common_init();
  std::string      buf;

  set_ptr_val( value_ptr );
  if ( value_ptr ) {
    int_val = *value_ptr;  /** Can't call set_int_val(), b/c that
                               function will try to call the
                               callback, etc */
    /** Actually, maybe not **/
    last_live_int = *value_ptr;
  }

  user_id    = id;
  glui_format_str( buf, "RadioGroup: %p", this );
  title = new GLUI_StaticText(this,"title");
  title->set_text(name);
  callback   = cb;

  parent->add_control( this );

  init_live();
}
Example #2
0
GLUI_RadioGroup::GLUI_RadioGroup(GLUI_Node *parent,
                                 int *value_ptr,
                                 int id, GLUI_CB cb)
{
  common_init();
  GLUI_String      buf;

  set_ptr_val( value_ptr );
  if ( value_ptr ) {
    int_val = *value_ptr;  /** Can't call set_int_val(), b/c that 
                               function will try to call the 
                               callback, etc */
    /** Actually, maybe not **/
    last_live_int = *value_ptr;
  }

  user_id    = id;
  glui_format_str( buf, "RadioGroup: %p", this );
  set_name( buf.c_str() );
  callback   = cb;

  parent->add_control( this );

  init_live();
}
Example #3
0
void GLUI_Rotation::common_init( void ) 
{
  glui_format_str( name, "Rotation: %p", this );
//  type                = GLUI_CONTROL_ROTATION;
  w                   = GLUI_ROTATION_WIDTH;
  h                   = GLUI_ROTATION_HEIGHT;
  can_activate        = true;
  live_type           = GLUI_LIVE_FLOAT_ARRAY;
  float_array_size    = 16;
  quadObj             = NULL;
  alignment           = GLUI_ALIGN_CENTER;
  can_spin            = false;
  spinning            = false;
  damping             = 0.0;
  ball                = new Arcball;

  reset();
}
Example #4
0
void GLUI_TreePanel::formatNode(GLUI_Tree *temp) 
{
  if (temp == NULL)
    return;
  int level = temp->get_level();
  int child_number = temp->get_child_number();
  GLUI_String level_name="";
  GLUI_String full_name="";

  //  temp->level_name == "";

  if (format & GLUI_TREEPANEL_DISPLAY_HIERARCHY) {
    if (format & GLUI_TREEPANEL_HIERARCHY_LEVEL_ONLY) {
      glui_format_str(level_name, "%d", level);
    }
    if (format & GLUI_TREEPANEL_HIERARCHY_NUMERICDOT) {
      if ( dynamic_cast<GLUI_Tree*>(temp->parent()) )
        glui_format_str(level_name, "%s.%d", 
                        ((GLUI_Tree *)(temp->parent()))->level_name.c_str(), 
                        child_number);
      else
        glui_format_str(level_name, "%d", child_number);
    }
  }

  temp->set_level_color(lred, lgreen, lblue);
  temp->set_format(format);
  temp->level_name = level_name;

  if (format & GLUI_TREEPANEL_ALTERNATE_COLOR) {
    switch (level%8) {
    case (7): temp->set_color(.5,.5,.5); break;
    case (6): temp->set_color(.3,.5,.5); break;
    case (5): temp->set_color(.5,.3,.5); break;
    case (4): temp->set_color(.3,.3,.5); break;
    case (3): temp->set_color(.5,.5,.3); break;
    case (2): temp->set_color(.3,.5,.3); break;
    case (1): temp->set_color(.5,.3,.3); break;
    default: temp->set_color(.3,.3,.3);
    }
  } else {
    temp->set_color(red,green,blue);
  }

  if (format & GLUI_TREEPANEL_DISABLE_BAR) {
    temp->disable_bar();
  } else {
    if (format & GLUI_TREEPANEL_DISABLE_DEEPEST_BAR) {
      temp->disable_bar();
      if ( dynamic_cast<GLUI_Tree*>(curr_root) )
        ((GLUI_Tree *)curr_root)->enable_bar();
    } else
      if (format & GLUI_TREEPANEL_CONNECT_CHILDREN_ONLY) {
        temp->disable_bar();
        if (temp->prev() && dynamic_cast<GLUI_Tree*>(temp->prev()) ) 
        {
          ((GLUI_Tree *)temp->prev())->enable_bar();
        }
      }
  }
}