KoMo2  1.0.0
A modern ARM emulator GUI.
ControlsView.cpp
Go to the documentation of this file.
1 
9 #include "ControlsView.h"
10 #include <gtkmm/button.h>
11 #include <gtkmm/image.h>
12 
18  : parent(parent),
19  helpButton(),
20  reloadJimulatorButton(),
21  pauseResumeButton(),
22  singleStepExecuteButton(),
23  haltExecutionButton() {
30 }
31 
37  set_layout(Gtk::BUTTONBOX_END);
38  pack_end(helpButton, false, false);
39  pack_end(reloadJimulatorButton, false, false);
40  pack_end(pauseResumeButton, false, false);
41  pack_end(singleStepExecuteButton, false, false);
42  pack_end(haltExecutionButton, false, false);
43  show_all_children();
44  show();
45 }
46 
51  getHelpButton()->set_tooltip_text("About KoMo2 (F12)");
52  getHelpButton()->get_accessible()->set_name("Help");
53  getHelpButton()->get_accessible()->set_description("Displays a help window.");
54  getHelpButton()->set_size_request(102, 102);
55  getHelpButton()->get_style_context()->add_class("controlButtons");
56 }
57 
62  getHaltExecutionButton()->set_tooltip_text("Halt Jimulator (F1)");
63  getHaltExecutionButton()->get_accessible()->set_name("Halt execution");
64  getHaltExecutionButton()->get_accessible()->set_description(
65  "Halt execution of the loaded program.");
66  getHaltExecutionButton()->set_size_request(102, 102);
67  getHaltExecutionButton()->get_style_context()->add_class("controlButtons");
68 }
69 
74  getSingleStepExecuteButton()->set_tooltip_text("Execute 1 instruction (F6)");
75  getSingleStepExecuteButton()->get_accessible()->set_name(
76  "Single step execute");
77  getSingleStepExecuteButton()->get_accessible()->set_description(
78  "Execute a single line of the loaded program.");
79  getSingleStepExecuteButton()->set_size_request(102, 102);
80  getSingleStepExecuteButton()->get_style_context()->add_class(
81  "controlButtons");
82 }
83 
88  getReloadJimulatorButton()->set_tooltip_text("Reload program (Ctrl+R)");
89  getReloadJimulatorButton()->get_accessible()->set_name("Reload program");
90  getReloadJimulatorButton()->get_accessible()->set_description(
91  "Reloads the currently loaded program.");
92  getReloadJimulatorButton()->set_size_request(102, 102);
93  getReloadJimulatorButton()->get_style_context()->add_class("controlButtons");
94 }
95 
102  getPauseResumeButton()->set_size_request(102, 102);
103  getPauseResumeButton()->get_style_context()->add_class("controlButtons");
104 }
105 
106 // ! Getters and setters
107 
113  model = val;
114 }
119 void ControlsView::setButtonImages(const std::string projectRoot) {
120  getHaltExecutionButton()->set_image(
121  *new Gtk::Image(projectRoot + "/res/img/haltSymbol.png"));
122 
123  getHelpButton()->set_image(
124  *new Gtk::Image(projectRoot + "/res/img/helpSymbol.png"));
125 
126  getSingleStepExecuteButton()->set_image(
127  *new Gtk::Image(projectRoot + "/res/img/singleStepSymbol.png"));
128 
129  getReloadJimulatorButton()->set_image(
130  *new Gtk::Image(projectRoot + "/res/img/refreshSymbol.png"));
131 }
136 Gtk::LinkButton* const ControlsView::getHelpButton() {
137  return &helpButton;
138 }
145  return &reloadJimulatorButton;
146 }
152  return &pauseResumeButton;
153 }
160  return &singleStepExecuteButton;
161 }
167  return &haltExecutionButton;
168 }
The class definition of the ControlsModel class, a data model which encapsulates all state...
Definition: ControlsModel.h:21
Gtk::LinkButton helpButton
A button which, when clicked, opens up an about/help window.
Definition: ControlsView.h:50
ControlsModel * model
A pointer to the related model.
Definition: ControlsView.h:45
void initProgramControlsContainer()
Packs children into the controlsView, and sets the layout and size of it.
Gtk::Button *const getSingleStepExecuteButton()
Gets the singleStepExecuteButton member variable.
Gtk::Button haltExecutionButton
A button which, when clicked, halts the current execution of Jimulator.
Definition: ControlsView.h:75
void initHelpButton()
Setup all of the information about the help button.
ControlsView(MainWindowView *const parent)
Construct a new Controls View.
Gtk::Button pauseResumeButton
A button which, when clicked, toggles between playing and pausing the execution of Jimulator (i...
Definition: ControlsView.h:63
Gtk::Button *const getHaltExecutionButton()
Gets the haltExecutionButton member variable.
The class definition of the main window of the program. This main window is the mater view of the pro...
void initSingleStepExecuteButton()
Sets up all of the information about the single step execution button.
Gtk::Button reloadJimulatorButton
A button which, when clicked, reloads the program into Jimulator again.
Definition: ControlsView.h:56
Gtk::Button *const getPauseResumeButton()
Gets the pauseResumeButton member variable.
void initReloadJimulatorButton()
Sets up all of the information about the reload Jimulator button.
Gtk::Button *const getReloadJimulatorButton()
Gets the reloadJimulatorButton member variable.
void initPauseResumeButton()
Sets up all of the information about the pause & resume button. This is emptier than its sibling func...
A definition of the class ControlsView.
void initHaltExecutionButton()
Sets up all of the information about the halt execution button.
void setModel(ControlsModel *const val)
Set the model member variable.
Gtk::LinkButton *const getHelpButton()
Gets the helpButton member variable.
Gtk::Button singleStepExecuteButton
A button which, when clicked, performs a single-step of execution IF Jimulator is already paused...
Definition: ControlsView.h:69
void setButtonImages(const std::string projectRoot)
Sets the images for 4 of the buttons.