From edaf1ab0c1723af15fabd2c06a92dbafe6a9a7d9 Mon Sep 17 00:00:00 2001 From: David Capello Date: Sat, 10 Apr 2010 15:55:28 -0300 Subject: [PATCH] Added "looklike" attribute in and XML elements. --- src/jinete/jfile.cpp | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/jinete/jfile.cpp b/src/jinete/jfile.cpp index 7f0f8026b..fd02da209 100644 --- a/src/jinete/jfile.cpp +++ b/src/jinete/jfile.cpp @@ -150,8 +150,17 @@ static JWidget convert_xmlelement_to_widget(TiXmlElement* elem) /* check */ else if (ustrcmp(elem_name, "check") == 0) { const char *text = elem->Attribute("text"); + const char *looklike = elem->Attribute("looklike"); + + text = (text ? TRANSLATE_ATTR(text): NULL); + + if (looklike != NULL && strcmp(looklike, "button") == 0) { + widget = ji_generic_button_new(text, JI_CHECK, JI_BUTTON); + } + else { + widget = jcheck_new(text); + } - widget = jcheck_new(text ? TRANSLATE_ATTR(text): NULL); if (widget) { bool center = bool_attr_is_true(elem, "center"); bool right = bool_attr_is_true(elem, "right"); @@ -232,9 +241,20 @@ static JWidget convert_xmlelement_to_widget(TiXmlElement* elem) else if (ustrcmp(elem_name, "radio") == 0) { const char* text = elem->Attribute("text"); const char* group = elem->Attribute("group"); + const char *looklike = elem->Attribute("looklike"); + + text = (text ? TRANSLATE_ATTR(text): NULL); + int radio_group = (group ? ustrtol(group, NULL, 10): 1); + + if (looklike != NULL && strcmp(looklike, "button") == 0) { + widget = ji_generic_button_new(text, JI_RADIO, JI_BUTTON); + if (widget) + jradio_set_group(widget, radio_group); + } + else { + widget = jradio_new(text, radio_group); + } - widget = jradio_new(text ? TRANSLATE_ATTR(text): NULL, - group ? ustrtol(group, NULL, 10): 1); if (widget) { bool center = bool_attr_is_true(elem, "center"); bool right = bool_attr_is_true(elem, "right");