hmm contactlist widget.. and.. elementary has a serious design flaw... whihc
i really don't like. now do i do a quick fix... or redo the entire api etc. SVN revision: 36392
This commit is contained in:
parent
a8056a27eb
commit
40655e28d5
|
@ -2118,4 +2118,86 @@ collections {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
group { name: "contact";
|
||||
images {
|
||||
image: "bt_base1.png" COMP;
|
||||
image: "bt_base2.png" COMP;
|
||||
image: "bt_hilight.png" COMP;
|
||||
image: "bt_shine.png" COMP;
|
||||
}
|
||||
parts {
|
||||
part { name: "button_image";
|
||||
mouse_events: 1;
|
||||
description { state: "default" 0.0;
|
||||
image {
|
||||
normal: "bt_base2.png";
|
||||
border: 7 7 7 7;
|
||||
}
|
||||
}
|
||||
description { state: "clicked" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
image.normal: "bt_base1.png";
|
||||
}
|
||||
}
|
||||
part { name: "elm.swallow.contents";
|
||||
type: SWALLOW;
|
||||
type: RECT;
|
||||
description { state: "default" 0.0;
|
||||
aspect: 1.0 1.0;
|
||||
aspect_preference: VERTICAL;
|
||||
align: 0.0 0.5;
|
||||
rel1.offset: 4 4;
|
||||
rel2.offset: 4 -5;
|
||||
rel2.relative: 0.0 1.0;
|
||||
color: 255 0 0 128;
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "elm.text";
|
||||
type: TEXT;
|
||||
effect: SOFT_SHADOW;
|
||||
mouse_events: 0;
|
||||
scale: 1;
|
||||
description { state: "default" 0.0;
|
||||
align: 0.0 1.0;
|
||||
rel1.to_x: "elm.swallow.contents";
|
||||
rel1.relative: 1.0 1.0;
|
||||
rel1.offset: 0 -5;
|
||||
rel2.offset: -5 -5;
|
||||
color: 224 224 224 255;
|
||||
color3: 0 0 0 64;
|
||||
text {
|
||||
text: "Name of Contact goes here";
|
||||
font: "Sans:style=Bold,Edje-Vera-Bold";
|
||||
size: 10;
|
||||
min: 0 1;
|
||||
align: 0.0 1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
part { name: "over1";
|
||||
mouse_events: 0;
|
||||
description { state: "default" 0.0;
|
||||
rel2.relative: 1.0 0.5;
|
||||
image {
|
||||
normal: "bt_hilight.png";
|
||||
border: 7 7 7 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
part { name: "over2";
|
||||
mouse_events: 1;
|
||||
repeat_events: 1;
|
||||
ignore_flags: ON_HOLD;
|
||||
description { state: "default" 0.0;
|
||||
image {
|
||||
normal: "bt_shine.png";
|
||||
border: 7 7 7 7;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,7 +80,8 @@ extern "C" {
|
|||
ELM_OBJ_TOGGLE,
|
||||
ELM_OBJ_CLOCK,
|
||||
ELM_OBJ_FRAME,
|
||||
ELM_OBJ_PAD
|
||||
ELM_OBJ_PAD,
|
||||
ELM_OBJ_CONTACTLIST
|
||||
// ELM_OBJ_CHECK, // FIXME: do
|
||||
// ELM_OBJ_RADIO, // FIXME: do
|
||||
// ELM_OBJ_SEP, // FIXME: do (separator horiz or vert)
|
||||
|
@ -151,6 +152,8 @@ extern "C" {
|
|||
typedef struct _Elm_Frame Elm_Frame;
|
||||
typedef struct _Elm_Pad_Class Elm_Pad_Class;
|
||||
typedef struct _Elm_Pad Elm_Pad;
|
||||
typedef struct _Elm_Contactlist_Class Elm_Contactlist_Class;
|
||||
typedef struct _Elm_Contactlist Elm_Contactlist;
|
||||
|
||||
typedef void (*Elm_Cb_Func) (void *data, Elm_Obj *obj, Elm_Cb_Type type, void *info);
|
||||
|
||||
|
@ -313,11 +316,8 @@ extern "C" {
|
|||
|
||||
/**************************************************************************/
|
||||
/* Scroller (scrollframe/scrolledview) Object */
|
||||
#define Elm_Scroller_Class_Methods \
|
||||
void (*file_set) (Elm_Scroller *scroller, const char *file, const char *group);
|
||||
#define Elm_Scroller_Class_All Elm_Widget_Class_All; Elm_Scroller_Class_Methods; \
|
||||
const char *file; \
|
||||
const char *group
|
||||
#define Elm_Scroller_Class_Methods
|
||||
#define Elm_Scroller_Class_All Elm_Widget_Class_All; Elm_Scroller_Class_Methods;
|
||||
|
||||
/* Object specific ones */
|
||||
EAPI Elm_Scroller *elm_scroller_new(Elm_Win *win);
|
||||
|
@ -550,4 +550,30 @@ extern "C" {
|
|||
Elm_Pad_Class_All;
|
||||
};
|
||||
|
||||
/**************************************************************************/
|
||||
/* Contactlist Object */
|
||||
#define Elm_Contactlist_Class_Methods \
|
||||
void (*file_set) (Elm_Contactlist *cl, const char *file, const char *group);
|
||||
#define Elm_Contactlist_Class_All Elm_Widget_Class_All; Elm_Contactlist_Class_Methods; \
|
||||
const char *file; \
|
||||
const char *group
|
||||
|
||||
/* Object specific ones */
|
||||
EAPI Elm_Contactlist *elm_contactlist_new(Elm_Win *win);
|
||||
struct _Elm_Contactlist_Class
|
||||
{
|
||||
void *parent;
|
||||
Elm_Obj_Type type;
|
||||
Elm_Contactlist_Class_Methods;
|
||||
};
|
||||
struct _Elm_Contactlist
|
||||
{
|
||||
Elm_Contactlist_Class_All;
|
||||
|
||||
Elm_Box *box;
|
||||
Elm_Scroller *scroller;
|
||||
Elm_Button *button;
|
||||
Elm_Box *listbox;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -32,6 +32,7 @@ elm_toggle.c \
|
|||
elm_clock.c \
|
||||
elm_frame.c \
|
||||
elm_pad.c \
|
||||
elm_contactlist.c \
|
||||
\
|
||||
els_pan.c \
|
||||
els_pan.h \
|
||||
|
|
|
@ -30,6 +30,7 @@ _elm_box_pack_start(Elm_Box *bx, Elm_Widget *wid)
|
|||
{
|
||||
bx->child_add(bx, wid);
|
||||
_els_smart_box_pack_start(bx->base, wid->base);
|
||||
elm_widget_sizing_update(wid);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -37,6 +38,7 @@ _elm_box_pack_end(Elm_Box *bx, Elm_Widget *wid)
|
|||
{
|
||||
bx->child_add(bx, wid);
|
||||
_els_smart_box_pack_end(bx->base, wid->base);
|
||||
elm_widget_sizing_update(wid);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -44,6 +46,7 @@ _elm_box_pack_before(Elm_Box *bx, Elm_Widget *wid, Elm_Widget *wid_before)
|
|||
{
|
||||
bx->child_add(bx, wid);
|
||||
_els_smart_box_pack_before(bx->base, wid->base, wid_before->base);
|
||||
elm_widget_sizing_update(wid);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -51,6 +54,7 @@ _elm_box_pack_after(Elm_Box *bx, Elm_Widget *wid, Elm_Widget *wid_after)
|
|||
{
|
||||
bx->child_add(bx, wid);
|
||||
_els_smart_box_pack_after(bx->base, wid->base, wid_after->base);
|
||||
elm_widget_sizing_update(wid);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -61,6 +65,7 @@ _elm_box_size_alloc(Elm_Box *bx, int w, int h)
|
|||
_els_smart_box_min_size_get(bx->base, &mw, &mh);
|
||||
if (w < mw) w = mw;
|
||||
if (h < mh) h = mh;
|
||||
printf("box %p size alloc to %ix%i\n", bx, w, h);
|
||||
bx->req.w = w;
|
||||
bx->req.h = h;
|
||||
}
|
||||
|
@ -69,7 +74,7 @@ static void
|
|||
_elm_box_size_req(Elm_Box *bx, Elm_Widget *child, int w, int h)
|
||||
{
|
||||
Evas_Coord mw, mh;
|
||||
|
||||
|
||||
if (child)
|
||||
{
|
||||
Evas_Coord maxx, maxy;
|
||||
|
|
|
@ -0,0 +1,122 @@
|
|||
#include <Elementary.h>
|
||||
#include "elm_priv.h"
|
||||
|
||||
static void _elm_contactlist_del(Elm_Contactlist *cl);
|
||||
|
||||
Elm_Contactlist_Class _elm_contactlist_class =
|
||||
{
|
||||
&_elm_widget_class,
|
||||
ELM_OBJ_CONTACTLIST
|
||||
};
|
||||
|
||||
static void
|
||||
_elm_contactlist_del(Elm_Contactlist *cl)
|
||||
{
|
||||
// custom here
|
||||
((Elm_Obj_Class *)(((Elm_Contactlist_Class *)(cl->clas))->parent))->del(ELM_OBJ(cl));
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_contactlist_geom_set(Elm_Contactlist *cl, int x, int y, int w, int h)
|
||||
{
|
||||
cl->box->geom_set(cl->box, x, y, w, h);
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_on_child_add(void *data, Elm_Contactlist *cl, Elm_Cb_Type type, Elm_Obj *obj)
|
||||
{
|
||||
Evas_Coord vw, vh;
|
||||
|
||||
if (!(obj->hastype(obj, ELM_OBJ_WIDGET))) return;
|
||||
// custom here (eg pack to box)
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_on_child_del(void *data, Elm_Contactlist *cl, Elm_Cb_Type type, Elm_Obj *obj)
|
||||
{
|
||||
if (!(obj->hastype(obj, ELM_OBJ_WIDGET))) return;
|
||||
// dunno
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_contactlist_show(Elm_Contactlist *cl)
|
||||
{
|
||||
cl->box->show(cl->box);
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_contactlist_hide(Elm_Contactlist *cl)
|
||||
{
|
||||
cl->box->hide(cl->box);
|
||||
}
|
||||
|
||||
static void
|
||||
on_button_activate(Elm_Contactlist *cl, Elm_Button *bt, Elm_Cb_Type type, void *info)
|
||||
{
|
||||
printf("Add contact\n");
|
||||
}
|
||||
|
||||
|
||||
EAPI Elm_Contactlist *
|
||||
elm_contactlist_new(Elm_Win *win)
|
||||
{
|
||||
Elm_Contactlist *cl;
|
||||
|
||||
cl = ELM_NEW(Elm_Contactlist);
|
||||
_elm_widget_init(cl);
|
||||
|
||||
cl->clas = &_elm_contactlist_class;
|
||||
cl->type = ELM_OBJ_CONTACTLIST;
|
||||
|
||||
cl->del = _elm_contactlist_del;
|
||||
|
||||
cl->geom_set = _elm_contactlist_geom_set;
|
||||
cl->show = _elm_contactlist_show;
|
||||
cl->hide = _elm_contactlist_hide;
|
||||
|
||||
cl->box = elm_box_new(win);
|
||||
cl->child_add(cl, cl->box);
|
||||
|
||||
cl->listbox = elm_box_new(win);
|
||||
printf("--listbox = %p\n", cl->listbox);
|
||||
|
||||
cl->scroller = elm_scroller_new(win);
|
||||
cl->box->pack_end(cl->box, cl->scroller);
|
||||
|
||||
cl->button = elm_button_new(win);
|
||||
cl->button->text_set(cl->button, "Add Contact");
|
||||
cl->button->cb_add(cl->button, ELM_CB_ACTIVATED, on_button_activate, cl);
|
||||
cl->button->expand_y = 0;
|
||||
cl->box->pack_end(cl->box, cl->button);
|
||||
|
||||
cl->button->show(cl->button);
|
||||
|
||||
int i;
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
Elm_Button *bt;
|
||||
|
||||
bt = elm_button_new(win);
|
||||
bt->text_set(bt, "Contact 1");
|
||||
bt->expand_y = 0;
|
||||
cl->listbox->pack_end(cl->listbox, bt);
|
||||
bt->show(bt);
|
||||
}
|
||||
|
||||
cl->scroller->child_add(cl->scroller, cl->listbox);
|
||||
elm_widget_sizing_update(cl->listbox);
|
||||
cl->scroller->show(cl->scroller);
|
||||
cl->listbox->show(cl->listbox);
|
||||
|
||||
elm_widget_sizing_update(cl->scroller);
|
||||
elm_widget_sizing_update(cl->button);
|
||||
elm_widget_sizing_update(cl->box);
|
||||
|
||||
cl->base = cl->box->base;
|
||||
|
||||
cl->cb_add(cl, ELM_CB_CHILD_ADD, _elm_on_child_add, NULL);
|
||||
cl->cb_add(cl, ELM_CB_CHILD_DEL, _elm_on_child_del, NULL);
|
||||
_elm_widget_post_init(cl);
|
||||
win->child_add(win, cl);
|
||||
return cl;
|
||||
}
|
|
@ -60,5 +60,6 @@ extern Elm_Toggle_Class _elm_toggle_class;
|
|||
extern Elm_Clock_Class _elm_clock_class;
|
||||
extern Elm_Frame_Class _elm_frame_class;
|
||||
extern Elm_Pad_Class _elm_pad_class;
|
||||
extern Elm_Contactlist_Class _elm_contactlist_class;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -20,7 +20,8 @@ static void
|
|||
_elm_scroller_geom_set(Elm_Scroller *sc, int x, int y, int w, int h)
|
||||
{
|
||||
Evas_Coord vw, vh;
|
||||
|
||||
|
||||
printf("sc geom set %ix%i (am %ix%i)\n", w, h, sc->w, sc->h);
|
||||
if ((sc->w != w) || (sc->h != h) || (sc->x != x) || (sc->y != y))
|
||||
{
|
||||
Evas_List *l;
|
||||
|
|
|
@ -23,6 +23,7 @@ _elm_table_pack(Elm_Table *tb, Elm_Widget *wid, int x, int y, int w, int h)
|
|||
{
|
||||
tb->child_add(tb, wid);
|
||||
_els_smart_table_pack(tb->base, wid->base, x, y, w, h);
|
||||
elm_widget_sizing_update(wid);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in New Issue