diff --git a/src/debugger/DataGridRamWidget.cxx b/src/debugger/DataGridRamWidget.cxx new file mode 100644 index 000000000..9be4c4f14 --- /dev/null +++ b/src/debugger/DataGridRamWidget.cxx @@ -0,0 +1,54 @@ +//============================================================================ +// +// SSSS tt lll lll +// SS SS tt ll ll +// SS tttttt eeee ll ll aaaa +// SSSS tt ee ee ll ll aa +// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" +// SS SS tt ee ll ll aa aa +// SSSS ttt eeeee llll llll aaaaa +// +// Copyright (c) 1995-2020 by Bradford W. Mott, Stephen Anthony +// and the Stella Team +// +// See the file "License.txt" for information on usage and redistribution of +// this file, and for a DISCLAIMER OF ALL WARRANTIES. +//============================================================================ + +#include "RamWidget.hxx" +#include "DataGridRamWidget.hxx" + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +DataGridRamWidget::DataGridRamWidget(GuiObject* boss, const RamWidget& ram, + const GUI::Font& font, + int x, int y, int cols, int rows, + int colchars, int bits, + Common::Base::Fmt base, + bool useScrollbar) + : DataGridWidget(boss, font, x, y, cols, rows, colchars, + bits, base, useScrollbar), + _ram(ram) +{ +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +string DataGridRamWidget::getToolTip(const Common::Point& pos) const +{ + const int idx = getToolTipIndex(pos); + + if(idx < 0) + return EmptyString; + + const Int32 addr = _addrList[idx]; + const string label = _ram.getLabel(addr); + const string tip = DataGridWidget::getToolTip(pos); + + if(label.empty()) + return tip; + + ostringstream buf; + + buf << _ram.getLabel(addr) << '\n' << tip; + + return buf.str(); +} diff --git a/src/debugger/DataGridRamWidget.hxx b/src/debugger/DataGridRamWidget.hxx new file mode 100644 index 000000000..451c23403 --- /dev/null +++ b/src/debugger/DataGridRamWidget.hxx @@ -0,0 +1,51 @@ +//============================================================================ +// +// SSSS tt lll lll +// SS SS tt ll ll +// SS tttttt eeee ll ll aaaa +// SSSS tt ee ee ll ll aa +// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" +// SS SS tt ee ll ll aa aa +// SSSS ttt eeeee llll llll aaaaa +// +// Copyright (c) 1995-2020 by Bradford W. Mott, Stephen Anthony +// and the Stella Team +// +// See the file "License.txt" for information on usage and redistribution of +// this file, and for a DISCLAIMER OF ALL WARRANTIES. +//============================================================================ + +#ifndef DATA_GRID_RAM_WIDGET_HXX +#define DATA_GRID_RAM_WIDGET_HXX + +class RamWidget; + +#include "DataGridWidget.hxx" +#include "Base.hxx" + +class DataGridRamWidget : public DataGridWidget +{ + public: + DataGridRamWidget(GuiObject* boss, const RamWidget& ram, + const GUI::Font& font, + int x, int y, int cols, int rows, + int colchars, int bits, + Common::Base::Fmt format = Common::Base::Fmt::_DEFAULT, + bool useScrollbar = false); + ~DataGridRamWidget() override = default; + + string getToolTip(const Common::Point& pos) const override; + + private: + const RamWidget& _ram; + + private: + // Following constructors and assignment operators not supported + DataGridRamWidget() = delete; + DataGridRamWidget(const DataGridRamWidget&) = delete; + DataGridRamWidget(DataGridRamWidget&&) = delete; + DataGridRamWidget& operator=(const DataGridRamWidget&) = delete; + DataGridRamWidget& operator=(DataGridRamWidget&&) = delete; +}; + +#endif