Exemplo n.º 1
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;
}
Exemplo n.º 2
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;
}
Exemplo n.º 3
0
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;
}
Exemplo n.º 4
0
void *BrowserMain(void * argument)
{
    printf("%s:%d\n", __func__, __LINE__);

    int argc = 0;
    char**argv = NULL;


    pthread_mutex_init (&mutex, NULL);
    
    g_type_init();
    g_thread_init(NULL);

    lite_open( &argc, &argv );

    WebKitDFB_Initialize( lite_get_dfb_interface() );

    IDirectFBDisplayLayer *layer;
    DFBDisplayLayerConfig  config;
    lite_get_layer_interface( &layer );
    layer->GetConfiguration( layer, &config );

    DFBRectangle windowRect        = {   0,  0, config.width, config.height };
    DFBRectangle webviewRect       = {   0,  0, config.width, config.height };

    lite_new_window( NULL, &windowRect, DWCAPS_NONE, liteNoWindowTheme, "WebKitDFB", &g_window );
    
    lite_new_webview( LITE_BOX(g_window), &webviewRect, liteDefaultWebViewTheme, &g_webview);

    lite_on_webview_doc_loaded ( g_webview, on_webview_doc_loaded, NULL );

    lite_on_raw_window_keyboard(g_window, on_key_press, g_webview );

    lite_focus_box( LITE_BOX(g_webview) );

    lite_set_window_opacity(g_window, 0xff);

    g_window->bg.enabled = DFB_FALSE;
    //lite_set_window_background_color(g_window, 0xff, 0, 0, 0xff);

    registerJsFunctions(g_webview, g_Callback);

    lite_webview_load(g_webview, g_url);
    lite_webview_set_transparent(g_webview, true);

    // FAKE KEY INTERFACE
    //IDirectFB *dfb;
    //dfb = lite_get_dfb_interface();
    //IDirectFBDisplayLayer *layer = NULL;
    //dfb->GetDisplayLayer(dfb, DLID_PRIMARY, &layer);
    layer->GetWindow(layer, 1, &g_dfb_window);

    lite_enqueue_window_timeout(200, timeout_cb, NULL, &timer_id);
    g_run = 1;
    while (g_run) {
        pthread_mutex_lock(&mutex);

        g_main_context_iteration(NULL, FALSE);
        lite_window_event_loop(g_window, 1);
        pthread_mutex_unlock(&mutex);
    }

   lite_close();

   return NULL;
}