void rtgui_anim_destroy(struct rtgui_animation *anim)
{
    /* Only free animation and timer. If you want to free the dc_buffer,
     * overwrite the on_finish. */
    rtgui_timer_destory(anim->timer);
    rtgui_free(anim);
}
Beispiel #2
0
static void _rtgui_textbox_deconstructor(rtgui_textbox_t *box)
{
	if (box->text != RT_NULL)
	{
		rt_free(box->text);
		box->text = RT_NULL;
	}

	rtgui_timer_destory(box->caret_timer);
	box->caret_timer = RT_NULL;
}
Beispiel #3
0
/* AUTO窗口关闭时的事件处理 */
rt_bool_t auto_window_close(struct rtgui_object *object, struct rtgui_event *event)
{
    if (timer != RT_NULL)
    {
        /* 停止并删除定时器 */
        rtgui_timer_stop(timer);
        rtgui_timer_destory(timer);

        timer = RT_NULL;
    }
    autowin = RT_NULL;

    return RT_TRUE;
}
Beispiel #4
0
Datei: edit.c Projekt: amsl/RTGUI
static rt_bool_t rtgui_edit_onunfocus(pvoid wdt, rtgui_event_t* event)
{
	struct rtgui_edit* edit = RTGUI_EDIT(wdt);

	/* stop caret timer */
	if(edit->caret_timer != RT_NULL)
	{
		rtgui_timer_stop(edit->caret_timer);
		rtgui_timer_destory(edit->caret_timer);
	}
	/* set caret to hide */
	edit->flag &= ~RTGUI_EDIT_CARET;
	rtgui_edit_draw_caret(edit);
	
	return RT_TRUE;
}
Beispiel #5
0
static void _rtgui_textbox_deconstructor(rtgui_textbox_t *textbox)
{
	if (textbox->text != RT_NULL)
	{
		rtgui_free(textbox->text);
		textbox->text = RT_NULL;
	}
	if (textbox->caret_timer != RT_NULL)
	{
		rtgui_timer_destory(textbox->caret_timer);
		textbox->caret_timer = RT_NULL;
	}
	if (textbox->caret != RT_NULL)
	{
		rtgui_free(textbox->caret);
		textbox->caret = RT_NULL;
	}
}
Beispiel #6
0
/* 关闭对话框时的回调函数 */
void diag_close(struct rtgui_timer* timer, void* parameter)
{
	cnt --;
	rt_sprintf(label_text, "closed then %d second!", cnt);

	/* 设置标签文本并更新控件 */
	rtgui_label_set_text(label, label_text);
	rtgui_widget_update(RTGUI_WIDGET(label));

	if (cnt == 0)
	{
		/* 超时,关闭对话框 */
		rtgui_win_destroy(msgbox);

		/* 停止并删除定时器 */
		rtgui_timer_stop(timer);
		rtgui_timer_destory(timer);
	}
}
Beispiel #7
0
Datei: edit.c Projekt: amsl/RTGUI
void _rtgui_edit_deconstructor(struct rtgui_edit *edit)
{
	if(edit->max_rows > 0)
	{
		while(edit->max_rows > 0)
			rtgui_edit_delete_line(edit, edit->head);
		edit->max_rows = 0;
	}
	if(edit->caret_timer != RT_NULL)
		rtgui_timer_destory(edit->caret_timer);
	edit->caret_timer = RT_NULL;

	if(edit->caret != RT_NULL)
		rtgui_free(edit->caret);
	edit->caret = RT_NULL;
	if(edit->update_buf != RT_NULL)
		rtgui_free(edit->update_buf);

	rtgui_dc_destory(edit->dbl_buf);
}
static rt_bool_t rtgui_textbox_onunfocus(struct rtgui_object *widget, rtgui_event_t *event)
{
	rtgui_textbox_t *box = RTGUI_TEXTBOX(widget);

	/* stop caret timer */
	if (box->caret_timer != RT_NULL)
	{
		rtgui_timer_stop(box->caret_timer);
		rtgui_timer_destory(box->caret_timer);
		box->caret_timer = RT_NULL;
	}
	/* set caret to hide */
	box->flag &= ~RTGUI_TEXTBOX_CARET_SHOW;
	rtgui_textbox_draw_caret(box, box->position);

	if (box->on_enter != RT_NULL)
		box->on_enter(box, event);

	return RT_TRUE;
}
rt_bool_t rtgui_app_event_handler(struct rtgui_object *object, rtgui_event_t *event)
{
    struct rtgui_app *app;

    RT_ASSERT(object != RT_NULL);
    RT_ASSERT(event != RT_NULL);

    app = RTGUI_APP(object);

    switch (event->type)
    {
    case RTGUI_EVENT_PAINT:
    case RTGUI_EVENT_VPAINT_REQ:
    case RTGUI_EVENT_MOUSE_BUTTON:
    case RTGUI_EVENT_MOUSE_MOTION:
    case RTGUI_EVENT_CLIP_INFO:
    case RTGUI_EVENT_WIN_ACTIVATE:
    case RTGUI_EVENT_WIN_DEACTIVATE:
    case RTGUI_EVENT_WIN_CLOSE:
    case RTGUI_EVENT_WIN_MOVE:
    case RTGUI_EVENT_WIN_SHOW:
    case RTGUI_EVENT_WIN_HIDE:
    case RTGUI_EVENT_KBD:
    case RTGUI_EVENT_GESTURE:
        _rtgui_application_dest_handle(app, event);
        break;

    case RTGUI_EVENT_APP_ACTIVATE:
        if (app->main_object != RT_NULL)
        {
            /* Let the polymorphism work. */
            struct rtgui_event_win_show wev;

            RTGUI_EVENT_WIN_SHOW_INIT(&wev);
            wev.wid = (struct rtgui_win*)app->main_object;

            rtgui_object_handle(app->main_object, &wev.parent);
        }
        break;

    case RTGUI_EVENT_APP_DESTROY:
        rtgui_app_exit(app, 0);
        break;

    case RTGUI_EVENT_TIMER:
    {
        struct rtgui_timer *timer;
        struct rtgui_event_timer *etimer = (struct rtgui_event_timer *) event;

        timer = etimer->timer;
        timer->pending_cnt--;
        RT_ASSERT(timer->pending_cnt >= 0);
        if (timer->state == RTGUI_TIMER_ST_DESTROY_PENDING)
        {
            /* Truly destroy the timer when there is no pending event. */
            if (timer->pending_cnt == 0)
                rtgui_timer_destory(timer);
        }
        else if (timer->state == RTGUI_TIMER_ST_RUNNING && timer->timeout != RT_NULL)
        {
            /* call timeout function */
            timer->timeout(timer, timer->user_data);
        }
    }
    break;

    case RTGUI_EVENT_MV_MODEL:
    {
        struct rtgui_event_mv_model *emodel = (struct rtgui_event_mv_model *)event;
        RT_ASSERT(emodel->view);
        return rtgui_object_handle(RTGUI_OBJECT(emodel->view), event);
    }

    case RTGUI_EVENT_COMMAND:
    {
        struct rtgui_event_command *ecmd = (struct rtgui_event_command *)event;

        if (ecmd->wid != RT_NULL)
            return _rtgui_application_dest_handle(app, event);
    }
    default:
        return rtgui_object_event_handler(object, event);
    }

    return RT_TRUE;
}