gui, widget: apply custom size to preview object.
This commit is contained in:
parent
e494225587
commit
7b381bea07
25
src/gui.c
25
src/gui.c
|
@ -7,6 +7,7 @@
|
|||
Evas_Object *list, *win, *gui_layout, *preview_box, *preview_obj;
|
||||
Evas_Object *description_frame, *option_frame;
|
||||
Evas_Object *size_width_slider, *size_height_slider;
|
||||
Evas_Object *option_force_resize;
|
||||
|
||||
typedef struct _Style_Data Style_Data;
|
||||
struct _Style_Data
|
||||
|
@ -109,7 +110,7 @@ _option_size_create(Evas_Object *box)
|
|||
{
|
||||
Evas_Object *o;
|
||||
|
||||
o = elm_check_add(box);
|
||||
option_force_resize = o = elm_check_add(box);
|
||||
elm_object_text_set(o, "Force resize");
|
||||
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
|
||||
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
|
@ -384,3 +385,25 @@ gui_widget_load(void)
|
|||
}
|
||||
elm_list_go(list);
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
option_is_force_resize(void)
|
||||
{
|
||||
if (!option_force_resize)
|
||||
return EINA_FALSE;
|
||||
return elm_check_state_get(option_force_resize);
|
||||
}
|
||||
|
||||
void
|
||||
option_preview_size_get(Evas_Coord *w, Evas_Coord *h)
|
||||
{
|
||||
if (size_width_slider)
|
||||
*w = elm_slider_value_get(size_width_slider);
|
||||
else
|
||||
*w = -1;
|
||||
|
||||
if (size_height_slider)
|
||||
*h = elm_slider_value_get(size_height_slider);
|
||||
else
|
||||
*h = -1;
|
||||
}
|
||||
|
|
|
@ -6,4 +6,7 @@ extern Evas_Object *win, *viewer_box;
|
|||
void gui_create(const char *edje_file);
|
||||
void gui_widget_load(void);
|
||||
|
||||
Eina_Bool option_is_force_resize(void);
|
||||
void option_preview_size_get(Evas_Coord *w, Evas_Coord *h);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -780,6 +780,7 @@ widget_create(const char *widget, const char *orig_style)
|
|||
{
|
||||
Evas_Object *o = NULL;
|
||||
const char *style = NULL;
|
||||
Evas_Coord w = 0, h = 0;
|
||||
|
||||
if (orig_style)
|
||||
style = eina_stringshare_add(_parse_style(orig_style));
|
||||
|
@ -826,5 +827,13 @@ widget_create(const char *widget, const char *orig_style)
|
|||
else
|
||||
o = _widget_not_implemented_create(widget);
|
||||
elm_object_theme_set(o, th);
|
||||
|
||||
if (option_is_force_resize())
|
||||
{
|
||||
option_preview_size_get(&w, &h);
|
||||
evas_object_size_hint_min_set(o, w, h);
|
||||
evas_object_size_hint_max_set(o, w, h);
|
||||
}
|
||||
|
||||
return o;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue