Making a shadow over a wx.Panel's children

Thomas Christensen wrote:

Is it possible to create a wx.Panel that contains some children like
wx.StaticText and wx.Button and have that wx.Panel draw a small shadow
over them at the top edge?

On Mac something like that could probably be done with an overlay, but since overlays are implemented with a wx.ClientDC on the other platforms then the child widgets would clip that drawing and the shadow would appear to be behind them instead of over them.

If you were drawing the text yourself instead of using child widgets then you could use wx.GraphicsContext and draw a rectangle over the text with partially transparent alpha, but you would still have the same layering issue with other widgets.

···

--
Robin Dunn
Software Craftsman

On Mac something like that could probably be done with an overlay, but
since overlays are implemented with a wx.ClientDC on the other platforms
then the child widgets would clip that drawing and the shadow would
appear to be behind them instead of over them.

I suspected that, and it has to work on all platforms. But I was thinking about the possibility of the existence of some event that would let me draw after the children had been drawn.

If you were drawing the text yourself instead of using child widgets
then you could use wx.GraphicsContext and draw a rectangle over the text
with partially transparent alpha, but you would still have the same
layering issue with other widgets.

It’s not feasible in my situation since it would have to work with panels made by other people. I am merely constructing a framework around derived panels.

Thanks

···

On Friday, May 31, 2013 11:28:11 PM UTC+7, Robin Dunn wrote: