#include "ContainerHWidget.h" #include "Widget.h" #include "CursorTask.h" #include #include #include #include #include void ContainerHWidget::addtocontainer( Widget* content ) { gridhwidget.push_back( content ); } void ContainerHWidget::adjust( ) { if (parent) { if (parent->getwidgettype()=="Window") { //remove 3 pixels all around the window borders and title bar to get the actual size xpos = parent->getxpos() +3; ypos = parent->getypos() +15; width = parent->getwidth() -6; height = parent->getheight() -18; } else if (parent->getwidgettype()=="Frame") { //remove 3 pixels all around the window borders and title bar to get the actual size xpos = parent->getxpos() +3; ypos = parent->getypos() +8; width = parent->getwidth() -6; height = parent->getheight() -11; } else if (parent->getwidgettype()=="ContainerH") { //if parent is a container, no need for extra space around the widgets // xpos = parent->getxpos(); // ypos = parent->getypos(); // width = parent->getwidth(); // height = parent->getheight(); } else if (parent->getwidgettype()=="ContainerV") { //if parent is a container, no need for extra space around the widgets // xpos = parent->getxpos(); // ypos = parent->getypos(); // width = parent->getwidth(); // height = parent->getheight(); } } int i=0; sizehgrid = gridhwidget.size(); for (auto& c : gridhwidget ) { c->setdimensions( xpos+2 + width/sizehgrid*i, ypos+2, width/sizehgrid-4, height-4 ); i++; } } void ContainerHWidget::logic( CursorTask *mouse ) { if (is_enabled && is_visible) { for (auto& c : gridhwidget ) c->logic( mouse ); } } void ContainerHWidget::render( SDL_Surface *screen, nSDL_Font *currentfont ) { if (is_visible) { for (auto& c : gridhwidget ) c->render( screen, currentfont ); } }