Exemplo n.º 1
0
static LCUI_BOOL MouseProc( void )
{
	POINT new_pos;
	LCUI_SystemEvent e;
	static LCUI_Pos old_pos = {0, 0};

	/* 如果是无缝模式则获取系统鼠标游标的坐标 */
	if( LCUIDisplay_GetMode() == LDM_SEAMLESS ) {
		GetCursorPos( &new_pos );
	} else {
		new_pos.x = mouse.x;
		new_pos.y = mouse.y;
	}
	e.type = LCUI_MOUSEMOVE;
	e.type_name = NULL;
	e.data = e.destroy_data = NULL;
	e.rel_x = new_pos.x - old_pos.x;
	e.rel_y = new_pos.y - old_pos.y;
	if( e.rel_x == 0 && e.rel_y == 0 ) {
		return FALSE;
	}
	old_pos.x = new_pos.x;
	old_pos.y = new_pos.y;
	_DEBUG_MSG("x: %d, y: %d, rel_x: %d, rel_y: %d\n", new_pos.x, new_pos.y, e.rel_x, e.rel_y);
	_DEBUG_MSG("post result: %d\n", LCUI_PostEvent( &e ));
	return TRUE;
}
Exemplo n.º 2
0
LCUI_Surface LCUIDisplay_GetSurfaceOwner( LCUI_Widget w )
{
	if( LCUIDisplay_GetMode() == LCDM_SEAMLESS ) {
		while( w->parent ) {
			w = w->parent;
		}
	} else {
		w = LCUIWidget_GetRoot();
	}
	return LCUIDisplay_GetBindSurface( w );
}
Exemplo n.º 3
0
LCUI_BOOL Widget_InvalidateArea( LCUI_Widget widget,
				 LCUI_RectF *in_rect, int box_type )
{
	int mode;
	LCUI_Rect area;
	LCUI_RectF rect;
	LCUI_Widget w = widget;
	LCUI_Widget root = LCUIWidget_GetRoot();
	LCUI_RectGroup group;

	if( !w ) {
		w = root;
	}
	mode = LCUIDisplay_GetMode();
	Widget_AdjustArea( w, in_rect, &rect, box_type );
	rect.x += w->box.graph.x;
	rect.y += w->box.graph.y;
	while( w && w->parent ) {
		LCUIRectF_ValidateArea( &rect, w->parent->box.padding.width,
					w->parent->box.padding.height );
		if( rect.width <= 0 || rect.height <= 0 ) {
			return FALSE;
		}
		if( mode != LCDM_SEAMLESS && w->parent == root ) {
			break;
		}
		w = w->parent;
		rect.x += w->box.padding.x;
		rect.y += w->box.padding.y;
	}
	RectFToInvalidArea( &rect, &area );
	if( mode != LCDM_SEAMLESS ) {
		RectList_Add( &self.rects, &area );
		return TRUE;
	}
	group = RBTree_CustomGetData( &self.groups, w );
	if( !group ) {
		group = NEW( LCUI_RectGroupRec, 1 );
		group->widget = w;
		LinkedList_Init( &group->rects );
		RBTree_CustomInsert( &self.groups, w, group );
	}
	return RectList_Add( &group->rects, &area ) == 0;
}