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

        o = ewl_image_new();

        if (!EWL_IMAGE_IS(o))
                LOG_FAILURE(buf, len, "widget is not of the type "
                                EWL_IMAGE_TYPE);
        else if (ewl_object_fill_policy_get(EWL_OBJECT(o))
                        != EWL_FLAG_FILL_NONE)
                LOG_FAILURE(buf, len, "Fill policy is not NONE");
        else if (ewl_image_file_path_get(EWL_IMAGE(o)))
                LOG_FAILURE(buf, len, "path is not NULL");
        else if (ewl_image_file_key_get(EWL_IMAGE(o)))
                LOG_FAILURE(buf, len, "key is not NULL");
        else if (ewl_image_proportional_get(EWL_IMAGE(o)))
                LOG_FAILURE(buf, len, "image is proportional");
        else if (ewl_image_constrain_get(EWL_IMAGE(o)))
                LOG_FAILURE(buf, len, "image has constrain");
        else
                ret = 1;

        ewl_widget_destroy(o);

        return ret;
}
示例#2
0
void
_icon_editor_gui_update()
{
  char *tmp;
  Evas_Object *im_obj;
  void *im_data = NULL;
  int im_w = 0, im_h = 0;

  tmp = icon_editor_exec_get();
  ewl_entry_text_set(EWL_ENTRY(editor->exec.entry), tmp);
  free(tmp);

  /* FIXME: set the name */
  im_obj = EWL_IMAGE(editor->icon_image)->image;

  icon_editor_image_data_get(&im_data, &im_w, &im_h);
  if (!im_data) return;
  evas_object_image_size_set(im_obj, im_w, im_h);
  evas_object_image_data_copy_set(im_obj, im_data);
  evas_object_image_alpha_set(im_obj, 1);
  evas_object_image_data_update_add(im_obj, 0, 0, im_w, im_h);
  evas_object_image_fill_set(im_obj, 0, 0, im_w, im_h);
  printf("wxh: %d x %d\n", im_w, im_h);
  ewl_object_size_request(EWL_OBJECT(editor->icon_image), im_w, im_h);
  ewl_object_maximum_size_set(EWL_OBJECT(editor->icon_image), im_w, im_h);
  ewl_object_minimum_size_set(EWL_OBJECT(editor->icon_image), im_w, im_h);
 
}
static int
test_scale_set_get(char *buf, int len)
{
        Ewl_Widget *o;
        int ret = 0;
        double sw, sh;

        o = ewl_image_new();
        ewl_image_scale_set(EWL_IMAGE(o), 2.0, 2.0);
        ewl_image_scale_get(EWL_IMAGE(o), &sw, &sh);

        if (sw != 2.0 || sh != 2.0)
                LOG_FAILURE(buf, len, "scale_get did not match scale_set.");
        else
                ret = 1;

        ewl_widget_destroy(o);

        return ret;
}
static int
test_path_set_get(char *buf, int len)
{
        Ewl_Widget *o;
        const char *t;
        int ret = 0;

        o = ewl_image_new();
        ewl_image_file_path_set(EWL_IMAGE(o), "/invalid/path");
        t = ewl_image_file_path_get(EWL_IMAGE(o));

        if (strcmp(t, "/invalid/path"))
                LOG_FAILURE(buf, len, "path_get did not match path_set.");
        else
                ret = 1;
        
        ewl_widget_destroy(o);

        return ret;
}
static int
test_proportional_set_get(char *buf, int len)
{
        Ewl_Widget *o;
        unsigned int p;
        int ret = 0;

        o = ewl_image_new();
        ewl_image_proportional_set(EWL_IMAGE(o), TRUE);
        p = ewl_image_proportional_get(EWL_IMAGE(o));

        if (p != TRUE)
                LOG_FAILURE(buf, len, "proportional_get did not match set.");
        else
                ret = 1;

        ewl_widget_destroy(o);

        return ret;
}
static int
test_constrain_set_get(char *buf, int len)
{
        Ewl_Widget *o;
        int ret = 0;
        int sw;

        o = ewl_image_new();
        ewl_image_constrain_set(EWL_IMAGE(o), 2);
        sw = ewl_image_constrain_get(EWL_IMAGE(o));

        if (sw != 2)
                LOG_FAILURE(buf, len, "scale_get did not match scale_set.");
        else
                ret = 1;

        ewl_widget_destroy(o);

        return ret;
}
示例#7
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);
}
示例#8
0
static int
create_test(Ewl_Container *box)
{
        Ewl_Widget *overlay;
        Ewl_Widget *img;
        Ewl_Widget *hist;

        overlay = ewl_overlay_new();
        ewl_container_child_append(EWL_CONTAINER(box), overlay);
        ewl_object_fill_policy_set(EWL_OBJECT(overlay), EWL_FLAG_FILL_ALL);
         ewl_callback_append(EWL_WIDGET(overlay), EWL_CALLBACK_CONFIGURE,
                        ewl_histogram_test_cb_configure, NULL);
        ewl_widget_show(overlay);

        img = ewl_image_new();
        ewl_image_file_path_set(EWL_IMAGE(img),
                                ewl_test_image_get("entrance.png"));
        ewl_image_proportional_set(EWL_IMAGE(img), TRUE);
        ewl_container_child_append(EWL_CONTAINER(overlay), img);
        ewl_object_fill_policy_set(EWL_OBJECT(img), EWL_FLAG_FILL_ALL);
        ewl_widget_show(img);

        hist = ewl_histogram_new();
        ewl_histogram_channel_set(EWL_HISTOGRAM(hist), EWL_HISTOGRAM_CHANNEL_Y);
        ewl_histogram_image_set(EWL_HISTOGRAM(hist), EWL_IMAGE(img));
        ewl_container_child_append(EWL_CONTAINER(overlay), hist);
        ewl_object_fill_policy_set(EWL_OBJECT(hist), EWL_FLAG_FILL_ALL);
        ewl_widget_show(hist);

        hist = ewl_histogram_new();
        ewl_histogram_channel_set(EWL_HISTOGRAM(hist), EWL_HISTOGRAM_CHANNEL_R);
        ewl_histogram_image_set(EWL_HISTOGRAM(hist), EWL_IMAGE(img));
        ewl_container_child_append(EWL_CONTAINER(overlay), hist);
        ewl_object_fill_policy_set(EWL_OBJECT(hist), EWL_FLAG_FILL_ALL);
        ewl_widget_show(hist);

        hist = ewl_histogram_new();
        ewl_histogram_channel_set(EWL_HISTOGRAM(hist), EWL_HISTOGRAM_CHANNEL_G);
        ewl_histogram_image_set(EWL_HISTOGRAM(hist), EWL_IMAGE(img));
        ewl_container_child_append(EWL_CONTAINER(overlay), hist);
        ewl_object_fill_policy_set(EWL_OBJECT(hist), EWL_FLAG_FILL_ALL);
        ewl_widget_show(hist);

        hist = ewl_histogram_new();
        ewl_histogram_channel_set(EWL_HISTOGRAM(hist), EWL_HISTOGRAM_CHANNEL_B);
        ewl_histogram_image_set(EWL_HISTOGRAM(hist), EWL_IMAGE(img));
        ewl_container_child_append(EWL_CONTAINER(overlay), hist);
        ewl_object_fill_policy_set(EWL_OBJECT(hist), EWL_FLAG_FILL_ALL);
        ewl_widget_show(hist);

        return 1;
}
示例#9
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);
}
示例#10
0
void
icon_editor_file_save()
{
  if (!editor || !editor->edf) return;

  icon_editor_exec_set(ewl_entry_text_get(EWL_ENTRY(editor->exec.entry)));

  if (editor->icon_image)
  {
    int w, h;
    Evas_Object *im;

    im = EWL_IMAGE(editor->icon_image)->image;
    evas_object_image_size_get(im, &w, &h);
    icon_editor_image_data_set(evas_object_image_data_get(im, FALSE), w, h);
  }
  /* FIXME create a new file name based on the name */
  /* (delete the old file first?) */
  edje_edit_file_save(editor->edf, editor->file);
}
示例#11
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);

}