Beispiel #1
0
int    GLUI_Mouse_Interaction::special_handler( int key,int modifiers )
{
  int center_x, center_y;
  int drag_x, drag_y;

  center_x = w/2;
  center_y = (h-18)/2;
  drag_x   = 0;
  drag_y   = 0;
	
  if ( key == GLUT_KEY_LEFT )
    drag_x = -6;
  else if ( key == GLUT_KEY_RIGHT )
    drag_x = 6;
  else if ( key == GLUT_KEY_UP )
    drag_y = -6;
  else if ( key == GLUT_KEY_DOWN )
    drag_y = 6;

  if ( drag_x != 0 OR drag_y != 0 ) {
    mouse_down_handler( center_x, center_y );
    mouse_held_down_handler( center_x + drag_x, center_y + drag_y,true );
    mouse_up_handler( center_x + drag_x, center_y + drag_y, true );
  }

  return false;
}
Beispiel #2
0
int    GLUI_Spinner::special_handler( int key,int modifiers )
{
  if ( key == GLUT_KEY_UP ) {    /** Simulate a click in the up arrow **/
    mouse_down_handler( x_abs + w - GLUI_SPINNER_ARROW_WIDTH + 1,
            y_abs + GLUI_SPINNER_ARROW_Y+1 );
    mouse_up_handler( x_abs + w - GLUI_SPINNER_ARROW_WIDTH + 1,
              y_abs + GLUI_SPINNER_ARROW_Y+1, true );
  }
  else if ( key == GLUT_KEY_DOWN ) {  /** Simulate a click in the up arrow **/
    mouse_down_handler(x_abs + w - GLUI_SPINNER_ARROW_WIDTH + 1,
               y_abs+GLUI_SPINNER_ARROW_Y+1+GLUI_SPINNER_ARROW_HEIGHT);
    mouse_up_handler( x_abs + w - GLUI_SPINNER_ARROW_WIDTH + 1,
              y_abs+GLUI_SPINNER_ARROW_Y+1 +GLUI_SPINNER_ARROW_HEIGHT,
              true );
  }
  else if ( key == GLUT_KEY_HOME ) {  /** Set value to limit top - 
                    or increment by 10 **/
  }
  else if ( key == GLUT_KEY_END ) {  
  }

  return true;
}