src/widgets/dropdown.cpp
changeset 8907 c6949b09d3b3
parent 8905 609b1121b3b3
child 9082 8a28686aeff2
equal deleted inserted replaced
8906:325b028994e9 8907:c6949b09d3b3
    34 {
    34 {
    35 	for (uint i = 0; i < lengthof(this->decode_params); i++) SetDParam(i, this->decode_params[i]);
    35 	for (uint i = 0; i < lengthof(this->decode_params); i++) SetDParam(i, this->decode_params[i]);
    36 	return this->string;
    36 	return this->string;
    37 }
    37 }
    38 
    38 
       
    39 void DropDownListItem::Draw(int x, int y, uint width, uint height, bool sel) const
       
    40 {
       
    41 	DrawStringTruncated(x + 2, y, this->String(), sel ? TC_WHITE : TC_BLACK, x + width);
       
    42 }
       
    43 
    39 /**
    44 /**
    40  * Delete all items of a drop down list and the list itself
    45  * Delete all items of a drop down list and the list itself
    41  * @param list List to delete.
    46  * @param list List to delete.
    42  */
    47  */
    43 static void DeleteDropDownList(DropDownList *list)
    48 static void DeleteDropDownList(DropDownList *list)
   120 
   125 
   121 				if (y + item_height < height) {
   126 				if (y + item_height < height) {
   122 					if (item->String() != STR_NULL) {
   127 					if (item->String() != STR_NULL) {
   123 						if (sel == item->result) GfxFillRect(x + 1, y, x + width, y + item_height - 1, 0);
   128 						if (sel == item->result) GfxFillRect(x + 1, y, x + width, y + item_height - 1, 0);
   124 
   129 
   125 						DrawStringTruncated(x + 2, y, item->String(), sel == item->result ? TC_WHITE : TC_BLACK, x + width);
   130 						item->Draw(x, y, width, 10, sel == item->result);
   126 
   131 
   127 						if (item->masked) {
   132 						if (item->masked) {
   128 							GfxFillRect(x, y, x + width, y + item_height - 1,
   133 							GfxFillRect(x, y, x + width, y + item_height - 1,
   129 								(1 << PALETTE_MODIFIER_GREYOUT) | _colour_gradient[w->widget[0].color][5]
   134 								(1 << PALETTE_MODIFIER_GREYOUT) | _colour_gradient[w->widget[0].color][5]
   130 							);
   135 							);