Skip to content

Commit

Permalink
Use for range loop, fix compiler warnings
Browse files Browse the repository at this point in the history
- Use for range loop
- Fix warnings about type mismatch (int vs unsigned int)
  • Loading branch information
midwan committed Nov 10, 2024
1 parent 0a1bc3e commit 58347a5
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/widgets/container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,26 +167,25 @@ namespace gcn
graphics->pushClipArea(getChildrenArea());

std::list<Widget*> children = getChildren();
std::list<Widget*>::iterator iter;
for (iter = children.begin(); iter != children.end(); ++iter)
for (const auto& iter : children)
{
if ((*iter)->isVisible())
if (iter->isVisible())
{
// If the widget has a frame,
// draw it before drawing the widget
if ((*iter)->getFrameSize() > 0)
if (iter->getFrameSize() > 0)
{
Rectangle rec = (*iter)->getDimension();
rec.x -= (*iter)->getFrameSize();
rec.y -= (*iter)->getFrameSize();
rec.width += 2 * (*iter)->getFrameSize();
rec.height += 2 * (*iter)->getFrameSize();
Rectangle rec = iter->getDimension();
rec.x -= static_cast<int>(iter->getFrameSize());
rec.y -= static_cast<int>(iter->getFrameSize());
rec.width += static_cast<int>(2 * iter->getFrameSize());
rec.height += static_cast<int>(2 * iter->getFrameSize());
graphics->pushClipArea(rec);
(*iter)->drawFrame(graphics);
iter->drawFrame(graphics);
graphics->popClipArea();
}
graphics->pushClipArea((*iter)->getDimension());
(*iter)->draw(graphics);
graphics->pushClipArea(iter->getDimension());
iter->draw(graphics);
graphics->popClipArea();
}
}
Expand Down

0 comments on commit 58347a5

Please sign in to comment.