Пример #1
0
static LCUI_BOOL MouseProc( void )
{
#ifdef USE_THIS_CODE
	LCUI_Pos pos;
	POINT new_pos;

	/* 获取鼠标坐标 */
	GetCursorPos( &new_pos );
	/* 转换成相对于窗口客户区的坐标 */
	ScreenToClient( Win32_GetSelfHWND(), &new_pos );
	if (new_pos.x > LCUIDisplay_GetWidth() ) {
		new_pos.x = LCUIDisplay_GetWidth();
	}
	if( new_pos.y > LCUIDisplay_GetHeight() ) {
		new_pos.y = LCUIDisplay_GetHeight();
	}
	new_pos.x = new_pos.x<0 ? 0:new_pos.x;
	new_pos.y = new_pos.y<0 ? 0:new_pos.y;
	LCUICursor_GetPos( &pos );
	if( pos.x == new_pos.x && pos.y == new_pos.y ) {
		return FALSE;
	}
	pos.x = new_pos.x;
	pos.y = new_pos.y;
	/* 更新鼠标游标的位置 */
	LCUICursor_SetPos( pos );
	LCUI_PostMouseMoveEvent( pos );
#endif
	return TRUE;
}
Пример #2
0
/*
 * 功能:用于对LCUI进行初始化操作
 * 说明:每个使用LCUI实现图形界面的程序,都需要先调用此函数进行LCUI的初始化
 * */
int LCUI_Init(void)
{
	if( System.is_inited ) {
		return -1;
	}
	System.is_inited = TRUE;
	System.func_atexit = NULL;
	System.exit_code = 0;
	System.state = STATE_ACTIVE;
	System.main_tid = LCUIThread_SelfID();
	LCUI_ShowCopyrightText();
	LCUIApp_Init();
	/* 初始化各个模块 */
	LCUI_InitEvent();
	LCUI_InitFont();
	LCUI_InitTimer();
	LCUI_InitDevice();
	LCUI_InitKeyboard();
	LCUI_InitMouse();
	LCUI_InitCursor();
	LCUI_InitWidget();
	LCUI_InitDisplay();
	{
		LCUI_Pos pos;
		pos.x = LCUIDisplay_GetWidth()/2;
		pos.y = LCUIDisplay_GetHeight()/2;
		/* 让鼠标游标居中显示 */
		LCUICursor_SetPos( pos );
		LCUICursor_Show();
	}
	return 0;
}
Пример #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;
}