From: Andre Kloss <kloss rbg informatik tu-darmstadt de>
To: dia-list gnome org
Subject: UrShape: Definition by controversy
Date: Thu, 5 Jul 2001 23:55:44 +0200 (MET DST)
Hi again.
I'm running out of time as well as motivation and, worst of all,
ideas. Ok, let's see, what we have now:
I need some Callback that a dragged UrShape can perform in order to
interact somehow with the UrContainer. The source for the UrShape
side of this functionality should read like this:
if (IS_IN(myself, container->bounding_box) && !isOver) {
isOver = TRUE; /* Perform this once */
container->behaviour->isOver(container, myself); /* interact */
}
Same goes for isOut and isDropped. I'm not sure yet if the select
callback belongs to the container or the UrShape, but well, here we
are - for now.
I still have no clue about the "normal" UrContainer Behaviour. If
someone could enlighten this to me, I would be able to think further
in that direction.
cu Andre
8<-----------------------------UrShape.h--------------------->8
/* urshape.h : defining the generic UrShape */
#ifndef URSHAPE_H
#define URSHAPE_H
#include "element.h"
/* What else has to be included? */
typedef enum _UrContainerType UrContainerType;
typedef struct _UrContainerBehaviour UrContainerBehaviour;
typedef struct _UrContainer UrContainer;
typedef struct _UrShape UrShape;
enum _UrContainerType {
SINGLE,
HORIZANTAL_ARRAY,
VERTICAL_ARRAY,
TABLE
};
struct _UrContainerBehaviour {
void (isOver)(UrContainer *myself, UrShape *other);
void (isOut)(UrContainer *myself, UrShape *other);
void (isDropped)(UrContainer *myself, UrShape *other);
void (select)(UrContainer *myself);
/* YOUR PROPOSAL GOES HERE */
}
struct _UrContainer {
UrContainerType type; /* Is it a Simple-/Array- or
Table-Container? */
UrContainerBehaviour behaviour; /* To discriminate behaviour */
/* (Dynamic) geometry stuff */
Rectangle *bounding_box;
GList *rows; /* The left border of rows */
GList *columns; /* The upper border of columns */
}
struct _UrShape {
Element element; /* Inheritance (C sometimes sucks ;) */
/* UrShape container stuff */
UrContainer *embedding; /* NULL if free,
"parent's" container else */
int row,column; /* For all but SINGLE, it'll be nice to know in what
row/column the UrShape is embedded. */
GList *childrenContainers; /* The containers I have */
/* The miniDOM. Thanx to Cyrille, now it _is_ mini. */
UrShape *parent_shape;
GList *self; /* this->self->data == this */
GList *children; /* (this->children->data->parent_shape == this ||
this->children == NULL) */
};
#endif