Exemplo n.º 1
0
Arquivo: madpdf.c Projeto: avm/madpdf
void update_statusbar()
{
    static char statlabel1str[100];
    sprintf(statlabel1str,"MadPDF (OK for Menu)");
    ewl_label_text_set(EWL_LABEL(statlabel1),statlabel1str);
    
    int curpage,totalpage;
    curpage=ewl_pdf_page_get(EWL_PDF(pdfwidget))+1;
    totalpage=epdf_document_page_count_get(ewl_pdf_pdf_document_get(EWL_PDF(pdfwidget)));
    
    static char statlabel2str[100];
    sprintf(statlabel2str,"pg: %d/%d  zoom: %d%%  ",curpage,totalpage,(int)round(curscale*100.0));
    double hpos,vpos;
    int leftarr=0,rightarr=0,downarr=0,uparr=0;
    if(CURRENT_W(trimpane)>CURRENT_W(scrollpane))
    {
        hpos=ewl_scrollpane_hscrollbar_value_get(EWL_SCROLLPANE(scrollpane));
        if(hpos>0.0)
        {
            leftarr=1;
        }
        if(hpos<1.0)
        {
            rightarr=1;    
        }
        
    }
    if(CURRENT_H(trimpane)>CURRENT_H(scrollpane))
    {
        vpos=ewl_scrollpane_vscrollbar_value_get(EWL_SCROLLPANE(scrollpane));
        if(vpos>0.0)
        {
            uparr=1;
        }
        if(vpos<1.0)
        {
            downarr=1;    
        }
        
    }
    if(leftarr||rightarr||downarr||uparr)
        strcat(statlabel2str,"pan: ");
    else
        strcat(statlabel2str,"pan: none");
    if(leftarr)
        strcat(statlabel2str,"←");
    if(rightarr)
        strcat(statlabel2str,"→");
    if(downarr)
        strcat(statlabel2str,"↓");
    if(uparr)
        strcat(statlabel2str,"↑");
    ewl_label_text_set(EWL_LABEL(statlabel2),statlabel2str);
}
Exemplo n.º 2
0
general_panel* generalpanel_create(main_window *win)
{
	Ewl_Widget *vbox, *label;
	general_panel* pnl;

	pnl=malloc(sizeof(general_panel));

        pnl->win = win;

	vbox = ewl_vbox_new();
	pnl->frame = vbox;

        pnl->notebook = ewl_notebook_new();
        ewl_container_child_append(EWL_CONTAINER(vbox), pnl->notebook);

        pnl->dns = dnspanel_create();
        pnl->boot = bootpanel_create(win);
        pnl->about = aboutpanel_create();

        label = ewl_label_new();
        ewl_label_text_set(EWL_LABEL(label), _("DNS (Dynamic Name Server)"));
        ewl_widget_show(label);

        ewl_container_child_append(EWL_CONTAINER(pnl->notebook), pnl->dns->frame);
        ewl_notebook_page_tab_widget_set(EWL_NOTEBOOK(pnl->notebook) ,pnl->dns->frame, label);

        label = ewl_label_new();
        ewl_label_text_set(EWL_LABEL(label), _("Boot process"));
        ewl_widget_show(label);

        ewl_container_child_append(EWL_CONTAINER(pnl->notebook), pnl->boot->frame);
        ewl_notebook_page_tab_widget_set(EWL_NOTEBOOK(pnl->notebook) ,pnl->boot->frame, label);


        label = ewl_label_new();
        ewl_label_text_set(EWL_LABEL(label), _("About"));
        ewl_widget_show(label);

        ewl_container_child_append(EWL_CONTAINER(pnl->notebook), pnl->about->frame);
        ewl_notebook_page_tab_widget_set(EWL_NOTEBOOK(pnl->notebook) ,pnl->about->frame, label);

        ewl_widget_show(pnl->frame);
        ewl_widget_show(pnl->notebook);
        ewl_widget_show(pnl->about->frame);
        ewl_widget_show(label);

        return pnl;
}
Exemplo n.º 3
0
/**
 * @param b: the border to retrieve the label text
 * @return Returns the border label text on success, NULL on failure.
 * @brief Get the label from a border widget
 */
const char *
ewl_border_label_get(Ewl_Border *b)
{
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET(b, NULL);
        DCHECK_TYPE_RET(b, EWL_BORDER_TYPE, NULL);

        DRETURN_PTR(ewl_label_text_get(EWL_LABEL(b->label)), DLEVEL_STABLE);
}
Exemplo n.º 4
0
/**
 * @param b: the border widget to change the text
 * @param t: the text to set for the border label
 * @return Returns no value.
 * @brief Set the label for the border
 *
 * Change the text of the border label to the string @a t.
 */
void
ewl_border_label_set(Ewl_Border *b, const char *t)
{
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR(b);
        DCHECK_TYPE(b, EWL_BORDER_TYPE);

        ewl_label_text_set(EWL_LABEL(b->label), t);

        DLEAVE_FUNCTION(DLEVEL_STABLE);
}
Exemplo n.º 5
0
static void _hseeker_cb(Ewl_Widget * w, void * event, void * data)
{
    double value;
    char buffer[10];
    const char * name;

    value = ewl_range_value_get(EWL_RANGE(w));

    name = ewl_widget_name_get(w);
    if (!strcmp(name, "velocity")) {
        config.velocity = (int) value ;
        snprintf(buffer, 10, "%i", config.velocity);
        ewl_label_text_set(EWL_LABEL(config.vel_label), buffer);
    }
    else if (!strcmp(name, "frame_rate")) {
        config.frame_rate = (int) value ;
        snprintf(buffer, 10, "%i", config.frame_rate);
        ewl_label_text_set(EWL_LABEL(config.frt_label), buffer);
    }
}
Exemplo n.º 6
0
/**
 * @param n: The Ewl_Notebook to work with
 * @param page: The page to get the tab text from
 * @return Returns the text of the pages tab
 * @brief Get the text of the notebook page @p page
 */
const char *
ewl_notebook_page_tab_text_get(Ewl_Notebook *n, Ewl_Widget *page)
{
        Ewl_Widget *o;

        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET(n, EWL_NOTEBOOK_TYPE);
        DCHECK_PARAM_PTR_RET(page, EWL_WIDGET_TYPE);
        DCHECK_TYPE_RET(n, EWL_NOTEBOOK_TYPE, NULL);
        DCHECK_TYPE_RET(page, EWL_WIDGET_TYPE, NULL);

        /* get the label widget */
        o = ewl_notebook_page_tab_widget_get(n, page);

        DRETURN_PTR((o ? ewl_label_text_get(EWL_LABEL(o)) : NULL), DLEVEL_STABLE);
}
Exemplo n.º 7
0
/**
 * @param n: The Ewl_Notebook to set the tab text in
 * @param page: The page to associate the tab text too
 * @param text: The text to set in the tab
 * @return Returns no value.
 * @brief Set the text of the tab for the page @p page to the text @p text
 */
void
ewl_notebook_page_tab_text_set(Ewl_Notebook *n, Ewl_Widget *page,
                                                        const char *text)
{
        Ewl_Widget *t = NULL;

        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR(n);
        DCHECK_PARAM_PTR(page);
        DCHECK_TYPE(n, EWL_NOTEBOOK_TYPE);
        DCHECK_TYPE(page, EWL_WIDGET_TYPE);

        if (text)
        {
                t = ewl_label_new();
                ewl_label_text_set(EWL_LABEL(t), text);
                ewl_widget_show(t);
        }

        ewl_notebook_page_tab_widget_set(n, page, t);

        DLEAVE_FUNCTION(DLEVEL_STABLE);
}
Exemplo n.º 8
0
static int
create_test(Ewl_Container *box)
{
        Ewl_Widget *menu1, *menu2, *menu3, *item;

        item = ewl_label_new();
        ewl_label_text_set(EWL_LABEL(item), "");
        ewl_widget_name_set(item, "menu_label");
        ewl_container_child_append(EWL_CONTAINER(box), item);
        ewl_widget_show(item);

        menu1 = ewl_menu_new();
        ewl_button_image_set(EWL_BUTTON(menu1),
                        ewl_test_image_get("Draw.png"), NULL);
        ewl_button_label_set(EWL_BUTTON(menu1), "Test Menu");
        ewl_container_child_append(EWL_CONTAINER(box), menu1);
        ewl_object_fill_policy_set(EWL_OBJECT(menu1), EWL_FLAG_FILL_NONE);
        ewl_widget_show(menu1);

        item = ewl_menu_item_new();
        ewl_button_image_set(EWL_BUTTON(item),
                        ewl_test_image_get("Open.png"), NULL);
        ewl_button_label_set(EWL_BUTTON(item), "Dia");
        ewl_container_child_append(EWL_CONTAINER(menu1), item);
        ewl_callback_append(item, EWL_CALLBACK_CLICKED, cb_menu_clicked, NULL);
        ewl_widget_show(item);

        item = ewl_menu_item_new();
        ewl_button_image_set(EWL_BUTTON(item),
                                ewl_test_image_get("Package.png"), NULL);
        ewl_button_label_set(EWL_BUTTON(item), "Gimp");
        ewl_container_child_append(EWL_CONTAINER(menu1), item);
        ewl_callback_append(item, EWL_CALLBACK_CLICKED, cb_menu_clicked, NULL);
        ewl_widget_show(item);

        item = ewl_menu_item_new();
        ewl_stock_type_set(EWL_STOCK(item), EWL_STOCK_OK);
        ewl_container_child_append(EWL_CONTAINER(menu1), item);
        ewl_callback_append(item, EWL_CALLBACK_CLICKED, cb_menu_clicked, NULL);
        ewl_widget_show(item);

        item = ewl_hseparator_new();
        ewl_container_child_append(EWL_CONTAINER(menu1), item);
        ewl_widget_show(item);

        item = ewl_menu_item_new();
        ewl_button_label_set(EWL_BUTTON(item), "Button");
        ewl_container_child_append(EWL_CONTAINER(menu1), item);
        ewl_callback_append(item, EWL_CALLBACK_CLICKED, cb_menu_clicked, NULL);
        ewl_widget_show(item);

        /* Create a sub-menu */
        menu2 = ewl_menu_new();
        ewl_button_label_set(EWL_BUTTON(menu2), "Sub Menu");
        ewl_container_child_append(EWL_CONTAINER(menu1), menu2);
        ewl_widget_show(menu2);

        item = ewl_menu_item_new();
        ewl_button_label_set(EWL_BUTTON(item), "Button 1");
        ewl_container_child_append(EWL_CONTAINER(menu2), item);
        ewl_callback_append(item, EWL_CALLBACK_CLICKED, cb_menu_clicked, NULL);
        ewl_widget_show(item);

        item = ewl_menu_item_new();
        ewl_button_label_set(EWL_BUTTON(item), "Button 2");
        ewl_container_child_append(EWL_CONTAINER(menu2), item);
        ewl_callback_append(item, EWL_CALLBACK_CLICKED, cb_menu_clicked, NULL);
        ewl_widget_show(item);

        /* create a sub-sub-menu */
        menu3 = ewl_menu_new();
        ewl_button_label_set(EWL_BUTTON(menu3), "Sub Sub Menu");
        ewl_container_child_append(EWL_CONTAINER(menu2), menu3);
        ewl_widget_show(menu3);

        item = ewl_menu_item_new();
        ewl_button_label_set(EWL_BUTTON(item), "Sub Button 1");
        ewl_container_child_append(EWL_CONTAINER(menu3), item);
        ewl_callback_append(item, EWL_CALLBACK_CLICKED, cb_menu_clicked, NULL);
        ewl_widget_show(item);

        item = ewl_menu_item_new();
        ewl_button_label_set(EWL_BUTTON(item), "Sub Button 2");
        ewl_container_child_append(EWL_CONTAINER(menu3), item);
        ewl_callback_append(item, EWL_CALLBACK_CLICKED, cb_menu_clicked, NULL);
        ewl_widget_show(item);

        /* Create a sub-menu */
        menu2 = ewl_menu_new();
        ewl_button_label_set(EWL_BUTTON(menu2), "Sub Menu2");
        ewl_container_child_append(EWL_CONTAINER(menu1), menu2);
        ewl_widget_show(menu2);

        item = ewl_menu_item_new();
        ewl_button_label_set(EWL_BUTTON(item), "Button 2-1");
        ewl_container_child_append(EWL_CONTAINER(menu2), item);
        ewl_callback_append(item, EWL_CALLBACK_CLICKED, cb_menu_clicked, NULL);
        ewl_widget_show(item);

        item = ewl_menu_item_new();
        ewl_button_label_set(EWL_BUTTON(item), "Button 2-2");
        ewl_container_child_append(EWL_CONTAINER(menu2), item);
        ewl_callback_append(item, EWL_CALLBACK_CLICKED, cb_menu_clicked, NULL);
        ewl_widget_show(item);

        return 1;
}
Exemplo n.º 9
0
eth_panel* ethpanel_create(main_window* win)
{
    Ewl_Widget *hbox,*grid;
    Ewl_Widget *label;
    eth_panel* pnl;
    pnl=(eth_panel*)malloc((unsigned int)sizeof(eth_panel));

    pnl->interface = NULL;
    pnl->win = win;
    pnl->frame = ewl_border_new();
    pnl->apply = 0;
    ewl_border_label_set(EWL_BORDER(pnl->frame),"hehe");
    ewl_widget_show(pnl->frame);

    pnl->box_configuration = ewl_vbox_new();
    ewl_container_child_append(EWL_CONTAINER(pnl->frame), pnl->box_configuration);
    ewl_widget_show(pnl->box_configuration);
    ewl_object_fill_policy_set(EWL_OBJECT(pnl->box_configuration), EWL_FLAG_FILL_HFILL);
    ewl_object_alignment_set(EWL_OBJECT(pnl->box_configuration),EWL_FLAG_ALIGN_LEFT);


    //#########################################
    //## box_configuration: box_activate ##
    //#########################################
    pnl->box_activate = ewl_hbox_new();
    ewl_container_child_append(EWL_CONTAINER(pnl->box_configuration), pnl->box_activate);
    pnl->btn_activate = ewl_button_new();
    ewl_button_label_set(EWL_BUTTON(pnl->btn_activate),_("Activate"));
    ewl_object_fill_policy_set(EWL_OBJECT(pnl->btn_activate), EWL_FLAG_FILL_SHRINK);

    pnl->btn_deactivate = ewl_button_new();
    ewl_button_label_set(EWL_BUTTON(pnl->btn_deactivate),_("Deactivate"));
    ewl_object_fill_policy_set(EWL_OBJECT(pnl->btn_deactivate), EWL_FLAG_FILL_SHRINK);

    ewl_container_child_append(EWL_CONTAINER(pnl->box_activate), pnl->btn_deactivate);
    ewl_container_child_append(EWL_CONTAINER(pnl->box_activate), pnl->btn_activate);
    ewl_widget_show(pnl->btn_activate);
    ewl_widget_show(pnl->btn_deactivate);
    ewl_widget_show(pnl->box_activate);
    ewl_callback_append(pnl->btn_activate, EWL_CALLBACK_CLICKED,
            ethpanel_btn_activate_clicked_cb, pnl);
    ewl_callback_append(pnl->btn_deactivate, EWL_CALLBACK_CLICKED,
            ethpanel_btn_deactivate_clicked_cb, pnl);



    //###################################################
    //## box_configuration: check list (static / dhcp) ##
    //###################################################

    hbox = ewl_hbox_new();
    ewl_container_child_append(EWL_CONTAINER(pnl->box_configuration), hbox);

    pnl->check_static = ewl_radiobutton_new();
    ewl_button_label_set(EWL_BUTTON(pnl->check_static),_("Static address"));
    pnl->check_dhcp = ewl_radiobutton_new();
    ewl_button_label_set(EWL_BUTTON(pnl->check_dhcp),_("DHCP (Automatic configuration)"));
    ewl_radiobutton_chain_set(EWL_RADIOBUTTON(pnl->check_dhcp),
                              EWL_RADIOBUTTON(pnl->check_static));
    ewl_container_child_append(EWL_CONTAINER(hbox), pnl->check_static);
    ewl_container_child_append(EWL_CONTAINER(hbox), pnl->check_dhcp);
    ewl_widget_show(hbox);
    ewl_widget_show(pnl->check_dhcp);
    ewl_widget_show(pnl->check_static);
    ewl_callback_append(pnl->check_static, EWL_CALLBACK_CLICKED,
            ethpanel_set_static_dhcp_clicked_cb, pnl);
    ewl_callback_append(pnl->check_dhcp, EWL_CALLBACK_CLICKED,
            ethpanel_set_static_dhcp_clicked_cb, pnl);


    //###################################
    //## box_configuration: Entry list ##
    //###################################
    pnl->entry_ip = ewl_entry_new();
    ewl_object_fill_policy_set(EWL_OBJECT(pnl->entry_ip), EWL_FLAG_FILL_FILL);
    ewl_object_alignment_set(EWL_OBJECT(pnl->entry_ip),EWL_FLAG_ALIGN_LEFT);

    pnl->entry_mask = ewl_entry_new();
    pnl->entry_gateway = ewl_entry_new();
    pnl->entry_cmd = ewl_entry_new();
    ewl_callback_append(pnl->entry_ip, EWL_CALLBACK_KEY_UP,
            ethpanel_textchanged_entry_cb, pnl);
    ewl_callback_append(pnl->entry_mask, EWL_CALLBACK_KEY_UP,
            ethpanel_textchanged_entry_cb, pnl);
    ewl_callback_append(pnl->entry_gateway, EWL_CALLBACK_KEY_UP,
            ethpanel_textchanged_entry_cb, pnl);

    grid = ewl_grid_new();
    ewl_container_child_append(EWL_CONTAINER(pnl->box_configuration), grid);
    ewl_object_fill_policy_set(EWL_OBJECT(grid), EWL_FLAG_FILL_HFILL);
    ewl_grid_dimensions_set(EWL_GRID(grid), 2, 5);
    ewl_grid_column_relative_w_set(EWL_GRID(grid), 0, 0.20);

    label = ewl_label_new();
    ewl_label_text_set(EWL_LABEL(label),_("Ip address: "));
    ewl_container_child_append(EWL_CONTAINER(grid), label);
    ewl_container_child_append(EWL_CONTAINER(grid), pnl->entry_ip);
    ewl_widget_show(label);
    ewl_widget_show(pnl->entry_ip);

    label = ewl_label_new();
    ewl_label_text_set(EWL_LABEL(label),_("Network mask: "));
    ewl_container_child_append(EWL_CONTAINER(grid), label);
    ewl_container_child_append(EWL_CONTAINER(grid), pnl->entry_mask);
    ewl_widget_show(label);
    ewl_widget_show(pnl->entry_mask);

    label = ewl_label_new();
    ewl_label_text_set(EWL_LABEL(label),_("Gateway: "));
    ewl_container_child_append(EWL_CONTAINER(grid), label);
    ewl_container_child_append(EWL_CONTAINER(grid), pnl->entry_gateway);
    ewl_widget_show(label);
    ewl_widget_show(pnl->entry_gateway);

    pnl->lbl_cmd = ewl_label_new();
    ewl_label_text_set(EWL_LABEL(pnl->lbl_cmd),_("Command: "));
    ewl_container_child_append(EWL_CONTAINER(grid), pnl->lbl_cmd);
    ewl_container_child_append(EWL_CONTAINER(grid), pnl->entry_cmd);
    ewl_widget_show(pnl->lbl_cmd);
    ewl_widget_show(pnl->entry_cmd);

    ewl_widget_show(grid);

    //#####################################
    //## box_configuration: Apply button ##
    //#####################################

    hbox = ewl_hbox_new();
    ewl_container_child_append(EWL_CONTAINER(pnl->box_configuration), hbox);
    pnl->btn_apply = ewl_button_new();
    ewl_stock_type_set(EWL_STOCK(pnl->btn_apply), EWL_STOCK_APPLY);
    ewl_object_fill_policy_set(EWL_OBJECT(pnl->btn_apply), EWL_FLAG_FILL_SHRINK);

    ewl_container_child_append(EWL_CONTAINER(hbox), pnl->btn_apply);
    ewl_widget_show(pnl->btn_apply);
    ewl_widget_show(hbox);

    ewl_callback_append(pnl->btn_apply, EWL_CALLBACK_CLICKED,
            ethpanel_btn_apply_clicked_cb, pnl);

    //########################################
    //## box_configuration: hbox_pbar	##
    //########################################

    pnl->hbox_pbar = ewl_hbox_new();
    pnl->pbar = ewl_progressbar_new();
    ewl_container_child_append(EWL_CONTAINER(pnl->box_configuration), pnl->hbox_pbar);
    ewl_container_child_append(EWL_CONTAINER(pnl->hbox_pbar), pnl->pbar);

    ewl_progressbar_label_set(EWL_PROGRESSBAR(pnl->pbar), APPLY_TEXT);
    ewl_range_unknown_set(EWL_RANGE(pnl->pbar), TRUE);

    ewl_widget_show(pnl->pbar);
    ewl_widget_show(pnl->hbox_pbar);

    return pnl;
}
Exemplo n.º 10
0
void ewl_frontend_dialog_config_open(Eli_App * eap)
{
    Ewl_Widget * o;
    Ewl_Widget * border_box;
    Ewl_Widget * hbox;
    Ewl_Widget * vbox;
    Ewl_Widget * main_box;
    Ewl_Widget * radio_b[2];

    /* one open config dialog should be enough */
    if (conf_win) return;
    /* Setup and show the configuration window */
    conf_win = ewl_dialog_new();
    ewl_dialog_action_position_set(EWL_DIALOG(conf_win), EWL_POSITION_BOTTOM);
    ewl_window_title_set(EWL_WINDOW(conf_win), _("Configuration"));
    ewl_window_name_set(EWL_WINDOW(conf_win), "Elitaire");
    ewl_window_class_set(EWL_WINDOW(conf_win), "Elitaire");
    ewl_window_leader_foreign_set(EWL_WINDOW(conf_win),
		    		EWL_EMBED_WINDOW(eap->main_win));
    ewl_callback_append(conf_win, EWL_CALLBACK_DELETE_WINDOW, destroy_cb,
                        NULL);
    ewl_dialog_has_separator_set(EWL_DIALOG(conf_win), 1);
    ewl_object_fill_policy_set(EWL_OBJECT(conf_win), EWL_FLAG_FILL_NONE);
    ewl_widget_show(conf_win);
    
    /* the main_box contain the border_boxes */
    ewl_dialog_active_area_set(EWL_DIALOG(conf_win), EWL_POSITION_TOP);
    main_box = ewl_vbox_new();
    ewl_container_child_append(EWL_CONTAINER(conf_win), main_box);
    ewl_object_fill_policy_set(EWL_OBJECT(main_box), EWL_FLAG_ALIGN_CENTER);
    ewl_widget_show(main_box);

    /* Setup and show the stock icons */
    ewl_dialog_active_area_set(EWL_DIALOG(conf_win), EWL_POSITION_BOTTOM);

    o = ewl_button_new();
    ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_CANCEL);
    ewl_container_child_append(EWL_CONTAINER(conf_win), o);
    ewl_callback_append(o, EWL_CALLBACK_CLICKED, conf_win_clicked_cb,
                        conf_win);
    ewl_widget_show(o);

    o = ewl_button_new();
    ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_APPLY);
    ewl_container_child_append(EWL_CONTAINER(conf_win), o);
    ewl_callback_append(o, EWL_CALLBACK_CLICKED, conf_win_clicked_cb,
                        conf_win);
    ewl_widget_show(o);

    o = ewl_button_new();
    ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_OK);
    ewl_container_child_append(EWL_CONTAINER(conf_win), o);
    ewl_callback_append(o, EWL_CALLBACK_CLICKED, conf_win_clicked_cb,
                        conf_win);
    ewl_widget_show(o);

    /* *** Graphic Box *** */
    /* Setup and show the border box */
    border_box = ewl_border_new();
    ewl_border_label_set(EWL_BORDER(border_box), _("Graphic"));
    ewl_container_child_append(EWL_CONTAINER(main_box), border_box);
    //ewl_object_fill_policy_set(EWL_OBJECT(border_box), EWL_FLAG_FILL_HFILL);
    ewl_widget_show(border_box);

    /* Setup and show the checkbuttons */
    o = ewl_checkbutton_new();
    ewl_button_label_set(EWL_BUTTON(o), _("animated movements"));
    ewl_container_child_append(EWL_CONTAINER(border_box), o);
    ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
    ewl_widget_show(o);
    config.animations = ecore_config_boolean_get("/graphic/animations");
    ewl_togglebutton_checked_set(EWL_TOGGLEBUTTON(o), config.animations);
    ewl_callback_append(o, EWL_CALLBACK_CLICKED, _check_selected, NULL);

    o = ewl_checkbutton_new();
    ewl_button_label_set(EWL_BUTTON(o), _("shadows"));
    ewl_container_child_append(EWL_CONTAINER(border_box), o);
    ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
    ewl_widget_show(o);
    config.shadows = ecore_config_boolean_get("/graphic/shadows");
    ewl_togglebutton_checked_set(EWL_TOGGLEBUTTON(o), config.shadows);
    ewl_callback_append(o, EWL_CALLBACK_CLICKED, _check_selected, NULL);

    /* Setup and show the velocity label and seeker */
    hbox = ewl_grid_new();
    ewl_container_child_append(EWL_CONTAINER(border_box), hbox);
    ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_FILL);
    ewl_grid_column_preferred_w_use(EWL_GRID(hbox), 1);
    ewl_widget_show(hbox);

    o = ewl_label_new();
    ewl_label_text_set(EWL_LABEL(o), _("velocity:"));
    ewl_container_child_append(EWL_CONTAINER(hbox), o);
    ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
    ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
    ewl_widget_show(o);

    o = ewl_label_new();
    ewl_container_child_append(EWL_CONTAINER(hbox), o);
    ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
    ewl_widget_show(o);
    config.vel_label = o;

    o = ewl_hseeker_new();
    config.velocity = ecore_config_int_get("velocity");
    ewl_range_minimum_value_set(EWL_RANGE(o), 200.0);
    ewl_range_maximum_value_set(EWL_RANGE(o), 800.0);
    ewl_range_step_set(EWL_RANGE(o), 60.0);
    ewl_range_value_set(EWL_RANGE(o), (double) config.velocity);
    ewl_widget_name_set(o, "velocity");
    ewl_container_child_append(EWL_CONTAINER(border_box), o);
    ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED, _hseeker_cb, NULL);
                          _hseeker_cb(o, NULL, NULL);
    ewl_widget_show(o);

    /* Setup and show the frame_rate label and seeker */
    hbox = ewl_grid_new();
    ewl_container_child_append(EWL_CONTAINER(border_box), hbox);
    ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_ALL);
    ewl_grid_column_preferred_w_use(EWL_GRID(hbox), 1);
    ewl_widget_show(hbox);

    o = ewl_label_new();
    ewl_label_text_set(EWL_LABEL(o), _("frame rate:"));
    ewl_container_child_append(EWL_CONTAINER(hbox), o);
    ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
    ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
    ewl_widget_show(o);
    
    o = ewl_label_new();
    ewl_container_child_append(EWL_CONTAINER(hbox), o);
    ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
    ewl_widget_show(o);
    config.frt_label = o;

    o = ewl_hseeker_new();
    config.frame_rate = ecore_config_int_get("frame_rate");
    ewl_range_minimum_value_set(EWL_RANGE(o), 10.0);
    ewl_range_maximum_value_set(EWL_RANGE(o), 100.0);
    ewl_range_step_set(EWL_RANGE(o), 10.0);
    ewl_range_value_set(EWL_RANGE(o), (double) config.frame_rate);
    ewl_widget_name_set(o, "frame_rate");
    ewl_container_child_append(EWL_CONTAINER(border_box), o);
    ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED, _hseeker_cb, NULL);
    _hseeker_cb(o, NULL, NULL);
    ewl_widget_show(o);

    /* *** Lazy Box *** */
    vbox = ewl_vbox_new();
    ewl_container_child_append(EWL_CONTAINER(main_box), vbox);
    ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_NORMAL);
    ewl_widget_show(vbox);

    border_box = ewl_border_new();
    ewl_container_child_append(EWL_CONTAINER(vbox), border_box);
    ewl_border_label_set(EWL_BORDER(border_box), _("Laziness"));
    ewl_widget_show(border_box);
    /* the radio buttons */
    config.lazy = ecore_config_int_get("lazy");
    radio_b[0] = ewl_radiobutton_new();
    ewl_button_label_set(EWL_BUTTON(radio_b[0]), _("normal mode"));
    ewl_object_alignment_set(EWL_OBJECT(radio_b[0]), EWL_FLAG_ALIGN_LEFT);
    ewl_container_child_append(EWL_CONTAINER(border_box), radio_b[0]);
    ewl_callback_append(radio_b[0], EWL_CALLBACK_CLICKED, _check_selected,
                        NULL);
    ewl_widget_show(radio_b[0]);

    radio_b[1] = ewl_radiobutton_new();
    ewl_button_label_set(EWL_BUTTON(radio_b[1]), _("lazy mode"));
    ewl_container_child_append(EWL_CONTAINER(border_box), radio_b[1]);
    ewl_object_alignment_set(EWL_OBJECT(radio_b[1]), EWL_FLAG_ALIGN_LEFT);
    ewl_radiobutton_chain_set(EWL_RADIOBUTTON(radio_b[1]),
                              EWL_RADIOBUTTON(radio_b[0]));
    ewl_callback_append(radio_b[1], EWL_CALLBACK_CLICKED, _check_selected,
                        NULL);
    ewl_widget_show(radio_b[1]);
    if (config.lazy)
        ewl_togglebutton_checked_set(EWL_TOGGLEBUTTON(radio_b[1]), 1);
    else
        ewl_togglebutton_checked_set(EWL_TOGGLEBUTTON(radio_b[0]), 1);

    /* *** Render Box *** */
    /* Setup and show the border box */
    border_box = ewl_border_new();
    ewl_border_label_set(EWL_BORDER(border_box), _("Render Engine"));
    ewl_container_child_append(EWL_CONTAINER(vbox), border_box);
    ewl_object_fill_policy_set(EWL_OBJECT(border_box), EWL_FLAG_FILL_FILL);
    ewl_object_alignment_set(EWL_OBJECT(border_box), EWL_FLAG_ALIGN_CENTER);
    ewl_object_alignment_set(EWL_OBJECT(main_box), EWL_FLAG_ALIGN_TOP);
    ewl_widget_show(border_box);

    o = ewl_text_new();
    ewl_text_text_set(EWL_TEXT(o), _("Changes only affect after new start"));
    ewl_container_child_append(EWL_CONTAINER(border_box), o);
    ewl_widget_show(o);

    /* the radio buttons */
    config.gl = ecore_config_boolean_get("/graphic/gl");
    radio_b[0] = ewl_radiobutton_new();
    ewl_button_label_set(EWL_BUTTON(radio_b[0]), _("Software"));
    ewl_container_child_append(EWL_CONTAINER(border_box), radio_b[0]);
    ewl_object_alignment_set(EWL_OBJECT(radio_b[0]), EWL_FLAG_ALIGN_LEFT);
    ewl_callback_append(radio_b[0], EWL_CALLBACK_CLICKED, _check_selected,
                        NULL);
    ewl_widget_show(radio_b[0]);

    radio_b[1] = ewl_radiobutton_new();
    ewl_button_label_set(EWL_BUTTON(radio_b[1]), _("OpenGL (testing)"));
    ewl_container_child_append(EWL_CONTAINER(border_box), radio_b[1]);
    ewl_object_alignment_set(EWL_OBJECT(radio_b[1]), EWL_FLAG_ALIGN_LEFT);
    ewl_radiobutton_chain_set(EWL_RADIOBUTTON(radio_b[1]),
                              EWL_RADIOBUTTON(radio_b[0]));
    ewl_callback_append(radio_b[1], EWL_CALLBACK_CLICKED, _check_selected,
                        NULL);
    ewl_widget_show(radio_b[1]);
    if (config.gl)
        ewl_togglebutton_checked_set(EWL_TOGGLEBUTTON(radio_b[1]), 1);
    else
        ewl_togglebutton_checked_set(EWL_TOGGLEBUTTON(radio_b[0]), 1);

}
Exemplo n.º 11
0
void mime_add_dialog_show(char* type, char* exe) {
	Ewl_Widget* layout_box = ewl_vbox_new();
	Ewl_Widget* window = ewl_window_new();
	Ewl_Widget* hbox;
	
	Ewl_Widget* label;
	Ewl_Widget* button;
	
	ewl_widget_show(layout_box);
	ewl_object_minimum_size_set(EWL_OBJECT(window), 400, 150);
	ewl_container_child_append(EWL_CONTAINER(window), layout_box);


	/*---*/
	hbox = ewl_hbox_new();
	ewl_widget_show(hbox);
	ewl_container_child_append(EWL_CONTAINER(layout_box), hbox);

	label = ewl_label_new();
	ewl_label_text_set(EWL_LABEL(label), "MIME Type");
	ewl_widget_show(label);
	ewl_container_child_append(EWL_CONTAINER(hbox), label);

	entry_type = ewl_entry_new();
	if (type) ewl_text_text_set(EWL_TEXT(entry_type), type);
	ewl_container_child_append(EWL_CONTAINER(hbox), entry_type);
	ewl_widget_show(entry_type);
	/*---*/

	/*---*/
	hbox = ewl_hbox_new();
	ewl_widget_show(hbox);
	ewl_container_child_append(EWL_CONTAINER(layout_box), hbox);

	label = ewl_label_new();
	ewl_label_text_set(EWL_LABEL(label), "Action");
	ewl_widget_show(label);
	ewl_container_child_append(EWL_CONTAINER(hbox), label);

	entry_action = ewl_entry_new();
	if (exe) ewl_text_text_set(EWL_TEXT(entry_action), exe);	
	ewl_container_child_append(EWL_CONTAINER(hbox), entry_action);
	ewl_widget_show(entry_action);
	/*---*/

	
	hbox = ewl_hbox_new();
	ewl_widget_show(hbox);
	ewl_container_child_append(EWL_CONTAINER(layout_box), hbox);

	button = ewl_button_new();
	ewl_button_label_set(EWL_BUTTON(button), "Add");
	ewl_object_maximum_h_set(EWL_OBJECT(button), 15);
	ewl_callback_append(button, EWL_CALLBACK_CLICKED, mime_add_cb, window);
	ewl_container_child_append(EWL_CONTAINER(hbox), button);
	ewl_widget_show(button);

	button = ewl_button_new();
	ewl_button_label_set(EWL_BUTTON(button), "Cancel");
	ewl_object_maximum_h_set(EWL_OBJECT(button), 15);
	ewl_callback_append(button, EWL_CALLBACK_CLICKED, window_dismiss_cb, window);
	ewl_container_child_append(EWL_CONTAINER(hbox), button);
	ewl_widget_show(button);

	ewl_widget_show(window);
}
Exemplo n.º 12
0
void
ewl_icon_local_viewer_delete_selected (entropy_gui_component_instance *
				       instance)
{
  Ewl_Iconbox *ib =
    EWL_ICONBOX (((entropy_icon_viewer *) instance->data)->iconbox);
  entropy_icon_viewer *viewer = instance->data;

  Ecore_List *new_file_list = ecore_list_new ();
  Ecore_List *icon_list;
  gui_file *local_file;
  Ewl_Iconbox_Icon *list_item;

  Ewl_Widget *dialog_win;
  Ewl_Widget *dialog_label;
  Ewl_Widget *button;

  /*This is kind of awkward - the first item on the list is
   * the plugin instance reference*/
  ecore_list_append (new_file_list, instance);

  dialog_win = ewl_dialog_new ();
  ewl_window_title_set (EWL_WINDOW (dialog_win), "Delete?");

  ewl_dialog_active_area_set (EWL_DIALOG (dialog_win), EWL_POSITION_TOP);
  dialog_label = ewl_label_new ();
  ewl_label_text_set (EWL_LABEL (dialog_label),
		      "Are you sure you want to delete these files?");
  ewl_container_child_append (EWL_CONTAINER (dialog_win), dialog_label);
  ewl_widget_show (dialog_label);

  ewl_dialog_active_area_set (EWL_DIALOG (dialog_win), EWL_POSITION_BOTTOM);



  //////////////////////
  icon_list = ewl_iconbox_get_selection (EWL_ICONBOX (ib));

  ecore_list_first_goto (icon_list);
  while ((list_item = ecore_list_next (icon_list))) {
    local_file = ecore_hash_get (viewer->icon_hash, list_item);
    if (local_file) {
      entropy_core_file_cache_add_reference (local_file->file->md5);
      ecore_list_append (new_file_list, local_file->file);
    }
  }
  entropy_file_wait_list_add (viewer, new_file_list);
  ecore_list_destroy (icon_list);

  button = ewl_button_new ();
  ewl_button_label_set (EWL_BUTTON (button), "Yes");
  ewl_widget_show (button);
  ewl_container_child_append (EWL_CONTAINER (dialog_win), button);
  ewl_callback_append (button, EWL_CALLBACK_CLICKED,
		       ewl_icon_local_viewer_delete_cb, new_file_list);

  button = ewl_button_new ();
  ewl_button_label_set (EWL_BUTTON (button), "No");
  ewl_widget_show (button);
  ewl_container_child_append (EWL_CONTAINER (dialog_win), button);
  ewl_callback_append (button, EWL_CALLBACK_CLICKED,
		       ewl_icon_local_viewer_delete_cb, new_file_list);

  ewl_widget_show (dialog_win);
}