Mercurial > hg > tweakathon2ios
view UI code/UIElementContainer.mm @ 52:89944ab3e129 tip
fix oF linker errors ios8
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Tue, 03 Feb 2015 13:18:23 +0000 |
parents | a223551fdc1f |
children |
line wrap: on
line source
// // UIElementContainer.cpp // emptyExample // // Created by Robert Tubb on 22/05/2013. // // #include "UIElementContainer.h" #include "ButtronXY.h" #include "ButtronSlider.h" //----------------------------------------------------------------------------- UIElementContainer::UIElementContainer(float ax, float ay, float awidth, float aheight, const UIProps& aprops) : UIElement(ax,ay,awidth,aheight,aprops.generalBackground) { cout << "UIElementContainer contructor\n"; myProps = aprops; cthickness = 0.; } //----------------------------------------------------------------------------- int UIElementContainer::getNumberOfControls(){ return subElements.size(); } //----------------------------------------------------------------------------- void UIElementContainer::removeAllSubelements(){ vector<UIElement *>::iterator UIitr; for(UIitr = subElements.begin(); UIitr < subElements.end(); UIitr++){ delete (*UIitr); } subElements.clear(); } //------------------------------------------------------------------- void UIElementContainer::draw(){ if(hidden) return; //cout << "DRAWING CONTAINER"<< endl; UIElement::draw(); // draw me if(cthickness != 0.){ // doh, duplicate code from buttron? drawBorder(); } // draw my subelems vector<UIElement *>::iterator UIitr; for(UIitr = subElements.begin(); UIitr < subElements.end(); UIitr++){ (*UIitr)->draw(); } }; //------------------------------------------------------------------- void UIElementContainer::drawBorder(){ ofSetLineWidth(cthickness); ofSetColor(myProps.borderColor); // top ofLine(x,y,x+width,y); // left ofLine(x,y,x,y+height); //right ofLine(x+width-cthickness,y,x+width-cthickness,y+height); // bottom ofLine(x-cthickness,y+height,x+width-cthickness,y+height); } //-------------------------------------------------------------------