info popup for gadcon clients

SVN revision: 31432
This commit is contained in:
Viktor Kojouharov 2007-08-20 18:50:20 +00:00
parent f00826e9e2
commit b0d4ef2ea9
6 changed files with 262 additions and 2 deletions

View File

@ -1373,3 +1373,56 @@ group {
}
}
group {
name: "e/gadman/popup";
parts {
part {
name: "border_tl";
type: RECT;
mouse_events: 0;
description {
state: "default" 0.0;
rel1.offset: 0 0;
rel2.offset: -1 -1;
color: 253 253 253 255;
}
}
part {
name: "border_br";
type: RECT;
mouse_events: 0;
description {
state: "default" 0.0;
rel1.offset: 1 1;
rel2.offset: -1 -1;
color: 165 165 165 255;
}
}
part {
name: "base";
type: RECT;
mouse_events: 0;
description {
state: "default" 0.0;
rel1.offset: 1 1;
rel2.offset: -2 -2;
color: 221 221 221 255;
}
}
part {
name: "e.swallow.content";
type: SWALLOW;
description {
state: "default" 0.0;
align: 0.5 0.5;
//color: 0 0 0 0;
rel1 {
offset: 3 3;
}
rel2 {
offset: -4 -4;
}
}
}
}
}

View File

@ -1,3 +1,4 @@
# vim: set keymap=bulgarian-phonetic:
# English translation of Enlightenment.
# This file is put in the public domain.
# Viktor Kojouharov <vkojouharov@abv.bg>, 2006.
@ -8,7 +9,7 @@ msgstr ""
"Project-Id-Version: Enlightenment DR17\n"
"Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2007-08-12 13:18+0300\n"
"PO-Revision-Date: 2007-08-12 14:11+0300\n"
"PO-Revision-Date: 2007-08-16 20:38+0300\n"
"Last-Translator: Viktor Kojouharov <vkojouharov@abv.bg>\n"
"Language-Team: English <en@li.org>\n"
"MIME-Version: 1.0\n"
@ -36,7 +37,7 @@ msgid ""
"is not stable. Many features are incomplete or even non-existant yet and may "
"have many bugs. You have been <hilight>WARNED!</hilight>"
msgstr ""
"&copy Всички права запазени; 1999-2006, Екипът на Enlightenment."
"&copy; Всички права запазени; 1999-2006, Екипът на Enlightenment."
"<br><br>Надяваме се, че използването на средата ще ви хареса колкото на нас "
"ни харесва да я пишем.<br><br>Този софтуер се предлага без никаква гаранция."
"Обуславя се на лицензионните условия, описани в файловете COPYING и COPYING-"

View File

@ -68,6 +68,7 @@ e_bindings.h \
e_moveresize.h \
e_actions.h \
e_popup.h \
e_gadcon_popup.h \
e_ipc_codec.h \
e_prefix.h \
e_datastore.h \
@ -193,6 +194,7 @@ e_bindings.c \
e_moveresize.c \
e_actions.c \
e_popup.c \
e_gadcon_popup.c \
e_ipc_codec.c \
e_prefix.c \
e_datastore.c \

168
src/bin/e_gadcon_popup.c Normal file
View File

@ -0,0 +1,168 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "e.h"
/* local subsystem functions */
static void _e_gadcon_popup_free(E_Gadcon_Popup *pop);
/* externally accessible functions */
EAPI E_Gadcon_Popup *
e_gadcon_popup_new(
E_Gadcon_Client *gcc,
void (*resize_func) (Evas_Object *obj, int *w, int *h))
{
E_Gadcon_Popup *pop;
Evas_Object *o;
pop = E_OBJECT_ALLOC(E_Gadcon_Popup, E_GADCON_POPUP_TYPE, _e_gadcon_popup_free);
if (!pop) return NULL;
pop->win = e_popup_new(
e_zone_current_get(e_container_current_get(e_manager_current_get())),
0, 0, 0, 0);
e_popup_layer_set(pop->win, 990);
o = edje_object_add(pop->win->evas);
e_theme_edje_object_set(o, "base/theme/gadman",
"e/gadman/popup");
evas_object_show(o);
evas_object_move(o, 0, 0);
e_popup_edje_bg_object_set(pop->win, o);
pop->o_bg = o;
pop->gcc = gcc;
pop->resize_func = resize_func;
return pop;
}
EAPI void
e_gadcon_popup_content_set(E_Gadcon_Popup *pop, Evas_Object *o)
{
Evas_Coord w = 0, h = 0;
Evas_Object *old_o;
E_OBJECT_CHECK(pop);
E_OBJECT_TYPE_CHECK(pop, E_GADCON_POPUP_TYPE);
old_o =
edje_object_part_swallow_get(pop->o_bg,
"e.swallow.content");
if (old_o)
{
edje_object_part_unswallow(pop->o_bg, old_o);
evas_object_del(old_o);
}
e_widget_min_size_get(o, &w, &h);
if (!w || !h)
edje_object_size_min_calc(o, &w, &h);
edje_extern_object_min_size_set(o, w, h);
edje_object_part_swallow(pop->o_bg, "e.swallow.content", o);
edje_object_size_min_calc(pop->o_bg, &pop->w, &pop->h);
evas_object_resize(pop->o_bg, pop->w, pop->h);
}
EAPI void
e_gadcon_popup_show(E_Gadcon_Popup *pop)
{
Evas_Coord gx, gy, gw, gh, zw, zh, px, py, ww, wh;
E_OBJECT_CHECK(pop);
E_OBJECT_TYPE_CHECK(pop, E_GADCON_POPUP_TYPE);
if (pop->pinned) return;
evas_object_show(pop->o_bg);
edje_object_size_min_calc(pop->o_bg, &ww, &wh);
e_popup_show(pop->win);
if (pop->resize_func) pop->resize_func(pop->o_bg, &ww, &wh);
evas_object_resize(pop->o_bg, ww, wh);
pop->w = ww;
pop->h = wh;
/* Popup positioning */
e_gadcon_client_geometry_get(pop->gcc, &gx, &gy, &gw, &gh);
zw = pop->gcc->gadcon->zone->w;
zh = pop->gcc->gadcon->zone->h;
switch (pop->gcc->gadcon->orient)
{
case E_GADCON_ORIENT_CORNER_RT:
case E_GADCON_ORIENT_CORNER_RB:
case E_GADCON_ORIENT_RIGHT:
px = gx - pop->w;
py = gy;
if (py + pop->h >= zh)
py = gy + gh - pop->h;
break;
case E_GADCON_ORIENT_LEFT:
case E_GADCON_ORIENT_CORNER_LT:
case E_GADCON_ORIENT_CORNER_LB:
px = gx + gw;
py = gy;
if (py + pop->h >= zh)
py = gy + gh - pop->h;
break;
break;
case E_GADCON_ORIENT_TOP:
case E_GADCON_ORIENT_CORNER_TL:
case E_GADCON_ORIENT_CORNER_TR:
py = gy + gh;
px = gx;
if (px + pop->w >= zw)
px = gx + gw - pop->w;
break;
case E_GADCON_ORIENT_BOTTOM:
case E_GADCON_ORIENT_CORNER_BL:
case E_GADCON_ORIENT_CORNER_BR:
py = gy - pop->h;
px = gx;
if (px + pop->w >= zw)
px = gx + gw - pop->w;
break;
default:
e_popup_move_resize(pop->win, 50, 50, pop->w, pop->h);
return;
}
e_popup_move_resize(pop->win, px, py, pop->w, pop->h);
}
EAPI void
e_gadcon_popup_hide(E_Gadcon_Popup *pop)
{
E_OBJECT_CHECK(pop);
E_OBJECT_TYPE_CHECK(pop, E_GADCON_POPUP_TYPE);
if (pop->pinned) return;
e_popup_hide(pop->win);
}
EAPI void
e_gadcon_popup_toggle_pinned(E_Gadcon_Popup *pop)
{
E_OBJECT_CHECK(pop);
E_OBJECT_TYPE_CHECK(pop, E_GADCON_POPUP_TYPE);
if (pop->pinned) {
pop->pinned = 0;
edje_object_signal_emit(pop->o_bg, "e,state,unpinned", "e");
} else {
pop->pinned = 1;
edje_object_signal_emit(pop->o_bg, "e,state,pinned", "e");
}
}
/* local subsystem functions */
static void
_e_gadcon_popup_free(E_Gadcon_Popup *pop)
{
pop->gcc = NULL;
e_object_del(E_OBJECT(pop->win));
if (pop->pinned) e_gadcon_popup_toggle_pinned(pop);
if (pop->o_bg)
evas_object_del(pop->o_bg);
if (pop->o_con)
evas_object_del(pop->o_con);
free(pop);
}

35
src/bin/e_gadcon_popup.h Normal file
View File

@ -0,0 +1,35 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#ifdef E_TYPEDEFS
typedef struct _E_Gadcon_Popup E_Gadcon_Popup;
#else
#ifndef E_GADCON_POPUP_H
#define E_GADCON_POPUP_H
#define E_GADCON_POPUP_TYPE 0xE0b0104e
struct _E_Gadcon_Popup
{
E_Object e_obj_inherit;
E_Popup *win;
E_Gadcon_Client *gcc;
Evas_Coord w, h;
Evas_Object *o_bg, *o_con;
int pinned : 1;
void (*resize_func) (Evas_Object *obj, int *w, int *h);
};
EAPI E_Gadcon_Popup *e_gadcon_popup_new(E_Gadcon_Client *gcc, void (*resize_func) (Evas_Object *obj, int *w, int *h));
EAPI void e_gadcon_popup_content_set(E_Gadcon_Popup *pop, Evas_Object *o);
EAPI void e_gadcon_popup_show(E_Gadcon_Popup *pop);
EAPI void e_gadcon_popup_hide(E_Gadcon_Popup *pop);
EAPI void e_gadcon_popup_toggle_pinned(E_Gadcon_Popup *pop);
#endif
#endif

View File

@ -43,6 +43,7 @@
#include "e_moveresize.h"
#include "e_actions.h"
#include "e_popup.h"
#include "e_gadcon_popup.h"
#include "e_ipc_codec.h"
#include "e_test.h"
#include "e_prefix.h"