OpenASIP  2.0
Public Member Functions | Protected Attributes | Static Protected Attributes | Private Types | Private Member Functions | List of all members
ProximUnitWindow Class Reference

#include <ProximUnitWindow.hh>

Inheritance diagram for ProximUnitWindow:
Inheritance graph
Collaboration diagram for ProximUnitWindow:
Collaboration graph

Public Member Functions

 ProximUnitWindow (ProximMainFrame *parent, int id)
 
virtual ~ProximUnitWindow ()
 
- Public Member Functions inherited from ProximSimulatorWindow
virtual void reset ()
 

Protected Attributes

SimulatorFrontendsimulator_
 Simulator instance . More...
 
wxChoice * unitChoice_
 Unit choicer widget. More...
 
wxChoice * modeChoice_
 Value display mode choicer widget. More...
 
wxListCtrl * valueList_
 List widget for the values. More...
 

Static Protected Attributes

static const wxString MODE_INT = _T("Int")
 String for the mode choicer integer mode. More...
 
static const wxString MODE_UNSIGNED = _T("Unsigned")
 String for the mode choicer unsigned integer mode. More...
 
static const wxString MODE_HEX = _T("Hex")
 String for the mode choicer hexadecimal mode. More...
 
static const wxString MODE_BIN = _T("Binary")
 String for the mode choicer binary mode. More...
 

Private Types

enum  {
  ID_UNIT_CHOICE = 10000, ID_MODE_CHOICE, ID_HELP, ID_CLOSE,
  ID_LINE, ID_VALUE_LIST
}
 

Private Member Functions

void onProgramLoaded (const SimulatorEvent &event)
 
void onSimulationStop (const SimulatorEvent &event)
 
void onChoice (wxCommandEvent &event)
 
void onClose (wxCommandEvent &event)
 
wxSizer * createContents (wxWindow *parent, bool call_fit, bool set_sizer)
 
virtual void reinitialize ()
 
virtual void update ()
 

Additional Inherited Members

- Protected Member Functions inherited from ProximSimulatorWindow
 ProximSimulatorWindow (ProximMainFrame *mainFrame, wxWindowID id=-1, wxPoint pos=wxDefaultPosition, wxSize size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
 
virtual ~ProximSimulatorWindow ()
 

Detailed Description

Parent class for windows displaying list information of the Proxim machine state window units.

This window listens to SimulatorEvents and updates the window contents automatically.

Definition at line 51 of file ProximUnitWindow.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
ID_UNIT_CHOICE 
ID_MODE_CHOICE 
ID_HELP 
ID_CLOSE 
ID_LINE 
ID_VALUE_LIST 

Definition at line 87 of file ProximUnitWindow.hh.

87  {
88  ID_UNIT_CHOICE = 10000,
90  ID_HELP,
91  ID_CLOSE,
92  ID_LINE,
94  };

Constructor & Destructor Documentation

◆ ProximUnitWindow()

ProximUnitWindow::ProximUnitWindow ( ProximMainFrame parent,
int  id 
)

Constructor.

Parameters
parentParent window of the window.
idWindow identifier.

Definition at line 67 of file ProximUnitWindow.cc.

68  :
69  ProximSimulatorWindow(parent, id),
70  unitChoice_(NULL),
71  valueList_(NULL) {
72 
73  createContents(this, true, true);
74 
75  simulator_ = wxGetApp().simulation()->frontend();
76 
77  unitChoice_ = dynamic_cast<wxChoice*>(FindWindow(ID_UNIT_CHOICE));
78  modeChoice_ = dynamic_cast<wxChoice*>(FindWindow(ID_MODE_CHOICE));
79  valueList_ = dynamic_cast<wxListCtrl*>(FindWindow(ID_VALUE_LIST));
80 
81  modeChoice_->Append(MODE_INT);
82  modeChoice_->Append(MODE_UNSIGNED);
83  modeChoice_->Append(MODE_HEX);
84  modeChoice_->Append(MODE_BIN);
85  modeChoice_->SetSelection(0);
86 
87 }

◆ ~ProximUnitWindow()

ProximUnitWindow::~ProximUnitWindow ( )
virtual

Destructor.

Definition at line 93 of file ProximUnitWindow.cc.

93  {
94 }

Member Function Documentation

◆ createContents()

wxSizer * ProximUnitWindow::createContents ( wxWindow *  parent,
bool  call_fit,
bool  set_sizer 
)
private

Creates the window contents.

Code generated by wxWidgets.

Parameters
parentParent window of the dialog contents.
call_fitIf true, created contents are fit inside the parent window.
set_sizerIf true, created top level sizer is set as the parent window contents.
Returns
Top level sizer of the created widgets.

Definition at line 169 of file ProximUnitWindow.cc.

170  {
171 
172  wxFlexGridSizer *item0 = new wxFlexGridSizer( 1, 0, 0 );
173  item0->AddGrowableCol( 0 );
174  item0->AddGrowableRow( 2 );
175 
176  wxGridSizer *item1 = new wxGridSizer( 2, 0, 0 );
177 
178  wxString *strs2 = (wxString*) NULL;
179  wxChoice *item2 = new wxChoice( parent, ID_UNIT_CHOICE, wxDefaultPosition, wxSize(120,-1), 0, strs2, 0 );
180  item1->Add( item2, 0, wxGROW|wxALL, 5 );
181 
182  wxString *strs3 = (wxString*) NULL;
183  wxChoice *item3 = new wxChoice( parent, ID_MODE_CHOICE, wxDefaultPosition, wxSize(120,-1), 0, strs3, 0 );
184  item1->Add( item3, 0, wxGROW|wxALL, 5 );
185 
186  item0->Add( item1, 0, wxGROW|wxALL, 5 );
187 
188  wxStaticLine *item4 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
189  item0->Add( item4, 0, wxGROW|wxALL, 5 );
190 
191  wxListCtrl *item5 = new wxListCtrl( parent, ID_VALUE_LIST, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxSUNKEN_BORDER );
192  item0->Add( item5, 0, wxGROW|wxALL, 5 );
193 
194  wxStaticLine *item6 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
195  item0->Add( item6, 0, wxGROW|wxALL, 5 );
196 
197  wxGridSizer *item7 = new wxGridSizer( 2, 0, 0 );
198 
199  wxButton *item8 = new wxButton( parent, ID_HELP, wxT("&Help"), wxDefaultPosition, wxDefaultSize, 0 );
200  item7->Add( item8, 0, wxALIGN_CENTER_VERTICAL, 5 );
201 
202  wxButton *item9 = new wxButton( parent, ID_CLOSE, wxT("&Close"), wxDefaultPosition, wxDefaultSize, 0 );
203  item7->Add( item9, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 );
204 
205  item0->Add( item7, 0, wxGROW|wxALL, 5 );
206 
207  if (set_sizer)
208  {
209  parent->SetSizer( item0 );
210  if (call_fit)
211  item0->SetSizeHints( parent );
212  }
213 
214  return item0;
215 }

References ID_CLOSE, ID_HELP, ID_LINE, ID_MODE_CHOICE, ID_UNIT_CHOICE, and ID_VALUE_LIST.

◆ onChoice()

void ProximUnitWindow::onChoice ( wxCommandEvent &  event)
private

Event handler for the dialog mode and unit choicers.

Updates the values list.

Definition at line 139 of file ProximUnitWindow.cc.

139  {
140  update();
141 }

References update().

Here is the call graph for this function:

◆ onClose()

void ProximUnitWindow::onClose ( wxCommandEvent &  event)
private

Event handler for the Close button.

Closes the window by destroying the parent frame of the window.

Definition at line 149 of file ProximUnitWindow.cc.

149  {
150  wxFrame* parent = dynamic_cast<wxFrame*>(GetParent());
151  if (parent != NULL) {
152  parent->Destroy();
153  }
154 }

◆ onProgramLoaded()

void ProximUnitWindow::onProgramLoaded ( const SimulatorEvent event)
private

Event handler which is called when a new program is loaded in the simulator.

Definition at line 109 of file ProximUnitWindow.cc.

109  {
110  reinitialize();
111 }

References reinitialize().

Here is the call graph for this function:

◆ onSimulationStop()

void ProximUnitWindow::onSimulationStop ( const SimulatorEvent event)
private

Event handler for simulation stop.

Updates the value list.

Definition at line 128 of file ProximUnitWindow.cc.

128  {
129  update();
130 }

References update().

Here is the call graph for this function:

◆ reinitialize()

void ProximUnitWindow::reinitialize ( )
privatevirtual

Called when the unit choicer needs to be reinitialized.

Reimplemented in ProximRegisterWindow, and ProximPortWindow.

Definition at line 101 of file ProximUnitWindow.cc.

101  {
102 }

Referenced by onProgramLoaded().

◆ update()

void ProximUnitWindow::update ( )
privatevirtual

Called when the value list needs to be updated.

Reimplemented in ProximRegisterWindow, and ProximPortWindow.

Definition at line 118 of file ProximUnitWindow.cc.

118  {
119 }

Referenced by onChoice(), and onSimulationStop().

Member Data Documentation

◆ MODE_BIN

const wxString ProximUnitWindow::MODE_BIN = _T("Binary")
staticprotected

String for the mode choicer binary mode.

Definition at line 73 of file ProximUnitWindow.hh.

Referenced by ProximRegisterWindow::loadImmediateUnit(), ProximRegisterWindow::loadRegisterFile(), and ProximPortWindow::update().

◆ MODE_HEX

const wxString ProximUnitWindow::MODE_HEX = _T("Hex")
staticprotected

String for the mode choicer hexadecimal mode.

Definition at line 71 of file ProximUnitWindow.hh.

Referenced by ProximRegisterWindow::loadImmediateUnit(), ProximRegisterWindow::loadRegisterFile(), and ProximPortWindow::update().

◆ MODE_INT

const wxString ProximUnitWindow::MODE_INT = _T("Int")
staticprotected

String for the mode choicer integer mode.

Definition at line 67 of file ProximUnitWindow.hh.

Referenced by ProximRegisterWindow::loadImmediateUnit(), ProximRegisterWindow::loadRegisterFile(), and ProximPortWindow::update().

◆ MODE_UNSIGNED

const wxString ProximUnitWindow::MODE_UNSIGNED = _T("Unsigned")
staticprotected

String for the mode choicer unsigned integer mode.

Definition at line 69 of file ProximUnitWindow.hh.

Referenced by ProximRegisterWindow::loadImmediateUnit(), ProximRegisterWindow::loadRegisterFile(), and ProximPortWindow::update().

◆ modeChoice_

wxChoice* ProximUnitWindow::modeChoice_
protected

◆ simulator_

SimulatorFrontend* ProximUnitWindow::simulator_
protected

◆ unitChoice_

wxChoice* ProximUnitWindow::unitChoice_
protected

◆ valueList_

wxListCtrl* ProximUnitWindow::valueList_
protected

The documentation for this class was generated from the following files:
ProximUnitWindow::modeChoice_
wxChoice * modeChoice_
Value display mode choicer widget.
Definition: ProximUnitWindow.hh:62
ProximUnitWindow::ID_LINE
@ ID_LINE
Definition: ProximUnitWindow.hh:92
FindWindow
Definition: FindWindow.hh:49
ProximUnitWindow::MODE_UNSIGNED
static const wxString MODE_UNSIGNED
String for the mode choicer unsigned integer mode.
Definition: ProximUnitWindow.hh:69
ProximUnitWindow::unitChoice_
wxChoice * unitChoice_
Unit choicer widget.
Definition: ProximUnitWindow.hh:60
ProximUnitWindow::ID_MODE_CHOICE
@ ID_MODE_CHOICE
Definition: ProximUnitWindow.hh:89
ProximUnitWindow::ID_HELP
@ ID_HELP
Definition: ProximUnitWindow.hh:90
ProximUnitWindow::ID_CLOSE
@ ID_CLOSE
Definition: ProximUnitWindow.hh:91
ProximUnitWindow::valueList_
wxListCtrl * valueList_
List widget for the values.
Definition: ProximUnitWindow.hh:64
ProximUnitWindow::MODE_INT
static const wxString MODE_INT
String for the mode choicer integer mode.
Definition: ProximUnitWindow.hh:67
ProximUnitWindow::simulator_
SimulatorFrontend * simulator_
Simulator instance .
Definition: ProximUnitWindow.hh:58
ProximUnitWindow::reinitialize
virtual void reinitialize()
Definition: ProximUnitWindow.cc:101
ProximUnitWindow::createContents
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
Definition: ProximUnitWindow.cc:169
ProximUnitWindow::ID_UNIT_CHOICE
@ ID_UNIT_CHOICE
Definition: ProximUnitWindow.hh:88
ProximUnitWindow::update
virtual void update()
Definition: ProximUnitWindow.cc:118
ProximUnitWindow::ID_VALUE_LIST
@ ID_VALUE_LIST
Definition: ProximUnitWindow.hh:93
ProximUnitWindow::MODE_HEX
static const wxString MODE_HEX
String for the mode choicer hexadecimal mode.
Definition: ProximUnitWindow.hh:71
ProximUnitWindow::MODE_BIN
static const wxString MODE_BIN
String for the mode choicer binary mode.
Definition: ProximUnitWindow.hh:73
ProximSimulatorWindow::ProximSimulatorWindow
ProximSimulatorWindow(ProximMainFrame *mainFrame, wxWindowID id=-1, wxPoint pos=wxDefaultPosition, wxSize size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
Definition: ProximSimulatorWindow.cc:49