a scrollview smart plus gfx for it.

SVN revision: 18103
This commit is contained in:
Carsten Haitzler 2005-10-29 11:51:19 +00:00
parent d329126dea
commit 6890023f71
27 changed files with 1440 additions and 19 deletions

View File

@ -166,7 +166,7 @@ CPPFLAGS="${PCPPFLAGS}"
AC_SUBST(cf_cflags)
AC_SUBST(cf_libs)
ALL_LINGUAS="bg de es fi fr ja pl pt ru zh_CN hu sl it cs da sk sv nb"
ALL_LINGUAS="bg de es fi fr ja pl pt ru zh_CN hu sl it cs da sk sv nb nl"
AC_SUBST(ALL_LINGUAS)
AM_GNU_GETTEXT([external])

View File

@ -45,7 +45,8 @@ default_check.edc \
default_radio.edc \
default_frame.edc \
default_label.edc \
default_button.edc
default_button.edc \
default_scrollframe.edc
default.edj: Makefile $(EXTRA_DIST)
$(EDJE_CC) $(EDJE_FLAGS) \

View File

@ -54,6 +54,7 @@ collections {
#include "default_radio.edc"
#include "default_frame.edc"
#include "default_button.edc"
#include "default_label.edc"
#include "default_label.edc"
#include "default_scrollframe.edc"
}

View File

@ -0,0 +1,737 @@
images {
image: "e17_ibar_bg_v.png" COMP;
image: "e17_ibar_over_v.png" COMP;
image: "e17_sb_btd1.png" COMP;
image: "e17_sb_btd2.png" COMP;
image: "e17_sb_btu1.png" COMP;
image: "e17_sb_btu2.png" COMP;
image: "e17_sb_btl1.png" COMP;
image: "e17_sb_btl2.png" COMP;
image: "e17_sb_btr1.png" COMP;
image: "e17_sb_btr2.png" COMP;
image: "e17_sb_btu1.png" COMP;
image: "e17_sb_barh1.png" COMP;
image: "e17_sb_barh2.png" COMP;
image: "e17_sb_barv1.png" COMP;
image: "e17_sb_barv2.png" COMP;
image: "e17_sb_runnerh.png" COMP;
image: "e17_sb_runnerv.png" COMP;
image: "e17_scrollbar_hdrag_thumb.png" COMP;
image: "e17_scrollbar_vdrag_thumb.png" COMP;
}
group {
name: "widgets/scrollframe";
parts {
part {
name: "bg";
mouse_events: 0;
description {
state: "default" 0.0;
image {
normal: "e17_ibar_bg_v.png";
border: 7 7 7 7;
}
fill {
smooth : 0;
}
}
}
part {
name: "clipper";
type: RECT;
mouse_events: 0;
description {
state: "default" 0.0;
rel1 {
to: "bg";
offset: 4 4;
}
rel2 {
to: "bg";
offset: -5 -5;
}
}
}
part {
name: "item";
clip_to: "clipper";
type: SWALLOW;
mouse_events: 0;
description {
state: "default" 0.0;
color: 0 0 0 0;
rel2 {
relative: 0.0 0.0;
offset: -1 -1;
to_x: "sb_vbar";
to_y: "sb_hbar";
}
}
}
part {
name: "conf_over";
mouse_events: 0;
description {
state: "default" 0.0;
rel1 {
to: "bg";
}
rel2 {
to: "bg";
}
image {
normal: "e17_ibar_over_v.png";
border: 13 13 13 13;
}
fill {
smooth : 0;
}
}
}
part {
name: "sb_vbar";
type: RECT;
mouse_events: 0;
description {
state: "default" 0.0;
min: 16 16;
align: 1.0 0.0;
rel1 {
to: "bg";
relative: 1.0 0.0;
offset: -5 4;
}
rel2 {
to: "bg";
relative: 1.0 0.0;
offset: -5 -1;
to_y: "sb_hbar";
}
}
description {
state: "hidden" 0.0;
visible: 0;
max: 0 99999;
rel1 {
to: "bg";
relative: 1.0 0.0;
offset: -4 4;
}
rel2 {
to: "bg";
relative: 1.0 0.0;
offset: -4 -1;
to_y: "sb_hbar";
}
}
}
part {
name: "sb_vbar_base";
type: RECT;
clip_to: "sb_vbar";
mouse_events: 1;
description {
state: "default" 0.0;
color: 0 0 0 0;
rel1 {
relative: 0.0 1.0;
offset: 0 0;
to: "sb_vbar_a1";
}
rel2 {
relative: 1.0 0.0;
offset: -1 -1;
to: "sb_vbar_a2";
}
}
}
part {
name: "sb_vbar_runner";
clip_to: "sb_vbar";
mouse_events: 0;
description {
state: "default" 0.0;
max: 2 99999;
rel1 {
to: "sb_vbar_base";
}
rel2 {
to: "sb_vbar_base";
}
image {
normal: "e17_sb_runnerv.png";
border: 0 0 4 4;
}
fill {
smooth: 0;
}
}
}
part {
name: "sb_vbar_p1";
type: RECT;
clip_to: "sb_vbar";
mouse_events: 1;
description {
state: "default" 0.0;
color: 0 0 0 0;
rel1 {
relative: 0.0 1.0;
offset: 0 0;
to: "sb_vbar_a1";
}
rel2 {
relative: 1.0 0.0;
offset: -1 -1;
to: "vbar_bar";
}
}
}
part {
name: "sb_vbar_p2";
type: RECT;
clip_to: "sb_vbar";
mouse_events: 1;
description {
state: "default" 0.0;
color: 0 0 0 0;
rel1 {
relative: 0.0 1.0;
offset: 0 0;
to: "vbar_bar";
}
rel2 {
relative: 1.0 0.0;
offset: -1 -1;
to: "sb_vbar_a2";
}
}
}
part {
name: "vbar_bar";
clip_to: "sb_vbar";
mouse_events: 1;
dragable {
x: 0 0 0;
y: 1 1 0;
confine: "sb_vbar_base";
}
description {
state: "default" 0.0;
min: 16 16;
rel1 {
relative: 0.5 0.5;
offset: 0 0;
to: "sb_vbar_base";
}
rel2 {
relative: 0.5 0.5;
offset: 0 0;
to: "sb_vbar_base";
}
image {
normal: "e17_sb_barv1.png";
border: 5 5 5 5;
}
}
description {
state: "clicked" 0.0;
inherit: "default" 0.0;
image {
normal: "e17_sb_barv2.png";
}
}
}
part {
name: "vbar_bar_thumb";
clip_to: "sb_vbar";
mouse_events: 0;
description {
state: "default" 0.0;
max: 8 8;
min: 8 8;
rel1 {
to: "vbar_bar";
}
rel2 {
to: "vbar_bar";
}
image {
normal: "e17_scrollbar_vdrag_thumb.png";
}
}
}
part {
name: "sb_vbar_a1";
type: IMAGE;
mouse_events: 1;
clip_to: "sb_vbar";
description {
state: "default" 0.0;
align: 0.5 0.0;
aspect: 1.0 1.0;
aspect_preference: HORIZONTAL;
rel1 {
to: "sb_vbar";
relative: 0.0 0.0;
offset: 0 0;
}
rel2 {
to: "sb_vbar";
relative: 1.0 0.0;
offset: -1 0;
}
image {
normal: "e17_sb_btu1.png";
}
}
description {
state: "clicked" 0.0;
inherit: "default" 0.0;
image {
normal: "e17_sb_btu2.png";
}
}
}
part {
name: "sb_vbar_a2";
type: IMAGE;
mouse_events: 1;
clip_to: "sb_vbar";
description {
state: "default" 0.0;
align: 0.5 1.0;
aspect: 1.0 1.0;
aspect_preference: HORIZONTAL;
rel1 {
to: "sb_vbar";
relative: 0.0 1.0;
offset: 0 -1;
}
rel2 {
to: "sb_vbar";
relative: 1.0 1.0;
offset: -1 -1;
}
image {
normal: "e17_sb_btd1.png";
}
}
description {
state: "clicked" 0.0;
inherit: "default" 0.0;
image {
normal: "e17_sb_btd2.png";
}
}
}
part {
name: "sb_hbar";
type: RECT;
mouse_events: 0;
description {
state: "default" 0.0;
min: 16 16;
align: 0.0 1.0;
rel1 {
to: "bg";
relative: 0.0 1.0;
offset: 4 -5;
}
rel2 {
to: "bg";
relative: 0.0 1.0;
offset: -1 -5;
to_x: "sb_vbar";
}
}
description {
state: "hidden" 0.0;
visible: 0;
rel1 {
to: "bg";
relative: 0.0 1.0;
offset: 0 -4;
}
rel2 {
to: "bg";
relative: 0.0 1.0;
offset: -1 -4;
to_x: "sb_vbar";
}
}
}
part {
name: "sb_hbar_base";
type: RECT;
clip_to: "sb_hbar";
mouse_events: 1;
description {
state: "default" 0.0;
color: 0 0 0 0;
rel1 {
relative: 1.0 0.0;
offset: 0 0;
to: "sb_hbar_a1";
}
rel2 {
relative: 0.0 1.0;
offset: -1 -1;
to: "sb_hbar_a2";
}
}
}
part {
name: "sb_hbar_runner";
clip_to: "sb_hbar";
mouse_events: 0;
description {
state: "default" 0.0;
max: 99999 2;
rel1 {
to: "sb_hbar_base";
}
rel2 {
to: "sb_hbar_base";
}
image {
normal: "e17_sb_runnerh.png";
border: 4 4 0 0;
}
fill {
smooth: 0;
}
}
}
part {
name: "sb_hbar_p1";
type: RECT;
clip_to: "sb_hbar";
mouse_events: 1;
description {
state: "default" 0.0;
color: 0 0 0 0;
rel1 {
relative: 1.0 0.0;
offset: 0 0;
to: "sb_hbar_a1";
}
rel2 {
relative: 0.0 1.0;
offset: -1 -1;
to: "hbar_bar";
}
}
}
part {
name: "sb_hbar_p2";
type: RECT;
clip_to: "sb_hbar";
mouse_events: 1;
description {
state: "default" 0.0;
color: 0 0 0 0;
rel1 {
relative: 1.0 0.0;
offset: 0 0;
to: "hbar_bar";
}
rel2 {
relative: 0.0 1.0;
offset: -1 -1;
to: "sb_hbar_a2";
}
}
}
part {
name: "hbar_bar";
clip_to: "sb_hbar";
mouse_events: 1;
dragable {
x: 1 1 0;
y: 0 0 0;
confine: "sb_hbar_base";
}
description {
state: "default" 0.0;
min: 16 16;
rel1 {
relative: 0.5 0.5;
offset: 0 0;
to: "sb_hbar_base";
}
rel2 {
relative: 0.5 0.5;
offset: 0 0;
to: "sb_hbar_base";
}
image {
normal: "e17_sb_barh1.png";
border: 5 5 5 5;
}
}
description {
state: "clicked" 0.0;
inherit: "default" 0.0;
image {
normal: "e17_sb_barh2.png";
}
}
}
part {
name: "hbar_bar_thumb";
clip_to: "sb_hbar";
mouse_events: 0;
description {
state: "default" 0.0;
max: 8 8;
min: 8 8;
rel1 {
to: "hbar_bar";
}
rel2 {
to: "hbar_bar";
}
image {
normal: "e17_scrollbar_hdrag_thumb.png";
}
}
}
part {
name: "sb_hbar_a1";
type: IMAGE;
mouse_events: 1;
clip_to: "sb_hbar";
description {
state: "default" 0.0;
align: 0.0 0.5;
aspect: 1.0 1.0;
aspect_preference: VERTICAL;
rel1 {
to: "sb_hbar";
relative: 0.0 0.0;
offset: 0 0;
}
rel2 {
to: "sb_hbar";
relative: 0.0 1.0;
offset: 0 -1;
}
image {
normal: "e17_sb_btl1.png";
}
}
description {
state: "clicked" 0.0;
inherit: "default" 0.0;
image {
normal: "e17_sb_btl2.png";
}
}
}
part {
name: "sb_hbar_a2";
type: IMAGE;
mouse_events: 1;
clip_to: "sb_hbar";
description {
state: "default" 0.0;
align: 1.0 0.5;
aspect: 1.0 1.0;
aspect_preference: VERTICAL;
rel1 {
to: "sb_hbar";
relative: 1.0 0.0;
offset: -1 0;
}
rel2 {
to: "sb_hbar";
relative: 1.0 1.0;
offset: -1 -1;
}
image {
normal: "e17_sb_btr1.png";
}
}
description {
state: "clicked" 0.0;
inherit: "default" 0.0;
image {
normal: "e17_sb_btr2.png";
}
}
}
}
programs {
program {
name: "sb_vbar_show";
signal: "vbar";
source: "show";
action: STATE_SET "default" 0.0;
target: "sb_vbar";
}
program {
name: "sb_vbar_hide";
signal: "vbar";
source: "hide";
action: STATE_SET "hidden" 0.0;
target: "sb_vbar";
}
program {
name: "sb_hbar_show";
signal: "hbar";
source: "show";
action: STATE_SET "default" 0.0;
target: "sb_hbar";
}
program {
name: "sb_hbar_hide";
signal: "hbar";
source: "hide";
action: STATE_SET "hidden" 0.0;
target: "sb_hbar";
}
program {
name: "sb_vbar_a1_down";
signal: "mouse,down,1";
source: "sb_vbar_a1";
action: STATE_SET "clicked" 0.0;
target: "sb_vbar_a1";
}
program {
name: "sb_vbar_a1_down2";
signal: "mouse,down,1";
source: "sb_vbar_a1";
action: DRAG_VAL_STEP 0.0 -1.0;
target: "vbar_bar";
}
program {
name: "sb_vbar_a1_up";
signal: "mouse,up,1";
source: "sb_vbar_a1";
action: STATE_SET "default" 0.0;
target: "sb_vbar_a1";
}
program {
name: "sb_vbar_a2_down";
signal: "mouse,down,1";
source: "sb_vbar_a2";
action: STATE_SET "clicked" 0.0;
target: "sb_vbar_a2";
}
program {
name: "sb_vbar_a2_down2";
signal: "mouse,down,1";
source: "sb_vbar_a2";
action: DRAG_VAL_STEP 0.0 1.0;
target: "vbar_bar";
}
program {
name: "sb_vbar_a2_up";
signal: "mouse,up,1";
source: "sb_vbar_a2";
action: STATE_SET "default" 0.0;
target: "sb_vbar_a2";
}
program {
name: "sb_vbar_p1_down";
signal: "mouse,down,1";
source: "sb_vbar_p1";
action: DRAG_VAL_PAGE 0.0 -1.0;
target: "vbar_bar";
}
program {
name: "sb_vbar_p2_down";
signal: "mouse,down,1";
source: "sb_vbar_p2";
action: DRAG_VAL_PAGE 0.0 1.0;
target: "vbar_bar";
}
program {
name: "sb_vbar_down";
signal: "mouse,down,1";
source: "vbar_bar";
action: STATE_SET "clicked" 0.0;
target: "vbar_bar";
}
program {
name: "sb_vbar_up";
signal: "mouse,up,1";
source: "vbar_bar";
action: STATE_SET "default" 0.0;
target: "vbar_bar";
}
program {
name: "sb_hbar_a1_down";
signal: "mouse,down,1";
source: "sb_hbar_a1";
action: STATE_SET "clicked" 0.0;
target: "sb_hbar_a1";
}
program {
name: "sb_hbar_a1_down2";
signal: "mouse,down,1";
source: "sb_hbar_a1";
action: DRAG_VAL_STEP -1.0 0.0;
target: "hbar_bar";
}
program {
name: "sb_hbar_a1_up";
signal: "mouse,up,1";
source: "sb_hbar_a1";
action: STATE_SET "default" 0.0;
target: "sb_hbar_a1";
}
program {
name: "sb_hbar_a2_down";
signal: "mouse,down,1";
source: "sb_hbar_a2";
action: STATE_SET "clicked" 0.0;
target: "sb_hbar_a2";
}
program {
name: "sb_hbar_a2_down2";
signal: "mouse,down,1";
source: "sb_hbar_a2";
action: DRAG_VAL_STEP 1.0 0.0;
target: "hbar_bar";
}
program {
name: "sb_hbar_a2_up";
signal: "mouse,up,1";
source: "sb_hbar_a2";
action: STATE_SET "default" 0.0;
target: "sb_hbar_a2";
}
program {
name: "sb_hbar_p1_down";
signal: "mouse,down,1";
source: "sb_hbar_p1";
action: DRAG_VAL_PAGE -1.0 0.0;
target: "hbar_bar";
}
program {
name: "sb_hbar_p2_down";
signal: "mouse,down,1";
source: "sb_hbar_p2";
action: DRAG_VAL_PAGE 1.0 0.0;
target: "hbar_bar";
}
program {
name: "sb_hbar_down";
signal: "mouse,down,1";
source: "hbar_bar";
action: STATE_SET "clicked" 0.0;
target: "hbar_bar";
}
program {
name: "sb_hbar_up";
signal: "mouse,up,1";
source: "hbar_bar";
action: STATE_SET "default" 0.0;
target: "hbar_bar";
}
}
}

View File

@ -403,4 +403,18 @@ e17_button_sm.png \
e17_button_sm2.png \
e17_button_sm_disabled.png \
e17_menu_check0.png \
e17_menu_radio0.png
e17_menu_radio0.png \
e17_sb_barh1.png \
e17_sb_barh2.png \
e17_sb_barv1.png \
e17_sb_barv2.png \
e17_sb_btd1.png \
e17_sb_btd2.png \
e17_sb_btl1.png \
e17_sb_btl2.png \
e17_sb_btr1.png \
e17_sb_btr2.png \
e17_sb_btu1.png \
e17_sb_btu2.png \
e17_sb_runnerh.png \
e17_sb_runnerv.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 726 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 718 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 725 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 715 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 720 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 718 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 721 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 715 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

View File

@ -106,6 +106,7 @@ e_int_border_remember.h \
e_eap_editor.h \
e_widget_iconsel.h \
e_widget_fileman.h \
e_scrollframe.h \
e_file_selector.h \
e_file_dialog.h
@ -194,6 +195,7 @@ e_int_border_remember.c \
e_eap_editor.c \
e_widget_iconsel.c \
e_widget_fileman.c \
e_scrollframe.c \
e_file_selector.c \
e_file_dialog.c \
$(ENLIGHTENMENTHEADERS)

View File

@ -84,6 +84,7 @@
#include "e_thumb.h"
#include "e_int_border_remember.h"
#include "e_eap_editor.h"
#include "e_scrollframe.h"
#include "e_file_selector.h"
#include "e_file_dialog.h"
#include "e_widget_fileman.h"

View File

@ -85,6 +85,7 @@ e_intl_init(void)
ADD_LANG("sk_SK.UTF-8");
ADD_LANG("sv_SV.UTF-8");
ADD_LANG("nb_NO.UTF-8");
ADD_LANG("nl_NL.UTF-8");
_e_intl_input_method_config_edd = E_CONFIG_DD_NEW("input_method_config", E_Input_Method_Config);
E_CONFIG_VAL(_e_intl_input_method_config_edd, E_Input_Method_Config, version, INT);

View File

@ -89,13 +89,13 @@ void
e_pan_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
{
API_ENTRY return;
sd->px = x;
sd->py = y;
if (x > (sd->w - sd->child_w)) x = sd->w - sd->child_w;
if (y > (sd->h - sd->child_h)) y = sd->h - sd->child_h;
if (x > (sd->child_w - sd->w)) x = sd->child_w - sd->w;
if (y > (sd->child_h - sd->h)) y = sd->child_h - sd->h;
if (x < 0) x = 0;
if (y < 0) y = 0;
if ((x == sd->px) && (y == sd->py)) return;
sd->px = x;
sd->py = y;
_e_smart_reconfigure(sd);
evas_object_smart_callback_call(sd->smart_obj, "changed", NULL);
}
@ -114,12 +114,12 @@ e_pan_max_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y)
API_ENTRY return;
if (x)
{
if (sd->w > sd->child_w) *x = sd->w - sd->child_w;
if (sd->w < sd->child_w) *x = sd->child_w - sd->w;
else *x = 0;
}
if (y)
{
if (sd->h > sd->child_h) *y = sd->h - sd->child_h;
if (sd->h < sd->child_h) *y = sd->child_h - sd->h;
else *y = 0;
}
}

View File

@ -6,15 +6,13 @@
#ifndef E_PAN_H
#define E_PAN_H
EAPI Evas_Object *e_pan_add(Evas *evas);
void e_pan_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
void e_pan_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
void e_pan_child_set(Evas_Object *obj, Evas_Object *child);
Evas_Object *e_pan_child_get(Evas_Object *obj);
void e_pan_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
void e_pan_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
void e_pan_max_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
void e_pan_child_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h);
EAPI Evas_Object *e_pan_add (Evas *evas);
EAPI void e_pan_child_set (Evas_Object *obj, Evas_Object *child);
EAPI Evas_Object *e_pan_child_get (Evas_Object *obj);
EAPI void e_pan_set (Evas_Object *obj, Evas_Coord x, Evas_Coord y);
EAPI void e_pan_get (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
EAPI void e_pan_max_get (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
EAPI void e_pan_child_size_get (Evas_Object *obj, Evas_Coord *w, Evas_Coord *h);
#endif
#endif

611
src/bin/e_scrollframe.c Normal file
View File

@ -0,0 +1,611 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "e.h"
#define SMART_NAME "e_scrollframe"
#define API_ENTRY E_Smart_Data *sd; sd = evas_object_smart_data_get(obj); if ((!obj) || (!sd) || (evas_object_type_get(obj) && strcmp(evas_object_type_get(obj), SMART_NAME)))
#define INTERNAL_ENTRY E_Smart_Data *sd; sd = evas_object_smart_data_get(obj); if (!sd) return;
typedef struct _E_Smart_Data E_Smart_Data;
struct _E_Smart_Data
{
Evas_Coord x, y, w, h;
Evas_Object *smart_obj;
Evas_Object *child_obj;
Evas_Object *pan_obj;
Evas_Object *edje_obj;
Evas_Object *event_obj;
E_Scrollframe_Policy hbar_flags, vbar_flags;
struct {
Evas_Coord w, h;
} child;
struct {
Evas_Coord x, y;
} step, page;
unsigned char hbar_visible : 1;
unsigned char vbar_visible : 1;
};
/* local subsystem functions */
static void _e_smart_child_del_hook(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_smart_child_resize_hook(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_smart_event_wheel(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_smart_edje_drag_v(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _e_smart_edje_drag_h(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _e_smart_scrollbar_read(E_Smart_Data *sd);
static void _e_smart_scrollbar_reset(E_Smart_Data *sd);
static int _e_smart_scrollbar_bar_h_visibility_adjust(E_Smart_Data *sd);
static int _e_smart_scrollbar_bar_v_visibility_adjust(E_Smart_Data *sd);
static void _e_smart_scrollbar_bar_visibility_adjust(E_Smart_Data *sd);
static void _e_smart_scrollbar_size_adjust(E_Smart_Data *sd);
static void _e_smart_reconfigure(E_Smart_Data *sd);
static void _e_smart_add(Evas_Object *obj);
static void _e_smart_del(Evas_Object *obj);
static void _e_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
static void _e_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
static void _e_smart_show(Evas_Object *obj);
static void _e_smart_hide(Evas_Object *obj);
static void _e_smart_color_set(Evas_Object *obj, int r, int g, int b, int a);
static void _e_smart_clip_set(Evas_Object *obj, Evas_Object * clip);
static void _e_smart_clip_unset(Evas_Object *obj);
static void _e_smart_init(void);
/* local subsystem globals */
static Evas_Smart *_e_smart = NULL;
/* externally accessible functions */
Evas_Object *
e_scrollframe_add(Evas *evas)
{
_e_smart_init();
return evas_object_smart_add(evas, _e_smart);
}
void
e_scrollframe_child_set(Evas_Object *obj, Evas_Object *child)
{
Evas_Coord w, h;
API_ENTRY return;
if (sd->child_obj)
{
e_pan_child_set(sd->pan_obj, NULL);
evas_object_event_callback_del(sd->child_obj, EVAS_CALLBACK_FREE, _e_smart_child_del_hook);
evas_object_event_callback_del(sd->child_obj, EVAS_CALLBACK_RESIZE, _e_smart_child_resize_hook);
}
sd->child_obj = child;
if (!child) return;
evas_object_event_callback_add(child, EVAS_CALLBACK_FREE, _e_smart_child_del_hook, sd);
evas_object_event_callback_add(child, EVAS_CALLBACK_RESIZE, _e_smart_child_resize_hook, sd);
evas_object_geometry_get(child, NULL, NULL, &w, &h);
sd->child.w = w;
sd->child.h = h;
e_pan_child_set(sd->pan_obj, sd->child_obj);
_e_smart_scrollbar_size_adjust(sd);
_e_smart_scrollbar_reset(sd);
}
void
e_scrollframe_child_pos_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
{
Evas_Coord mx = 0, my = 0;
double vx, vy;
API_ENTRY return;
e_pan_max_get(sd->pan_obj, &mx, &my);
if (mx > 0) vx = (double)x / (double)mx;
else vx = 0.0;
if (vx < 0.0) vx = 0.0;
else if (vx > 1.0) vx = 1.0;
if (my > 0) vy = (double)y / (double)my;
else vy = 0.0;
if (vy < 0.0) vy = 0.0;
else if (vy > 1.0) vy = 1.0;
edje_object_part_drag_value_set(sd->edje_obj, "vbar_bar", 0.0, vy);
edje_object_part_drag_value_set(sd->edje_obj, "hbar_bar", vx, 0.0);
e_pan_set(sd->pan_obj, x, y);
}
void
e_scrollframe_child_pos_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y)
{
API_ENTRY return;
e_pan_get(sd->pan_obj, x, y);
}
void
e_scrollframe_child_viewport_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
{
API_ENTRY return;
evas_object_geometry_get(sd->pan_obj, NULL, NULL, w, h);
}
void
e_scrollframe_step_size_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
{
API_ENTRY return;
if (x < 1) x = 1;
if (y < 1) y = 1;
sd->step.x = x;
sd->step.y = y;
_e_smart_scrollbar_size_adjust(sd);
}
void
e_scrollframe_step_size_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y)
{
API_ENTRY return;
if (x) *x = sd->step.x;
if (y) *y = sd->step.y;
}
void
e_scrollframe_page_size_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
{
API_ENTRY return;
sd->page.x = x;
sd->page.y = y;
_e_smart_scrollbar_size_adjust(sd);
}
void
e_scrollframe_page_size_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y)
{
API_ENTRY return;
if (x) *x = sd->page.x;
if (y) *y = sd->page.y;
}
void
e_scrollframe_policy_set(Evas_Object *obj, E_Scrollframe_Policy hbar, E_Scrollframe_Policy vbar)
{
API_ENTRY return;
if ((sd->hbar_flags == hbar) && (sd->vbar_flags == vbar)) return;
sd->hbar_flags = hbar;
sd->vbar_flags = vbar;
_e_smart_scrollbar_size_adjust(sd);
}
void
e_scrollframe_policy_get(Evas_Object *obj, E_Scrollframe_Policy *hbar, E_Scrollframe_Policy *vbar)
{
API_ENTRY return;
if (hbar) *hbar = sd->hbar_flags;
if (vbar) *vbar = sd->vbar_flags;
}
/* local subsystem functions */
static void
_e_smart_edje_drag_v(void *data, Evas_Object *obj, const char *emission, const char *source)
{
E_Smart_Data *sd;
sd = data;
_e_smart_scrollbar_read(sd);
}
static void
_e_smart_edje_drag_h(void *data, Evas_Object *obj, const char *emission, const char *source)
{
E_Smart_Data *sd;
sd = data;
_e_smart_scrollbar_read(sd);
}
static void
_e_smart_child_del_hook(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
E_Smart_Data *sd;
sd = data;
sd->child_obj = NULL;
_e_smart_scrollbar_size_adjust(sd);
_e_smart_scrollbar_reset(sd);
}
static void
_e_smart_child_resize_hook(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Coord w, h;
E_Smart_Data *sd;
sd = data;
evas_object_geometry_get(sd->child_obj, NULL, NULL, &w, &h);
if ((w != sd->child.w) || (h != sd->child.h))
{
sd->child.w = w;
sd->child.h = h;
_e_smart_scrollbar_size_adjust(sd);
}
}
static void
_e_smart_event_wheel(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Mouse_Wheel *ev;
E_Smart_Data *sd;
Evas_Coord x = 0, y = 0;
sd = data;
ev = event_info;
e_scrollframe_child_pos_get(sd->smart_obj, &x, &y);
y += ev->z * sd->step.y;
e_scrollframe_child_pos_set(sd->smart_obj, x, y);
}
static void
_e_smart_scrollbar_read(E_Smart_Data *sd)
{
Evas_Coord x, y, mx = 0, my = 0;
double vx, vy;
edje_object_part_drag_value_get(sd->edje_obj, "vbar_bar", NULL, &vy);
edje_object_part_drag_value_get(sd->edje_obj, "hbar_bar", &vx, NULL);
e_pan_max_get(sd->pan_obj, &mx, &my);
x = vx * (double)mx;
y = vy * (double)my;
e_pan_set(sd->pan_obj, x, y);
}
static void
_e_smart_scrollbar_reset(E_Smart_Data *sd)
{
edje_object_part_drag_value_set(sd->edje_obj, "vbar_bar", 0.0, 0.0);
edje_object_part_drag_value_set(sd->edje_obj, "hbar_bar", 0.0, 0.0);
if (!sd->child_obj)
{
edje_object_part_drag_size_set(sd->edje_obj, "vbar_bar", 1.0, 1.0);
edje_object_part_drag_size_set(sd->edje_obj, "hbar_bar", 1.0, 1.0);
}
e_pan_set(sd->pan_obj, 0, 0);
}
static int
_e_smart_scrollbar_bar_v_visibility_adjust(E_Smart_Data *sd)
{
int scroll_v_vis_change = 0;
Evas_Coord w, h, vw, vh;
w = sd->child.w;
h = sd->child.h;
evas_object_geometry_get(sd->pan_obj, NULL, NULL, &vw, &vh);
if (sd->vbar_visible)
{
if (sd->vbar_flags == E_SCROLLFRAME_POLICY_AUTO)
{
if (sd->child_obj)
{
if (h <= vh)
{
scroll_v_vis_change = 1;
sd->vbar_visible = 0;
}
}
else
{
scroll_v_vis_change = 1;
sd->vbar_visible = 0;
}
}
else if (sd->vbar_flags == E_SCROLLFRAME_POLICY_OFF)
{
scroll_v_vis_change = 1;
sd->vbar_visible = 0;
}
}
else
{
if (sd->vbar_flags == E_SCROLLFRAME_POLICY_AUTO)
{
if (sd->child_obj)
{
if (h > vh)
{
scroll_v_vis_change = 1;
sd->vbar_visible = 1;
}
}
}
else if (sd->vbar_flags == E_SCROLLFRAME_POLICY_ON)
{
scroll_v_vis_change = 1;
sd->vbar_visible = 1;
}
}
if (scroll_v_vis_change)
{
if (sd->vbar_visible)
edje_object_signal_emit(sd->edje_obj, "vbar", "show");
else
edje_object_signal_emit(sd->edje_obj, "vbar", "hide");
edje_object_message_signal_process(sd->edje_obj);
_e_smart_scrollbar_size_adjust(sd);
}
return scroll_v_vis_change;
}
static int
_e_smart_scrollbar_bar_h_visibility_adjust(E_Smart_Data *sd)
{
int scroll_h_vis_change = 0;
Evas_Coord w, h, vw, vh;
w = sd->child.w;
h = sd->child.h;
evas_object_geometry_get(sd->pan_obj, NULL, NULL, &vw, &vh);
if (sd->hbar_visible)
{
if (sd->hbar_flags == E_SCROLLFRAME_POLICY_AUTO)
{
if (sd->child_obj)
{
if (w <= vw)
{
scroll_h_vis_change = 1;
sd->hbar_visible = 0;
}
}
else
{
scroll_h_vis_change = 1;
sd->hbar_visible = 0;
}
}
else if (sd->hbar_flags == E_SCROLLFRAME_POLICY_OFF)
{
scroll_h_vis_change = 1;
sd->hbar_visible = 0;
}
}
else
{
if (sd->hbar_flags == E_SCROLLFRAME_POLICY_AUTO)
{
if (sd->child_obj)
{
if (w > vw)
{
scroll_h_vis_change = 1;
sd->hbar_visible = 1;
}
}
}
else if (sd->hbar_flags == E_SCROLLFRAME_POLICY_ON)
{
scroll_h_vis_change = 1;
sd->hbar_visible = 1;
}
}
if (scroll_h_vis_change)
{
if (sd->hbar_visible)
edje_object_signal_emit(sd->edje_obj, "hbar", "show");
else
edje_object_signal_emit(sd->edje_obj, "hbar", "hide");
edje_object_message_signal_process(sd->edje_obj);
_e_smart_scrollbar_size_adjust(sd);
}
return scroll_h_vis_change;
}
static void
_e_smart_scrollbar_bar_visibility_adjust(E_Smart_Data *sd)
{
int changed = 0;
changed |= _e_smart_scrollbar_bar_h_visibility_adjust(sd);
changed |= _e_smart_scrollbar_bar_v_visibility_adjust(sd);
if (changed)
{
_e_smart_scrollbar_bar_h_visibility_adjust(sd);
_e_smart_scrollbar_bar_v_visibility_adjust(sd);
}
}
static void
_e_smart_scrollbar_size_adjust(E_Smart_Data *sd)
{
if (sd->child_obj)
{
Evas_Coord x, y, w, h, mx = 0, my = 0, vw = 0, vh = 0;
double vx, vy, size;
evas_object_geometry_get(sd->pan_obj, NULL, NULL, &vw, &vh);
w = sd->child.w;
if (w < 1) w = 1;
size = (double)vw / (double)w;
if (size > 1.0)
{
size = 1.0;
edje_object_part_drag_value_set(sd->edje_obj, "hbar_bar", 0.0, 0.0);
}
edje_object_part_drag_size_set(sd->edje_obj, "hbar_bar", size, 1.0);
h = sd->child.h;
if (h < 1) h = 1;
size = (double)vh / (double)h;
if (size > 1.0)
{
size = 1.0;
edje_object_part_drag_value_set(sd->edje_obj, "vbar_bar", 0.0, 0.0);
}
edje_object_part_drag_size_set(sd->edje_obj, "vbar_bar", 1.0, size);
edje_object_part_drag_value_get(sd->edje_obj, "hbar_bar", &vx, NULL);
edje_object_part_drag_value_get(sd->edje_obj, "vbar_bar", NULL, &vy);
e_pan_max_get(sd->pan_obj, &mx, &my);
x = vx * mx;
y = vy * my;
edje_object_part_drag_step_set(sd->edje_obj, "hbar_bar", (double)sd->step.x / (double)w, 0.0);
edje_object_part_drag_step_set(sd->edje_obj, "vbar_bar", 0.0, (double)sd->step.y / (double)h);
if (sd->page.x > 0)
edje_object_part_drag_page_set(sd->edje_obj, "hbar_bar", (double)sd->page.x / (double)w, 0.0);
else
edje_object_part_drag_page_set(sd->edje_obj, "hbar_bar", -((double)sd->page.x * ((double)vw / (double)w)) / 100.0, 0.0);
if (sd->page.y > 0)
edje_object_part_drag_page_set(sd->edje_obj, "vbar_bar", 0.0, (double)sd->page.y / (double)h);
else
edje_object_part_drag_page_set(sd->edje_obj, "vbar_bar", 0.0, -((double)sd->page.y * ((double)vh / (double)h)) / 100.0);
e_pan_set(sd->pan_obj, x, y);
}
else
{
edje_object_part_drag_size_set(sd->edje_obj, "vbar_bar", 1.0, 1.0);
edje_object_part_drag_size_set(sd->edje_obj, "hbar_bar", 1.0, 1.0);
e_pan_set(sd->pan_obj, 0, 0);
}
_e_smart_scrollbar_bar_visibility_adjust(sd);
}
static void
_e_smart_reconfigure(E_Smart_Data *sd)
{
evas_object_move(sd->edje_obj, sd->x, sd->y);
evas_object_resize(sd->edje_obj, sd->w, sd->h);
evas_object_move(sd->event_obj, sd->x, sd->y);
evas_object_resize(sd->event_obj, sd->w, sd->h);
_e_smart_scrollbar_size_adjust(sd);
}
static void
_e_smart_add(Evas_Object *obj)
{
E_Smart_Data *sd;
Evas_Object *o;
sd = calloc(1, sizeof(E_Smart_Data));
if (!sd) return;
evas_object_smart_data_set(obj, sd);
sd->smart_obj = obj;
sd->x = 0;
sd->y = 0;
sd->w = 0;
sd->h = 0;
sd->step.x = 32;
sd->step.y = 32;
sd->page.x = -50;
sd->page.y = -50;
sd->hbar_flags = E_SCROLLFRAME_POLICY_AUTO;
sd->vbar_flags = E_SCROLLFRAME_POLICY_AUTO;
sd->hbar_visible = 1;
sd->vbar_visible = 1;
o = edje_object_add(evas_object_evas_get(obj));
sd->edje_obj = o;
e_theme_edje_object_set(o, "base/theme/widgets",
"widgets/scrollframe");
edje_object_signal_callback_add(o, "drag*", "vbar_bar", _e_smart_edje_drag_v, sd);
edje_object_signal_callback_add(o, "drag*", "hbar_bar", _e_smart_edje_drag_h, sd);
evas_object_smart_member_add(o, obj);
o = e_pan_add(evas_object_evas_get(obj));
sd->pan_obj = o;
evas_object_show(o);
edje_object_part_swallow(sd->edje_obj, "item", o);
o = evas_object_rectangle_add(evas_object_evas_get(obj));
sd->event_obj = o;
evas_object_color_set(o, 0, 0, 0, 0);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_WHEEL, _e_smart_event_wheel, sd);
evas_object_smart_member_add(o, obj);
evas_object_repeat_events_set(o, 1);
evas_object_show(o);
_e_smart_scrollbar_reset(sd);
}
static void
_e_smart_del(Evas_Object *obj)
{
INTERNAL_ENTRY;
e_scrollframe_child_set(obj, NULL);
evas_object_del(sd->pan_obj);
evas_object_del(sd->edje_obj);
evas_object_del(sd->event_obj);
free(sd);
}
static void
_e_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
{
INTERNAL_ENTRY;
sd->x = x;
sd->y = y;
_e_smart_reconfigure(sd);
}
static void
_e_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
{
INTERNAL_ENTRY;
sd->w = w;
sd->h = h;
_e_smart_reconfigure(sd);
}
static void
_e_smart_show(Evas_Object *obj)
{
INTERNAL_ENTRY;
evas_object_show(sd->edje_obj);
}
static void
_e_smart_hide(Evas_Object *obj)
{
INTERNAL_ENTRY;
evas_object_hide(sd->edje_obj);
}
static void
_e_smart_color_set(Evas_Object *obj, int r, int g, int b, int a)
{
INTERNAL_ENTRY;
evas_object_color_set(sd->edje_obj, r, g, b, a);
}
static void