1//============================================================================
2//
3// SSSS tt lll lll
4// SS SS tt ll ll
5// SS tttttt eeee ll ll aaaa
6// SSSS tt ee ee ll ll aa
7// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8// SS SS tt ee ll ll aa aa
9// SSSS ttt eeeee llll llll aaaaa
10//
11// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
12// and the Stella Team
13//
14// See the file "License.txt" for information on usage and redistribution of
15// this file, and for a DISCLAIMER OF ALL WARRANTIES.
16//============================================================================
17
18#ifndef CART_RAM_WIDGET_HXX
19#define CART_RAM_WIDGET_HXX
20
21class GuiObject;
22class DataGridOpsWidget;
23class StringListWidget;
24class InternalRamWidget;
25class CartDebugWidget;
26
27#include "RamWidget.hxx"
28#include "Widget.hxx"
29#include "Command.hxx"
30
31class CartRamWidget : public Widget, public CommandSender
32{
33 public:
34 CartRamWidget(GuiObject* boss, const GUI::Font& lfont,
35 const GUI::Font& nfont,
36 int x, int y, int w, int h, CartDebugWidget& cartDebug);
37 virtual ~CartRamWidget() = default;
38
39 void loadConfig() override;
40 void setOpsWidget(DataGridOpsWidget* w);
41
42 private:
43 void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
44
45 protected:
46 // Font used for 'normal' text; _font is for 'label' text
47 const GUI::Font& _nfont;
48
49 // These will be needed by most of the child classes;
50 // we may as well make them protected variables
51 int myFontWidth, myFontHeight, myLineHeight, myButtonHeight;
52
53 private:
54 // Following constructors and assignment operators not supported
55 CartRamWidget() = delete;
56 CartRamWidget(const CartRamWidget&) = delete;
57 CartRamWidget(CartRamWidget&&) = delete;
58 CartRamWidget& operator=(const CartRamWidget&) = delete;
59 CartRamWidget& operator=(CartRamWidget&&) = delete;
60
61 private:
62 class InternalRamWidget : public RamWidget
63 {
64 public:
65 InternalRamWidget(GuiObject* boss, const GUI::Font& lfont,
66 const GUI::Font& nfont,
67 int x, int y, int w, int h,
68 CartDebugWidget& cartDebug);
69 virtual ~InternalRamWidget();
70
71 private:
72 uInt8 getValue(int addr) const override;
73 void setValue(int addr, uInt8 value) override;
74 string getLabel(int addr) const override;
75
76 void fillList(uInt32 start, uInt32 size, IntArray& alist,
77 IntArray& vlist, BoolArray& changed) const override;
78 uInt32 readPort(uInt32 start) const override;
79 const ByteArray& currentRam(uInt32 start) const override;
80
81 private:
82 CartDebugWidget& myCart;
83
84 private:
85 // Following constructors and assignment operators not supported
86 InternalRamWidget() = delete;
87 InternalRamWidget(const InternalRamWidget&) = delete;
88 InternalRamWidget(InternalRamWidget&&) = delete;
89 InternalRamWidget& operator=(const InternalRamWidget&) = delete;
90 InternalRamWidget& operator=(InternalRamWidget&&) = delete;
91 };
92
93 private:
94 StringListWidget* myDesc;
95 InternalRamWidget* myRam;
96};
97
98#endif
99