int main (int argc, char *argv[]) { LiteWindow *window; int timeout = 0; if (argc > 1) { if ( (strcmp(argv[1], "timeout") == 0) ) timeout = TIMEOUT; } ltest_start_timer("Init LiTE"); if( lite_open(&argc, &argv) ) return 1; ltest_stop_timer(); window = ltest_create_main_window("Cursor Unit Test"); run_cursor_tests(window); run_cursor_performance_tests(window); ltest_display_timestamps(); lite_window_event_loop(window, timeout); lite_destroy_window(window); lite_close(); ltest_print_timestamps(); return 0; }
int main (int argc, char *argv[]) { LiteLabel *label; LiteTextLine *textline; DFBRectangle rect; DFBResult res; /* initialize */ if (lite_open( &argc, &argv )) return 1; /* create a window */ rect.x = LITE_CENTER_HORIZONTALLY; rect.y = LITE_CENTER_VERTICALLY, rect.w = 300; rect.h = 40; res = lite_new_window( NULL, &rect, DWCAPS_ALPHACHANNEL, liteDefaultWindowTheme, "Run program...", &window ); /* setup the label */ rect.x = 10; rect.y = 12; rect.w = 60; res = lite_new_label(LITE_BOX(window), &rect, liteNoLabelTheme, 14, &label ); lite_set_label_text( label, "Program" ); /* setup the textline */ rect.x = 70; rect.y = 9; rect.w = 220; rect.h = 22; res = lite_new_textline(LITE_BOX(window), &rect, liteNoTextLineTheme, &textline); lite_on_textline_enter( textline, on_enter, NULL ); lite_on_textline_abort( textline, on_abort, NULL ); lite_focus_box( LITE_BOX(textline) ); /* show the window */ lite_set_window_opacity( window, liteFullWindowOpacity ); window->window->RequestFocus( window->window ); /* run the default event loop */ lite_window_event_loop( window, 0 ); /* destroy the window with all this children and resources */ lite_destroy_window( window ); /* deinitialize */ lite_close(); return 0; }
int main (int argc, char *argv[]) { LiteWindow *window; LiteLabel *label; DFBRectangle rect; int timeout = 0; if (argc > 1) { if ( (strcmp(argv[1], "timeout") == 0) ) timeout = TIMEOUT; } ltest_start_timer("Init LiTE"); if( lite_open(&argc, &argv) ) return 1; ltest_stop_timer(); rect.x = 0; rect.y = 0; rect.w = 800; rect.h = 480; ltest_start_timer("New Window"); LTEST("New Window", lite_new_window(NULL, &rect, DWCAPS_ALPHACHANNEL, liteDefaultWindowTheme, "LiteWindow test", &window)); ltest_stop_timer(); ltest_start_timer("Set Opacities in Window"); LTEST("Set Window Some Opacity", lite_set_window_opacity(window, 0x99)); LTEST("Set Window No Opacity", lite_set_window_opacity(window, liteNoWindowOpacity)); LTEST("Set Window Full Opacity", lite_set_window_opacity(window, liteFullWindowOpacity)); ltest_stop_timer(); rect.x = 10; rect.y = 10; rect.w = 400; ltest_start_timer("New Label and set Text"); LTEST("New Label", lite_new_label(LITE_BOX(window), &rect, liteNoLabelTheme, 20, &label)); LTEST("Set Label Text", lite_set_label_text(label, "Testing LiteWindow")); ltest_stop_timer(); ltest_display_timestamps(); lite_window_event_loop(window, timeout); LTEST("Destroy Window", lite_destroy_window(window)); LTEST("Close LiTE", lite_close()); ltest_print_timestamps(); return 0; }
static void on_enter( const char *text, void *ctx ) { int i = 0; int len = strlen(text); char *buf, *p, *args[len+1]; if (len < 1) return; buf = p = strdup( text ); while (*p) { if (*p == ' ') { *p++ = 0; continue; } args[i++] = p++; while (*p && *p != ' ') p++; } if (i < 1) return; /* destroy the window with all this children and resources */ lite_destroy_window( window ); /* deinitialize */ lite_close(); args[i] = NULL; execvp( args[0], args ); perror( "execvp" ); exit(-1); }
int main (int argc, char *argv[]) { LiteButton *button; LiteImage *image; LiteLabel *label; LiteTextLine *textline; LiteWindow *window; DFBRectangle rect; DFBResult res; /* initialize */ if (lite_open( &argc, &argv )) return 1; /* create a window */ rect.x = LITE_CENTER_HORIZONTALLY; rect.y = LITE_CENTER_VERTICALLY; rect.w = 300; rect.h = 200; res = lite_new_window( NULL, &rect, DWCAPS_ALPHACHANNEL, liteDefaultWindowTheme, "Simple", &window ); /* setup the label */ rect.x = 10; rect.y = 10; rect.w = 110; res = lite_new_label(LITE_BOX(window), &rect, liteNoLabelTheme, 20, &label); lite_set_label_text( label, "Hello World" ); /* setup the textline */ rect.x = 10; rect.y = 40; rect.w = 100; rect.h = 20; res = lite_new_textline(LITE_BOX(window), &rect, liteNoTextLineTheme, &textline); rect.x = 10; rect.y = 60; rect.w = 100; rect.h = 20; res = lite_new_textline(LITE_BOX(window), &rect, liteNoTextLineTheme, &textline); /* setup the button */ rect.x = 180; rect.y = 130; rect.w = 50; rect.h = 50; res = lite_new_button(LITE_BOX(window), &rect, liteNoButtonTheme, &button); lite_set_button_image( button, LITE_BS_NORMAL, EXAMPLESDATADIR "/stop.png" ); lite_set_button_image( button, LITE_BS_DISABLED, EXAMPLESDATADIR "/stop_disabled.png" ); lite_set_button_image( button, LITE_BS_HILITE, EXAMPLESDATADIR "/stop_highlighted.png" ); lite_set_button_image( button, LITE_BS_PRESSED, EXAMPLESDATADIR "/stop_pressed.png" ); lite_on_button_press( button, button_pressed, window ); /* 2nd button */ rect.x = 230; rect.y = 130; rect.w = 50; rect.h = 50; res = lite_new_button(LITE_BOX(window), &rect, liteNoButtonTheme, &button); lite_set_button_type( button, LITE_BT_TOGGLE ); lite_set_button_image( button, LITE_BS_NORMAL, EXAMPLESDATADIR "/toggle.png" ); lite_set_button_image( button, LITE_BS_DISABLED, EXAMPLESDATADIR "/toggle_disabled.png" ); lite_set_button_image( button, LITE_BS_HILITE, EXAMPLESDATADIR "/toggle_highlighted.png" ); lite_set_button_image( button, LITE_BS_PRESSED, EXAMPLESDATADIR "/toggle_pressed.png" ); lite_set_button_image( button, LITE_BS_HILITE_ON, EXAMPLESDATADIR "/toggle_highlighted_on.png" ); lite_set_button_image( button, LITE_BS_DISABLED_ON, EXAMPLESDATADIR "/toggle_disabled_on.png" ); lite_on_button_press( button, toggle_button_pressed, window ); /* setup the image */ rect.x = 200; rect.y = 20; rect.w = 64; rect.h = 50; res = lite_new_image(LITE_BOX(window), &rect, liteNoImageTheme, &image); lite_load_image( image, EXAMPLESDATADIR "/D.png" ); /* show the window */ lite_set_window_opacity( window, liteFullWindowOpacity ); /* run the default event loop */ lite_window_event_loop( window, 0 ); /* destroy the window with all this children and resources */ lite_destroy_window( window ); /* deinitialize */ lite_close(); return 0; }
static int onExit(activity *act) { DFBResult res; res = lite_destroy_window(act->window); return MKD_OK; }