slider widget... workies (in theory). still nto that pretty.


			
			
				devs/princeamd/enlightenment-0.17-elive
			
			
		
Carsten Haitzler 17 years ago
parent c1ea85e2b4
commit b0a324b5ee
  1. 244
      data/themes/default_slider.edc
  2. 10
      src/bin/e_slider.c
  3. 1
      src/bin/e_slider.h
  4. 8
      src/bin/e_test.c
  5. 43
      src/bin/e_widget_slider.c
  6. 2
      src/bin/e_widget_slider.h

@ -6,6 +6,8 @@ images {
image: "e17_sb_runnerh.png" COMP;
image: "e17_sb_runnerv.png" COMP;
image: "focus.png" COMP;
image: "e17_frame_label_over.png" COMP;
image: "e17_frame_label_under.png" COMP;
}
group {
@ -29,6 +31,15 @@ group {
state: "default" 0.0;
color: 0 0 0 0;
}
description {
state: "active" 0.0;
color: 0 0 0 0;
rel2 {
to_y: "label_over";
relative: 1.0 0.0;
offset: -1 -1;
}
}
}
part {
name: "sb_vbar_runner";
@ -52,6 +63,97 @@ group {
}
}
}
part {
name: "label_under";
mouse_events: 0;
description {
state: "default" 0.0;
visible: 0;
image {
normal: "e17_frame_label_under.png";
}
}
description {
state: "active" 0.0;
rel1 {
to: "label_over";
relative: 0.0 0.0;
offset: 1 1;
}
rel2 {
to: "label_over";
relative: 1.0 1.0;
offset: -2 -2;
}
image {
normal: "e17_frame_label_under.png";
border: 3 3 3 3;
}
fill {
smooth: 0;
}
}
}
part {
name: "label";
type: TEXT;
mouse_events: 0;
description {
state: "default" 0.0;
visible: 0;
}
description {
state: "active" 0.0;
align: 0.5 1.0;
rel1 {
relative: 0.0 1.0;
offset: 4 -5;
}
rel2 {
relative: 1.0 1.0;
offset: -5 -5;
}
color: 0 0 0 255;
text {
text: "00.00";
font: "Edje-Vera";
size: 10;
min: 1 1;
align: 0.5 0.5;
}
}
}
part {
name: "label_over";
mouse_events: 0;
description {
state: "default" 0.0;
visible: 0;
image {
normal: "e17_frame_label_over.png";
}
}
description {
state: "active" 0.0;
rel1 {
to: "label";
relative: 0.0 0.0;
offset: -5 -4;
}
rel2 {
to: "label";
relative: 1.0 1.0;
offset: 2 2;
}
image {
normal: "e17_frame_label_over.png";
border: 7 7 7 7;
}
fill {
smooth: 0;
}
}
}
part {
name: "sb_vbar_p1";
type: RECT;
@ -94,6 +196,7 @@ group {
description {
state: "default" 0.0;
min: 16 16;
fixed: 1 1;
rel1 {
relative: 0.5 0.5;
offset: 0 0;
@ -186,6 +289,26 @@ group {
transition: ACCELERATE 0.5;
target: "focus";
}
program {
name: "show_label";
signal: "show_label";
source: "";
action: STATE_SET "active" 0.0;
target: "sb_vbar_base";
target: "label_under";
target: "label";
target: "label_over";
}
program {
name: "hide_label";
signal: "hide_label";
source: "";
action: STATE_SET "default" 0.0;
target: "sb_vbar_base";
target: "label_under";
target: "label";
target: "label_over";
}
}
}
group {
@ -209,6 +332,15 @@ group {
state: "default" 0.0;
color: 0 0 0 0;
}
description {
state: "active" 0.0;
color: 0 0 0 0;
rel2 {
to_x: "label_over";
relative: 0.0 1.0;
offset: -1 -1;
}
}
}
part {
name: "sb_hbar_runner";
@ -232,6 +364,97 @@ group {
}
}
}
part {
name: "label_under";
mouse_events: 0;
description {
state: "default" 0.0;
visible: 0;
image {
normal: "e17_frame_label_under.png";
}
}
description {
state: "active" 0.0;
rel1 {
to: "label_over";
relative: 0.0 0.0;
offset: 1 1;
}
rel2 {
to: "label_over";
relative: 1.0 1.0;
offset: -2 -2;
}
image {
normal: "e17_frame_label_under.png";
border: 3 3 3 3;
}
fill {
smooth: 0;
}
}
}
part {
name: "label";
type: TEXT;
mouse_events: 0;
description {
state: "default" 0.0;
visible: 0;
}
description {
state: "active" 0.0;
align: 1.0 0.5;
rel1 {
relative: 1.0 0.0;
offset: -1 4;
}
rel2 {
relative: 1.0 1.0;
offset: -5 -5;
}
color: 0 0 0 255;
text {
text: "00.00";
font: "Edje-Vera";
size: 10;
min: 1 1;
align: 0.5 0.5;
}
}
}
part {
name: "label_over";
mouse_events: 0;
description {
state: "default" 0.0;
visible: 0;
image {
normal: "e17_frame_label_over.png";
}
}
description {
state: "active" 0.0;
rel1 {
to: "label";
relative: 0.0 0.0;
offset: -5 -4;
}
rel2 {
to: "label";
relative: 1.0 1.0;
offset: 2 2;
}
image {
normal: "e17_frame_label_over.png";
border: 7 7 7 7;
}
fill {
smooth: 0;
}
}
}
part {
name: "sb_hbar_p1";
type: RECT;
@ -274,6 +497,7 @@ group {
description {
state: "default" 0.0;
min: 16 16;
fixed: 1 1;
rel1 {
relative: 0.5 0.5;
offset: 0 0;
@ -366,5 +590,25 @@ group {
transition: ACCELERATE 0.5;
target: "focus";
}
program {
name: "show_label";
signal: "show_label";
source: "";
action: STATE_SET "active" 0.0;
target: "sb_hbar_base";
target: "label_under";
target: "label";
target: "label_over";
}
program {
name: "hide_label";
signal: "hide_label";
source: "";
action: STATE_SET "default" 0.0;
target: "sb_hbar_base";
target: "label_under";
target: "label";
target: "label_over";
}
}
}

@ -169,6 +169,8 @@ e_slider_value_format_display_set(Evas_Object *obj, const char *format)
edje_object_signal_emit(sd->edje_obj, "hide_label", "");
}
_e_smart_format_update(sd);
edje_object_message_signal_process(sd->edje_obj);
edje_object_size_min_calc(sd->edje_obj, &(sd->minw), &(sd->minh));
}
const char *
@ -201,6 +203,14 @@ e_slider_min_size_get(Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh)
if (minh) *minh = sd->minh;
}
Evas_Object *
e_slider_edje_object_get(Evas_Object *obj)
{
API_ENTRY return NULL;
return sd->edje_obj;
}
/* local subsystem functions */
static int
_e_smart_set_timer(void *data)

@ -22,5 +22,6 @@ EAPI const char *e_slider_value_format_display_get (Evas_Object *obj);
EAPI void e_slider_direction_set (Evas_Object *obj, int reversed);
EAPI int e_slider_direction_get (Evas_Object *obj);
EAPI void e_slider_min_size_get (Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh);
EAPI Evas_Object *e_slider_edje_object_get (Evas_Object *obj);
#endif
#endif

@ -512,19 +512,21 @@ _e_test_internal(E_Container *con)
{
E_Dialog *dia;
Evas_Object *o;
Evas_Coord mw, mh;
dia = e_dialog_new(con);
e_dialog_title_set(dia, "A Test Dialog");
o = e_slider_add(dia->win->evas);
e_slider_orientation_set(o, 1);
e_slider_orientation_set(o, 0);
e_slider_value_set(o, 0.5);
e_slider_value_step_count_set(o, 4);
e_slider_value_format_display_set(o, "%1.1f V");
// e_slider_value_format_display_set(o, "%1.2f V");
e_slider_min_size_get(o, &mw, &mh);
evas_object_smart_callback_add(o, "changed", _e_test_cb_e_smart_pan_changed_hook, NULL);
evas_object_show(o);
e_dialog_content_set(dia, o, 240, 16);
e_dialog_content_set(dia, o, mw, 240 + mh);
e_dialog_button_add(dia, "OK", NULL, NULL, NULL);
e_win_centered_set(dia->win, 1);

@ -6,16 +6,19 @@
typedef struct _E_Widget_Data E_Widget_Data;
struct _E_Widget_Data
{
Evas_Object *o_slider;
Evas_Object *o_widget, *o_slider;
double *dval;
int *ival;
};
static void _e_wid_del_hook(Evas_Object *obj);
static void _e_wid_focus_hook(Evas_Object *obj);
static void _e_wid_focus_steal(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_wid_cb_changed(void *data, Evas_Object *obj, void *event_info);
/* externally accessible functions */
Evas_Object *
e_widget_slider_add(Evas *evas)
e_widget_slider_add(Evas *evas, int horiz, int rev, char *fmt, double min, double max, double step, int count, double *dval, int *ival, Evas_Coord size)
{
Evas_Object *obj, *o;
E_Widget_Data *wd;
@ -27,6 +30,7 @@ e_widget_slider_add(Evas *evas)
e_widget_focus_hook_set(obj, _e_wid_focus_hook);
wd = calloc(1, sizeof(E_Widget_Data));
e_widget_data_set(obj, wd);
wd->o_widget = obj;
o = e_slider_add(evas);
wd->o_slider = o;
@ -34,6 +38,26 @@ e_widget_slider_add(Evas *evas)
e_widget_sub_object_add(obj, o);
e_widget_resize_object_set(obj, o);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _e_wid_focus_steal, obj);
e_slider_orientation_set(o, horiz);
e_slider_direction_set(o, rev);
e_slider_value_format_display_set(o, fmt);
e_slider_value_step_count_set(o, count);
e_slider_value_step_size_set(o, step);
e_slider_value_range_set(o, min, max);
if (dval) e_slider_value_set(o, *dval);
else if (ival) e_slider_value_set(o, *ival);
e_slider_min_size_get(o, &mw, &mh);
if (horiz)
e_widget_min_size_set(obj, mw + size, mh);
else
e_widget_min_size_set(obj, mw + size, mh + size);
wd->dval = dval;
wd->ival = ival;
evas_object_smart_callback_add(o, "changed", _e_wid_cb_changed, wd);
return obj;
}
@ -54,12 +78,12 @@ _e_wid_focus_hook(Evas_Object *obj)
wd = e_widget_data_get(obj);
if (e_widget_focus_get(obj))
{
// edje_object_signal_emit(e_scrollframe_edje_object_get(wd->o_scrollframe), "focus_in", "");
edje_object_signal_emit(e_slider_edje_object_get(wd->o_slider), "focus_in", "");
evas_object_focus_set(wd->o_slider, 1);
}
else
{
// edje_object_signal_emit(e_scrollframe_edje_object_get(wd->o_scrollframe), "focus_out", "");
edje_object_signal_emit(e_slider_edje_object_get(wd->o_slider), "focus_out", "");
evas_object_focus_set(wd->o_slider, 0);
}
}
@ -69,3 +93,14 @@ _e_wid_focus_steal(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
e_widget_focus_steal(data);
}
static void
_e_wid_cb_changed(void *data, Evas_Object *obj, void *event_info)
{
E_Widget_Data *wd;
wd = data;
if (wd->dval) *(wd->dval) = e_slider_value_get(wd->o_slider);
else if (wd->ival) *(wd->ival) = e_slider_value_get(wd->o_slider);
e_widget_change(wd->o_widget);
}

@ -6,7 +6,7 @@
#ifndef E_WIDGET_SLIDER_H
#define E_WIDGET_SLIDER_H
EAPI Evas_Object *e_widget_slider_add(Evas *evas);
EAPI Evas_Object *e_widget_slider_add(Evas *evas, int horiz, int rev, char *fmt, double min, double max, double step, int count, double *dval, int *ival, Evas_Coord sizex);
#endif
#endif

Loading…
Cancel
Save