set aspect on start gadget window, not layout

devs/discomfitor/sandblog2017
Mike Blumenkrantz 5 years ago
parent 1f651fbfe8
commit 62128d19d8
  1. 2
      loader/start.c
  2. 75
      loader/test.c

@ -164,7 +164,7 @@ main(int argc, char *argv[])
elm_win_alpha_set(win, 1);
ly = elm_layout_add(win);
evas_object_size_hint_min_set(win, 100, 100);
evas_object_size_hint_aspect_set(ly, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
evas_object_size_hint_aspect_set(win, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
elm_layout_file_set(ly,
elm_theme_group_path_find(NULL, "e/gadget/start/main"), "e/gadget/start/main");
elm_win_resize_object_add(win, ly);

@ -1,5 +1,78 @@
#include <Elementary.h>
static Evas_Object *popup;
static Evas_Object *child;
static void
popup_del(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
popup = NULL;
}
static void
child_del(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
child = NULL;
}
static void
popup_unfocus(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
{
evas_object_del(obj);
}
static void
mouse_button(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info)
{
Evas_Object *ic;
Evas_Event_Mouse_Down *ev = event_info;
char buf[PATH_MAX];
int w, h;
Evas_Object *win;
Elm_Win_Type type = ELM_WIN_POPUP_MENU;
if ((ev->button != 1) && (ev->button != 3)) return;
if (ev->button == 3)
{
type = ELM_WIN_BASIC;
if (child)
{
evas_object_del(child);
return;
}
}
win = elm_win_add(elm_win_get(obj), "win", type);
elm_win_alpha_set(win, 1);
if (ev->button == 3)
{
child = win;
evas_object_event_callback_add(win, EVAS_CALLBACK_DEL, child_del, NULL);
}
else
{
popup = win;
evas_object_event_callback_add(win, EVAS_CALLBACK_DEL, popup_del, NULL);
}
if (ev->button == 3)
evas_object_event_callback_add(win, EVAS_CALLBACK_FOCUS_OUT, popup_unfocus, NULL);
ic = elm_icon_add(win);
snprintf(buf, sizeof(buf), "%s/images/bubble.png", elm_app_data_dir_get());
elm_image_file_set(ic, buf, NULL);
elm_image_object_size_get(ic, &w, &h);
evas_object_size_hint_aspect_set(win, EVAS_ASPECT_CONTROL_BOTH, w, h);
if (ev->button == 1)
{
elm_image_resizable_set(ic, EINA_FALSE, EINA_FALSE);
elm_image_no_scale_set(ic, EINA_TRUE);
}
evas_object_size_hint_weight_set(ic, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_fill_set(ic, 0.5, 0.5);
evas_object_size_hint_min_set(ic, 100, 100);
elm_win_resize_object_add(win, ic);
evas_object_show(ic);
evas_object_show(win);
}
int
main(int argc, char *argv[])
{
@ -7,7 +80,6 @@ main(int argc, char *argv[])
char buf[PATH_MAX];
int w, h;
elm_init(argc, (char**)argv);
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
elm_app_info_set(main, "elementary", "images/logo.png");
@ -31,6 +103,7 @@ main(int argc, char *argv[])
evas_object_size_hint_min_set(ic, 100, 100);
elm_win_resize_object_add(win, ic);
evas_object_show(ic);
evas_object_event_callback_add(ic, EVAS_CALLBACK_MOUSE_DOWN, mouse_button, NULL);
evas_object_show(win);
ecore_main_loop_begin();

Loading…
Cancel
Save