Kevin Altis
2004-10-01 10:38:58 UTC
I've brought this up before, but since wxMac is coming along I thought it
time to bring it up again to see if a solution might finally present itself.
In the images below, the trash can is a wxStaticBitmap, the edit image is a
wxBitmapButton. Both are transparent GIFs.
Loading Image...
Loading Image...
The transparency was achieved on the wxBitmapButton by assigning a null
event to EVT_ERASE_BACKGROUND. That doesn't appear to work for GTK or the
Mac, so it is a Windows-specific hack for wxBitmapButton. Binding
EVT_ERASE_BACKGROUND doesn't appear to have any effect with a wxStaticBitmap
on Windows. Mac OS X displays outlines for both wxBitmapButton and
wxStaticBitmap.
What wxWindows needs is some way of displaying non-rectangular and/or
roundrect buttons when given an image with transparency. That is needed for
displaying a variety of buttons, including the standard style of an
icon/image with text underneath the icon typical in toolbars and icon file
system listings. It would be nice if wxBitmapButton was the control for
displaying the transparent images since it has an associated command event,
but if necessary a new control that doesn't map to an underlying native
control could be devised.
If we ever want image maps or other clickable areas in wxHtml, we'll
probably need the ability to display transparent images overlapping other
objects too.
By using just a wxStaticBitmap you can get close if you have a solid
background since there is no 3D button style applied when drawing the image.
Giving true transparency probably requires a more complex solution which
eludes me.
The wxDragImage in wxPython is probably pretty close to what is needed, but
it needs to be wrapped up to simplify its use and might need some
refactoring to reduce flickering and memory usage.
Suggestions?
ka
time to bring it up again to see if a solution might finally present itself.
In the images below, the trash can is a wxStaticBitmap, the edit image is a
wxBitmapButton. Both are transparent GIFs.
Loading Image...
Loading Image...
The transparency was achieved on the wxBitmapButton by assigning a null
event to EVT_ERASE_BACKGROUND. That doesn't appear to work for GTK or the
Mac, so it is a Windows-specific hack for wxBitmapButton. Binding
EVT_ERASE_BACKGROUND doesn't appear to have any effect with a wxStaticBitmap
on Windows. Mac OS X displays outlines for both wxBitmapButton and
wxStaticBitmap.
What wxWindows needs is some way of displaying non-rectangular and/or
roundrect buttons when given an image with transparency. That is needed for
displaying a variety of buttons, including the standard style of an
icon/image with text underneath the icon typical in toolbars and icon file
system listings. It would be nice if wxBitmapButton was the control for
displaying the transparent images since it has an associated command event,
but if necessary a new control that doesn't map to an underlying native
control could be devised.
If we ever want image maps or other clickable areas in wxHtml, we'll
probably need the ability to display transparent images overlapping other
objects too.
By using just a wxStaticBitmap you can get close if you have a solid
background since there is no 3D button style applied when drawing the image.
Giving true transparency probably requires a more complex solution which
eludes me.
The wxDragImage in wxPython is probably pretty close to what is needed, but
it needs to be wrapped up to simplify its use and might need some
refactoring to reduce flickering and memory usage.
Suggestions?
ka