OpenASIP  2.0
Public Member Functions | Private Attributes | List of all members
VariableDialog Class Reference

#include <VariableDialog.hh>

Inheritance diagram for VariableDialog:
Inheritance graph
Collaboration diagram for VariableDialog:
Collaboration graph

Public Member Functions

 VariableDialog (wxListCtrl *list, std::string language)
 
virtual ~VariableDialog ()=default
 
void onOK (wxCommandEvent &)
 

Private Attributes

wxTextCtrl * nameCtrl_
 
wxTextCtrl * widthCtrl_
 
wxComboBox * typeCtrl_
 
wxListCtrl * varList_
 
std::string language_
 

Detailed Description

Declaration of VariableDialog.

Author
Lasse Lehtonen 2017 (lasse.lehtonen-no.spam-tut.fi)

Definition at line 34 of file VariableDialog.hh.

Constructor & Destructor Documentation

◆ VariableDialog()

VariableDialog::VariableDialog ( wxListCtrl *  list,
std::string  language 
)

Implementation of VariableDialog.

Author
Lasse Lehtonen 2017 (lasse.lehtonen-no.spam-tut.fi)

Definition at line 36 of file VariableDialog.cc.

37  : wxDialog(NULL, -1, "Add Variable for Operation Implementation",
38  wxDefaultPosition, wxSize(360, 140), wxRESIZE_BORDER),
39  varList_(list), language_(language) {
40 
41  wxButton* okButton = new wxButton(
42  this, wxID_OK, wxT("Ok"), wxDefaultPosition, wxSize(70, 30));
43 
44  wxButton* closeButton = new wxButton(
45  this, wxID_CANCEL, wxT("Cancel"), wxDefaultPosition, wxSize(70, 30));
46 
47  wxBoxSizer* hbox1 = new wxBoxSizer(wxHORIZONTAL);
48  hbox1->Add(okButton, 1);
49  hbox1->Add(closeButton, 1, wxLEFT, 5);
50 
51  nameCtrl_ = new wxTextCtrl(this, -1);
52  widthCtrl_ = new wxTextCtrl(this, -1);
53  if (language_ == "VHDL") {
54  wxString strs[] = {wxT("Logic"), wxT("Unsigned"), wxT("Signed")};
55  typeCtrl_ = new wxComboBox(this, -1, wxT(""), wxDefaultPosition,
56  wxDefaultSize, 3, strs, wxCB_READONLY);
57  } else {
58  wxString strs[] = {wxT("Unsigned"), wxT("Signed")};
59  typeCtrl_ = new wxComboBox(this, -1, wxT(""), wxDefaultPosition,
60  wxDefaultSize, 2, strs, wxCB_READONLY);
61  }
62  typeCtrl_->SetSelection(0);
63 
64  wxStaticText* title1 = new wxStaticText(this, -1, wxT("Name"));
65  wxStaticText* title2 = new wxStaticText(this, -1, wxT("Width"));
66  wxStaticText* title3 = new wxStaticText(this, -1, wxT("Type"));
67 
68  wxFlexGridSizer* flex1 = new wxFlexGridSizer(2, 3, 9, 25);
69  flex1->Add(title1);
70  flex1->Add(title2);
71  flex1->Add(title3);
72  flex1->Add(nameCtrl_);
73  flex1->Add(widthCtrl_);
74  flex1->Add(typeCtrl_);
75 
76  wxBoxSizer* vbox = new wxBoxSizer(wxVERTICAL);
77  vbox->Add(flex1, 0, wxALIGN_LEFT | wxLEFT | wxTOP | wxBOTTOM, 10);
78  vbox->Add(hbox1, 0, wxALIGN_CENTER | wxTOP | wxBOTTOM, 10);
79 
80  SetSizer(vbox);
81  Centre();
82  ShowModal();
83  Destroy();
84 }

◆ ~VariableDialog()

virtual VariableDialog::~VariableDialog ( )
virtualdefault

Member Function Documentation

◆ onOK()

void VariableDialog::onOK ( wxCommandEvent &  )

Definition at line 87 of file VariableDialog.cc.

87  {
88  int idx = varList_->GetItemCount();
89  varList_->InsertItem(idx, nameCtrl_->GetLineText(0));
90  varList_->SetItem(idx, 1, widthCtrl_->GetLineText(0));
91  varList_->SetItem(
92  idx, 2, typeCtrl_->GetString(typeCtrl_->GetSelection()));
93  varList_->SetItem(idx, 3, language_);
94  EndModal(wxID_OK);
95 }

References language_, nameCtrl_, typeCtrl_, varList_, and widthCtrl_.

Member Data Documentation

◆ language_

std::string VariableDialog::language_
private

Definition at line 46 of file VariableDialog.hh.

Referenced by onOK().

◆ nameCtrl_

wxTextCtrl* VariableDialog::nameCtrl_
private

Definition at line 42 of file VariableDialog.hh.

Referenced by onOK().

◆ typeCtrl_

wxComboBox* VariableDialog::typeCtrl_
private

Definition at line 44 of file VariableDialog.hh.

Referenced by onOK().

◆ varList_

wxListCtrl* VariableDialog::varList_
private

Definition at line 45 of file VariableDialog.hh.

Referenced by onOK().

◆ widthCtrl_

wxTextCtrl* VariableDialog::widthCtrl_
private

Definition at line 43 of file VariableDialog.hh.

Referenced by onOK().


The documentation for this class was generated from the following files:
VariableDialog::nameCtrl_
wxTextCtrl * nameCtrl_
Definition: VariableDialog.hh:42
VariableDialog::language_
std::string language_
Definition: VariableDialog.hh:46
VariableDialog::varList_
wxListCtrl * varList_
Definition: VariableDialog.hh:45
VariableDialog::typeCtrl_
wxComboBox * typeCtrl_
Definition: VariableDialog.hh:44
VariableDialog::widthCtrl_
wxTextCtrl * widthCtrl_
Definition: VariableDialog.hh:43