Beispiel #1
0
void rtgui_win_destroy(struct rtgui_win* win)
{
	/* close the window first if it's not. */
	if (!(win->flag & RTGUI_WIN_FLAG_CLOSED))
	{
		struct rtgui_event_win_close eclose;

		RTGUI_EVENT_WIN_CLOSE_INIT(&eclose);
		eclose.wid = win;

		if (win->style & RTGUI_WIN_STYLE_DESTROY_ON_CLOSE)
		{
			_rtgui_win_deal_close(win,
					(struct rtgui_event*)&eclose,
					RT_TRUE);
			return;
		}
		else
			_rtgui_win_deal_close(win,
					(struct rtgui_event*)&eclose,
					RT_TRUE);
	}

	if (win->flag & RTGUI_WIN_FLAG_MODAL)
	{
		/* set the RTGUI_WIN_STYLE_DESTROY_ON_CLOSE flag so the window will be
		 * destroyed after the event_loop */
		win->style |= RTGUI_WIN_STYLE_DESTROY_ON_CLOSE;
		rtgui_win_end_modal(win, RTGUI_MODAL_CANCEL);
	}
	else
	{
		rtgui_widget_destroy(RTGUI_WIDGET(win));
	}
}
Beispiel #2
0
/* send a close event to myself to get a consistent behavior */
rt_bool_t rtgui_win_close(struct rtgui_win* win)
{
    struct rtgui_event_win_close eclose;

    RTGUI_EVENT_WIN_CLOSE_INIT(&eclose);
    eclose.wid = win;
    return _rtgui_win_deal_close(win,
                                 (struct rtgui_event*)&eclose);
}