예제 #1
0
GLUI_EditText  *GLUI::
add_edittext_to_panel( GLUI_Panel *panel, char *name, 
		       int data_type, void *data,
		       int id, GLUI_Update_CB callback)
{
  GLUI_EditText *control;

  control = new GLUI_EditText;

  if ( control ) {
    control->set_name( name );
    
    control->data_type   = data_type;
    control->ptr_val     = data;
    control->user_id     = id;
    control->callback    = callback;
    
    if ( data_type == GLUI_EDITTEXT_TEXT ) {
      control->live_type = GLUI_LIVE_TEXT;
    }
    else if ( data_type == GLUI_EDITTEXT_INT ) {
      control->live_type = GLUI_LIVE_INT;
      if ( data == NULL )
	control->set_int_val(control->int_val);   /** Set to some default, in case of no live var **/
    }
    else if ( data_type == GLUI_EDITTEXT_FLOAT ) {
      control->live_type = GLUI_LIVE_FLOAT;
      control->num_periods = 1;
      if ( data == NULL )
	control->set_float_val(control->float_val);   /** Set to some default, in case of no live var **/
    }
    else {
      return NULL;   /* Did not pass in a valid data type */
    }

    add_control( panel, control );

    control->init_live();

    return control;
  }
  else {
    return NULL;
  }

}
예제 #2
0
GLUI_EditText* createAngleSelector(GLUI_Panel* pan, const char* label, int* pointer)
{
	GLUI_EditText* spinner = new GLUI_EditText(pan, label, pointer);
	spinner->set_int_limits(-1, 360);
    return spinner;
}
/**
 * @brief UI設定関数
 */
void setGlui(void)
{
  /* GLUIコントローラーの設定 */
  GLUI * glui = GLUI_Master.create_glui("Control Panel", 0);

  /* スリットサイズのテキストボックス追加 */
  GLUI_EditText * editSlitWidth = new GLUI_EditText(glui, "Slit width (cm)", &slitWidth, NULL, inputChangeSlitWidth);
  // 限界値とその処理
  //editSlitWidth->set_float_limits(0.0, 1.0, GLUI_LIMIT_CLAMP);
  // 初期値
  editSlitWidth->set_float_val(0.3);

  /* 移動スピードのテキストボックス追加 */
  GLUI_EditText * editSlitSpeed = new GLUI_EditText(glui, "Slit speed (cm)/s", &slitSpeed, NULL, inputChangeSlitSpeed);
  //editSlitSpeed->set_float_limits(0.0, 1.0, GLUI_LIMIT_CLAMP);
  editSlitSpeed->set_float_val(18000);

  // 仕切り線
  glui->add_separator();

  /* モード変更用のラジオボタン */
  // テキスト
  glui->add_statictext("Move select");
  GLUI_RadioGroup * mode_radio = new GLUI_RadioGroup(glui, &mode);
  // モード変更の項目設定
  glui->add_radiobutton_to_group(mode_radio, "Slit Move");
  glui->add_radiobutton_to_group(mode_radio, "Image Move");

  // 仕切り線
  glui->add_separator();

  // スリット色変え
  GLUI_RadioGroup * slit_mode_radio = new GLUI_RadioGroup(glui, &slitColor);
  glui->add_radiobutton_to_group(slit_mode_radio, "Black");
  glui->add_radiobutton_to_group(slit_mode_radio, "White");

  glui->add_separator();

  // 反復ボタン
  new GLUI_Checkbox(glui, "Repetition", &repetition);

  glui->add_separator();

  /* 画像変更のラジオボタン */
  glui->add_statictext("Image select");
  GLUI_RadioGroup * imageMode_radio = new GLUI_RadioGroup(glui, &ImageMode);
  glui->add_radiobutton_to_group(imageMode_radio, "Dromedary camel - Line drowing black");
  glui->add_radiobutton_to_group(imageMode_radio, "Dromedary camel - Line drowing white");
  glui->add_radiobutton_to_group(imageMode_radio, "Dromedary camel - Black");
  glui->add_radiobutton_to_group(imageMode_radio, "Dromedary camel - White");

  glui->add_radiobutton_to_group(imageMode_radio, "Bactrian camel - Line drowing black");
  glui->add_radiobutton_to_group(imageMode_radio, "Bactrian camel - Line drowing white");
  glui->add_radiobutton_to_group(imageMode_radio, "Bactrian camel - Black");
  glui->add_radiobutton_to_group(imageMode_radio, "Bactrian camel - White");

  glui->add_radiobutton_to_group(imageMode_radio, "Momotaro");

  glui->add_radiobutton_to_group(imageMode_radio, "Circle");
  glui->add_radiobutton_to_group(imageMode_radio, "Square");
  glui->add_radiobutton_to_group(imageMode_radio, "triangle");

  // 仕切り線
  glui->add_separator();

  /* exitボタン */
  glui->add_button("Exit", 0, gluiCallBack);

  // idlezコールバック関数はGLUIで登録
  GLUI_Master.set_glutIdleFunc(NULL);
}