void eol_component_list_draw(eolComponent *component) { eolRect r; eolRect ir; /*item rect*/ eolVec2D itemPos = {0,0}; eolVec2D scaleArea; int position = 0; GList *it = NULL; eolComponentListItem *item = NULL; eolComponentList *list = eol_component_get_list_data(component); if (list == NULL)return; r.x = component->bounds.x - 1; r.y = component->bounds.y - 1; r.w = component->bounds.w + 2; r.h = component->bounds.h + 2; if (list->showBackground) eol_draw_solid_rect(component->bounds,list->backgroundColor,list->backgroundAlpha); /*draw list items*/ scaleArea = eol_component_list_scaleable_area(list); /*TODO make the iterator start at the top position of the scroll*/ for (it = list->itemList,position = 0;it != NULL;it = it->next,position++) { if (!it->data)continue; item = (eolComponentListItem*)it->data; itemPos = eol_component_list_get_item_position(component,position); eol_rect_set(&ir,itemPos.x,itemPos.y,list->itemRect.w,list->itemRect.h); if (!eol_list_item_bound_check(list,ir)) { continue; } eol_component_move(item->item,ir); if (item->selected) { eol_draw_solid_rect(ir,list->highlightColor,0.9); } eol_component_draw(item->item); if (item->highlight) { eol_draw_rect(ir,list->highlightColor,1); } } if (list->showBoarder) { eol_draw_rect(r,eol_vec3d(1,1,1),1); } if ((list->showVSlider) && (fabs(scaleArea.y) > 1)) { eol_component_draw(list->vSlider); } if ((list->showHSlider) && (fabs(scaleArea.x) > 1)) { eol_component_draw(list->hSlider); } }
void eol_component_entry_draw(eolComponent *component, eolRect bounds) { eolRect r; eolComponentEntry *entry = eol_component_get_entry_data(component); if (entry == NULL)return; r.x = bounds.x - 1; r.y = bounds.y - 1; r.w = bounds.w + 2; r.h = bounds.h + 2; eol_draw_solid_rect(r,eol_vec3d(1,1,1),1); eol_draw_solid_rect(bounds,entry->bgcolor,1); if (entry->buffer->len <= 0)return; if (entry->font == NULL) { if (entry->wordWrap) { eol_font_draw_text_block( entry->buffer->str, bounds.x, bounds.y, bounds.w, 0, entry->color, entry->alpha, entry->fontSize ); } else { eol_font_draw_text_justify( entry->buffer->str, bounds.x, bounds.y, entry->color, entry->alpha, entry->fontSize, entry->justify ); } } else { if (entry->wordWrap) { eol_font_draw_text_block_custom( entry->buffer->str, bounds, entry->color, entry->alpha, entry->font ); } else { eol_font_draw_text_justify_custom( entry->buffer->str, bounds.x, bounds.y, entry->color, entry->alpha, entry->font, entry->justify ); } } }