Beispiel #1
0
static void listview_resize ( widget *wid, short w, short h )
{
    listview *lv = (listview *) wid;
    lv->widget.w = MAX ( 0, w );
    lv->widget.h = MAX ( 0, h );
    int height       = lv->widget.h - widget_padding_get_padding_height ( WIDGET ( lv ) );
    int spacing_vert = distance_get_pixel ( lv->spacing, ORIENTATION_VERTICAL );
    lv->max_rows     = ( spacing_vert + height ) / ( lv->element_height + spacing_vert );
    lv->max_elements = lv->max_rows * lv->menu_columns;

    if ( lv->scrollbar->widget.index == 0 ) {
        widget_move ( WIDGET ( lv->scrollbar ),
                      widget_padding_get_left ( WIDGET ( lv ) ),
                      widget_padding_get_top  ( WIDGET ( lv ) ) );
    }
    else {
        widget_move ( WIDGET ( lv->scrollbar ),
                      lv->widget.w - widget_padding_get_right ( WIDGET ( lv ) ) - widget_get_width ( WIDGET ( lv->scrollbar ) ),
                      widget_padding_get_top ( WIDGET ( lv ) ) );
    }
    widget_resize (  WIDGET ( lv->scrollbar ), widget_get_width ( WIDGET ( lv->scrollbar ) ), height );

    listview_recompute_elements ( lv );
    widget_queue_redraw ( wid );
}
Beispiel #2
0
static int ui_scale_accept_handler(window_info *win)
{
	int label_id = 101, yes_button = 102, no_button = 103;
	int win_width = (int)(0.5 + win->current_scale * 400);
	int win_height = 3 * buddy_border_space + 2 * win->small_font_len_y;
	char string[250] = {0};
	int current_window;

	for(current_window = 0; current_window < MAX_ACCEPT_BUDDY_WINDOWS; current_window++)
		if(accept_windows[current_window].window_id == win->window_id)
			break;
	if(current_window == MAX_ACCEPT_BUDDY_WINDOWS)
		return 0;

	safe_snprintf(string, sizeof(string), buddy_wants_to_add_str, accept_windows[current_window].name);
	put_small_colored_text_in_box_zoomed(c_blue1, (unsigned char*)string, strlen(string),
		win_width - 2 * buddy_border_space, accept_windows[current_window].text, win->current_scale);

	widget_resize(win->window_id, accept_windows[current_window].checkbox, win->small_font_len_y, win->small_font_len_y);
	widget_move(win->window_id, accept_windows[current_window].checkbox, buddy_border_space, win_height);
	widget_set_size(win->window_id, label_id, win->current_scale* DEFAULT_SMALL_RATIO);
	widget_move(win->window_id, label_id, 2 * buddy_border_space + win->small_font_len_y, win_height);
	win_height += widget_get_height(win->window_id, accept_windows[current_window].checkbox) + 2 * buddy_border_space;

	button_resize(win->window_id, yes_button, 0, 0, win->current_scale);
	button_resize(win->window_id, no_button, 0, 0, win->current_scale);
	widget_move(win->window_id, yes_button, (win_width/2 - widget_get_width(win->window_id, yes_button)) / 2, win_height);
	widget_move(win->window_id, no_button, win_width/2 + (win_width/2 - widget_get_width(win->window_id, no_button)) / 2, win_height);

	win_height += widget_get_height(win->window_id, yes_button) + buddy_border_space;
	resize_window(win->window_id, win_width, win_height);

	return 1;
}
Beispiel #3
0
/* ...initialize GL-processing context */
static int app_context_init(widget_data_t *widget, void *data)
{
    app_data_t     *app = data;
    window_data_t  *window = (window_data_t *)widget;
    int             W = widget_get_width(widget);
    int             H = widget_get_height(widget);
    
    /* ...initialize surround-view engine (dimensions are fixed?) */
    CHK_ERR(app->sv = sview_engine_init(app->sv_cfg, 1280, 800), -errno);

    
    
    /* ...create UI layer */
    CHK_ERR(app->gui = gui_create(window, app), -errno);

//    /* ...display context is shared with all windows; context is surfaceless */
//    eglMakeCurrent(display->egl.dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, display->egl.ctx);
//    BUG(eglGetCurrentContext() == EGL_NO_CONTEXT, _x("invalid egl context"));
//    
//    sview_engine_destroy(app->sv);
//    app->sv = sview_engine_init(app->sv_cfg, 1280, 800);
//    
//    sview_engine_destroy(app->sv);
//    app->sv = sview_engine_init(app->sv_cfg, 1280, 800);
//    
//    sview_bv_reinit(app->sv,app->sv_cfg, 1280, 800);
    
    TRACE(INIT, _b("run-time initialized: %u*%u"), W, H);

    return 0;
}
Beispiel #4
0
void create_update_root_window (int width, int height, int time)
{
	if (update_root_win < 0)
	{
		window_info *win = NULL;
		int update_root_restart_id = 0;

		update_root_win = create_window ("Update", -1, -1, 0, 0, width, height, ELW_USE_UISCALE|ELW_TITLE_NONE|ELW_SHOW_LAST);
		if (update_root_win < 0 || update_root_win >= windows_list.num_windows)
			return;
		win = &windows_list.window[update_root_win];

		update_root_restart_id = button_add_extended (update_root_win, update_root_restart_id, NULL, 0, 0, 0, 0, 0, win->current_scale, 1.0f, 1.0f, 1.0f, restart_now_label);
		widget_move(update_root_win, update_root_restart_id,
			(width - widget_get_width(update_root_win, update_root_restart_id)) /2,
			height - 2 * widget_get_height(update_root_win, update_root_restart_id));

		set_window_handler (update_root_win, ELW_HANDLER_DISPLAY, &display_update_root_handler);
		set_window_handler (update_root_win, ELW_HANDLER_KEYPRESS, &keypress_update_root_handler);
		set_window_handler (update_root_win, ELW_HANDLER_SHOW, &show_update_handler);
		widget_set_OnClick(update_root_win, update_root_restart_id, &click_update_root_restart);
	}
	
	update_countdown = time;
}
Beispiel #5
0
int display_buddy_add(void)
{
	if(buddy_add_win < 0)
	{
		int label_id = 100, input_id = 101, button_id = 102;
		window_info *win = NULL;
		int label_width = 0;
		int win_x_len = 0;
		int win_y_len = 0;

		/* Create the window */
		buddy_add_win = create_window(buddy_add_str, buddy_win, 0, buddy_menu_x_len/2, buddy_menu_y_len/4, 0, 0, ELW_USE_UISCALE|ELW_WIN_DEFAULT);
		if (buddy_add_win <=0 || buddy_add_win >= windows_list.num_windows)
			return -1;
		win = &windows_list.window[buddy_add_win];

		/* Add name input and label */
		label_id = label_add_extended(buddy_add_win, label_id, NULL,
			buddy_border_space, buddy_border_space, 0, win->current_scale, newcol_r, newcol_g, newcol_b, buddy_name_str);
		label_width = widget_get_width(buddy_add_win, label_id);
		input_id = pword_field_add_extended(buddy_add_win, input_id, NULL,
			2 * buddy_border_space + label_width, buddy_border_space,
			MAX_USERNAME_LENGTH * win->default_font_len_x, win->default_font_len_y + buddy_border_space,
			P_TEXT, win->current_scale, newcol_r, newcol_g, newcol_b, buddy_name_buffer, MAX_USERNAME_LENGTH);
		widget_set_OnMouseover(buddy_add_win, label_id, name_onmouseover_handler);
		widget_set_OnMouseover(buddy_add_win, input_id, name_onmouseover_handler);
		widget_set_OnKey(buddy_add_win, input_id, name_input_keypress_handler);

		/* Add "Add buddy" button */
		button_id = button_add_extended(buddy_add_win, button_id, NULL, 0, 0, 0, 0, 0, win->current_scale, newcol_r, newcol_g, newcol_b, buddy_add_str);
		widget_set_OnClick(buddy_add_win, button_id, click_add_buddy_handler);

		/* Resize window and centre button */
		win_x_len = 3 * buddy_border_space + label_width + widget_get_width(buddy_add_win, input_id) + win->box_size;
		win_y_len = 3 * buddy_border_space + widget_get_height(buddy_add_win, input_id) + widget_get_height(buddy_add_win, button_id);
		resize_window(buddy_add_win, win_x_len, win_y_len);
		widget_move(buddy_add_win, button_id, (win_x_len - widget_get_width(buddy_add_win, button_id)) / 2, 3 * buddy_border_space + win->default_font_len_y);

		return buddy_add_win;
	}
	else
	{
		toggle_window(buddy_add_win);
		return buddy_add_win;
	}
}
Beispiel #6
0
static int resize_knowledge_handler(window_info *win, int new_width, int new_height)
{
	int gap_y;
	int image_size = (int)(0.5 + win->current_scale * 50);
	int label_width = 0;
	int label_height = 0;
	int book_x_off = 0;
	int label_x_left = 0;
	int book_x_left = 0;

	text_border = win->small_font_len_x / 2;
	booklist_y_step = win->small_font_len_y - 2;
	booklist_y_len = 2 * text_border + (int)(0.5 + booklist_y_step * displayed_book_rows);
	progressbox_y_len = booklist_y_len + 2 * text_border + (int)(0.5 + win->small_font_len_y * info_lines);

	gap_y = (win->len_y - progressbox_y_len - win->small_font_len_y - 4) / 2;
	progress_top_y = progressbox_y_len + gap_y;
	progress_bot_y = win->len_y - gap_y;
	progress_right_x = win->len_x - (int)(0.5 + win->current_scale * 15);
	progress_left_x = win->len_x - (int)(0.5 + win->current_scale * 140);

	widget_resize(win->window_id, knowledge_scroll_id, win->box_size, booklist_y_len);
	widget_move(win->window_id, knowledge_scroll_id, win->len_x - win->box_size, 0);

	widget_set_size(win->window_id, knowledge_book_label_id, win->current_scale * 0.8);
	widget_resize(win->window_id, knowledge_book_label_id, strlen(knowledge_read_book) * win->default_font_len_x * 0.8, win->default_font_len_y * 0.8);
	widget_resize(win->window_id, knowledge_book_image_id, image_size, image_size);

	label_width = widget_get_width(win->window_id, knowledge_book_label_id);
	label_height = widget_get_height(win->window_id, knowledge_book_label_id);
	book_x_off = (label_width > image_size) ?label_width :image_size;
	gap_y = booklist_y_len + (progressbox_y_len - booklist_y_len - image_size - label_height)/ 2;
	label_x_left = progress_right_x - book_x_off/2 - label_width/2;
	book_x_left = progress_right_x - book_x_off/2 - image_size/2;
	book_start_x = (label_x_left < book_x_left) ?label_x_left :book_x_left;

	widget_move(win->window_id, knowledge_book_label_id, label_x_left, gap_y);
	widget_move(win->window_id, knowledge_book_image_id, book_x_left, gap_y + label_height);


	return 0;
}
Beispiel #7
0
static void listview_draw ( widget *wid, cairo_t *draw )
{
    unsigned int offset = 0;
    listview     *lv    = (listview *) wid;
    if ( lv->scroll_type == LISTVIEW_SCROLL_CONTINIOUS ) {
        offset = scroll_continious ( lv );
    }
    else {
        offset = scroll_per_page ( lv );
    }
    // Set these all together to make sure they update consistently.
    scrollbar_set_max_value ( lv->scrollbar, lv->req_elements );
    scrollbar_set_handle_length ( lv->scrollbar, lv->cur_columns * lv->max_rows );
    if ( lv->reverse ) {
        scrollbar_set_handle ( lv->scrollbar, lv->req_elements - lv->selected - 1 );
    }
    else {
        scrollbar_set_handle ( lv->scrollbar, lv->selected  );
    }
    lv->last_offset = offset;
    int spacing_vert = distance_get_pixel ( lv->spacing, ORIENTATION_VERTICAL );
    int spacing_hori = distance_get_pixel ( lv->spacing, ORIENTATION_HORIZONTAL );

    int left_offset = widget_padding_get_left ( wid );
    int top_offset  = widget_padding_get_top ( wid );
    if ( lv->scrollbar->widget.index == 0 ) {
        left_offset += spacing_hori + lv->scrollbar->widget.w;
    }
    if ( lv->cur_elements > 0 && lv->max_rows > 0 ) {
        // Set new x/y possition.
        unsigned int max = MIN ( lv->cur_elements, lv->req_elements - offset );
        if ( lv->rchanged ) {
            unsigned int width = lv->widget.w - spacing_hori * ( lv->cur_columns - 1 );
            width -= widget_padding_get_padding_width ( wid );
            if ( widget_enabled ( WIDGET ( lv->scrollbar ) ) ) {
                width -= spacing_hori;
                width -= widget_get_width ( WIDGET ( lv->scrollbar ) );
            }
            unsigned int element_width = ( width ) / lv->cur_columns;
            for ( unsigned int i = 0; i < max; i++ ) {
                unsigned int ex = left_offset + ( ( i ) / lv->max_rows ) * ( element_width + spacing_hori );
                if ( lv->reverse ) {
                    unsigned int ey = wid->h - ( widget_padding_get_bottom ( wid ) + ( ( i ) % lv->max_rows ) * ( lv->element_height + spacing_vert ) ) - lv->element_height;
                    textbox_moveresize ( lv->boxes[i], ex, ey, element_width, lv->element_height );
                }
                else {
                    unsigned int ey = top_offset + ( ( i ) % lv->max_rows ) * ( lv->element_height + spacing_vert );
                    textbox_moveresize ( lv->boxes[i], ex, ey, element_width, lv->element_height );
                }

                update_element ( lv, i, i + offset, TRUE );
                widget_draw ( WIDGET ( lv->boxes[i] ), draw );
            }
            lv->rchanged = FALSE;
        }
        else {
            for ( unsigned int i = 0; i < max; i++ ) {
                update_element ( lv, i, i + offset, FALSE );
                widget_draw ( WIDGET ( lv->boxes[i] ), draw );
            }
        }
    }
    widget_draw ( WIDGET ( lv->scrollbar ), draw );
}
Beispiel #8
0
static void hori_calculate_size ( box *b )
{
    int spacing           = distance_get_pixel ( b->spacing, ROFI_ORIENTATION_HORIZONTAL );
    int expanding_widgets = 0;
    int active_widgets    = 0;
    int rem_width         = widget_padding_get_remaining_width ( WIDGET ( b ) );
    int rem_height        = widget_padding_get_remaining_height ( WIDGET ( b ) );
    for ( GList *iter = g_list_first ( b->children ); iter != NULL; iter = g_list_next ( iter ) ) {
        widget * child = (widget *) iter->data;
        if ( child->enabled && child->expand == FALSE ) {
            widget_resize ( child,
                            widget_get_desired_width ( child ), //child->w,
                            rem_height );
        }
    }
    b->max_size = 0;
    for ( GList *iter = g_list_first ( b->children ); iter != NULL; iter = g_list_next ( iter ) ) {
        widget * child = (widget *) iter->data;
        if ( !child->enabled ) {
            continue;
        }
        active_widgets++;
        if ( child->expand == TRUE ) {
            expanding_widgets++;
            continue;
        }
        // Size used by fixed width widgets.
        if ( child->h > 0 ) {
            b->max_size += child->w;
        }
    }
    b->max_size += MAX ( 0, ( ( active_widgets - 1 ) * spacing ) );
    if ( b->max_size > ( rem_width ) ) {
        b->max_size = rem_width;
        g_debug ( "Widgets to large (width) for box: %d %d", b->max_size, b->widget.w );
        return;
    }
    if ( active_widgets > 0 ) {
        int    left  = widget_padding_get_left ( WIDGET ( b ) );
        double rem   = rem_width - b->max_size;
        int    index = 0;
        for ( GList *iter = g_list_first ( b->children ); iter != NULL; iter = g_list_next ( iter ) ) {
            widget * child = (widget *) iter->data;
            if ( child->enabled == FALSE  ) {
                continue;
            }
            if ( child->expand == TRUE ) {
                // Re-calculate to avoid round issues leaving one pixel left.
                int expanding_widgets_size = ( rem ) / ( expanding_widgets - index );
                widget_move ( child, left, widget_padding_get_top ( WIDGET ( b ) ) );
                left += expanding_widgets_size;
                widget_resize ( child, expanding_widgets_size, rem_height );
                left += spacing;
                rem  -= expanding_widgets_size;
                index++;
            }
            else {
                widget_move ( child, left, widget_padding_get_top ( WIDGET ( b ) ) );
                left += widget_get_width (  child );
                left += spacing;
            }
        }
    }
    b->max_size += widget_padding_get_padding_width ( WIDGET ( b ) );
}
Beispiel #9
0
static int display_buddy_change(_buddy *buddy)
{
	int label_id = 100, name_id = 101, type_label_id = 102, checkbox_id = 103, checkbox_label_id = 104, change_button_id = 105;
	int buddy_change_x_len = 0;
	int buddy_change_y_len = 0;
	window_info *win = NULL;
	int tmp_width = 0;

	buddy_to_change = buddy->name;
	if(buddy_change_win >= 0) {
		/* Destroy the window to make sure everything's set up. */
		destroy_window(buddy_change_win);
		buddy_change_win = -1;
		buddy_delete = 0;
	}

	/* Create the window */
	buddy_change_win = create_window(buddy_change_str, buddy_win, 0, buddy_menu_x_len/2, buddy_menu_y_len/4, 0, 0, ELW_USE_UISCALE|ELW_WIN_DEFAULT);
	if (buddy_change_win <=0 || buddy_change_win >= windows_list.num_windows)
		return -1;
	win = &windows_list.window[buddy_change_win];

	/* Add name label and name */
	label_id = label_add_extended(buddy_change_win, label_id, NULL,
		buddy_border_space, buddy_border_space, 0, win->current_scale, newcol_r, newcol_g, newcol_b, buddy_name_str);
	tmp_width = widget_get_width(buddy_change_win, label_id);
	name_id = label_add_extended(buddy_change_win, name_id, NULL,
		2 * buddy_border_space + tmp_width, buddy_border_space, 0, win->current_scale, newcol_r, newcol_g, newcol_b, buddy_to_change);

	buddy_change_x_len = 3 * buddy_border_space + tmp_width + MAX_USERNAME_LENGTH * win->default_font_len_x + win->box_size;
	buddy_change_y_len = 2 * buddy_border_space + widget_get_height(buddy_change_win, name_id);

	buddy_type_input_id = -1;
	if (buddy->type < 0xFE)
	{
		size_t i;
		const size_t num_type_labels = 5;
		char * type_labels_text[] = {buddy_white_str, buddy_red_str, buddy_green_str, buddy_blue_str, buddy_yellow_str};

		/* Add type label and input widget */
		type_label_id = label_add_extended(buddy_change_win, type_label_id, NULL,
			buddy_border_space, buddy_change_y_len, 0, win->current_scale, newcol_r, newcol_g, newcol_b, buddy_type_str);
		tmp_width = widget_get_width(buddy_change_win, type_label_id);

		buddy_type_input_id = multiselect_add(buddy_change_win, NULL,
			2 * buddy_border_space + tmp_width, buddy_change_y_len, buddy_change_x_len - tmp_width - 3 * buddy_border_space);
		for (i=0; i<num_type_labels; i++)
			multiselect_button_add_extended(buddy_change_win, buddy_type_input_id,
				0, i * 25 * win->current_scale, 0, type_labels_text[i], DEFAULT_SMALL_RATIO * win->current_scale, i==0);
		multiselect_set_selected(buddy_change_win, buddy_type_input_id, buddy->type);

		widget_set_OnMouseover(buddy_change_win, label_id, type_onmouseover_handler);
		widget_set_OnMouseover(buddy_change_win, buddy_type_input_id, type_onmouseover_handler);

		if ((3 * buddy_border_space + tmp_width + widget_get_width(buddy_change_win, buddy_type_input_id)) > buddy_change_x_len)
			buddy_change_x_len = 3 * buddy_border_space + tmp_width + widget_get_width(buddy_change_win, buddy_type_input_id);
		buddy_change_y_len += buddy_border_space + multiselect_get_height(buddy_change_win, buddy_type_input_id);
	}

	/* Delete buddy checkbox and label */
	checkbox_id = checkbox_add(buddy_change_win, NULL, 0, 0, win->default_font_len_y, win->default_font_len_y, &buddy_delete);
	checkbox_label_id = label_add_extended(buddy_change_win, checkbox_label_id, NULL,
		0, 0, 0, win->current_scale, newcol_r, newcol_g, newcol_b, buddy_delete_str);
	widget_set_OnClick(buddy_change_win, checkbox_label_id, click_delete_checkbox_label);
	widget_set_OnMouseover(buddy_change_win, checkbox_label_id, delete_onmouseover_handler);
	tmp_width = widget_get_width(buddy_change_win, checkbox_id) + buddy_border_space + widget_get_width(buddy_change_win, checkbox_label_id);
	widget_move(buddy_change_win, checkbox_id, (buddy_change_x_len - tmp_width) / 2, buddy_change_y_len);
	widget_move(buddy_change_win, checkbox_label_id,
		buddy_change_x_len - ((buddy_change_x_len - tmp_width) / 2) - widget_get_width(buddy_change_win, checkbox_label_id), buddy_change_y_len);
	buddy_change_y_len += buddy_border_space + widget_get_height(buddy_change_win, checkbox_id);

	/* Change button */
	change_button_id = button_add_extended(buddy_change_win, change_button_id, NULL,
		0, 0, 0, 0, 0, win->current_scale, newcol_r, newcol_g, newcol_b, buddy_change_str);
	widget_set_OnClick(buddy_change_win, change_button_id, click_change_buddy_handler);
	widget_move(buddy_change_win, change_button_id,
		(buddy_change_x_len - widget_get_width(buddy_change_win, change_button_id)) / 2, buddy_change_y_len);
	buddy_change_y_len += buddy_border_space + widget_get_height(buddy_change_win, change_button_id);

	resize_window(buddy_change_win, buddy_change_x_len, buddy_change_y_len);

	return buddy_change_win;
}
Beispiel #10
0
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
{
//    box 20 by 40
    widget *wid= (widget*)g_malloc0(sizeof(widget)); 
    widget_resize ( wid, 20, 40);
    widget_move ( wid, 10, 10);
    // Getter, setter x pos
    //
    TASSERT( widget_get_x_pos ( wid )  == 10 );
    TASSERT( widget_get_y_pos ( wid )  == 10 );

    // Left of box
    TASSERT ( widget_intersect ( wid, 0, 0) == 0 );
    TASSERT ( widget_intersect ( wid, 0, 10) == 0 );
    TASSERT ( widget_intersect ( wid, 0, 25) == 0 );
    TASSERT ( widget_intersect ( wid, 0, 40) == 0 );
    TASSERT ( widget_intersect ( wid, 0, 50) == 0 );
    TASSERT ( widget_intersect ( wid, 9, 0) == 0 );
    TASSERT ( widget_intersect ( wid, 9, 10) == 0 );
    TASSERT ( widget_intersect ( wid, 9, 25) == 0 );
    TASSERT ( widget_intersect ( wid, 9, 40) == 0 );
    TASSERT ( widget_intersect ( wid, 9, 50) == 0 );
    TASSERT ( widget_intersect ( wid, 10, 0) == 0 );
    TASSERT ( widget_intersect ( wid, 10, 10) == 1 );
    TASSERT ( widget_intersect ( wid, 10, 25) == 1 );
    TASSERT ( widget_intersect ( wid, 10, 40) == 1 );
    TASSERT ( widget_intersect ( wid, 10, 50) == 0 );

    // Middle

    TASSERT ( widget_intersect ( wid, 25, 0) == 0 );
    TASSERT ( widget_intersect ( wid, 25, 10) == 1 );
    TASSERT ( widget_intersect ( wid, 25, 25) == 1 );
    TASSERT ( widget_intersect ( wid, 25, 40) == 1 );
    TASSERT ( widget_intersect ( wid, 25, 50) == 0 );

    // Right
    TASSERT ( widget_intersect ( wid, 29, 0) == 0 );
    TASSERT ( widget_intersect ( wid, 29, 10) == 1 );
    TASSERT ( widget_intersect ( wid, 29, 25) == 1 );
    TASSERT ( widget_intersect ( wid, 29, 40) == 1 );
    TASSERT ( widget_intersect ( wid, 29, 50) == 0 );

    TASSERT ( widget_intersect ( wid, 30, 0) == 0 );
    TASSERT ( widget_intersect ( wid, 30, 10) == 0 );
    TASSERT ( widget_intersect ( wid, 30, 25) == 0 );
    TASSERT ( widget_intersect ( wid, 30, 40) == 0 );
    TASSERT ( widget_intersect ( wid, 30, 50) == 0 );

    widget_move ( wid, 30, 30);
    // Left of box
    TASSERT ( widget_intersect ( wid, 10, 20) == 0 );
    TASSERT ( widget_intersect ( wid, 10, 30) == 0 );
    TASSERT ( widget_intersect ( wid, 10, 45) == 0 );
    TASSERT ( widget_intersect ( wid, 10, 60) == 0 );
    TASSERT ( widget_intersect ( wid, 10, 70) == 0 );
    TASSERT ( widget_intersect ( wid, 19, 20) == 0 );
    TASSERT ( widget_intersect ( wid, 19, 30) == 0 );
    TASSERT ( widget_intersect ( wid, 19, 45) == 0 );
    TASSERT ( widget_intersect ( wid, 19, 60) == 0 );
    TASSERT ( widget_intersect ( wid, 19, 70) == 0 );
    TASSERT ( widget_intersect ( wid, 30, 20) == 0 );
    TASSERT ( widget_intersect ( wid, 30, 30) == 1 );
    TASSERT ( widget_intersect ( wid, 30, 45) == 1 );
    TASSERT ( widget_intersect ( wid, 30, 60) == 1 );
    TASSERT ( widget_intersect ( wid, 30, 70) == 0 );

    // Middle

    TASSERT ( widget_intersect ( wid, 20+25,20+ 0) == 0 );
    TASSERT ( widget_intersect ( wid, 20+25,20+ 10) == 1 );
    TASSERT ( widget_intersect ( wid, 20+25,20+ 25) == 1 );
    TASSERT ( widget_intersect ( wid, 20+25,20+ 40) == 1 );
    TASSERT ( widget_intersect ( wid, 20+25,20+ 50) == 0 );

    TASSERT ( widget_intersect ( wid, 20+29, 20+0) == 0 );
    TASSERT ( widget_intersect ( wid, 20+29, 20+10) == 1 );
    TASSERT ( widget_intersect ( wid, 20+29, 20+25) == 1 );
    TASSERT ( widget_intersect ( wid, 20+29, 20+40) == 1 );
    TASSERT ( widget_intersect ( wid, 20+29, 20+50) == 0 );

    TASSERT ( widget_intersect ( wid, 20+30, 20+0) == 0 );
    TASSERT ( widget_intersect ( wid, 20+30, 20+10) == 0 );
    TASSERT ( widget_intersect ( wid, 20+30, 20+25) == 0 );
    TASSERT ( widget_intersect ( wid, 20+30, 20+40) == 0 );
    TASSERT ( widget_intersect ( wid, 20+30, 20+50) == 0 );

    // Right
    TASSERT ( widget_intersect ( wid, 20+29, 20+0) == 0 );
    TASSERT ( widget_intersect ( wid, 20+29, 20+10) == 1 );
    TASSERT ( widget_intersect ( wid, 20+29, 20+25) == 1 );
    TASSERT ( widget_intersect ( wid, 20+29, 20+40) == 1 );
    TASSERT ( widget_intersect ( wid, 20+29, 20+50) == 0 );

    TASSERT ( widget_intersect ( wid, 20+30, 20+0) == 0 );
    TASSERT ( widget_intersect ( wid, 20+30, 20+10) == 0 );
    TASSERT ( widget_intersect ( wid, 20+30, 20+25) == 0 );
    TASSERT ( widget_intersect ( wid, 20+30, 20+40) == 0 );
    TASSERT ( widget_intersect ( wid, 20+30, 20+50) == 0 );


    TASSERT ( widget_intersect ( wid, -100, -100) == 0);
    TASSERT ( widget_intersect ( wid, INT_MIN, INT_MIN) == 0);
    TASSERT ( widget_intersect ( wid, INT_MAX, INT_MAX) == 0);

    // Other wrappers.
    TASSERT ( widget_get_height ( wid ) ==  wid->h);
    TASSERT ( widget_get_width ( wid ) ==  wid->w);

    TASSERT ( widget_enabled ( wid ) == FALSE );
    widget_enable ( wid );
    TASSERT ( widget_enabled ( wid ) == TRUE );
    widget_disable ( wid );
    TASSERT ( widget_enabled ( wid ) == FALSE );
    // Null pointer tests.
    TASSERT ( widget_intersect ( NULL, 0, 0) == 0 );
    widget_move ( NULL, 0, 0 );
    TASSERT ( widget_get_height ( NULL ) ==  0);
    TASSERT ( widget_get_width ( NULL ) ==  0);
    TASSERT ( widget_enabled ( NULL ) == 0);
    widget_disable ( NULL );
    widget_enable ( NULL );
    widget_draw ( NULL, NULL );
    widget_free ( NULL );
    widget_resize ( NULL, 0, 0);
    widget_update ( NULL );
    widget_queue_redraw ( NULL );
    TASSERT (widget_need_redraw ( NULL ) == FALSE);
    widget_clicked ( NULL, NULL );
    widget_set_clicked_handler ( NULL, NULL, NULL );


    g_free(wid);
}