multi fields
- From: lidiriel <lidiriel coriolys org>
- To: dia mailling list <dia-list gnome org>
- Subject: multi fields
- Date: Mon, 24 Jul 2006 18:33:33 +0200
Hello,
i try to create a new plugin for dia in C.
But I have a little problem with PropDescription.
I have two question ?
1=>
See in the end of this mail for an extract of my code.
In this code i have a table dtmf[2] of enumerate (BayMenuDtmfResponse)
and i would use it for store parameter.
What's the method for use a table ? It is good ?
2=>
What is PROP_TYPE_DARRAY ? I don't found a simple example only with uml
plugin and this plugin is complicated...
thanks for your help !
Lidiriel
/* Object Menu definition */
typedef struct _Menu {
Element element;
ConnectionPoint connections[BAY_MENU_NUM_CNX];
/* menu genral parameter */
BayMenuType type; /* menu type */
gchar *name; /* menu name */
***
/* menu fonctionnal parameter */
BayMenuDtmfResponse dtmf[2];
} Menu;
***
PropEnumData menu_dtmf[] = {
{ N_("wrong"), BAY_MENU_WRONG },
{ N_("ok return dtmf"), BAY_MENU_RETURN_DTMF },
{ NULL}};
/* all property description */
static PropDescription menu_props[] = {
ELEMENT_COMMON_PROPERTIES,
{ "type", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE, N_("Type"), NULL,
menu_style },
{ "name", PROP_TYPE_STRING, PROP_FLAG_VISIBLE, N_("Name"), NULL, NULL },
{ "dtmf1", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE, N_("DTMF 1"), NULL,
menu_dtmf },
{ "dtmf2", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE, N_("DTMF 2"), NULL,
menu_dtmf },
PROP_DESC_END
};
static PropDescription *
menu_describe_props(Menu *menu)
{
if (menu_props[0].quark == 0)
prop_desc_list_calculate_quarks(menu_props);
return menu_props;
}
static PropOffset menu_offsets[] = {
ELEMENT_COMMON_PROPERTIES_OFFSETS,
{ "type", PROP_TYPE_ENUM, offsetof(Menu, type) },
{ "name", PROP_TYPE_STRING, offsetof(Menu, name) },
{ "dtmf1", PROP_TYPE_ENUM, offsetof(Menu, dtmf[0]) },
{ "dtmf2", PROP_TYPE_ENUM, offsetof(Menu, dtmf[1]) },
{ NULL, 0, 0}
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]