+--------- ------------------+
| A | | |
|---------+ B | |
|---------------+ |
| C |
+----------------------------+
As you can see there are three rectangles 'A', 'B' and 'C'.
'A' is the smallest rectangle. 'B' is also a rectangle which is enclosing 'A' and 'C' is also a rectangle which is enclosing 'B'
'C' is the main window which is resizable. I want to create 'B' and 'A' window as shown and even if the main window is resized the child windows should not move from top left position but can stretch.
I am new to GUI programming so need some help here. Below is my code which is doing something as below:
+--------- -----------------+
| |
| +------------+
| | |
+---------------------------+
Code below is creating the child window in bottom right which is what i don't want.
MainComponent.cpp
void MainContentComponent::resized()
{
if(draw_component) {
draw_component->setBounds(0, 0, getParentHeight()/4, getParentWidth()/4);
draw_component->updateTransform();
}
}
In above setBounds where is 0, 0 co-ordinates in the rectangle?
ChildComponent.cpp
void childComp::resized ()
{
setBounds ((int) (0.1f * getParentWidth()), (int) (0.1f * getParentHeight()), (int) (0.5f * getParentWidth()), (int) (0.7f * getParentHeight()));
repaint();
}
Can you please give some code for doing what i intend to do as shown in the above diagrams with "A", "B" and "C" rectangle? I went through all the examples but couldn't infer how to do this.