add skeleton of scrollbar code... more meat to be added...


			
			
				devs/princeamd/enlightenment-0.17-elive
			
			
		
Carsten Haitzler 22 years ago
parent 23e05d4d83
commit dd30bfa6e8
  1. 14
      configure.in
  2. 1
      src/Makefile.am
  3. 13
      src/actions.c
  4. 215
      src/scrollbar.c
  5. 53
      src/scrollbar.h

@ -2,20 +2,6 @@ dnl Process this file with autoconf to produce a configure script.
AC_INIT(configure.in)
# BAH - ugly. bloody operating systems. figure out per os options for cp
# defaults
CP_OPTIONS="-ar"
AC_CANONICAL_SYSTEM
case "$build_os" in
*olaris*)
CP_OPTIONS="-ar";
;;
*bsd*)
CP_OPTIONS="-PpR";
;;
esac
ENLIGHTENMENT_MAJOR=0
ENLIGHTENMENT_MINOR=17
ENLIGHTENMENT_MICRO=pre_0

@ -24,6 +24,7 @@ enlightenment_SOURCES = \
menubuild.h menubuild.c \
pack.c \
resist.h resist.c \
scrollbar.h scrollbar.c \
shelf.c \
text.h text.c \
util.h util.c \

@ -491,8 +491,17 @@ e_action_init(void)
/* FIXME: these REALLY need to go into other file(s) but it's not worht it */
/* yet at this point. it can be done later */
/* Erm is that really true? They're all static, all called through the
above functions -- so it's good to have them encapsulated here? --cK */
/* Erm is that really true? They're all static, all called through the */
/* above functions -- so it's good to have them encapsulated here? --cK */
/* well i was thinking changing this to be a bunch of: */
/* #include "action_windows.c" */
/* #include "action_files.c" */
/* #include "action_general.c" */
/* etc. - group actions in files for their logical uses */
/* kind of evil to inlucde c files.. but it means breaking it up better */
/* probably moving these includes above the init and having hooks into the */
/* init func */
static void
e_act_move_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry)

@ -0,0 +1,215 @@
#include "scrollbar.h"
static void e_scrollbar_recalc(E_Scrollbar *sb);
static void e_scrollbar_setup_bits(E_Scrollbar *sb);
static void
e_scrollbar_recalc(E_Scrollbar *sb)
{
}
static void
e_scrollbar_setup_bits(E_Scrollbar *sb)
{
/* sb->base = ebits_load("");*/
/* sb->bar = ebits_load("");*/
}
E_Scrollbar *
e_scrollbar_new(void)
{
E_Scrollbar *sb;
sb = NEW(E_Scrollbar, 1);
ZERO(sb, E_Scrollbar, 1);
sb->range = 1.0;
sb->max = 1.0;
sb->w = 12;
sb->h = 64;
return sb;
}
void
e_scrollbar_free(E_Scrollbar *sb)
{
if (sb->evas)
{
if (sb->base) ebits_free(sb->base);
if (sb->bar) ebits_free(sb->bar);
}
FREE(sb);
}
void
e_scrollbar_add_to_evas(E_Scrollbar *sb, Evas evas)
{
if (sb->evas)
{
if (sb->base) ebits_free(sb->base);
if (sb->bar) ebits_free(sb->bar);
}
sb->evas = evas;
if (sb->evas)
{
e_scrollbar_setup_bits(sb);
if (sb->base) ebits_set_layer(sb->base, sb->layer);
if (sb->bar) ebits_set_layer(sb->bar, sb->layer);
if (sb->base) ebits_move(sb->base, sb->x, sb->y);
if (sb->base) ebits_resize(sb->base, sb->w, sb->h);
e_scrollbar_recalc(sb);
if (sb->bar) ebits_move(sb->bar, sb->bar_pos.x, sb->bar_pos.y);
if (sb->bar) ebits_resize(sb->bar, sb->bar_pos.w, sb->bar_pos.h);
if (sb->visible)
{
if (sb->base) ebits_show(sb->base);
if (sb->bar) ebits_show(sb->bar);
}
}
}
void
e_scrollbar_show(E_Scrollbar *sb)
{
if (sb->visible) return;
sb->visible = 1;
if (sb->base) ebits_show(sb->base);
if (sb->bar) ebits_show(sb->bar);
}
void
e_scrollbar_hide(E_Scrollbar *sb)
{
if (!sb->visible) return;
sb->visible = 0;
if (sb->base) ebits_hide(sb->base);
if (sb->bar) ebits_hide(sb->bar);
}
void
e_scrollbar_raise(E_Scrollbar *sb)
{
if (sb->base) ebits_raise(sb->base);
if (sb->bar) ebits_raise(sb->bar);
}
void
e_scrollbar_lower(E_Scrollbar *sb)
{
if (sb->bar) ebits_lower(sb->bar);
if (sb->base) ebits_lower(sb->base);
}
void
e_scrollbar_set_layer(E_Scrollbar *sb, int l)
{
if (l == sb->layer) return;
sb->layer = l;
if (sb->base) ebits_set_layer(sb->base, sb->layer);
if (sb->bar) ebits_set_layer(sb->bar, sb->layer);
}
void
e_scrollbar_set_direction(E_Scrollbar *sb, int d)
{
if (d == sb->direction) return;
if (sb->evas)
{
Evas evas;
if (sb->base) ebits_free(sb->base);
if (sb->bar) ebits_free(sb->bar);
evas = sb->evas;
sb->evas = NULL;
e_scrollbar_add_to_evas(sb, evas);
}
}
void
e_scrollbar_move(E_Scrollbar *sb, double x, double y)
{
if ((x == sb->x) && (y == sb->y)) return;
sb->x = x;
sb->y = y;
if (sb->base) ebits_move(sb->base, sb->x, sb->y);
e_scrollbar_recalc(sb);
if (sb->bar) ebits_move(sb->bar, sb->bar_pos.x, sb->bar_pos.y);
}
void
e_scrollbar_resize(E_Scrollbar *sb, double w, double h)
{
if ((w == sb->w) && (h == sb->h)) return;
sb->w = w;
sb->h = h;
if (sb->base) ebits_resize(sb->base, sb->w, sb->h);
e_scrollbar_recalc(sb);
if (sb->bar) ebits_move(sb->bar, sb->bar_pos.x, sb->bar_pos.y);
if (sb->bar) ebits_resize(sb->bar, sb->bar_pos.w, sb->bar_pos.h);
}
void
e_scrollbar_set_change_func(E_Scrollbar *sb,
void (*func_change) (void *_data, E_Scrollbar *sb, double val),
void *data)
{
sb->func_change = func_change;
sb->func_data = data;
}
void
e_scrollbar_set_value(E_Scrollbar *sb, double val)
{
if (sb->val == val) return;
sb->val = val;
e_scrollbar_recalc(sb);
if (sb->bar) ebits_move(sb->bar, sb->bar_pos.x, sb->bar_pos.y);
if (sb->bar) ebits_resize(sb->bar, sb->bar_pos.w, sb->bar_pos.h);
if (sb->func_change) sb->func_change(sb->func_data, sb, sb->val);
}
void
e_scrollbar_set_range(E_Scrollbar *sb, double range)
{
if (sb->range == range) return;
sb->range = range;
e_scrollbar_recalc(sb);
if (sb->bar) ebits_move(sb->bar, sb->bar_pos.x, sb->bar_pos.y);
if (sb->bar) ebits_resize(sb->bar, sb->bar_pos.w, sb->bar_pos.h);
}
void
e_scrollbar_set_max(E_Scrollbar *sb, double max)
{
if (sb->max == max) return;
sb->max = max;
e_scrollbar_recalc(sb);
if (sb->bar) ebits_move(sb->bar, sb->bar_pos.x, sb->bar_pos.y);
if (sb->bar) ebits_resize(sb->bar, sb->bar_pos.w, sb->bar_pos.h);
}
double
e_scrollbar_get_value(E_Scrollbar *sb)
{
return sb->val;
}
double
e_scrollbar_get_range(E_Scrollbar *sb)
{
return sb->range;
}
double
e_scrollbar_get_max(E_Scrollbar *sb)
{
return sb->max;
}
void
e_scrollbar_get_geometry(E_Scrollbar *sb, double *x, double *y, double *w, double *h)
{
if (x) *x = sb->x;
if (y) *y = sb->y;
if (w) *w = sb->w;
if (h) *h = sb->h;
}

@ -0,0 +1,53 @@
#include "e.h"
typedef struct _E_Scrollbar E_Scrollbar;
struct _E_Scrollbar
{
/* I<---val--->|<==range==>|<-->I<-max */
double val;
double max;
double range;
Evas evas;
Ebits_Object bar;
Ebits_Object base;
int visible;
int layer;
int direction;
double x, y, w, h;
struct {
double x, y, w, h;
} bar_area;
struct {
double x, y, w, h;
} bar_pos;
void (*func_change) (void *_data, E_Scrollbar *sb, double val);
void *func_data;
};
E_Scrollbar *e_scrollbar_new(void);
void e_scrollbar_free(E_Scrollbar *sb);
void e_scrollbar_add_to_evas(E_Scrollbar *sb, Evas evas);
void e_scrollbar_show(E_Scrollbar *sb);
void e_scrollbar_hide(E_Scrollbar *sb);
void e_scrollbar_raise(E_Scrollbar *sb);
void e_scrollbar_lower(E_Scrollbar *sb);
void e_scrollbar_set_layer(E_Scrollbar *sb, int l);
void e_scrollbar_set_direction(E_Scrollbar *sb, int d);
void e_scrollbar_move(E_Scrollbar *sb, double x, double y);
void e_scrollbar_resize(E_Scrollbar *sb, double w, double h);
void e_scrollbar_set_change_func(E_Scrollbar *sb,
void (*func_change) (void *_data, E_Scrollbar *sb, double val),
void *data);
void e_scrollbar_set_value(E_Scrollbar *sb, double val);
void e_scrollbar_set_range(E_Scrollbar *sb, double range);
void e_scrollbar_set_max(E_Scrollbar *sb, double max);
double e_scrollbar_get_value(E_Scrollbar *sb);
double e_scrollbar_get_range(E_Scrollbar *sb);
double e_scrollbar_get_max(E_Scrollbar *sb);
void e_scrollbar_get_geometry(E_Scrollbar *sb, double *x, double *y, double *w, double *h);
Loading…
Cancel
Save