going to work on gadcon - an intended replacement for gadman. just starting

things up - comments welcome, but this needs to fix up layout of gadgets for
moduels (gadman will exist for a while - mayeb forever, but i will migrate
most internal modules to gadcon eventually)


SVN revision: 20196
This commit is contained in:
Carsten Haitzler 2006-02-02 09:42:19 +00:00
parent b89c4dd7bb
commit 9ba71cbd62
4 changed files with 187 additions and 1 deletions

View File

@ -137,7 +137,8 @@ e_exehist.h \
e_color_class.h \
e_widget_textblock.h \
e_apps_error.h \
e_stolen.h
e_stolen.h \
e_gadcon.h
enlightenment_src = \
e_user.c \
@ -256,6 +257,7 @@ e_color_class.c \
e_widget_textblock.c \
e_apps_error.c \
e_stolen.c \
e_gadcon.c \
$(ENLIGHTENMENTHEADERS)
enlightenment_SOURCES = \

107
src/bin/e_gadcon.c Normal file
View File

@ -0,0 +1,107 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "e.h"
static void _e_gadcon_free(E_Gadcon *gc);
static void _e_gadcon_client_free(E_Gadcon_Client *gcc);
/* externally accessible functions */
EAPI int
e_gadcon_init(void)
{
return 1;
}
EAPI int
e_gadcon_shutdown(void)
{
return 1;
}
EAPI E_Gadcon *
e_gadcon_swallowed_new(Evas_Object *obj, char *swallow_name)
{
E_Gadcon *gc;
gc = E_OBJECT_ALLOC(E_Gadcon, E_GADCON_TYPE, _e_gadcon_free);
if (!gc) return NULL;
gc->type = E_GADCON_TYPE_ARRANGE;
gc->edje.o_parent = obj;
gc->edje.swallow_name = strdup(swallow_name);
gc->evas = evas_object_evas_get(obj);
gc->o_container = NULL; // need to make a new smart obj for the layout
return gc;
}
EAPI E_Gadcon *
e_gadcon_freefloat_new(Ecore_Evas *ee)
{
E_Gadcon *gc;
gc = E_OBJECT_ALLOC(E_Gadcon, E_GADCON_TYPE, _e_gadcon_free);
if (!gc) return NULL;
gc->type = E_GADCON_TYPE_FREEFLOAT;
gc->ecore_evas.ee = ee;
gc->evas = ecore_evas_get(ee);
gc->o_container = NULL; // use layout smart
return gc;
}
EAPI void
e_gadcon_orient_set(E_Gadcon *gc, E_Gadcon_Orient orient)
{
E_OBJECT_CHECK_RETURN(gc, NULL);
E_OBJECT_TYPE_CHECK_RETURN(gc, E_GADCON_TYPE, NULL);
if (gc->type != E_GADCON_TYPE_ARRANGE) return;
gc->edje.orient = orient;
}
/* only needed if it's a freefloat type and when the canvas changes size */
EAPI void
e_gadcon_resize(E_Gadcon *gc, int w, int h)
{
E_OBJECT_CHECK_RETURN(gc, NULL);
E_OBJECT_TYPE_CHECK_RETURN(gc, E_GADCON_TYPE, NULL);
if (gc->type != E_GADCON_TYPE_FREEFLOAT) return;
e_layout_virtual_size_set(gc->o_container, w, h);
evas_object_resize(gc->o_container, w, h);
}
EAPI E_Gadcon_Client *
e_gadcon_client_new(E_Gadcon *gc)
{
E_Gadcon_Client *gcc;
E_OBJECT_CHECK_RETURN(gc, NULL);
E_OBJECT_TYPE_CHECK_RETURN(gc, E_GADCON_TYPE, NULL);
gcc = E_OBJECT_ALLOC(E_Gadcon_Client, E_GADCON_CLIENT_TYPE, _e_gadcon_client_free);
if (!gcc) return NULL;
gcc->gadcon = gc;
gc->clients = evas_list_append(gc->clients, gcc);
return gcc;
}
/* local subsystem functions */
static void
_e_gadcon_free(E_Gadcon *gc)
{
if (gc->o_container) evas_object_del(gc->o_container);
E_FREE(gc->edje.swallow_name);
free(gc);
}
static void
_e_gadcon_client_free(E_Gadcon_Client *gcc)
{
gcc->gadcon->clients = evas_list_remove(gcc->gadcon->clients, gcc);
free(gcc);
}

76
src/bin/e_gadcon.h Normal file
View File

@ -0,0 +1,76 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#ifdef E_TYPEDEFS
typedef enum _E_Gadcon_Type
{
E_GADCON_TYPE_FREEFLOAT,
E_GADCON_TYPE_ARRANGE,
} E_Gadcon_Type;
typedef enum _E_Gadcon_Orient
{
/* generic orientations */
E_GADCON_ORIENT_HORIZ,
E_GADCON_ORIENT_VERT,
/* specific oreintations */
E_GADCON_ORIENT_LEFT,
E_GADCON_ORIENT_RIGHT,
E_GADCON_ORIENT_TOP,
E_GADCON_ORIENT_BOTTOM
} E_Gadcon_Orient;
typedef struct _E_Gadcon E_Gadcon;
typedef struct _E_Gadcon_Client E_Gadcon_Client;
#else
#ifndef E_GADCON_H
#define E_GADCON_H
#define E_GADCON_TYPE 0xE0b01022
#define E_GADCON_CLIENT_TYPE 0xE0b01023
struct _E_Gadcon
{
E_Object e_obj_inherit;
E_Gadcon_Type type;
struct {
Evas_Object *o_parent;
char *swallow_name;
E_Gadcon_Orient orient;
} edje;
struct {
Ecore_Evas *ee;
} ecore_evas;
Evas *evas;
Evas_Object *o_container;
Evas_List *clients;
};
struct _E_Gadcon_Client
{
E_Object e_obj_inherit;
E_Gadcon *gadcon;
Evas_Object *o_base;
struct {
Evas_Coord w, h;
} min, max, asked, given;
};
EAPI int e_gadcon_init(void);
EAPI int e_gadcon_shutdown(void);
EAPI E_Gadcon *e_gadcon_swallowed_new(Evas_Object *obj, char *swallow_name);
EAPI E_Gadcon *e_gadcon_freefloat_new(Ecore_Evas *ee);
EAPI void e_gadcon_resize(E_Gadcon *gc, int w, int h);
EAPI void e_gadcon_orient_set(E_Gadcon *gc, E_Gadcon_Orient orient);
EAPI E_Gadcon_Client *e_gadcon_client_new(E_Gadcon *gc);
#endif
#endif

View File

@ -116,3 +116,4 @@
#include "e_widget_textblock.h"
#include "e_apps_error.h"
#include "e_stolen.h"
#include "e_gadcon.h"