diff --git a/src/common/Stack.hxx b/src/common/Stack.hxx index 5e0325913..9ee0b21ac 100644 --- a/src/common/Stack.hxx +++ b/src/common/Stack.hxx @@ -21,6 +21,7 @@ #define STACK_HXX #include +#include /** * Simple fixed size stack class. @@ -35,6 +36,8 @@ class FixedStack uInt32 _size; public: + using StackFunction = std::function; + FixedStack() : _size(0) { } bool empty() const { return _size <= 0; } @@ -45,11 +48,14 @@ class FixedStack T pop() { return std::move(_stack[--_size]); } uInt32 size() const { return _size; } - T* begin() { return _stack.begin(); } - T* end() { return _stack.begin() + _size; } - - const T* cbegin() const { return _stack.begin(); } - const T* cend() const { return _stack.begin() + _size; } + // Apply the given function to every item in the stack + // We do it this way so the stack API can be preserved, + // and no access to individual elements is allowed outside + // the class. + void applyAll(const StackFunction& func) { + for(uInt32 i = 0; i < _size; ++i) + func(_stack[i]); + } private: // Following constructors and assignment operators not supported diff --git a/src/debugger/gui/RomListWidget.hxx b/src/debugger/gui/RomListWidget.hxx index a3c798822..35a1fedc5 100644 --- a/src/debugger/gui/RomListWidget.hxx +++ b/src/debugger/gui/RomListWidget.hxx @@ -20,7 +20,6 @@ #ifndef ROM_LIST_WIDGET_HXX #define ROM_LIST_WIDGET_HXX -class RomListSettings; class ScrollBarWidget; class PackedBitArray; class CheckListWidget; @@ -28,6 +27,7 @@ class CheckListWidget; #include "Base.hxx" #include "CartDebug.hxx" #include "EditableWidget.hxx" +#include "RomListSettings.hxx" /** RomListWidget */ class RomListWidget : public EditableWidget diff --git a/src/debugger/gui/TiaOutputWidget.hxx b/src/debugger/gui/TiaOutputWidget.hxx index 5555594a6..633a0975e 100644 --- a/src/debugger/gui/TiaOutputWidget.hxx +++ b/src/debugger/gui/TiaOutputWidget.hxx @@ -21,13 +21,12 @@ #define TIA_OUTPUT_WIDGET_HXX class GuiObject; -class ContextMenu; class FBSurface; class TiaZoomWidget; #include "Widget.hxx" #include "Command.hxx" - +#include "ContextMenu.hxx" class TiaOutputWidget : public Widget, public CommandSender { diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx index 29bcaee3e..4d9d4b203 100644 --- a/src/gui/Dialog.cxx +++ b/src/gui/Dialog.cxx @@ -302,11 +302,10 @@ void Dialog::drawDialog() // Extra surfaces must be rendered afterwards, so they are drawn on top if(s.render()) { - for(auto& surface: mySurfaceStack) - { + mySurfaceStack.applyAll([](shared_ptr& surface){ surface->setDirty(); surface->render(); - } + }); } } diff --git a/src/gui/DialogContainer.cxx b/src/gui/DialogContainer.cxx index 90b149f9e..c26d6a18c 100644 --- a/src/gui/DialogContainer.cxx +++ b/src/gui/DialogContainer.cxx @@ -103,12 +103,11 @@ void DialogContainer::draw(bool full) // Draw all the dialogs on the stack when we want a full refresh if(full) { - for(auto& dialog: myDialogStack) - { - dialog->center(); - dialog->setDirty(); - dialog->drawDialog(); - } + myDialogStack.applyAll([](Dialog*& d){ + d->center(); + d->setDirty(); + d->drawDialog(); + }); } else if(!myDialogStack.empty()) myDialogStack.top()->drawDialog(); diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx index f4160e765..fd6f9e176 100644 --- a/src/gui/LauncherDialog.cxx +++ b/src/gui/LauncherDialog.cxx @@ -191,6 +191,11 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent, setListFilters(); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +LauncherDialog::~LauncherDialog() +{ +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - const string& LauncherDialog::selectedRomMD5() { diff --git a/src/gui/LauncherDialog.hxx b/src/gui/LauncherDialog.hxx index 6d4e5044e..90d243c7d 100644 --- a/src/gui/LauncherDialog.hxx +++ b/src/gui/LauncherDialog.hxx @@ -57,7 +57,7 @@ class LauncherDialog : public Dialog public: LauncherDialog(OSystem& osystem, DialogContainer& parent, int x, int y, int w, int h); - virtual ~LauncherDialog() = default; + virtual ~LauncherDialog(); /** Get MD5sum for the currently selected file