| 2947 | } |
| 2948 | |
| 2949 | void DrawWidget(const Rect &r, WidgetID widget) const override |
| 2950 | { |
| 2951 | if (widget != WID_IC_PANEL) return; |
| 2952 | |
| 2953 | Rect ir = r.Shrink(WidgetDimensions::scaled.bevel); |
| 2954 | DrawPixelInfo tmp_dpi; |
| 2955 | if (!FillDrawPixelInfo(&tmp_dpi, ir)) return; |
| 2956 | AutoRestoreBackup dpi_backup(_cur_dpi, &tmp_dpi); |
| 2957 | |
| 2958 | int left_pos = WidgetDimensions::scaled.frametext.left - WidgetDimensions::scaled.bevel.left; |
| 2959 | if (this->ind_cargo >= NUM_INDUSTRYTYPES) left_pos += (CargoesField::industry_width + CargoesField::cargo_field_width) / 2; |
| 2960 | int last_column = (this->ind_cargo < NUM_INDUSTRYTYPES) ? 4 : 2; |
| 2961 | |
| 2962 | const NWidgetBase *nwp = this->GetWidget<NWidgetBase>(WID_IC_PANEL); |
| 2963 | int vpos = WidgetDimensions::scaled.frametext.top - WidgetDimensions::scaled.bevel.top - this->vscroll->GetPosition() * nwp->resize_y; |
| 2964 | int row_height = CargoesField::small_height; |
| 2965 | for (const auto &field : this->fields) { |
| 2966 | if (vpos + row_height >= 0) { |
| 2967 | int xpos = left_pos; |
| 2968 | int col, dir; |
| 2969 | if (_current_text_dir == TD_RTL) { |
| 2970 | col = last_column; |
| 2971 | dir = -1; |
| 2972 | } else { |
| 2973 | col = 0; |
| 2974 | dir = 1; |
| 2975 | } |
| 2976 | while (col >= 0 && col <= last_column) { |
| 2977 | field.columns[col].Draw(xpos, vpos); |
| 2978 | xpos += (col & 1) ? CargoesField::cargo_field_width : CargoesField::industry_width; |
| 2979 | col += dir; |
| 2980 | } |
| 2981 | } |
| 2982 | vpos += row_height; |
| 2983 | if (vpos >= height) break; |
| 2984 | row_height = CargoesField::normal_height; |
| 2985 | } |
| 2986 | } |
| 2987 | |
| 2988 | /** |
| 2989 | * Calculate in which field was clicked, and within the field, at what position. |
nothing calls this directly
no test coverage detected