aboutsummaryrefslogtreecommitdiff
path: root/generic/Item.h
diff options
context:
space:
mode:
authorlecoanet2002-04-08 13:56:53 +0000
committerlecoanet2002-04-08 13:56:53 +0000
commit4181cc1dbeb4a684f0a32a1c142a2e6b5c7259e4 (patch)
tree53dfed414f15440c3f1d5fa68b8ab3f318904e5b /generic/Item.h
parent26c1a2f52c92f44ee99132a343ad76d0014ae348 (diff)
downloadtkzinc-4181cc1dbeb4a684f0a32a1c142a2e6b5c7259e4.zip
tkzinc-4181cc1dbeb4a684f0a32a1c142a2e6b5c7259e4.tar.gz
tkzinc-4181cc1dbeb4a684f0a32a1c142a2e6b5c7259e4.tar.bz2
tkzinc-4181cc1dbeb4a684f0a32a1c142a2e6b5c7259e4.tar.xz
Ajoute la manipulation de texte et de la s�lection/curseur sur les
textes des fields. Support du focus sur les fields. Restructuration du fichier/ Le code des fields est d�sormais dans Field.c le code ing�rant dans group est rapatri� dans group et le code de redessin / endommagement est dans tkZinc. Des modifs importantes dans le protocole de certaines fonctions ont �t� n�cessaire. Ca touche pratiquement tous les fichiers ainsi que certaines m�thodes de ITEM. Suppression de ITEM_P, les m�thodes sont remplac�es par des fonctions externes pr�fix�es par Zn.
Diffstat (limited to 'generic/Item.h')
-rw-r--r--generic/Item.h138
1 files changed, 46 insertions, 92 deletions
diff --git a/generic/Item.h b/generic/Item.h
index 67fd646..840fa2c 100644
--- a/generic/Item.h
+++ b/generic/Item.h
@@ -33,7 +33,9 @@
#include "PostScript.h"
#include "Attrs.h"
+#include "Types.h"
#include "List.h"
+#include "Field.h"
#include <X11/Xlib.h>
@@ -81,6 +83,9 @@
#define COMPOSE_ROTATION_BIT 64
+struct _WidgetInfo;
+struct _ZnTransfo;
+
/*
* Item record header --
*/
@@ -106,45 +111,6 @@ typedef struct _ItemStruct {
/*
- * Group item special record.
- */
-typedef struct _GroupItemStruct {
- ItemStruct header;
-
- /* Public data */
- Item clip;
- unsigned char alpha;
-
- /* Private data */
- Item head; /* Doubly linked list of all items. */
- Item tail;
- ZnList dependents; /* List of dependent items. */
-#ifdef OM
- /* Overlap manager variables.
- * These variables are valid *only* if the overlap
- * manager is active. */
- ZnBool call_om; /* Tell if there is a need to call the */
- /* overlap manager. */
-#endif
-} GroupItemStruct, *GroupItem;
-
-
-/*
- * Field array management record.
- */
-typedef struct _FieldSetStruct {
- struct _WidgetInfo *wi;
- ZnLabelFormat label_format;
- unsigned int num_fields;
- struct _FieldStruct *fields;
- ZnDim label_width; /* Describe the label size. Access these */
- ZnDim label_height; /* 2 only with GetLabelBBox. -1 means
- * not up to date. */
- ZnPoint label_pos; /* Describe the label origin. */
-} FieldSetStruct, *FieldSet;
-
-
-/*
* Item class record --
*/
typedef int (*ItemInitMethod)(Item item, int *argc, Tcl_Obj *CONST *args[]);
@@ -162,7 +128,7 @@ typedef ZnBool (*ItemIsSensitiveMethod)(Item item, int part);
typedef double (*ItemPickMethod)(Item item, ZnPoint *point,
Item start_item, int aperture,
Item *a_item, int *a_part);
-typedef FieldSet (*ItemGetFieldSetMethod)(Item item);
+typedef struct _FieldSetStruct* (*ItemGetFieldSetMethod)(Item item);
typedef void (*ItemContourMethod)(Item item, int cmd, ZnPoly *poly);
typedef void (*ItemPickVertexMethod)(Item item, ZnPoint *p, int *contour,
int *vertex, int *o_vertex);
@@ -171,21 +137,24 @@ typedef ZnBool (*ItemGetClipVerticesMethod)(Item item, ZnTriStrip *tristrip);
typedef ZnBool (*ItemGetContoursMethod)(Item item, ZnPoly *poly);
typedef int (*ItemCoordsMethod)(Item item, int contour, int index, int cmd,
ZnPoint **points, int *num_points);
-typedef void (*ItemInsertCharsMethod)(Item item, int index, char *chars);
-typedef void (*ItemDeleteCharsMethod)(Item item, int first, int last);
-typedef void (*ItemCursorMethod)(Item item, int index);
-typedef int (*ItemIndexMethod)(Item item, Tcl_Obj *index_spec, int *index);
+typedef void (*ItemInsertCharsMethod)(Item item, int field, int *index,
+ char *chars);
+typedef void (*ItemDeleteCharsMethod)(Item item, int field, int *first,
+ int *last);
+typedef void (*ItemCursorMethod)(Item item, int field, int index);
+typedef int (*ItemIndexMethod)(Item item, int field, Tcl_Obj *index_spec,
+ int *index);
typedef int (*ItemPartMethod)(Item item, Tcl_Obj **part_spec, int *part);
-typedef int (*ItemSelectionMethod)(Item item, int offset, char *chars,
- int max_chars);
+typedef int (*ItemSelectionMethod)(Item item, int field, int offset,
+ char *chars, int max_chars);
typedef void (*ItemPostScriptMethod)(Item item, PostScriptInfo ps_info);
typedef struct _ItemClassStruct {
- int item_size;
- ZnBool has_fields;
+ int size;
+ ZnBool has_fields; /* 1 if fields are supported */
int num_parts; /* 0 if no special parts, else
* gives how many parts exist. */
- ZnBool has_anchors;
+ ZnBool has_anchors; /* 1 if anchors are supported */
char *name;
ZnAttrConfig *attr_desc;
ItemInitMethod Init;
@@ -229,13 +198,10 @@ extern struct _ITEM {
int (*ConfigureItem)(Item item, int field, int argc, Tcl_Obj *CONST args[],
ZnBool init);
int (*QueryItem)(Item item, int field, int argc, Tcl_Obj *CONST args[]);
- int (*AttributesInfo)(Item item, int field, int argc, Tcl_Obj *CONST args[]);
- void (*SetFieldsAutoAlign)(Item item, int alignment);
void (*InsertItem)(Item item, Item group, Item mark_item, ZnBool before);
void (*UpdateItemPriority)(Item item, Item mark_item, ZnBool before);
- void (*InsertDependentItem)(Item item);
void (*UpdateItemDependency)(Item item, Item old_connection);
- void (*RemoveItem)(Item item);
+ void (*ExtractItem)(Item item);
void (*SetId)(Item item);
void (*FreeId)(Item item);
void (*AddTag)(Item item, Tk_Uid tag);
@@ -259,45 +225,33 @@ extern struct _ITEM {
*
**********************************************************************************
*/
-extern struct _ITEM_P {
- void (*GlobalModuleInit)();
- Item (*CreateItem)(struct _WidgetInfo *wi, ItemClass item_class,
- int *argc, Tcl_Obj *CONST *args[]);
- void (*AddItemClass)(ItemClass class);
- ItemClass (*LookupItemClass)(char *class_name);
- ZnList (*ItemClassList)();
- void (*Damage)(struct _WidgetInfo *wi, ZnBBox *damage);
- void (*Repair)(struct _WidgetInfo *wi);
- void (*Update)(struct _WidgetInfo *wi);
- int (*ConfigureAttributes)(char *record, int field, int argc,
- Tcl_Obj *CONST args[], int *flags);
- int (*QueryAttribute)(char *record, int field, Tcl_Obj *attr_name);
- void (*InitFields)(FieldSet field_set);
- void (*CloneFields)(FieldSet field_set);
- void (*FreeFields)(FieldSet field_set);
- void (*DrawFields)(FieldSet field_set);
- void (*RenderFields)(FieldSet field_set);
- int (*FieldsToArea)(FieldSet field_set, ZnBBox *area);
- ZnBool (*IsFieldSensitive)(FieldSet field_set, int part);
- double (*FieldsPick)(FieldSet field_set, ZnPoint *p, int *part);
- void (*LeaderToLabel)(FieldSet field_set, ZnPoint *start, ZnPoint *end);
- void (*GetLabelBBox)(FieldSet field_set, ZnDim *w, ZnDim *h);
- void (*GetFieldBBox)(FieldSet field_set, unsigned int index, ZnBBox *field_bbox);
- void (*InitTransformStack)(struct _WidgetInfo *wi);
- void (*FreeTransformStack)(struct _WidgetInfo *wi);
- void (*ResetTransformStack)(struct _WidgetInfo *wi);
- void (*PushTransform)(struct _WidgetInfo *wi, struct _ZnTransfo *transfo,
- ZnBool compose_scale, ZnBool compose_rot);
- void (*PopTransform)(struct _WidgetInfo *wi);
- void (*InitClipStack)(struct _WidgetInfo *wi);
- void (*FreeClipStack)(struct _WidgetInfo *wi);
- void (*ResetClipStack)(struct _WidgetInfo *wi);
- void (*PushClip)(struct _WidgetInfo *wi, ZnTriStrip *tristrip, ZnBool simple,
- ZnBool set_gc);
- void (*PopClip)(struct _WidgetInfo *wi, ZnBool set_gc);
- ZnBool (*CurrentClip)(struct _WidgetInfo *wi, Region *reg, ZnBBox **clip_box,
- ZnBool *simple);
-} ITEM_P;
+void ZnItemInit();
+Item ZnCreateItem(struct _WidgetInfo *wi, ItemClass item_class,
+ int *argc, Tcl_Obj *CONST *args[]);
+void ZnAddItemClass(ItemClass class);
+ItemClass ZnLookupItemClass(char *class_name);
+ZnList ZnItemClassList();
+int ZnConfigureAttributes(struct _WidgetInfo *wi, void *record,
+ ZnAttrConfig *attr_desc, int argc, Tcl_Obj *CONST args[],
+ int *flags);
+int ZnAttributesInfo(struct _WidgetInfo *wi, void *record,
+ ZnAttrConfig *attr_desc, int argc, Tcl_Obj *CONST args[]);
+int ZnQueryAttribute(struct _WidgetInfo *wi, void *record, ZnAttrConfig *attr_desc,
+ Tcl_Obj *attr_name);
+void ZnInitTransformStack(struct _WidgetInfo *wi);
+void ZnFreeTransformStack(struct _WidgetInfo *wi);
+void ZnResetTransformStack(struct _WidgetInfo *wi);
+void ZnPushTransform(struct _WidgetInfo *wi, struct _ZnTransfo *transfo,
+ ZnBool compose_scale, ZnBool compose_rot);
+void ZnPopTransform(struct _WidgetInfo *wi);
+void ZnInitClipStack(struct _WidgetInfo *wi);
+void ZnFreeClipStack(struct _WidgetInfo *wi);
+void ZnResetClipStack(struct _WidgetInfo *wi);
+void ZnPushClip(struct _WidgetInfo *wi, ZnTriStrip *tristrip, ZnBool simple,
+ ZnBool set_gc);
+void ZnPopClip(struct _WidgetInfo *wi, ZnBool set_gc);
+ZnBool ZnCurrentClip(struct _WidgetInfo *wi, Region *reg, ZnBBox **clip_box,
+ ZnBool *simple);
extern ZnItemClassId ZnArc;