You could also have a look at this macro.
Especially the function maybe_add_return_type called e.g. by init_tree could be helpful.
The optional return type (see context menu) for enums is their value as provided by the tagging engine.
Good luck, HS2
Thanks! That macro helped quite a bit!! Now I am able to draw a tree for enums and structs with this..For those who are interested:
static _command int GetParent(_str childtype = "enumc", struct VS_TAG_BROWSE_INFO &cm = null) name_info(',')
{
int context_id;
_str class_name = cm.class_name;
_str member_name;
_str type_name;
tag_split_class_name(cm.class_name, member_name, class_name);
context_id = tag_find_context(member_name,true,true);
while (context_id > 0)
{
tag_get_context_info(context_id,cm);
if(cm.type_name == "typedef")
{
_str temp[];
split(cm.return_type," ",temp);
type_name = temp[0];
}
else
type_name = cm.type_name;
if((childtype == "enumc" && type_name == "enum") ||
(childtype == "var" && type_name == "struct")) break;
context_id = tag_next_context(member_name,true,true);
}
return context_id;
}
_command void DrawTreeMembers() name_info(',')
{
struct VS_TAG_BROWSE_INFO cm;
struct VS_TAG_BROWSE_INFO child_cm;
int context_id,id ,line_no, tag_flags;
_str file_name, class_name, type_name;
_UpdateContext(true);
int status = tag_get_browse_info("", cm,true);
if(!status) {
context_id = tag_find_context(cm.member_name,true,true);
}
/* If it is a enumc or a var; get the tag info for enum */
switch(cm.type_name)
{
case "enumc":
case "var":
{
context_id = GetParent(cm.type_name,cm);
break;
}
}
say(cm.member_name);
for ( id = context_id; id < tag_get_num_of_context(); id++) {
tag_get_context_info(id,child_cm);
if(cm.line_no <= child_cm.line_no && cm.end_line_no >= child_cm.line_no)
{
if(child_cm.member_name != cm.member_name) {
say(" +---"child_cm.member_name);
}
}
else
{
/* We are done */
break;
}
}
}