diff options
-rw-r--r-- | src/network/network_content_gui.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp index 332cf1a53..1b4b7e030 100644 --- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -297,6 +297,7 @@ class NetworkContentListWindow : public Window, ContentCallback { bool auto_select; ///< Automatically select all content when the meta-data becomes available StringFilter string_filter; ///< Filter for content list QueryString filter_editbox; ///< Filter editbox; + Dimension checkbox_size; ///< Size of checkbox/"blot" sprite const ContentInfo *selected; ///< The selected content info int list_pos; ///< Our position in the list @@ -481,6 +482,8 @@ public: selected(NULL), list_pos(0) { + this->checkbox_size = maxdim(maxdim(GetSpriteSize(SPR_BOX_EMPTY), GetSpriteSize(SPR_BOX_CHECKED)), GetSpriteSize(SPR_BLOT)); + this->CreateNestedTree(); this->vscroll = this->GetScrollbar(WID_NCL_SCROLLBAR); this->FinishInitNested(WN_NETWORK_WINDOW_CONTENT_LIST); @@ -516,6 +519,10 @@ public: *size = maxdim(*size, GetStringBoundingBox(STR_CONTENT_FILTER_TITLE)); break; + case WID_NCL_CHECKBOX: + size->width = this->checkbox_size.width + WD_MATRIX_RIGHT + WD_MATRIX_LEFT; + break; + case WID_NCL_TYPE: { Dimension d = *size; for (int i = CONTENT_TYPE_BEGIN; i < CONTENT_TYPE_END; i++) { @@ -526,7 +533,7 @@ public: } case WID_NCL_MATRIX: - resize->height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM; + resize->height = max(this->checkbox_size.height, (uint)FONT_HEIGHT_NORMAL) + WD_MATRIX_TOP + WD_MATRIX_BOTTOM; size->height = 10 * resize->height; break; } @@ -577,9 +584,11 @@ public: const NWidgetBase *nwi_name = this->GetWidget<NWidgetBase>(WID_NCL_NAME); const NWidgetBase *nwi_type = this->GetWidget<NWidgetBase>(WID_NCL_TYPE); + int line_height = max(this->checkbox_size.height, (uint)FONT_HEIGHT_NORMAL); /* Fill the matrix with the information */ - int sprite_y_offset = WD_MATRIX_TOP + (FONT_HEIGHT_NORMAL - 10) / 2; + int sprite_y_offset = WD_MATRIX_TOP + (line_height - this->checkbox_size.height) / 2 - 1; + int text_y_offset = WD_MATRIX_TOP + (line_height - FONT_HEIGHT_NORMAL) / 2; uint y = r.top; int cnt = 0; for (ConstContentIterator iter = this->content.Get(this->vscroll->GetPosition()); iter != this->content.End() && cnt < this->vscroll->GetCapacity(); iter++, cnt++) { @@ -600,9 +609,9 @@ public: DrawSprite(sprite, pal, nwi_checkbox->pos_x + (pal == PAL_NONE ? 2 : 3), y + sprite_y_offset + (pal == PAL_NONE ? 1 : 0)); StringID str = STR_CONTENT_TYPE_BASE_GRAPHICS + ci->type - CONTENT_TYPE_BASE_GRAPHICS; - DrawString(nwi_type->pos_x, nwi_type->pos_x + nwi_type->current_x - 1, y + WD_MATRIX_TOP, str, TC_BLACK, SA_HOR_CENTER); + DrawString(nwi_type->pos_x, nwi_type->pos_x + nwi_type->current_x - 1, y + text_y_offset, str, TC_BLACK, SA_HOR_CENTER); - DrawString(nwi_name->pos_x + WD_FRAMERECT_LEFT, nwi_name->pos_x + nwi_name->current_x - WD_FRAMERECT_RIGHT, y + WD_MATRIX_TOP, ci->name, TC_BLACK); + DrawString(nwi_name->pos_x + WD_FRAMERECT_LEFT, nwi_name->pos_x + nwi_name->current_x - WD_FRAMERECT_RIGHT, y + text_y_offset, ci->name, TC_BLACK); y += this->resize.step_height; } } |