Foundation classes for a basic GUI implementing simple widgets and events

Dependents:   TouchScreenGUIDemo

Widgets/ContainerWidget.h

Committer:
duncanFrance
Date:
2016-05-28
Revision:
18:d849f3ada858
Parent:
13:6714534e7974

File content as of revision 18:d849f3ada858:

#ifndef SIMPLEGUI_CONTAINER_WIDGET_H
#define SIMPLEGUI_CONTAINER_WIDGET_H

#include "Widget.h"
#include "Window.h"

/**
* Simple container hold widgets side-by-side and draws a border
* It will expand as needed to hold the widgets
**/
class ContainerWidget : public Window
{

public:

    enum Layout { VERTICAL_LEFT, VERTICAL_RIGHT, VERTICAL_CENTER, HORIZONTAL, FIXED };

    ContainerWidget(GraphicsContext *context);
    
    /**
    * Overrides
    **/
    virtual void setSize(int width, int height);
    virtual void attach(Widget *child);

    void setLayout(Layout l);
    
protected:

    int _minWidth, _minHeight;
    Layout _layout;
    
    /**
    * Override
    **/
    virtual void _adjust();

};

#endif