Beispiel #1
0
/** 响应顶级部件的各种事件 */
static void OnTopLevelWidgetEvent( LCUI_Widget w, LCUI_WidgetEvent *e, void *arg )
{
	int e_type = *((int*)&arg);
	LCUI_Surface surface;
	LCUI_Rect *p_rect;

	DEBUG_MSG("tip, e_type = %d\n", e_type);
	surface = LCUIDisplay_GetBindSurface( e->target );
	if( display.mode == LDM_SEAMLESS ) {
		if( !surface && e_type != WET_ADD ) {
			return;
		}
	} else if ( e->target == LCUIRootWidget ) {
		if( !surface && e_type != WET_ADD ) {
			return;
		}
	} else {
		return;
	}
	p_rect = &e->target->base.box.graph;
	switch( e_type ) {
	case WET_ADD:
		LCUIDisplay_BindSurface( e->target );
		break;
	case WET_REMOVE:
	case WET_DESTROY:
		LCUIDisplay_UnbindSurface( e->target );
		break;
	case WET_SHOW:
		Surface_Show( surface );
		break;
	case WET_HIDE:
		Surface_Hide( surface );
		break;
	case WET_TITLE:
		//_DEBUG_MSG("%S\n", e->target->title );
		Surface_SetCaptionW( surface, e->target->title );
		break;
	case WET_RESIZE:
		DEBUG_MSG( "resize, w: %d, h: %d\n", p_rect->w, p_rect->h );
		Surface_Resize( surface, p_rect->w, p_rect->h );
		Widget_InvalidateArea( w, NULL, SV_GRAPH_BOX );
		if( w == LCUIRootWidget && display.mode != LDM_SEAMLESS ) {
			LCUIDisplay_ExecResize( p_rect->w, p_rect->h );
		}
		break;
	case WET_MOVE:
		DEBUG_MSG( "x: %d, y: %d\n", p_rect->left, p_rect->top );
		Surface_Move( surface, p_rect->left, p_rect->top );
		break;
	default: break;
	}
}
Beispiel #2
0
static int LCUIDisplay_FullScreen( void )
{
	switch( display.mode ) {
	case LDM_SEAMLESS:
		LCUIDisplay_CleanSurfaces();
		LCUIDisplay_BindSurface( LCUIRootWidget );
	case LDM_WINDOWED:
	default: break;
	case LDM_FULLSCREEN:
		return 0;
	}
	LCUIDisplay_SetSize( display.info.getWidth(), display.info.getHeight() );
	display.mode = LDM_FULLSCREEN;
	return 0;
}
Beispiel #3
0
static int LCUIDisplay_FullScreen( void )
{
	LCUI_Widget root = LCUIWidget_GetRoot();
	switch( display.mode ) {
	case LCDM_SEAMLESS:
		LCUIDisplay_CleanSurfaces();
		LCUIDisplay_BindSurface(root );
	case LCDM_WINDOWED:
	default: break;
	case LCDM_FULLSCREEN:
		return 0;
	}
	display.mode = LCDM_FULLSCREEN;
	LCUIDisplay_SetSize( LCUIDisplay_GetWidth(), LCUIDisplay_GetHeight() );
	return 0;
}
Beispiel #4
0
static int LCUIDisplay_Windowed( void )
{
	switch( display.mode ) {
	case LDM_FULLSCREEN:
	case LDM_WINDOWED:
		return 0;
	case LDM_SEAMLESS:
	default:
		LCUIDisplay_CleanSurfaces();
		LCUIDisplay_BindSurface( LCUIRootWidget );
		break;
	}
	Widget_Show( LCUIRootWidget );
	Widget_Resize( LCUIRootWidget, display.info.getWidth(),
		       display.info.getHeight() );
	display.mode = LDM_WINDOWED;
	return 0;
}
Beispiel #5
0
static int LCUIDisplay_Windowed( void )
{
	LCUI_Widget root = LCUIWidget_GetRoot();
	switch( display.mode ) {
	case LCDM_WINDOWED:
		return 0;
	case LCDM_FULLSCREEN:
		break;
	case LCDM_SEAMLESS:
	default:
		LCUIDisplay_CleanSurfaces();
		LCUIDisplay_BindSurface( root );
		break;
	}
	Widget_Show( root );
	Widget_Resize( root, DEFAULT_WIDTH, DEFAULT_HEIGHT );
	display.mode = LCDM_WINDOWED;
	return 0;
}
Beispiel #6
0
static int LCUIDisplay_Seamless( void )
{
	LinkedListNode *node;
	LCUI_Widget root = LCUIWidget_GetRoot();
	DEBUG_MSG("display.mode: %d\n", display.mode);
	switch( display.mode ) {
	case LCDM_SEAMLESS:
		return 0;
	case LCDM_FULLSCREEN:
	case LCDM_WINDOWED:
	default:
		LCUIDisplay_CleanSurfaces();
		break;
	}
	for( LinkedList_Each( node, &root->children ) ) {
		LCUIDisplay_BindSurface( node->data );
	}
	display.mode = LCDM_SEAMLESS;
	return 0;
}
Beispiel #7
0
static int LCUIDisplay_Seamless( void )
{
	int i, n;
	LCUI_Widget widget;
	DEBUG_MSG("display.mode: %d\n", display.mode);
	switch( display.mode ) {
	case LDM_SEAMLESS:
		return 0;
	case LDM_FULLSCREEN:
	case LDM_WINDOWED:
	default:
		LCUIDisplay_CleanSurfaces();
		break;
	}
	n = LinkedList_GetTotal( &LCUIRootWidget->children );
	for( i=0; i<n; ++i ) {
		LinkedList_Goto( &LCUIRootWidget->children, i );
		widget = (LCUI_Widget)
		LinkedList_Get( &LCUIRootWidget->children );
		LCUIDisplay_BindSurface( widget );
	}
	display.mode = LDM_SEAMLESS;
	return 0;
}