/* 退出程序 */ static int LCUIApp_Quit(void) { LCUI_App *app; app = LCUIApp_GetSelf(); if( !app ) { printf("%s (): %s", __FUNCTION__, APP_ERROR_UNRECORDED_APP); return -1; } LCUIAppList_Delete(app->id); /* 如果程序列表为空,就退出LCUI */ if (Queue_Empty(&LCUI_Sys.app_list)) { LCUI_Quit(); } return 0; }
static LRESULT CALLBACK Win32_LCUI_WndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ) { PAINTSTRUCT ps; LCUI_Rect area; switch (message) { case WM_KEYDOWN: printf("WM_KEYDOWN: %ld\n",wParam); LCUIKeyboard_HitKey( wParam ); return 0; case WM_KEYUP: printf("WM_KEYUP: %ld\n",wParam); LCUIKeyboard_FreeKey( wParam ); return 0; case WM_RBUTTONDOWN: Win32_LCUIMouse_ButtonDown( LCUIKEY_RIGHTBUTTON ); return 0; case WM_RBUTTONUP: Win32_LCUIMouse_ButtonUp( LCUIKEY_RIGHTBUTTON ); return 0; case WM_LBUTTONDOWN: //_DEBUG_MSG("left button down\n"); Win32_LCUIMouse_ButtonDown( LCUIKEY_LEFTBUTTON ); return 0; case WM_LBUTTONUP: //_DEBUG_MSG("left button up\n"); Win32_LCUIMouse_ButtonUp( LCUIKEY_LEFTBUTTON ); return 0; case WM_PAINT: DEBUG_MSG("WM_PAINT\n"); BeginPaint( hwnd, &ps ); /* 获取区域坐标及尺寸 */ area.x = ps.rcPaint.left; area.y = ps.rcPaint.top; area.width = ps.rcPaint.right - area.x; area.height = ps.rcPaint.bottom - area.y; LCUIScreen_InvalidArea( area ); EndPaint( hwnd, &ps ); return 0; case WM_DESTROY: PostQuitMessage(0); LCUI_Quit(); return 0; default:break; } return DefWindowProc (hwnd, message, wParam, lParam) ; }
static LRESULT CALLBACK WndProc( HWND hwnd, UINT msg, WPARAM arg1, LPARAM arg2 ) { MSG win_ev; switch( msg ) { case WM_LCUI_EVENT: return 0; case WM_CLOSE: LCUI_Quit(); default:break; } win_ev.hwnd = hwnd; win_ev.wParam = arg1; win_ev.lParam = arg2; win_ev.message = msg; if( EventTrigger_Trigger( win.trigger, msg, &win_ev ) == 0 ) { return DefWindowProc( hwnd, msg, arg1, arg2 ); } return 0; }
void LCUI_Exit( int exit_code ) { System.exit_code = exit_code; LCUI_Quit(); }