From c70be70cab3615cb36cc5f244671cf5d39f1fda8 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Fri, 9 Feb 2024 09:47:21 +0100 Subject: General code cleanups * Removing unused includes * Use member initialization * Use range-based for loops * Use nullptr * Removed no longer used aliases * Use override * Don't use else after return * Use '= delete' to remove implicit members * Use std::string::empty instead of comparing to "" --- src/gui/widgets/tabbedarea.cpp | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'src/gui/widgets/tabbedarea.cpp') diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index 1fdd276f..644adf07 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -25,10 +25,7 @@ #include -TabbedArea::TabbedArea() : gcn::TabbedArea(), - mTabsWidth(0), - mVisibleTabsWidth(0), - mTabScrollIndex(0) +TabbedArea::TabbedArea() { mWidgetContainer->setOpaque(false); addWidgetListener(this); @@ -51,13 +48,10 @@ int TabbedArea::getNumberOfTabs() const Tab *TabbedArea::getTab(const std::string &name) const { - auto itr = mTabs.begin(), itr_end = mTabs.end(); - while (itr != itr_end) + for (auto itr = mTabs.begin(); itr != mTabs.end(); ++itr) { if ((*itr).first->getCaption() == name) return static_cast((*itr).first); - - ++itr; } return nullptr; } @@ -72,13 +66,10 @@ void TabbedArea::draw(gcn::Graphics *graphics) gcn::Widget *TabbedArea::getWidget(const std::string &name) const { - auto itr = mTabs.begin(), itr_end = mTabs.end(); - while (itr != itr_end) + for (const auto &[tab, widget] : mTabs) { - if ((*itr).first->getCaption() == name) - return (*itr).second; - - ++itr; + if (tab->getCaption() == name) + return widget; } return nullptr; -- cgit v1.2.3-70-g09d2