KoMo2  1.0.0
A modern ARM emulator GUI.
DisassemblyView.h
Go to the documentation of this file.
1 
10 #include <gtkmm/box.h>
11 #include <gtkmm/buttonbox.h>
12 #include <gtkmm/eventbox.h>
13 #include <gtkmm/grid.h>
14 #include <gtkmm/label.h>
15 #include <gtkmm/togglebutton.h>
16 #include <iostream>
17 #include <string>
18 #include <vector>
19 
20 class MainWindowView;
21 class DisassemblyModel;
22 
28 class DisassemblyRows : public Gtk::Box {
29  public:
31 
32  // SET
33  void setBreakpoint(const bool text);
34  void setAddress(const std::string text);
35  void setHex(const std::string text);
36  void setDisassembly(const std::string text);
37  void setAddressVal(const uint32_t val);
38  void setModel(DisassemblyModel* const val);
39 
40  // GET
41  Gtk::ToggleButton* const getButton();
42  const uint32_t getAddressVal() const;
43  const bool getBreakpoint();
44  const std::string getDisassembly();
45  const std::string getAddress() const;
46 
47  private:
52  Gtk::HBox buttonSizer;
56  Gtk::ToggleButton breakpoint;
60  Gtk::Label address;
64  Gtk::Label hex;
68  Gtk::Label disassembly;
69 
73  uint32_t addressVal;
74 
79 
80  void initBreakpoint();
81  void initAddress();
82  void initHex();
83  void initDisassembly();
84 
85  // ! Deleted special member functions
86  // stops these functions from being misused, creates a sensible error
87  DisassemblyRows(const DisassemblyRows&) = delete;
88  DisassemblyRows(const DisassemblyRows&&) = delete;
89  DisassemblyRows& operator=(const DisassemblyRows&) = delete;
90  DisassemblyRows& operator=(const DisassemblyRows&&) = delete;
91 };
92 
101 class DisassemblyView : public Gtk::EventBox {
102  public:
103  DisassemblyView(MainWindowView* const parent);
104 
105  // ! Getters and setters
106 
107  void setModel(DisassemblyModel* const val);
108  DisassemblyModel* const getModel() const;
109  std::vector<DisassemblyRows>* const getRows();
110  MainWindowView* const getParent() const;
111 
112  private:
113  // ! Member children
122 
123  // ! GUI children
127  Gtk::VButtonBox disassemblyContainer;
132  std::vector<DisassemblyRows> rows{std::vector<DisassemblyRows>(13)};
133 
134  // ! Functions
135 
136  void initDisassemblyContainer();
137  void initDisassemblyRows();
138 
139  // ! Deleted special member functions
140  // stops these functions from being misused, creates a sensible error
141  DisassemblyView(const DisassemblyView&) = delete;
142  DisassemblyView(const DisassemblyView&&) = delete;
143  DisassemblyView& operator=(const DisassemblyView&) = delete;
144  DisassemblyView& operator=(const DisassemblyView&&) = delete;
145 };
void setAddressVal(const uint32_t val)
Set the value of addressVal member.
The declaration of the DisassemblyModel class.
DisassemblyModel * model
A pointer to the related model.
uint32_t addressVal
The address pointed to, as an integer.
A single instance of this class represents a single read memory address and the associated data - thi...
DisassemblyRows()
Construct a new DisassemblyRows::DisassemblyRows object.
const std::string getAddress() const
Get the text in the address box.
Gtk::Label address
Displays the address of the current memory value.
void setDisassembly(const std::string text)
Set the text of disassembly label.
void initHex()
Initialises the hex label.
Gtk::Label disassembly
Displays the current disassembly value of the memory.
const bool getBreakpoint()
Returns if a breakpoint is set or not.
void setBreakpoint(const bool text)
Set the state of the breakpoint button. This is a little unusual - it sets the state in terms of CSS ...
The class definition of the main window of the program. This main window is the mater view of the pro...
DisassemblyModel * model
A pointer to the model.
Gtk::HBox buttonSizer
Setting exact size of widgets is hard; this container is needed to set the size of the button...
void initAddress()
Initialises the address label.
void setAddress(const std::string text)
Set the text of the address label.
Represents the entire disassembly window in the overall KoMo2 GUI. Contains several rows of memory va...
void initBreakpoint()
Initialises the breakpoint button.
MainWindowView *const parent
A pointer to the parent view.
Gtk::ToggleButton *const getButton()
Gets a constant pointer to the breakpoint button member.
void initDisassembly()
Initialises the disassembly label.
Gtk::Label hex
Displays the current hexadecimal value of the memory.
void setModel(DisassemblyModel *const val)
Sets the value of the model pointer.
Gtk::VButtonBox disassemblyContainer
A container for the disassembly rows.
const std::string getDisassembly()
Gets the disassembly text for the breakpoint row.
void setHex(const std::string text)
Set the text of the hex label.
Gtk::ToggleButton breakpoint
The debugging breakpoint button.
const uint32_t getAddressVal() const
Get the addressVal member.