1 |
#ifndef MAPATTR_H |
2 |
#define MAPATTR_H |
3 |
|
4 |
#include "App.h" |
5 |
#include "Cnv.h" |
6 |
#include "Defines.h" |
7 |
|
8 |
/**********************************************************************/ |
9 |
|
10 |
/** |
11 |
* Get a value from the mapstruct and put it in the string; the string is |
12 |
* BUFSIZ long. |
13 |
*/ |
14 |
typedef void (*MapAttrGetFunc)(mapstruct *, char *); |
15 |
|
16 |
/** |
17 |
* Write to the mapstruct based on the string given. |
18 |
*/ |
19 |
typedef void (*MapAttrPutFunc)(mapstruct *, const char *); |
20 |
|
21 |
typedef enum _MapAttrType { |
22 |
MATypeString, |
23 |
MATypeToggle |
24 |
} MapAttrType; |
25 |
|
26 |
/* Toggle types store a nonzero for true in the first octet of the buffer, and |
27 |
* read the first octet of whatever they're passed. |
28 |
*/ |
29 |
|
30 |
typedef struct { |
31 |
String label; /* Human-readable name of property. */ |
32 |
MapAttrType type; |
33 |
MapAttrGetFunc getValue; |
34 |
MapAttrPutFunc putValue; |
35 |
} MapAttrDef; |
36 |
|
37 |
struct _MapAttr { |
38 |
App app; |
39 |
mapstruct *map; /* map being edited */ |
40 |
Edit client; /* Edit-window that created this */ |
41 |
Widget shell; /* popup-shell */ |
42 |
struct { |
43 |
Widget name; /* asciiText, one line */ |
44 |
Widget msg; /* ditto */ |
45 |
} iw; |
46 |
Widget *tags; /* asciiText or toggle For each MapAttrDef */ |
47 |
}; |
48 |
|
49 |
/* MapAttr is defined in Defines.h. */ |
50 |
|
51 |
/* |
52 |
* function inteface |
53 |
*/ |
54 |
MapAttr MapAttrCreate(mapstruct *map, App app, Edit client); |
55 |
void MapAttrDestroy(MapAttr self); |
56 |
void MapAttrChange(MapAttr self, mapstruct *map); |
57 |
|
58 |
#endif /* MAPATTR_H */ |