I have a custom gadget that I add to a window (created by the Window Class). The gadget needs to erase its background before it gets GM_RENDERed. It appears to me (based on experimenting) that the window class uses FORESHINEPEN (rather than BACKGROUNDPEN) for the background.
Is it really the case? Can I rely on this pen being used across various themes? I mean, will FORESHINEPEN (whatever colour it represents in a particular theme) always be used for the background?
Actually you shouldn't care about the background pen. Just use EraseRect.
To get the proper background you should save the GA_BackFill attribute in your OM_SET method and in GM_RENDER use InstallLayerHook to install that backfill hook. Don't forget to set it back to the previous value before GM_RENDER returns.
Thank you, works like a charm!
AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2