static int
test_constructor(char *buf, int len)
{
    Ewl_Widget *sp;
    int ret = 0;

    sp = ewl_scrollpane_new();

    if (!EWL_SCROLLPANE_IS(sp))
        LOG_FAILURE(buf, len, "returned widget is not of the type "
                    EWL_SCROLLPANE_TYPE);
    else if (ewl_scrollport_hscrollbar_flag_get(EWL_SCROLLPORT(sp))
             != EWL_SCROLLPORT_FLAG_AUTO_VISIBLE)
        LOG_FAILURE(buf, len, "horizontal scrollbar doesn't auto hide");
    else if (ewl_scrollport_vscrollbar_flag_get(EWL_SCROLLPORT(sp))
             != EWL_SCROLLPORT_FLAG_AUTO_VISIBLE)
        LOG_FAILURE(buf, len, "vertical scrollbar doesn't auto hide");
    else if (ewl_object_fill_policy_get(EWL_OBJECT(sp))
             != (EWL_FLAG_FILL_FILL | EWL_FLAG_FILL_SHRINK))
        LOG_FAILURE(buf, len, "fill policy is not FILL | SHRINK");
    else
        ret = 1;

    ewl_widget_destroy(sp);

    return ret;
}
예제 #2
0
void
eke_gui_ewl_feed_change(Eke *eke, Eke_Feed *feed)
{
    Eke_Gui_Ewl_Feed *disp;
    Eke_Feed_Item *item;
    Ewl_Widget *o;

    disp = ecore_hash_get(eke->feeds, feed);
    if (!disp->tab) {
        Ewl_Widget *o;

        disp->tab = ewl_text_new(feed->title);
        ewl_widget_show(disp->tab);

        o = ewl_vbox_new();
        ewl_notebook_page_append(EWL_NOTEBOOK(eke->gui.ewl.notebook),
                                                        disp->tab, o);
        ewl_widget_show(o);

        disp->page = ewl_scrollpane_new();
        ewl_container_child_append(EWL_CONTAINER(o), disp->page);
        ewl_object_insets_set(EWL_OBJECT(disp->page), 5, 5, 5, 5);
        ewl_widget_show(disp->page);
    }
    ewl_container_reset(EWL_CONTAINER(disp->page));

    ecore_list_first_goto(feed->items);
    while ((item = ecore_list_next(feed->items)) != NULL) {
        o = ewl_text_new(NULL);
        ewl_text_wrap_set(EWL_TEXT(o), 1);
        ewl_text_style_set(EWL_TEXT(o), "soft_shadow");
        ewl_text_text_set(EWL_TEXT(o), item->title);
        ewl_container_child_append(EWL_CONTAINER(disp->page), o);
        ewl_widget_show(o);

        if (item->link) {
            o = ewl_text_new(item->link);
            ewl_text_wrap_set(EWL_TEXT(o), 1);
            ewl_container_child_append(EWL_CONTAINER(disp->page), o);
            ewl_widget_show(o);
        }

        if (item->desc) {
            o = ewl_text_new(item->desc);
            ewl_text_wrap_set(EWL_TEXT(o), 1);
            ewl_container_child_append(EWL_CONTAINER(disp->page), o);
            ewl_widget_show(o);
        }

        o = ewl_text_new(" ");
        ewl_container_child_append(EWL_CONTAINER(disp->page), o);
        ewl_widget_show(o);
    }
}
예제 #3
0
static int
create_test(Ewl_Container *box)
{
        Ewl_Widget *o, *o2;

        o2 = ewl_button_new();
        ewl_stock_type_set(EWL_STOCK(o2), EWL_STOCK_OPEN);
        ewl_callback_append(o2, EWL_CALLBACK_CLICKED, cb_clicked, NULL);
        ewl_object_fill_policy_set(EWL_OBJECT(o2), EWL_FLAG_FILL_NONE);
        ewl_container_child_append(box, o2);
        ewl_widget_show(o2);

        o = ewl_scrollpane_new();
        ewl_container_child_append(box, o);
        ewl_widget_name_set(o, "scroll");
        ewl_widget_show(o);

        return 1;
}
예제 #4
0
파일: edvi_ewl_test.c 프로젝트: Limsik/e17
int
main (int argc, char *argv[])
{
  Ecore_List     *str_data = NULL;
  Ewl_Widget     *window;
  Ewl_Widget     *hbox;
  Ewl_Widget     *list;
  Ewl_Model      *model;
  Ewl_View       *view;
  Ewl_Widget     *dvi;
  Ewl_Widget     *sp;
  const Edvi_Document  *document;
  int             page_count;
  int             i;

  if (argc == 1) {
    printf ("Usage: %s dvi_file\n", argv[0]);
    return EXIT_FAILURE;
  }

  printf ("[DVI] version       : %s\n", edvi_version_get ());
  if (!edvi_init (300, "cx", 4,
                  1.0, 1.0,
                  0, 255, 255, 255, 0, 0, 0))
    return EXIT_FAILURE;

  ewl_init (&argc, (char **)argv);
  str_data = ecore_list_new();
  ecore_list_free_cb_set (str_data, free);

  /* We open the dvi file */
  dvi = ewl_dvi_new ();
  if (!ewl_dvi_file_set (EWL_DVI (dvi), argv[1])) {
    printf ("Can not load the document %s\nExiting...", argv[1]);
    ecore_list_destroy (str_data);
    ewl_main_quit();
    return EXIT_FAILURE;
  }

  window = ewl_window_new ();
  ewl_window_title_set (EWL_WINDOW (window), "Ewl Dvi Test Application");
  ewl_callback_append (window, EWL_CALLBACK_DELETE_WINDOW,
                       _quit_cb, str_data);

  hbox = ewl_hbox_new ();
  ewl_box_homogeneous_set (EWL_BOX (hbox), FALSE);
  ewl_container_child_append (EWL_CONTAINER (window), hbox);
  ewl_widget_show (hbox);

  sp = ewl_scrollpane_new ();
  ewl_container_child_append (EWL_CONTAINER (hbox), sp);
  ewl_widget_show (sp);

  document = ewl_dvi_dvi_document_get (EWL_DVI (dvi));
  page_count = edvi_document_page_count_get (document);
  for (i = 0; i < page_count; i++) {
    char row_text[64];
    char *txt;

    snprintf (row_text, 64, "%d", i + 1);
    txt = strdup (row_text);
    ecore_list_append(str_data, txt);
  }

  model = ewl_model_ecore_list_instance();
  view = ewl_label_view_get();

  list = ewl_list_new ();
  ewl_mvc_model_set(EWL_MVC(list), model);
  ewl_mvc_view_set(EWL_MVC(list), view);
  ewl_mvc_data_set(EWL_MVC(list), str_data);
  ewl_callback_append (list,
                       EWL_CALLBACK_VALUE_CHANGED,
                       EWL_CALLBACK_FUNCTION (_change_page_cb),
                       dvi);
  ewl_container_child_append (EWL_CONTAINER (sp), list);
  ewl_widget_show (list);

  ewl_dvi_mag_set (EWL_DVI (dvi), 0.5);
  ewl_container_child_append (EWL_CONTAINER (hbox), dvi);
  ewl_widget_show (dvi);

  ewl_widget_show (window);

  ewl_main ();

  edvi_shutdown ();

  return EXIT_SUCCESS;
}
예제 #5
0
static int
create_test(Ewl_Container *box)
{
        int i;
        const Freebox_Test fbtests[] = {
                {
                        "Manual Placement",
                        EWL_FREEBOX_LAYOUT_MANUAL,
                        NULL
                       },
                {
                        "Auto Placement",
                        EWL_FREEBOX_LAYOUT_AUTO,
                        NULL
                },
                {
                        "Comparator Placement (by name)",
                        EWL_FREEBOX_LAYOUT_COMPARATOR,
                        ewl_freebox_cb_compare
                },
                { NULL, EWL_FREEBOX_LAYOUT_AUTO, NULL }
        };

        srand(time(NULL));

        ewl_object_fill_policy_set(EWL_OBJECT(box), EWL_FLAG_FILL_ALL);

        for (i = 0; fbtests[i].name != NULL; i++) {
                Ewl_Widget *border, *hbox, *fb, *pane, *o;

                border  = ewl_border_new();
                ewl_border_label_set(EWL_BORDER(border),
                                (char *)fbtests[i].name);
                ewl_object_fill_policy_set(EWL_OBJECT(border), EWL_FLAG_FILL_FILL);
                ewl_container_child_append(EWL_CONTAINER(box), border);
                ewl_widget_show(border);

                /* nest the freebox in a scrollpane */
                pane = ewl_scrollpane_new();
                ewl_container_child_append(EWL_CONTAINER(border), pane);
                ewl_widget_show(pane);

                /* create a freebox of the type for this test */
                fb = ewl_freebox_new();
                ewl_freebox_layout_type_set(EWL_FREEBOX(fb), fbtests[i].type);
                if (fbtests[i].compare) {
                        ewl_freebox_comparator_set(EWL_FREEBOX(fb),
                                        fbtests[i].compare);
                        sort_fb = fb;
                }
                ewl_container_child_append(EWL_CONTAINER(pane), fb);
                ewl_widget_show(fb);

                /* pack controls for the freebox */
                hbox = ewl_hbox_new();
                ewl_container_child_append(EWL_CONTAINER(border), hbox);
                ewl_object_fill_policy_set(EWL_OBJECT(hbox),
                                EWL_FLAG_FILL_NONE);
                ewl_object_alignment_set(EWL_OBJECT(hbox), EWL_FLAG_ALIGN_TOP);
                ewl_widget_show(hbox);

                o = ewl_button_new();
                ewl_button_label_set(EWL_BUTTON(o), "Add items");
                ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
                ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_TOP);
                ewl_container_child_append(EWL_CONTAINER(hbox), o);
                ewl_callback_append(o, EWL_CALLBACK_CLICKED,
                                        ewl_freebox_cb_add, fb);
                ewl_widget_show(o);

                o = ewl_button_new();
                ewl_button_label_set(EWL_BUTTON(o), "Clear items");
                ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
                ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_TOP);
                ewl_container_child_append(EWL_CONTAINER(hbox), o);
                ewl_callback_append(o, EWL_CALLBACK_CLICKED,
                                        ewl_freebox_cb_clear, fb);
                ewl_widget_show(o);
        }

        return 1;
}
예제 #6
0
/*
 * Internal functions
 */
static Ewl_Widget *
help_reader_window_new(void)
{
    Ewl_Widget * win, * c, * w, * vbox;

    win = calloc(1, sizeof(Help_Reader_Window));
    ewl_window_init(EWL_WINDOW(win));
    ewl_object_size_request(EWL_OBJECT(win), 600, 500);
    ewl_window_name_set(EWL_WINDOW(win), "Elitaire Help");
    ewl_window_class_set(EWL_WINDOW(win), "Elitaire");
    ewl_callback_append(win, EWL_CALLBACK_DESTROY,
                        help_reader_window_cb_destroy, NULL);
    ewl_callback_append(win, EWL_CALLBACK_DELETE_WINDOW,
                        help_reader_window_cb_delete, NULL);
    ewl_widget_show(win);

    /* vbox to hold the toolbar and the text view */
    vbox = ewl_vbox_new();
    ewl_container_child_append(EWL_CONTAINER(win), vbox);
    ewl_widget_show(vbox);

    /* the toolbar */
    c = ewl_htoolbar_new();
    ewl_toolbar_icon_part_hide(EWL_TOOLBAR(c), EWL_ICON_PART_LABEL);
    ewl_container_child_append(EWL_CONTAINER(vbox), c);
    ewl_widget_show(c);

    /* the toolbar buttons */
    w = ewl_icon_simple_new();
    ewl_stock_type_set(EWL_STOCK(w), EWL_STOCK_ARROW_LEFT);
    ewl_callback_append(w, EWL_CALLBACK_CLICKED,
                        help_reader_prev_button_cb_clicked, win);
    ewl_container_child_append(EWL_CONTAINER(c), w);
    ewl_widget_disable(w);
    ewl_widget_show(w);
    HELP_READER_WINDOW(win)->prev_button = w;

    w = ewl_icon_simple_new();
    ewl_stock_type_set(EWL_STOCK(w), EWL_STOCK_ARROW_RIGHT);
    ewl_callback_append(w, EWL_CALLBACK_CLICKED,
                        help_reader_next_button_cb_clicked, win);
    ewl_container_child_append(EWL_CONTAINER(c), w);
    ewl_widget_disable(w);
    ewl_widget_show(w);
    HELP_READER_WINDOW(win)->next_button = w;

    w = ewl_icon_simple_new();
    ewl_stock_type_set(EWL_STOCK(w), EWL_STOCK_HOME);
    ewl_callback_append(w, EWL_CALLBACK_CLICKED,
                        help_reader_home_button_cb_clicked, win);
    ewl_container_child_append(EWL_CONTAINER(c), w);
    ewl_widget_show(w);

    /* the text view */
    c = ewl_scrollpane_new();
    ewl_container_child_append(EWL_CONTAINER(vbox), c);
    ewl_widget_show(c);

    w = ewl_text_new();
    ewl_container_child_append(EWL_CONTAINER(c), w);
    ewl_widget_show(w);

    HELP_READER_WINDOW(win)->text = w;

    /* the histroy */
    HELP_READER_WINDOW(win)->history = ecore_dlist_new();
    ecore_dlist_free_cb_set(HELP_READER_WINDOW(win)->history, free);

    return win;
}
예제 #7
0
파일: madpdf.c 프로젝트: quickhand/madpdf
int main ( int argc, char ** argv )
{	

    
    Ewl_Widget *vbox=NULL;
    Ewl_Widget *statbar=NULL;
    char *homedir;
    char *configfile;
    if(argc<2)
        return 1;
    
    if ( !ewl_init ( &argc, argv ) )
    {
        return 1;
    }

    //setlocale(LC_ALL, "");
    //textdomain("elementpdf");
    ewl_theme_theme_set(get_theme_file());
    
    homedir=getenv("HOME");
    configfile=(char *)calloc(strlen(homedir)+21 + 1, sizeof(char));
    strcat(configfile,homedir);
    strcat(configfile,"/.madpdf");
    
    if(!file_exists(configfile))
    {
        mkdir (configfile,S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH);
        
    }
    
    strcat(configfile,"/settings.xml");
    
    
    
    load_settings(configfile);
    
    win = ewl_window_new();
    ewl_window_title_set ( EWL_WINDOW ( win ), "EWL_WINDOW" );
    ewl_window_name_set ( EWL_WINDOW ( win ), "EWL_WINDOW" );
    ewl_window_class_set ( EWL_WINDOW ( win ), "EWLWindow" );
    ewl_object_size_request ( EWL_OBJECT ( win ), 600, 800 );
    ewl_callback_append ( win, EWL_CALLBACK_DELETE_WINDOW, destroy_cb, NULL );
    ewl_callback_append(win, EWL_CALLBACK_KEY_DOWN, cb_key_down, NULL);
    ewl_widget_name_set(win,"mainwindow");
    ewl_widget_show ( win );
 
    vbox=ewl_vbox_new();
    ewl_container_child_append(EWL_CONTAINER(win),vbox);
    ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_FILL);
    ewl_widget_show(vbox);
    
    scrollpane=ewl_scrollpane_new();
    ewl_container_child_append(EWL_CONTAINER(vbox),scrollpane);
    ewl_callback_append(scrollpane,EWL_CALLBACK_REVEAL,cb_scrollpane_revealed,NULL);
    ewl_scrollpane_hscrollbar_flag_set(EWL_SCROLLPANE(scrollpane),EWL_SCROLLPANE_FLAG_ALWAYS_HIDDEN);
    ewl_scrollpane_vscrollbar_flag_set(EWL_SCROLLPANE(scrollpane),EWL_SCROLLPANE_FLAG_ALWAYS_HIDDEN);
    //ewl_object_fill_policy_set(EWL_OBJECT(scrollpane), EWL_FLAG_FILL_FILL);
    //ewl_theme_data_str_set(EWL_WIDGET(scrollpane),"/scrollpane/group","ewl/blank");
    ewl_widget_show(scrollpane);
    
    trimpane=ewl_scrollpane_new();
    ewl_container_child_append(EWL_CONTAINER(scrollpane),trimpane);
    ewl_object_alignment_set(EWL_OBJECT(trimpane),EWL_FLAG_ALIGN_LEFT|EWL_FLAG_ALIGN_TOP);
    ewl_scrollpane_hscrollbar_flag_set(EWL_SCROLLPANE(trimpane),EWL_SCROLLPANE_FLAG_ALWAYS_HIDDEN);
    ewl_scrollpane_vscrollbar_flag_set(EWL_SCROLLPANE(trimpane),EWL_SCROLLPANE_FLAG_ALWAYS_HIDDEN);
    //ewl_theme_data_str_set(EWL_WIDGET(trimpane),"/scrollpane/group","ewl/blank");
    ewl_widget_show(trimpane);
    
    statbar=ewl_hbox_new();
    ewl_container_child_append(EWL_CONTAINER(vbox),statbar);
    ewl_theme_data_str_set(EWL_WIDGET(statbar),"/hbox/group","ewl/menu/oi_menu");
    ewl_object_fill_policy_set(EWL_OBJECT(statbar),EWL_FLAG_FILL_HFILL|EWL_FLAG_FILL_VSHRINKABLE);
    ewl_widget_show(statbar);
    
    statlabel1=ewl_label_new();   
    //ewl_statusbar_left_append(EWL_STATUSBAR(statbar),statlabel1);
    ewl_container_child_append(EWL_CONTAINER(statbar),statlabel1);
    ewl_theme_data_str_set(EWL_WIDGET(statlabel1),"/label/group","ewl/oi_statbar_label_left");
    ewl_theme_data_str_set(EWL_WIDGET(statlabel1),"/label/textpart","ewl/oi_statbar_label_left/text");
    ewl_object_fill_policy_set(EWL_OBJECT(statlabel1),EWL_FLAG_FILL_HSHRINKABLE);
    ewl_widget_show(statlabel1);
    
    statlabel2=ewl_label_new();   
    //ewl_statusbar_right_append(EWL_STATUSBAR(statbar),statlabel2);
    ewl_container_child_append(EWL_CONTAINER(statbar),statlabel2);
    ewl_theme_data_str_set(EWL_WIDGET(statlabel2),"/label/group","ewl/oi_statbar_label_right");
    ewl_theme_data_str_set(EWL_WIDGET(statlabel2),"/label/textpart","ewl/oi_statbar_label_right/text");
    ewl_object_fill_policy_set(EWL_OBJECT(statlabel2),EWL_FLAG_FILL_HFILL);
    ewl_widget_show(statlabel2);
    
    
    pdfwidget = ewl_pdf_new();
    ewl_pdf_file_set (EWL_PDF (pdfwidget), argv[1]);
    ewl_container_child_append(EWL_CONTAINER(trimpane),pdfwidget);
    ewl_object_alignment_set(EWL_OBJECT(pdfwidget),EWL_FLAG_ALIGN_LEFT|EWL_FLAG_ALIGN_TOP);
    ewl_widget_name_set(pdfwidget,"pdfwidget");
    ewl_callback_append (pdfwidget, EWL_CALLBACK_CONFIGURE, cb_pdfwidget_resized, NULL );
    ewl_widget_show (pdfwidget);
    
    //set up menu
    menu=ewl_context_menu_new();
    
    ewl_callback_append(menu, EWL_CALLBACK_KEY_DOWN, cb_menu_key_down, NULL);
    ewl_theme_data_str_set(EWL_WIDGET(menu),"/menu/group","ewl/menu/oi_menu");
    ewl_context_menu_attach(EWL_CONTEXT_MENU(menu), statbar);
    
    Ewl_Widget *temp=ewl_menu_new();
    ewl_container_child_append(EWL_CONTAINER(menu),temp);
    ewl_widget_name_set(temp,"menuitem1");
    ewl_button_label_set(EWL_BUTTON(temp),"1. Go to page...");
    ewl_widget_show(temp);

    goto_entry=ewl_entry_new();
    ewl_container_child_append(EWL_CONTAINER(temp),goto_entry);
    ewl_object_custom_w_set(EWL_OBJECT(goto_entry),50);
    ewl_callback_append(goto_entry, EWL_CALLBACK_KEY_DOWN, cb_goto_key_down, NULL);
    ewl_widget_show(goto_entry);
    
    
    temp=ewl_menu_item_new();
    ewl_widget_name_set(temp,"menuitem2");
    ewl_container_child_append(EWL_CONTAINER(menu),temp);
    ewl_button_label_set(EWL_BUTTON(temp),"2. Preferences...");
    ewl_widget_show(temp);

        
    
    
    ewl_main();
    save_settings(configfile);
    free(configfile);
    free_settings();
    return 0;
}