littleflylongbow / guichan

Automatically exported from code.google.com/p/guichan
Other
0 stars 0 forks source link

ListBox has a permanent background. #107

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Currently (in 0.8.1) gcn::ListBox is constantly opaque, making it a pain in
the butt to copy/paste current code if I want a transparent background.  I
looked at the source and the beginning of its draw() method draws a box
(using the currently set background color) behind all the text within the box.

I'll offer upload a patch if this is something that would be of interest to
everyone.  (I'm thinking of adding a setOpaque() and isOpaque() methods, as
is seen in other classes) to allow enabling and disabling of the background.

Original issue reported on code.google.com by holy.smo...@gmail.com on 18 Dec 2008 at 4:34

GoogleCodeExporter commented 8 years ago
My apologies if these are not correctly created, as I've never neither 
submitted code
before nor have I ever created a patch file before, but I think these are how 
they
are supposed to look.

Original comment by holy.smo...@gmail.com on 18 Dec 2008 at 6:08

Attachments:

GoogleCodeExporter commented 8 years ago
Wouldn't it be easier to just set the background color to transparent?  Or does 
that
cause extra rendering?

Original comment by bsm...@gmail.com on 24 Dec 2008 at 8:33

GoogleCodeExporter commented 8 years ago
As far as I'm aware, the background needs to be set to a gcn::Color.  
Transparent
implementation in other objects is run in this same way, though, (if isOpaque() 
==
TRUE then it draws the background and if not it won't draw it)

I suppose a next question would be, wouldn't make more sense to put this
functionality in gcn::Widget (isOpaque(), setOpaque()) and just add it to
gcn::Widget::draw())?

Original comment by holy.smo...@gmail.com on 24 Dec 2008 at 9:23

GoogleCodeExporter commented 8 years ago
"and just add it to gcn::Widget::draw())"

gcn::Widget::draw is a pure virtual function.

"wouldn't make more sense to put this functionality in gcn::Widget (isOpaque(),
setOpaque())"

What does setOpaque mean for a label or for an image? If the functionality 
isn't used
by all widgets I see no reason adding it to the base class.

Original comment by olof.nae...@gmail.com on 24 Dec 2008 at 9:33

GoogleCodeExporter commented 8 years ago
Well, supposing the image has a transparency or certain background for the 
label. 
That certainly isn't to say their constructors couldn't disable it by default. 
Still, I figured it might be worth noting.

Original comment by holy.smo...@gmail.com on 24 Dec 2008 at 9:36