0x004CA4DF
| 1253 | |
| 1254 | // 0x004CA4DF |
| 1255 | void Window::draw(Gfx::DrawingContext& drawingCtx) |
| 1256 | { |
| 1257 | if (this->isTranslucent() && !this->hasFlags(WindowFlags::noBackground)) |
| 1258 | { |
| 1259 | drawingCtx.fillRect(this->x, this->y, this->x + this->width - 1, this->y + this->height - 1, enumValue(ExtColour::unk34), Gfx::RectFlags::transparent); |
| 1260 | } |
| 1261 | |
| 1262 | uint64_t pressedWidget = 0; |
| 1263 | if (Input::state() == Input::State::dropdownActive || Input::state() == Input::State::widgetPressed) |
| 1264 | { |
| 1265 | if (Input::isPressed(type, number)) |
| 1266 | { |
| 1267 | const WidgetIndex_t widgetIndex = Input::getPressedWidgetIndex(); |
| 1268 | pressedWidget = 1ULL << widgetIndex; |
| 1269 | } |
| 1270 | } |
| 1271 | |
| 1272 | uint64_t tool_widget = 0; |
| 1273 | if (ToolManager::isToolActive(this->type, this->number)) |
| 1274 | { |
| 1275 | tool_widget = 1ULL << ToolManager::getToolWidgetIndex(); |
| 1276 | } |
| 1277 | |
| 1278 | uint64_t hovered_widget = 0; |
| 1279 | if (Input::isHovering(this->type, this->number)) |
| 1280 | { |
| 1281 | hovered_widget = 1ULL << Input::getHoveredWidgetIndex(); |
| 1282 | } |
| 1283 | |
| 1284 | uint8_t scrollviewIndex = 0; |
| 1285 | for (auto& widget : widgets) |
| 1286 | { |
| 1287 | widget.draw(drawingCtx, this, pressedWidget, tool_widget, hovered_widget, scrollviewIndex); |
| 1288 | |
| 1289 | // FIXME: This is ugly and error prone, put the ScrollArea data in the widget, |
| 1290 | // previously it was passed as reference to draw where it incremented it. |
| 1291 | if (widget.type == WidgetType::scrollview) |
| 1292 | { |
| 1293 | scrollviewIndex++; |
| 1294 | } |
| 1295 | } |
| 1296 | |
| 1297 | if (this->hasFlags(WindowFlags::whiteBorderMask)) |
| 1298 | { |
| 1299 | drawingCtx.fillRectInset( |
| 1300 | this->x, |
| 1301 | this->y, |
| 1302 | this->x + this->width - 1, |
| 1303 | this->y + this->height - 1, |
| 1304 | Colour::white, |
| 1305 | Gfx::RectInsetFlags::fillNone); |
| 1306 | } |
| 1307 | } |
| 1308 | |
| 1309 | WidgetIndex_t Window::firstActivatedWidgetInRange(WidgetIndex_t minIndex, WidgetIndex_t maxIndex) |
| 1310 | { |
no test coverage detected