예제 #1
0
/*! 
  Callback invoked when mouse down event is received.
  \author  jfpatry
  \date    Created:  2000-09-17
  \date    Modified: 2000-09-17
*/
static void button_mouse_down_cb( void *widget, 
				  winsys_mouse_button_t which_button,
				  int x, int y )
{
    button_t *button = (button_t*) widget;

    check_assertion( button != NULL, "button is NULL" );

    if ( which_button != WS_LEFT_BUTTON ) {
	return;
    }

    if ( !in_bbox( button, x, y ) ) {
	return;
    }

    if ( ! button->enabled ) {
	return;
    }

    if ( button->clicked == False ) {
	print_debug( DEBUG_UI, "Button is down" );
	button->clicked = True;
	ui_set_dirty();
    }
}
예제 #2
0
/*! 
  Callback invoked when mouse up event is received.
  \author  jfpatry
  \date    Created:  2000-09-17
  \date    Modified: 2000-09-17
*/
static void button_mouse_up_cb( void *widget, 
				winsys_mouse_button_t which_button,
				int x, int y )
{
    button_t *button = (button_t*) widget;

    check_assertion( button != NULL, "button is NULL" );

    if ( which_button != WS_LEFT_BUTTON ) {
	return;
    }

    if ( ! button->enabled ) {
	return;
    }

    if ( !in_bbox( button, x, y ) ) {
	if ( button->clicked ) {
	    print_debug( DEBUG_UI, "Button is up (not clicked)" );
	    button->clicked = False;
	    ui_set_dirty();
	}
	return;
    } 


    if ( button->clicked ) {
	button->clicked = False;
	print_debug( DEBUG_UI, "Button was clicked" );
	button_perform_click_action( button );
	ui_set_dirty();
    }
}
예제 #3
0
파일: nsearch.c 프로젝트: BenGraeler/gstat
void qtree_push_point(DATA *d, DPOINT *where) {
/* add a single point to the search tree structure in d->qtree_root */

	/*
	 * do not do this while reading the data: suppose we'll never need
	 * a neighbourhood selection after all! 
	 */
	if (! is_qtree_search(d))
		return;

	/* min_bbox = d->sel_rad * Q_STOP_AT; */

	/*
	 * if this point is outside the current search tree,
	 * we need to add another level to the top and try again:
	 */
	while (! in_bbox(where, d->qtree_root->bb))
		d->qtree_root = qtree_expand(where, d->qtree_root);

	/*
	 * finally push the point onto the tree:
	 */
	qtree_push(where, &(d->qtree_root), 0);
	return;
}
예제 #4
0
/*! 
  Callback invoked when mouse motion event is received.
  \author  jfpatry
  \date    Created:  2000-09-17
  \date    Modified: 2000-09-17
*/
static void button_mouse_motion_cb( void *widget, int x, int y )
{
    button_t *button = (button_t*) widget;

    check_assertion( button != NULL, "button is NULL" );

    if ( ! button->enabled ) {
	return;
    }

    if ( in_bbox( button, x, y ) ) {
	if ( button->focused == False ) {
	    print_debug( DEBUG_UI, "Mouse entered button" );
	    button->focused = True;
	    ui_set_dirty();
	}
    } else {
	if ( button->focused == True ) {
	    print_debug( DEBUG_UI, "Mouse left button" );
	    button->focused = False;
	    ui_set_dirty();
	}
    }
}