Exemple #1
0
void GLUI_EditText::common_construct( GLUI_Node *parent, const char *name, 
                                      int data_t, int live_t, void *data, int id, 
                                      GLUI_CB cb )
{
  common_init();
  set_name( name );
    
  live_type   = live_t;
  data_type   = data_t;
  ptr_val     = data;
  user_id     = id;
  callback    = cb;
    

  if ( live_type == GLUI_LIVE_INT) {
    if ( data == NULL )
      set_int_val(int_val);   /** Set to some default, in case of no live var **/
  }
  else if ( live_type == GLUI_LIVE_FLOAT ) {
    num_periods = 1;
    if ( data == NULL )
      set_float_val(float_val);   /** Set to some default, in case of no live var **/
  }
  else if ( live_type == GLUI_LIVE_DOUBLE ) {
    num_periods = 1;
    if ( data == NULL )
      set_double_val(double_val);   /** Set to some default, in case of no live var **/
  }


  parent->add_control( this );

  init_live();
}
Exemple #2
0
GLUI_Rotation::GLUI_Rotation( GLUI_Node *parent,
                              const char *name, float *value_ptr,
                              int id, 
                              GLUI_CB cb )
{
  common_init();
  set_ptr_val( value_ptr );
  user_id    = id;
  set_name( name );
  callback    = cb;
  parent->add_control( this );
  init_live();
  
  /*** Init the live 4x4 matrix.  This is different than the standard
       live variable behavior, since the original value of the 4x4 matrix
       is ignored and reset to Identity  ***/
/*
NO! WVB
    if ( value_ptr != NULL ) {
      int i, j, index;
      for( i=0; i<4; i++ ) {
	for( j=0; j<4; j++ ) {
	  index = i*4+j;
	  if ( i==j )
	    value_ptr[index] = 1.0;
	  else
	    value_ptr[index] = 0.0;
	}
      }
    }
*/
    /*init_ball();              */
		

}
GLUI_Translation::GLUI_Translation(
  GLUI_Node *parent, const char *name,
  int trans_t, float *value_ptr,
  int id, GLUI_CB cb )
{
  common_init();

  set_ptr_val( value_ptr );
  user_id    = id;
  set_name( name );
  callback    = cb;
  parent->add_control( this );
  //init_live();

  trans_type = trans_t;

  if ( trans_type == GLUI_TRANSLATION_XY ) {
    float_array_size = 2;
  }
  else if ( trans_type == GLUI_TRANSLATION_X ) {
    float_array_size = 1;
  }
  else if ( trans_type == GLUI_TRANSLATION_Y ) {
    float_array_size = 1;
  }
  else if ( trans_type == GLUI_TRANSLATION_Z ) {
    float_array_size = 1;
  }
  init_live();
}
Exemple #4
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();
}
Exemple #5
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();
}
/****************************** GLUI_Listbox::GLUI_Listbox() **********/
GLUI_Listbox::GLUI_Listbox( GLUI_Node *parent,
                            const char *name, int *value_ptr,
                            int id, 
                            GLUI_CB cb)
{
  common_init();
  set_ptr_val( value_ptr );
  user_id    = id;
  set_name( name );
  callback    = cb;

  parent->add_control( this );

  init_live();
}
Exemple #7
0
/****************************** GLUI_CommandLine::GLUI_CommandLine() **********/
GLUI_CommandLine::GLUI_CommandLine( GLUI_Node *parent, const char *name, 
                                    void *data, int id, GLUI_CB cb )
{
  common_init();
  set_name( name );
    
  data_type   = GLUI_EDITTEXT_TEXT;
  ptr_val     = data;
  user_id     = id;
  callback    = cb;
    
  live_type = GLUI_LIVE_TEXT;

  parent->add_control( this );

  init_live();
}
Exemple #8
0
GLUI_Slider::GLUI_Slider(GLUI_Node *parent, const char *name,
                         int id, GLUI_CB cb,
                         int the_data_type,
                         float limit_lo,
                         float limit_hi,
                         void *data)
{
   common_init();
   user_id = id;
   callback = cb;
   set_name( name );
   data_type = the_data_type;
   ptr_val = data;

   if ( data_type == GLUI_SLIDER_INT ) {
      set_int_limits((int)limit_lo, (int)limit_hi);
      if ( data == NULL ) {
         set_int_val(int_low);
         live_type = GLUI_LIVE_NONE;
      } else
         live_type = GLUI_LIVE_INT;

   } else if ( data_type == GLUI_SLIDER_FLOAT ) {
      set_float_limits(limit_lo, limit_hi);
      if ( data == NULL ) {
         set_float_val(float_low);
         live_type = GLUI_LIVE_NONE;
      } else
         live_type = GLUI_LIVE_FLOAT;
   }

   parent->add_control( this );

   init_live();

   //In case the live var was out of range,
   //(and got clamped) we update the live
   //var to the internal value
   output_live(false);
}
Exemple #9
0
void GLUI_List::common_construct(
  GLUI_Node *parent,
  GLUI_String* data, bool scroll, 
  int id, 
  GLUI_CB callback
  /*,GLUI_Control *object
  , GLUI_InterObject_CB obj_cb*/)
{
  common_init();
  GLUI_Node *list_panel = parent;

  if (scroll) {
    GLUI_Panel *p = new GLUI_Panel(parent,"",GLUI_PANEL_NONE);
    p->x_off = 1;
    list_panel = p;
  }
  this->ptr_val     = data;
  if (data) {
    this->live_type = GLUI_LIVE_STRING;
  }
  this->user_id     = id;
  this->callback    = callback;
  this->name        = "list";
  list_panel->add_control( this );
  if (scroll) 
  {
    new GLUI_Column(list_panel, false);
    scrollbar = 
      new GLUI_Scrollbar(list_panel,
                         "scrollbar",
                         GLUI_SCROLL_VERTICAL,
                         GLUI_SCROLL_INT);
    scrollbar->set_object_callback(GLUI_List::scrollbar_callback, this);
    scrollbar->set_alignment(GLUI_ALIGN_LEFT);
    // scrollbar->can_activate = false; //kills ability to mouse drag too
  }
  init_live();
}