Set/calc better the obj size hints, also respect aspect_hints

This commit is contained in:
Davide Andreoli 2014-08-31 16:26:57 +02:00
parent c343bd509c
commit beec9a292d
5 changed files with 18 additions and 6 deletions

View File

@ -47,6 +47,7 @@ class Gadget(e.Gadget):
obj.signal_callback_add('mouse,down,2', 'over', self.speaker_click_cb)
obj.signal_callback_add('mouse,wheel,*', 'over', self.speaker_wheel_cb)
obj.size_hint_aspect = evas.EVAS_ASPECT_CONTROL_BOTH , 16, 16
self.speaker_update(obj)
def instance_destroyed(self, obj):

View File

@ -293,6 +293,7 @@ collections {
rel1.to: "players.box";
rel1.relative: 0.0 1.0;
rel1.offset: 0 6;
align: 0.0 0.0;
box {
layout: "vertical";
padding: 0 6;

View File

@ -6,6 +6,7 @@ import datetime
import random
import e
from efl import evas
from efl import edje
from efl import ecore
@ -28,6 +29,9 @@ class Gadget(e.Gadget):
obj.data['timer'] = timer
obj.signal_callback_add('mouse,down,1', '*', self.led_click_cb)
w, h = obj.size_min
obj.size_hint_aspect = evas.EVAS_ASPECT_CONTROL_BOTH , w, h
return obj
def instance_destroyed(self, obj):

View File

@ -47,7 +47,7 @@ collections {
}
group { name: "e/gadgets/led_clock/main";
min: 74 21;
parts {
part { name: "bg";

View File

@ -562,7 +562,7 @@ _edgar_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style
if (gc->location->site == E_GADCON_SITE_DESKTOP && gadget->opt_pop_on_desk)
pop_on_desk = EINA_TRUE;
// TODO search in the E theme ("e/gadget/name/main")
// create the edje object (popup or main)
obj = edje_object_add(gc->evas);
group = pop_on_desk ? "popup" : "main";
if (!edgar_theme_edje_object_set(gadget, obj, group))
@ -645,7 +645,8 @@ _edgar_gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient)
{
Edgar_Py_Gadget *gadget = gcc->data;
E_Gadcon_Orient generic;
Evas_Coord min_w, min_h;
Evas_Coord w, h, mw, mh;
Evas_Aspect_Control aspect;
DBG("EDGAR: Gadcon Orient: %d", orient);
switch (orient)
@ -684,9 +685,14 @@ _edgar_gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient)
// apply obj size hints
edje_object_message_signal_process(gcc->o_base);
edje_object_size_min_calc(gcc->o_base, &min_w, &min_h);
e_gadcon_client_min_size_set(gcc, min_w, min_h);
e_gadcon_client_aspect_set(gcc, min_w, min_h);
evas_object_size_hint_min_get(gcc->o_base, &mw, &mh);
edje_object_size_min_restricted_calc(gcc->o_base, &w, &h, mw, mh);
e_gadcon_client_min_size_set(gcc, w, h);
// also aspect hints if requested
evas_object_size_hint_aspect_get(gcc->o_base, &aspect, &w, &h);
if (aspect != EVAS_ASPECT_CONTROL_NONE)
e_gadcon_client_aspect_set(gcc, w, h);
}
static const char*