as i want do have a wxPanel component to be resized on image contentmodification, it works
but the parent sizers stays the same
so i request the parent to do a layout but the sizer dont change size upon new children size
(then the wxPanel is not refreshing anymore)
Code: Select all
void CameraPreview::OnPaint(wxPaintEvent& event)
{
wxPaintDC dc(this);
int x,y,w,h;
dc.GetClippingBox( &x, &y, &w, &h );
if(refreshImage)
{
dc.DrawBitmap( *toDraw,(wxCoord) x,(wxCoord) y ,false); <------------ is still called but the result is black
delete toDraw;
refreshImage = false;
}
}
void CameraPreview::SetData(IplImage img)
{
...
toDraw = new wxBitmap( pWxImg );
ResizeOnce(img.width, img.height);
refreshImage=true;
Refresh();
}
void CameraPreview::OnSize(wxSizeEvent& event)
{
Refresh();
}
void CameraPreview::ResizeOnce(int width, int height)
{
wxSize size = GetSize();
if((size.GetWidth()==width)&&(size.GetHeight()==height))
return;
SetSize(width, height); --------> does not work becos of following line i guess
//GetParent()->Layout(); --------> when enabled, the bitmap above is still drawn, but the result is a black
}