I am currently working on a UI with wxWidgets. I'm constructing a space in the application to display a live stream video, with a big wxPanel "panelContent" that itself contains two smaller wxPanels: one to display the actual stream, "panelStream", and the other, smaller, one, "controlPanel" to go below the stream and display various buttons to seek, start, pause and stop the stream. The problem I have is not knowing how to set up these panels to allow for the panelStream to be resized according to how big the user makes the mainframe, but for the controlPanel to ALWAYS appear regardless of any resizing, subject to a minimum size. Right now, with the code posted below, the mainframe is maximized by default on Init() and thus displays everything correctly. When resizing, however, the controlPanel is the first to disappear. DevicePanel is the main window that governs all three panels mentioned above, plus one other that isn't relevant to this post. The code is a lot but I think my query is a reasonable one. Thanks for any help in advance
Code: Select all
void DevicePanel::Init()
{
//main sizer to govern the two main panels
devViewSizer = new wxBoxSizer(wxHORIZONTAL);
SetSizer(devViewSizer);
//panel to display list of bonded devices
listSizer = new wxGridSizer(1, 0, 0);
drawDeviceListPanel(devViewSizer, listSizer);
//panel to display stream selected from list of devices and control panel
sizerContent = new wxBoxSizer(wxVERTICAL);
drawContentPanel(devViewSizer, sizerContent);
//create a panel within deviceContentPanel to display video stream
sizerShow = new wxBoxSizer(wxVERTICAL);
drawVideoStreamPanel(sizerContent, sizerShow);
//this panel contains all the streaming control buttons
controlSizer = new wxBoxSizer(wxHORIZONTAL);
drawControlPanel(sizerContent, controlSizer);
}
//this panel contains videoStreamPanel and controlPanel
void DevicePanel::drawContentPanel(wxSizer* devViewSizer, wxSizer* ownSizer)
{
deviceContentPanel = new wxPanel(this, wxID_ANY, wxPoint(0, 0), wxSize(DWIDTH - 260 - 80, DHEIGHT));
devViewSizer->Add(deviceContentPanel);
deviceContentPanel->SetSizer(ownSizer);
}
//this panel displays the actual stream
void DevicePanel::drawVideoStreamPanel(wxSizer* devViewSizer, wxSizer* ownSizer)
{
vidStreamPanel = new wxPanel(deviceContentPanel, wxID_ANY, wxPoint(0, 0), wxSize(DWIDTH - 260 - 80, DHEIGHT - 80 - 120));
devViewSizer->Add(vidStreamPanel);
//ownSizer->Add(new wxPanel(vidStreamPanel, wxID_ANY, wxPoint(0, 0), wxSize(DWIDTH - 260 - 80, (DHEIGHT - 80 - 120) / 2)));
//vidStreamPanel->SetSizer(ownSizer);
}
//this panel contains all the streaming control buttons
void DevicePanel::drawControlPanel(wxSizer* devViewSizer, wxSizer* ownSizer)
{
controlPanel = new wxPanel(deviceContentPanel, wxID_ANY, wxPoint(0, 0), wxSize(DWIDTH - 260 - 80, 160));
devViewSizer->Add(controlPanel);
controlPanel->SetSizer(ownSizer);
}