steve wrote:
>
> I have a panel on my frame, and I do drawings on it (rectangles,
> shapes etc) with wxpython GDI (using methods like dc.DrawRectangle
> etc). Rectangles and shapes have colors. There are no widgets on the
> panel. Just shapes.
That's very different from what you first described.
> When I press a button on the toolbar, I want everything on that panel
> to turn into grayscale (all shapes will lose their colors), and a
> colored custom progress bar will appear in the middle of that
> grayscaled panel (and on top of shapes), and it will run (because a
> lengthy operation will be executed). When the execution is completed,
> the progress bar will disappear and the shapes on panel will regain
> its original colors.
It seems to me that the easy way to do this is to have all of your color
selections go through a filter:
m_Shape->SetBackgroundColor( ChooseColor( 255,128,64 ) );
...
wxColour MyWindow::ChooseColor( int r, int g, int b )
{
if( m_NeedGrayscale )
{
// This is a cheap but acceptable RGB->grayscale conversion.
int gray = (2 * r + 4 * g + b) / 7;
return wxColour( gray, gray, gray );
}
else
return wxColour( r, g, b );
}
Now, to draw in grayscale, you just set the flag and call "Refresh();."