| 1861 | } |
| 1862 | |
| 1863 | void OnPaint() override |
| 1864 | { |
| 1865 | this->GenerateBuildList(); |
| 1866 | this->vscroll->SetCount(this->eng_list.size()); |
| 1867 | |
| 1868 | this->SetWidgetsDisabledState(this->sel_engine == EngineID::Invalid(), WID_BV_SHOW_HIDE, WID_BV_BUILD); |
| 1869 | |
| 1870 | /* Disable renaming engines in network games if you are not the server. */ |
| 1871 | this->SetWidgetDisabledState(WID_BV_RENAME, this->sel_engine == EngineID::Invalid() || (_networking && !_network_server)); |
| 1872 | |
| 1873 | this->DrawWidgets(); |
| 1874 | |
| 1875 | if (!this->IsShaded()) { |
| 1876 | int needed_height = this->details_height; |
| 1877 | /* Draw details panels. */ |
| 1878 | if (this->sel_engine != EngineID::Invalid()) { |
| 1879 | const Rect r = this->GetWidget<NWidgetBase>(WID_BV_PANEL)->GetCurrentRect().Shrink(WidgetDimensions::scaled.framerect); |
| 1880 | int text_end = DrawVehiclePurchaseInfo(r.left, r.right, r.top, this->sel_engine, this->te); |
| 1881 | needed_height = std::max(needed_height, (text_end - r.top) / GetCharacterHeight(FS_NORMAL)); |
| 1882 | } |
| 1883 | if (needed_height != this->details_height) { // Details window are not high enough, enlarge them. |
| 1884 | int resize = needed_height - this->details_height; |
| 1885 | this->details_height = needed_height; |
| 1886 | this->ReInit(0, resize * GetCharacterHeight(FS_NORMAL)); |
| 1887 | return; |
| 1888 | } |
| 1889 | } |
| 1890 | } |
| 1891 | |
| 1892 | void OnQueryTextFinished(std::optional<std::string> str) override |
| 1893 | { |
nothing calls this directly
no test coverage detected