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

#include <ImplementationParameterDialog.hh>

Inheritance diagram for ImplementationParameterDialog:
Inheritance graph
Collaboration diagram for ImplementationParameterDialog:
Collaboration graph

Public Member Functions

 ImplementationParameterDialog (wxWindow *parent, wxWindowID id, HDB::FUImplementation::Parameter &implementation)
 
virtual ~ImplementationParameterDialog ()
 

Private Types

enum  {
  ID_LABEL_NAME = 10000, ID_NAME, ID_LABEL_TYPE, ID_TYPE,
  ID_LABEL_VALUE, ID_VALUE, ID_LINE
}
 Enumerated IDs for dialog widgets. More...
 

Private Member Functions

void onOK (wxCommandEvent &event)
 
wxSizer * createContents (wxWindow *parent, bool call_fit, bool set_sizer)
 Creates the dialog contents. More...
 

Private Attributes

HDB::FUImplementation::Parameterparameter_
 FU port implementation to modify. More...
 
wxString name_
 
wxString type_
 
wxString value_
 

Detailed Description

Dialog for editing FU port implementations.

Definition at line 44 of file ImplementationParameterDialog.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

Enumerated IDs for dialog widgets.

Enumerator
ID_LABEL_NAME 
ID_NAME 
ID_LABEL_TYPE 
ID_TYPE 
ID_LABEL_VALUE 
ID_VALUE 
ID_LINE 

Definition at line 56 of file ImplementationParameterDialog.hh.

56  {
57  ID_LABEL_NAME = 10000,
58  ID_NAME,
60  ID_TYPE,
62  ID_VALUE,
63  ID_LINE
64  };

Constructor & Destructor Documentation

◆ ImplementationParameterDialog()

ImplementationParameterDialog::ImplementationParameterDialog ( wxWindow *  parent,
wxWindowID  id,
HDB::FUImplementation::Parameter implementation 
)

The Constructor.

Parameters
parentParent window of the dialog.
idWindow identifier for the dialog window.
parameterFU implementation parameter to modify.

Definition at line 52 of file ImplementationParameterDialog.cc.

53  :
54  wxDialog(parent, id, _T("Parameter")),
55  parameter_(parameter) {
56 
57  createContents(this, true, true);
58 
62 
63  FindWindow(ID_NAME)->SetValidator(wxTextValidator(wxFILTER_ASCII, &name_));
64  FindWindow(ID_TYPE)->SetValidator(wxTextValidator(wxFILTER_ASCII, &type_));
65  FindWindow(ID_VALUE)->SetValidator(
66  wxTextValidator(wxFILTER_ASCII, &value_));
67 
68  TransferDataToWindow();
69 }

References WxConversion::toWxString().

Here is the call graph for this function:

◆ ~ImplementationParameterDialog()

ImplementationParameterDialog::~ImplementationParameterDialog ( )
virtual

The Destructor.

Definition at line 74 of file ImplementationParameterDialog.cc.

74  {
75 }

Member Function Documentation

◆ createContents()

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

Creates the dialog contents.

Creates the dialog contents.

Definition at line 116 of file ImplementationParameterDialog.cc.

117  {
118 
119  wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
120 
121  wxFlexGridSizer *item1 = new wxFlexGridSizer( 2, 0, 0 );
122 
123  wxStaticText *item2 = new wxStaticText( parent, ID_LABEL_NAME, wxT("Name:"), wxDefaultPosition, wxDefaultSize, 0 );
124  item1->Add( item2, 0, wxALIGN_RIGHT|wxALL, 5 );
125 
126  wxTextCtrl *item3 = new wxTextCtrl( parent, ID_NAME, wxT(""), wxDefaultPosition, wxSize(200,-1), 0 );
127  item1->Add( item3, 0, wxALIGN_CENTER|wxALL, 5 );
128 
129  wxStaticText *item4 = new wxStaticText( parent, ID_LABEL_TYPE, wxT("Type:"), wxDefaultPosition, wxDefaultSize, 0 );
130  item1->Add( item4, 0, wxALIGN_RIGHT|wxALL, 5 );
131 
132  wxTextCtrl *item5 = new wxTextCtrl( parent, ID_TYPE, wxT(""), wxDefaultPosition, wxSize(80,-1), 0 );
133  item1->Add( item5, 0, wxGROW|wxALL, 5 );
134 
135  wxStaticText *item6 = new wxStaticText( parent, ID_LABEL_VALUE, wxT("Value:"), wxDefaultPosition, wxDefaultSize, 0 );
136  item1->Add( item6, 0, wxALIGN_RIGHT|wxALL, 5 );
137 
138  wxTextCtrl *item7 = new wxTextCtrl( parent, ID_VALUE, wxT(""), wxDefaultPosition, wxSize(80,-1), 0 );
139  item1->Add( item7, 0, wxGROW|wxALL, 5 );
140 
141  item0->Add( item1, 0, wxALIGN_CENTER|wxALL, 5 );
142 
143  wxStaticLine *item8 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
144  item0->Add( item8, 0, wxGROW|wxALL, 5 );
145 
146  wxBoxSizer *item9 = new wxBoxSizer( wxHORIZONTAL );
147 
148  wxButton *item10 = new wxButton( parent, wxID_CANCEL, wxT("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
149  item9->Add( item10, 0, wxALIGN_CENTER, 5 );
150 
151  wxButton *item11 = new wxButton( parent, wxID_OK, wxT("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
152  item9->Add( item11, 0, wxALIGN_CENTER|wxALL, 5 );
153 
154  item0->Add( item9, 0, wxALL, 5 );
155 
156  if (set_sizer)
157  {
158  parent->SetSizer( item0 );
159  if (call_fit)
160  item0->SetSizeHints( parent );
161  }
162 
163  return item0;
164 }

◆ onOK()

void ImplementationParameterDialog::onOK ( wxCommandEvent &  event)
private

Event handler for the dialog OK-button.

Definition at line 82 of file ImplementationParameterDialog.cc.

82  {
83 
84  TransferDataFromWindow();
85 
86  name_ = name_.Trim(true).Trim(false);
87  type_ = type_.Trim(true).Trim(false);
88  value_ = value_.Trim(true).Trim(false);
89 
90 
91  if (name_.IsEmpty()) {
92  wxString message = _T("Name field must not be empty.");
93  ErrorDialog dialog(this, message);
94  dialog.ShowModal();
95  return;
96  }
97 
98  if (type_.IsEmpty()) {
99  wxString message = _T("Type field must not be empty.");
100  ErrorDialog dialog(this, message);
101  dialog.ShowModal();
102  return;
103  }
104 
108 
109  EndModal(wxID_OK);
110 }

References WxConversion::toString().

Here is the call graph for this function:

Member Data Documentation

◆ name_

wxString ImplementationParameterDialog::name_
private

Definition at line 72 of file ImplementationParameterDialog.hh.

◆ parameter_

HDB::FUImplementation::Parameter& ImplementationParameterDialog::parameter_
private

FU port implementation to modify.

Definition at line 70 of file ImplementationParameterDialog.hh.

◆ type_

wxString ImplementationParameterDialog::type_
private

Definition at line 73 of file ImplementationParameterDialog.hh.

◆ value_

wxString ImplementationParameterDialog::value_
private

Definition at line 74 of file ImplementationParameterDialog.hh.


The documentation for this class was generated from the following files:
WxConversion::toWxString
static wxString toWxString(const std::string &source)
FindWindow
Definition: FindWindow.hh:49
ImplementationParameterDialog::ID_LINE
@ ID_LINE
Definition: ImplementationParameterDialog.hh:63
ImplementationParameterDialog::ID_LABEL_VALUE
@ ID_LABEL_VALUE
Definition: ImplementationParameterDialog.hh:61
ErrorDialog
Definition: ErrorDialog.hh:42
ImplementationParameterDialog::name_
wxString name_
Definition: ImplementationParameterDialog.hh:72
HDB::Parameter::type
std::string type
Type of the parameter.
Definition: HDBTypes.hh:48
ImplementationParameterDialog::ID_LABEL_TYPE
@ ID_LABEL_TYPE
Definition: ImplementationParameterDialog.hh:59
ImplementationParameterDialog::ID_NAME
@ ID_NAME
Definition: ImplementationParameterDialog.hh:58
HDB::Parameter::name
std::string name
Name of the parameter.
Definition: HDBTypes.hh:47
ImplementationParameterDialog::type_
wxString type_
Definition: ImplementationParameterDialog.hh:73
ImplementationParameterDialog::createContents
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
Creates the dialog contents.
Definition: ImplementationParameterDialog.cc:116
ImplementationParameterDialog::ID_VALUE
@ ID_VALUE
Definition: ImplementationParameterDialog.hh:62
ImplementationParameterDialog::parameter_
HDB::FUImplementation::Parameter & parameter_
FU port implementation to modify.
Definition: ImplementationParameterDialog.hh:70
ImplementationParameterDialog::value_
wxString value_
Definition: ImplementationParameterDialog.hh:74
ImplementationParameterDialog::ID_LABEL_NAME
@ ID_LABEL_NAME
Definition: ImplementationParameterDialog.hh:57
HDB::Parameter::value
std::string value
Value of the parameter.
Definition: HDBTypes.hh:49
ImplementationParameterDialog::ID_TYPE
@ ID_TYPE
Definition: ImplementationParameterDialog.hh:60
WxConversion::toString
static std::string toString(const wxString &source)