Files
LCUI/test/helloworld.c
T
2016-01-02 20:04:09 +08:00

45 lines
976 B
C
Executable File

#include <LCUI_Build.h>
#include <LCUI/LCUI.h>
#include <LCUI/display.h>
#include <LCUI/gui/widget.h>
#include <LCUI/gui/builder.h>
#ifdef LCUI_BUILD_IN_WIN32
#include <io.h>
#include <fcntl.h>
/* 在运行程序时会打开控制台,以查看打印的调试信息 */
static void InitConsoleWindow(void)
{
int hCrt;
FILE *hf;
AllocConsole();
hCrt=_open_osfhandle((long)GetStdHandle(STD_OUTPUT_HANDLE),_O_TEXT );
hf=_fdopen( hCrt, "w" );
*stdout=*hf;
setvbuf (stdout, NULL, _IONBF, 0);
// test code
printf ("InitConsoleWindow OK!\n");
}
#endif
int main( int argc, char **argv )
{
LCUI_Widget root, box;
#ifdef LCUI_BUILD_IN_WIN32
InitConsoleWindow();
#endif
LCUI_Init();
LCUIDisplay_SetMode( LDM_WINDOWED );
LCUIDisplay_SetSize( 960, 540 );
box = LCUIBuilder_LoadFile("hello.xml");
if( box ) {
root = LCUIWidget_GetRoot();
Widget_Append( root, box );
Widget_Unwrap( &box );
}
return LCUI_Main();
}