KoMo2  1.0.0
A modern ARM emulator GUI.
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ControlsModel Class Reference

The class definition of the ControlsModel class, a data model which encapsulates all state, data and functionality of the Jimulator controls of The KoMo2 GUI. This model is in keeping with the MVC design pattern, where this class is a Model, the status display label is a View, and the Jimulator control buttons are Controllers. More...

#include <ControlsModel.h>

Inheritance diagram for ControlsModel:
Model

Public Member Functions

 ControlsModel (ControlsView *const view, const std::string manual, KoMo2Model *const parent)
 Construct a new ControlsModel::ControlsModel object. More...
 
virtual const bool handleKeyPress (const GdkEventKey *const e) override
 Handles a key press event pertaining to this model. More...
 
virtual void changeJimulatorState (const JimulatorState newState) override
 Handles the Jimulator state change for this model. For each value of newState, it will update the state of the control buttons & potentially update their images. More...
 

Private Member Functions

void onReloadJimulatorClick ()
 Handles the reloadJimulatorButton click events - sends a command to Jimulator and changes JimulatorState to "JimulatorState::LOADED".
 
void onPauseResumeClick ()
 Handles the pauseResumeButton click events - changes JimulatorState to "JimulatorState::RUNNING" if currently JimulatorState::PAUSED, and "JimulatorState::PAUSED" if currently JimulatorState::RUNNING. Sends a command to Jimulator in every case.
 
void onSingleStepExecuteClick ()
 Handles the singleStepExecuteButton click events - changes JimulatorState to "JimulatorState::PAUSED" if state is already LOADED, and sends a command to Jimulator.
 
void onHaltExecutionClick ()
 Handles the haltExecutionButton click events - changes JimulatorState to "JimulatorState::UNLOADED".
 
 ControlsModel (const ControlsModel &)=delete
 
 ControlsModel (const ControlsModel &&)=delete
 
ControlsModeloperator= (const ControlsModel &)=delete
 
ControlsModeloperator= (const ControlsModel &&)=delete
 
- Private Member Functions inherited from Model
 Model (KoMo2Model *const parent)
 Constructs a new Model object - just assigns the parent variable. More...
 
KoMo2Model *const getParent () const
 Returns the parent pointer. More...
 
template<class T1 , class T2 >
void setButtonListener (Gtk::Button *const button, const T1 b, const T2 c)
 Connect any button to any member function of. More...
 
void setButtonState (Gtk::Button *const button, const bool state, Gtk::Image *const img=nullptr, const std::string newTooltip="", const std::string newLabelText="") const
 Sets the state of a button to some boolean - the assumption is that if a button is not meant to be sensitive (get_sensitive() == false) then it should also not have a tooltip or many other attributes. You can also optionally update the buttons image, tooltip text, and label text. More...
 
JimulatorState getJimulatorState () const
 Return the jimulatorState member object. More...
 

Private Attributes

ControlsView *const view
 A pointer to the view which this model represents.
 

Detailed Description

The class definition of the ControlsModel class, a data model which encapsulates all state, data and functionality of the Jimulator controls of The KoMo2 GUI. This model is in keeping with the MVC design pattern, where this class is a Model, the status display label is a View, and the Jimulator control buttons are Controllers.

Definition at line 21 of file ControlsModel.h.

Constructor & Destructor Documentation

ControlsModel::ControlsModel ( ControlsView *const  view,
const std::string  manual,
KoMo2Model *const  parent 
)

Construct a new ControlsModel::ControlsModel object.

Parameters
viewA pointer to the accompanying view object.
manualA URL to a site hosting the user manual for KoMo2.
parentA pointer to the parent model.

Definition at line 21 of file ControlsModel.cpp.

Member Function Documentation

void ControlsModel::changeJimulatorState ( const JimulatorState  newState)
overridevirtual

Handles the Jimulator state change for this model. For each value of newState, it will update the state of the control buttons & potentially update their images.

Parameters
newStateThe state that was changed into.

Implements Model.

Definition at line 145 of file ControlsModel.cpp.

const bool ControlsModel::handleKeyPress ( const GdkEventKey *const  e)
overridevirtual

Handles a key press event pertaining to this model.

Parameters
eThe key press event.
Returns
bool Was a key pressed or not?

Implements Model.

Definition at line 110 of file ControlsModel.cpp.


The documentation for this class was generated from the following files: