* Draw a text button widget to the display, relative to 0,0. * * @param w The widget (which is a button) to draw. */
| 294 | * @param w The widget (which is a button) to draw. |
| 295 | */ |
| 296 | void GUI_Widget_TextButton2_Draw(Widget *w) |
| 297 | { |
| 298 | Screen oldScreenID; |
| 299 | uint16 stringID; |
| 300 | uint16 positionX, positionY; |
| 301 | uint16 width, height; |
| 302 | uint8 colour; |
| 303 | bool buttonSelected; |
| 304 | bool buttonDown; |
| 305 | |
| 306 | if (w == NULL) return; |
| 307 | |
| 308 | oldScreenID = SCREEN_ACTIVE; |
| 309 | if (GFX_Screen_IsActive(SCREEN_0)) { |
| 310 | oldScreenID = GFX_Screen_SetActive(SCREEN_1); |
| 311 | } |
| 312 | |
| 313 | stringID = w->stringID; |
| 314 | |
| 315 | buttonSelected = w->state.selected; |
| 316 | buttonDown = w->state.hover2; |
| 317 | |
| 318 | positionX = w->offsetX; |
| 319 | positionY = w->offsetY; |
| 320 | width = w->width; |
| 321 | height = w->height; |
| 322 | |
| 323 | GUI_DrawWiredRectangle(positionX - 1, positionY - 1, positionX + width, positionY + height, 12); |
| 324 | GUI_DrawBorder(positionX, positionY, width, height, buttonDown ? 0 : 1, true); |
| 325 | |
| 326 | colour = 0xF; |
| 327 | if (buttonSelected) { |
| 328 | colour = 0x6; |
| 329 | } else if (buttonDown) { |
| 330 | colour = 0xE; |
| 331 | } |
| 332 | |
| 333 | if (!buttonDown && stringID == STR_REPAIR) { |
| 334 | colour = 0xEF; |
| 335 | } |
| 336 | |
| 337 | GUI_DrawText_Wrapper( |
| 338 | String_Get_ByIndex(stringID), |
| 339 | positionX + width / 2, |
| 340 | positionY + 1, |
| 341 | colour, |
| 342 | 0, |
| 343 | 0x121 |
| 344 | ); |
| 345 | |
| 346 | w->shortcut = GUI_Widget_GetShortcut(*String_Get_ByIndex(stringID)); |
| 347 | |
| 348 | if (oldScreenID != SCREEN_0) return; |
| 349 | |
| 350 | GUI_Mouse_Hide_InRegion(positionX - 1, positionY - 1, positionX + width + 1, positionY + height + 1); |
| 351 | GFX_Screen_Copy2(positionX - 1, positionY - 1, positionX - 1, positionY - 1, width + 2, height + 2, SCREEN_1, SCREEN_0, false); |
| 352 | GUI_Mouse_Show_InRegion(); |
| 353 |
nothing calls this directly
no test coverage detected