simple GUI elements for drawing on a canvas, works with adafruit graphics lib

Dependents:   ezSBC_MPU9250

SmallGUIBase.cpp

Committer:
JojoS
Date:
2017-04-24
Revision:
0:ccdf1edcbba6

File content as of revision 0:ccdf1edcbba6:

#include "SmallGUIBase.h"

Canvas::Canvas(Adafruit_GFX &_gfxDevice) :
    gfxDevice(_gfxDevice)
{
    ctrlCount = 0;
}

void Canvas::draw()
{
    // call draw() on all controls
    int i;
    for (i=0; i < ctrlCount; i++)
        ctrlList[i]->draw(gfxDevice);
}

void Canvas::addControl(baseControl &bc)
{
    if (ctrlCount < MAX_CONTROLS_PER_CANVAS) {
        ctrlList[ctrlCount] = &bc;
        ctrlCount++;
    }
}