I need to design, for a school project, **a very simple** GUI framework which needs to support the following controls/widgets: Window, Panel, Image, Label and Button. 

* The first question that came up to my mind is whether or not `Window` should be a control. I think it suppose to.
* We have `Window` and `Panel` which can contain other controls. `Button`, `Label` and `Image`, cannot. So we need two basic types of controls; One which is a container and another which is not (I've seen that in Gtk implementation the later is also a container, but can only contain one single child. It's called [GtkBin](https://developer.gnome.org/gtk3/stable/GtkBin.html). I think it's an overhead for my simple project.
* Third issue I came across with is: I need to **traverse the UI tree** (for the drawing) but since there's no mechanism for polymorphism in C, it's becoming somewhat problematic.

I thought about the following solution, utilizing `union`. Basically I'll need some function to convert a generic `Control` to it's actuall type.

```
typedef struct button {
    char *image_path;
} Button;

typedef struct control_node {
    Control *node;
    struct control_node *next;
} ControlNode;

typedef struct panel {
    ControlNode *children;
} Panel;

typedef union control_data {
    Panel panel;
    Button button;
} ControlData;

typedef struct control {
    int x;
    int y;
    int type;
    ControlData *data;
} Control;

```

So I'd like to get your thoughts about the issues I've introduced and an opinion about my current strategy (I am **NOT** looking for an implementation, rather thoughts/ideas etc)

Thanks.