Esempio n. 1
0
void
icon_editor_image_file_set(char *file)
{
  void *data;
  int w, h;

  printf("file: %s\n", file);
  ewl_image_file_set(EWL_IMAGE(editor->icon_image), file, NULL);
  icon_editor_image_data_get(&data, &w, &h);
  icon_editor_image_data_set(data, w, h);
}
Esempio n. 2
0
/**
 * @param d: dialog to change the icon
 * @param theme_icon: the name of the theme icon
 * @return Returns no value.
 * @brief Changes the icon of the dialog. 
 *
 * Changes the icon to the given string. @p theme_icon can be any icon that
 * is defined in the ewl_theme_icon.h file.  If @p theme_icon is @c NULL
 * no icon will be create or an existing icon will be destroyed.
 */
void
ewl_icondialog_icon_set(Ewl_Icondialog *d, const char *theme_icon)
{
        const char *image;
        int size;

        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR(d);
        DCHECK_TYPE(d, EWL_ICONDIALOG_TYPE);

        /* 
         * if there is no icon destroy the existing one and we are done
         */
        if (!theme_icon)
        {
                if (d->icon)
                        ewl_widget_destroy(d->icon);
                DRETURN(DLEVEL_STABLE);
        }

        /* get the size from the theme or set a default value */
        size = ewl_theme_data_int_get(EWL_WIDGET(d), "icon_size");
        if (!size) size = 64;

        /* get the file for the image */
        image = ewl_icon_theme_icon_path_get(theme_icon, size);
        if (!image)
                DRETURN(DLEVEL_STABLE);

        /* and finally create the icon */
        d->icon = ewl_image_new();
        ewl_image_file_set(EWL_IMAGE(d->icon), image, NULL);
        ewl_object_minimum_size_set(EWL_OBJECT(d->icon), size, size);
        
        /* we need to reset the container redirect before we can add the icon */
        ewl_container_redirect_set(EWL_CONTAINER(d->dialog.vbox), NULL);
        ewl_container_child_prepend(EWL_CONTAINER(d->dialog.vbox), d->icon);
        ewl_container_redirect_set(EWL_CONTAINER(d->dialog.vbox), 
                                        EWL_CONTAINER(d->vbox));

        ewl_widget_show(d->icon);

        DLEAVE_FUNCTION(DLEVEL_STABLE);
}
Esempio n. 3
0
void ewl_entropy_tip_window_display()
{
    Ewl_Widget* tip_window = ewl_window_new();
    Ewl_Widget* vbox = ewl_vbox_new();
    Ewl_Widget* hbox = ewl_hbox_new();
    Ewl_Widget* button;
    Ewl_Widget* image = ewl_image_new();

    ewl_entropy_tip_window_create_tips();
    tip_number = 0;

    ewl_object_alignment_set(EWL_OBJECT(hbox), EWL_FLAG_ALIGN_BOTTOM);
    ewl_object_alignment_set(EWL_OBJECT(vbox), EWL_FLAG_ALIGN_BOTTOM);
    ewl_object_alignment_set(EWL_OBJECT(tip_window), EWL_FLAG_ALIGN_BOTTOM);
    ewl_object_fill_policy_set(EWL_OBJECT(tip_window), EWL_FLAG_FILL_FILL);
    ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_FILL);

    ewl_container_child_append(EWL_CONTAINER(tip_window), vbox);
    ewl_container_child_append(EWL_CONTAINER(vbox), hbox);

    text_tip = ewl_text_new();
    ewl_object_minimum_h_set(EWL_OBJECT(text_tip), 80);
    ewl_container_child_append(EWL_CONTAINER(hbox), text_tip);

    ewl_image_file_set(EWL_IMAGE(image), PACKAGE_DATA_DIR "/icons/tip.png", NULL);
    ewl_container_child_append(EWL_CONTAINER(hbox), image);
    ewl_widget_show(hbox);

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

    button = ewl_button_new();
    ewl_button_label_set(EWL_BUTTON(button), "Prev Tip");
    ewl_object_custom_h_set(EWL_OBJECT(button), 15);
    ewl_widget_show(button);
    ewl_container_child_append(EWL_CONTAINER(hbox), button);

    button = ewl_button_new();
    ewl_button_label_set(EWL_BUTTON(button), "Next Tip");
    ewl_object_custom_h_set(EWL_OBJECT(button), 15);
    ewl_callback_append(button, EWL_CALLBACK_CLICKED, ewl_entropy_tip_window_tip_next_cb, NULL);
    ewl_widget_show(button);
    ewl_container_child_append(EWL_CONTAINER(hbox), button);

    button = ewl_button_new();
    ewl_button_label_set(EWL_BUTTON(button), "Close");
    ewl_object_custom_h_set(EWL_OBJECT(button), 15);
    ewl_callback_append(button, EWL_CALLBACK_CLICKED, ewl_entropy_tip_window_destroy_cb, tip_window);
    ewl_widget_show(button);
    ewl_container_child_append(EWL_CONTAINER(hbox), button);


    ewl_callback_append(tip_window, EWL_CALLBACK_DELETE_WINDOW, ewl_entropy_tip_window_destroy_cb, tip_window);

    ewl_widget_show(tip_window);
    ewl_widget_show(vbox);
    ewl_widget_show(text_tip);
    ewl_widget_show(image);

    ewl_entropy_tip_window_tip_next_cb(NULL,NULL,NULL);

}