void code_generate_object_textbox (s_hashtable_t *htable, s_xml_node_t *node) { s_xml_node_t *tmp; w_textbox_t *textbox; w_object_t *pobject; w_object_t *wobject; s_xml_node_t *window = s_xml_node_get_parent(node, "window"); wobject = (w_object_t *) s_hashtable_get_data(htable, s_xml_node_get_attr_value(window, "id")); pobject = (w_object_t *) s_hashtable_get_data(htable, s_xml_node_get_attr_value(node->parent, "id")); w_textbox_init(wobject->window, &textbox, pobject); s_hashtable_add(htable, s_xml_node_get_attr_value(node, "id"), textbox->object); while ((tmp = s_xml_node_get_path(node, "style")) != NULL) { FRAME_SHAPE fshape; FRAME_SHADOW fshadow; code_get_style(htable, tmp, &fshape, &fshadow); w_textbox_set_style(textbox->object, fshape, fshadow); tmp->dontparse = 1; } while ((tmp = s_xml_node_get_path(node, "image")) != NULL) { char **var; unsigned int count; unsigned int style; unsigned int rotate; code_get_image(htable, tmp, &style, &rotate, &count, &var); if (var != NULL) { w_textbox_set_image(textbox->object, style, rotate, count, var); while (count--) s_free(var[count]); s_free(var); } tmp->dontparse = 1; } while ((tmp = s_xml_node_get_path(node, "properties")) != NULL) { TEXTBOX_PROPERTIES prop; code_get_enum(htable, tmp->value, &prop); w_textbox_set_properties(textbox->object, prop); tmp->dontparse = 1; } while ((tmp = s_xml_node_get_path(node, "size")) != NULL) { int size = atoi(tmp->value); w_textbox_set_size(textbox->object, size); tmp->dontparse = 1; } if ((tmp = s_xml_node_get_path(node, "color")) != NULL) { int cr = atoi(s_xml_node_get_path_value(tmp, "red")); int cg = atoi(s_xml_node_get_path_value(tmp, "green")); int cb = atoi(s_xml_node_get_path_value(tmp, "blue")); w_textbox_set_rgb(textbox->object, cr, cg, cb); if ((tmp = s_xml_node_get_path(node, "color/red")) != NULL) { tmp->dontparse = 1; } if ((tmp = s_xml_node_get_path(node, "color/green")) != NULL) { tmp->dontparse = 1; } if ((tmp = s_xml_node_get_path(node, "color/blue")) != NULL) { tmp->dontparse = 1; } tmp->dontparse = 1; } if ((tmp = s_xml_node_get_path(node, "string")) != NULL) { w_textbox_set_str(textbox->object, code_trim_quota(tmp->value)); tmp->dontparse = 1; } }
int w_listbox_item_init (w_object_t *listbox, w_listbox_item_t **listbox_item) { int pos; w_listbox_t *lb; w_listbox_item_t *li; w_listbox_item_image_t *ii; lb = listbox->data[OBJECT_LISTBOX]; li = (w_listbox_item_t *) s_malloc(sizeof(w_listbox_item_t)); memset(li, 0, sizeof(w_listbox_item_t)); w_textbox_init(listbox->window, &(li->textbox), listbox); w_textbox_set_size(li->textbox->object, lb->itemheight - 8); for (pos = 0; !s_list_eol(lb->item_images, pos); pos++) { ii = (w_listbox_item_image_t *) s_list_get(lb->item_images, pos); w_textbox_set_image(li->textbox->object, ii->style, ii->rotation, ii->nimages, ii->images); } w_object_show(li->textbox->object); *listbox_item = li; return 0; }