| 1214 | } |
| 1215 | |
| 1216 | void UpdateWidgetColour(WindowBase* w, WidgetIndex widgetIndex, Colour colour) |
| 1217 | { |
| 1218 | if (w->classification == WindowClass::custom) |
| 1219 | { |
| 1220 | auto& customInfo = GetInfo(static_cast<CustomWindow*>(w)); |
| 1221 | auto customWidgetInfo = customInfo.GetCustomWidgetDesc(w, widgetIndex); |
| 1222 | if (customWidgetInfo != nullptr) |
| 1223 | { |
| 1224 | auto& widget = w->widgets[widgetIndex]; |
| 1225 | |
| 1226 | auto lastColour = customWidgetInfo->Colour; |
| 1227 | if (lastColour != colour && colourIsValid(colour)) |
| 1228 | { |
| 1229 | customWidgetInfo->Colour = colour; |
| 1230 | widget.image = getColourButtonImage(colour); |
| 1231 | |
| 1232 | auto* windowMgr = GetWindowManager(); |
| 1233 | windowMgr->InvalidateWidget(*w, widgetIndex); |
| 1234 | |
| 1235 | std::vector<JSValue> args; |
| 1236 | args.push_back(JS_NewInt32(customWidgetInfo->OnChange.context, EnumValue(colour))); |
| 1237 | InvokeEventHandler(customInfo.Owner, customWidgetInfo->OnChange, args); |
| 1238 | } |
| 1239 | } |
| 1240 | } |
| 1241 | } |
| 1242 | |
| 1243 | void UpdateWidgetSelectedIndex(WindowBase* w, WidgetIndex widgetIndex, int32_t selectedIndex) |
| 1244 | { |
no test coverage detected