/** Parse a button tray component. */ void ParseTrayButton(const TokenNode *tp, TrayType *tray) { TrayComponentType *cp; const char *icon; const char *label; const char *popup; const char *temp; unsigned int width, height; char border; Assert(tp); Assert(tray); icon = FindAttribute(tp->attributes, ICON_ATTRIBUTE); label = FindAttribute(tp->attributes, LABEL_ATTRIBUTE); popup = FindAttribute(tp->attributes, POPUP_ATTRIBUTE); temp = FindAttribute(tp->attributes, BORDER_ATTRIBUTE); if(temp && !strcmp(temp, FALSE_VALUE)) { border = 0; } else { border = 1; } temp = FindAttribute(tp->attributes, WIDTH_ATTRIBUTE); if(temp) { width = ParseUnsigned(tp, temp); } else { width = 0; } temp = FindAttribute(tp->attributes, HEIGHT_ATTRIBUTE); if(temp) { height = ParseUnsigned(tp, temp); } else { height = 0; } cp = CreateTrayButton(icon, label, tp->value, popup, width, height, border); if(JLIKELY(cp)) { AddTrayComponent(tray, cp); } }
/** Parse a button tray component. */ void ParseTrayButton(const TokenNode *tp, TrayType *tray) { TrayComponentType *cp; const char *icon; const char *label; const char *popup; const char *temp; unsigned int width, height; Assert(tp); Assert(tray); icon = FindAttribute(tp->attributes, ICON_ATTRIBUTE); label = FindAttribute(tp->attributes, LABEL_ATTRIBUTE); popup = FindAttribute(tp->attributes, "popup"); temp = FindAttribute(tp->attributes, WIDTH_ATTRIBUTE); if(temp) { width = ParseUnsigned(tp, temp); } else { width = 0; } temp = FindAttribute(tp->attributes, HEIGHT_ATTRIBUTE); if(temp) { height = ParseUnsigned(tp, temp); } else { height = 0; } cp = CreateTrayButton(icon, label, popup, width, height); if(JLIKELY(cp)) { AddTrayComponent(tray, cp); ParseTrayComponentActions(tp, cp, AddTrayButtonAction); } }