int main(int argc, char **argv) { LCUI_Widget *window; /* 载入图像资源 */ LoadIMG(); /* 初始化LCUI */ LCUI_Init(350,280,0); /* 创建窗口 */ window = Widget_New("window"); /* 设置窗口背景色 */ Widget_SetBackgroundColor( window, RGB(255,255,255) ); /* 调整窗口尺寸 */ Widget_Resize( window, Size(320, 240) ); /* 设置窗口为线条边框风格 */ Widget_SetStyleID( window, WINDOW_STYLE_NONE ); /* 将界面创建至窗口内 */ CreateGUI( window ); /* 设置定时器,用于定时更新时间显示 */ LCUITimer_Set( 1000, UpdateTimeView, NULL, TRUE ); /* 设置定时器,用于更新滑块的位置 */ LCUITimer_Set( 20, PicBtn_UpdatePos, NULL, TRUE ); /* 显示窗口 */ Widget_Show( window ); /* 在LCUI退出时释放图像资源 */ LCUIApp_AtQuit( FreeIMG ); return LCUI_Main(); }
int test_widget_rect( void ) { int i, ret = 0; float values[3] = { 1.0f, 1.5f, 2.0f }; for( i = 0; i < 3; ++i ) { memset( &self, 0, sizeof( self ) ); TEST_LOG( "test widget rectagle in " "%g%% scaling mode\n", values[i] * 100 ); LCUI_Init(); #ifdef _WIN32 Logger_SetHandler( LoggerHandler ); Logger_SetHandlerW( LoggerHandlerW ); #endif self.widget = create_widget(); LCUIMetrics_SetScale( values[i] ); LCUIDisplay_SetSize( SCREEN_WIDTH, SCREEN_HEIGHT ); /* 等一段时间后再开始测试,避免初始化 LCUI 时产生的脏矩形影响测试结果 */ LCUITimer_Set( 100, start_test, NULL, FALSE ); LCUIWidget_Update(); if( LCUI_Main() != 0 ) { ret -= 1; } } return ret; }
static void OnStartSyncFiles( void *privdata, void *data ) { if( self.is_syncing ) { return; } self.is_syncing = TRUE; self.timer = LCUITimer_Set( 200, OnUpdateStats, NULL, TRUE ); LCUIThread_Create( &self.thread, FileSyncThread, NULL ); }
static void FileSyncThread( void *arg ) { LCUI_Widget alert = self.text->parent; TextView_SetTextW( self.title, TEXT_STARED ); Widget_RemoveClass( alert, "hide" ); LCFinder_SyncFiles( &self.status ); OnUpdateStats( NULL ); LCUITimer_Free( self.timer ); TextView_SetTextW( self.title, TEXT_FINISHED ); LCUITimer_Set( 3000, OnHideTip, NULL, FALSE ); self.is_syncing = FALSE; self.timer = 0; LCFinder_TriggerEvent( EVENT_SYNC_DONE, NULL ); }