RobustToolbox icon indicating copy to clipboard operation
RobustToolbox copied to clipboard

Add support for overlays to draw controls

Open ElectroJr opened this issue 1 year ago • 0 comments

Nice feature to have, e.g. for richtext support for something like space-wizards/space-station-14/pull/28705

Overview of changes:

  • Added IUserInterfaceManager.RenderControl() for manually drawing controls.
    • This is basically just exposing the IUserInterfaceManagerInternal functions.
    • Instead of having a bunch of optional arguments, I chose to use the existing public ControlRenderArguments struct, under the assumption that it is not meant to be internal/obsoleted/removed.
  • The OverlayDrawArgs struct now provides an IRenderHandle and has an internal constructor.
    • This is currently required for control rendering. However, I could instead have changed control rendering to take in a screen handle instead.
    • I don't really understand the need for the separation of the screen/world handle, and I'd rather just allow people to use IRenderHandle which provides both, even if it is currently an unstable API that is subject to change.
  • The IClydeViewport overlay rendering methods now take in an IRenderHandle instead of a world/screen handle. Required for the viewports to draw overlays with the new OverlayDrawArgs.
    • Requires space-wizards/space-station-14/pull/28786
  • Controls can now be manually restyled via Control.InvalidateStyleSheet() and Control.DoStyleUpdate()
    • InvalidateStyleSheet() is just the old internal StyleSheetUpdate() method, but was renamed for consistency with the measure & arrange invalidation methods.

ElectroJr avatar Jun 09 '24 09:06 ElectroJr