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

#include <EditParameterDialog.hh>

Inheritance diagram for EditParameterDialog:
Inheritance graph
Collaboration diagram for EditParameterDialog:
Collaboration graph

Public Member Functions

 EditParameterDialog (wxWindow *parent, ExplorerPluginParameter *parameter)
 
virtual ~EditParameterDialog ()
 

Private Types

enum  {
  ID_TEXT, ID_NAME, ID_TYPE, ID_VALUE,
  ID_OK, ID_CANCEL
}
 

Private Member Functions

virtual bool TransferDataToWindow ()
 
void onClose (wxCommandEvent &event)
 
void onOk (wxCommandEvent &event)
 
void setTexts ()
 
wxSizer * createContents (wxWindow *parent, bool call_fit, bool set_sizer)
 

Private Attributes

wxStaticText * paramName_
 name More...
 
wxStaticText * paramType_
 name More...
 
wxTextCtrl * paramValue_
 name More...
 
ExplorerPluginParameterparameter_
 

Detailed Description

Explorer plugin call window.

Definition at line 49 of file EditParameterDialog.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
ID_TEXT 
ID_NAME 
ID_TYPE 
ID_VALUE 
ID_OK 
ID_CANCEL 

Definition at line 74 of file EditParameterDialog.hh.

74  {
75  ID_TEXT,
76  ID_NAME,
77  ID_TYPE,
78  ID_VALUE,
79  ID_OK,
80  ID_CANCEL
81  };

Constructor & Destructor Documentation

◆ EditParameterDialog()

EditParameterDialog::EditParameterDialog ( wxWindow *  parent,
ExplorerPluginParameter parameter 
)

The Constructor.

Parameters
parentParent window of the dialog.
addressSpaceThe address space to be modified with the dialog.

Definition at line 72 of file EditParameterDialog.cc.

74  :
75  wxDialog(parent, -1, _T(""), wxDefaultPosition), parameter_(parameter)
76  {
77  createContents(this, true, true);
78 
79  paramName_ = dynamic_cast<wxStaticText*>(FindWindow(ID_NAME));
80  paramType_ = dynamic_cast<wxStaticText*>(FindWindow(ID_TYPE));
81  paramValue_ = dynamic_cast<wxTextCtrl*>(FindWindow(ID_VALUE));
82 
83  // set widget texts
84  setTexts();
85 
87 }

◆ ~EditParameterDialog()

EditParameterDialog::~EditParameterDialog ( )
virtual

The Destructor.

Definition at line 93 of file EditParameterDialog.cc.

93  {
94 }

Member Function Documentation

◆ createContents()

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

Creates the dialog window contents.

This method was generated with wxDesigner, thus the ugly code and too long lines.

Returns
Main sizer of the created contents.
Parameters
parentThe dialog window.
call_fitIf true, fits the contents inside the dialog.
set_sizerIf true, sets the main sizer as dialog contents.

Definition at line 162 of file EditParameterDialog.cc.

165  {
166 
167  wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
168 
169  wxBoxSizer *item1 = new wxBoxSizer( wxHORIZONTAL );
170 
171  wxStaticText *item2 = new wxStaticText( parent, ID_TEXT, wxT("Parameter Name:"), wxDefaultPosition, wxDefaultSize, 0 );
172  item1->Add( item2, 0, wxALIGN_CENTER|wxALL, 5 );
173 
174  wxStaticText *item3 = new wxStaticText( parent, ID_NAME, wxT("xxxxxxxxxxxxxxx"), wxDefaultPosition, wxSize(150,-1), 0 );
175  item1->Add( item3, 0, wxALIGN_CENTER|wxALL, 5 );
176 
177  item0->Add( item1, 0, wxALL, 5 );
178 
179  wxBoxSizer *item4 = new wxBoxSizer( wxHORIZONTAL );
180 
181  wxStaticText *item5 = new wxStaticText( parent, ID_TEXT, wxT("Parameter Type:"), wxDefaultPosition, wxDefaultSize, 0 );
182  item4->Add( item5, 0, wxALIGN_CENTER|wxALL, 5 );
183 
184  wxStaticText *item6 = new wxStaticText( parent, ID_TYPE, wxT("xxxxxxxxxxxx"), wxDefaultPosition, wxSize(150,-1), 0 );
185  item4->Add( item6, 0, wxALIGN_CENTER|wxALL, 5 );
186 
187  item0->Add( item4, 0, wxALL, 5 );
188 
189  wxBoxSizer *item7 = new wxBoxSizer( wxHORIZONTAL );
190 
191  wxStaticText *item8 = new wxStaticText( parent, ID_TEXT, wxT("Value:"), wxDefaultPosition, wxDefaultSize, 0 );
192  item7->Add( item8, 0, wxALIGN_CENTER|wxALL, 5 );
193 
194  wxTextCtrl *item9 = new wxTextCtrl( parent, ID_VALUE, wxT(""), wxDefaultPosition, wxSize(110,-1), 0 );
195  item7->Add( item9, 0, wxALIGN_CENTER|wxALL, 5 );
196 
197  item0->Add( item7, 0, wxALIGN_CENTER|wxALL, 5 );
198 
199  wxBoxSizer *item10 = new wxBoxSizer( wxHORIZONTAL );
200 
201  wxButton *item11 = new wxButton( parent, ID_OK, wxT("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
202  item10->Add( item11, 0, wxALIGN_CENTER|wxALL, 5 );
203 
204  wxButton *item12 = new wxButton( parent, ID_CANCEL, wxT("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
205  item10->Add( item12, 0, wxALL, 5 );
206 
207  item0->Add( item10, 0, wxALIGN_CENTER|wxALL, 5 );
208 
209  if (set_sizer)
210  {
211  parent->SetSizer( item0 );
212  if (call_fit)
213  item0->SetSizeHints( parent );
214  }
215 
216  return item0;
217 }

◆ onClose()

void EditParameterDialog::onClose ( wxCommandEvent &  event)
private

Validates input in the controls, and updates the AddressSpace.

Definition at line 131 of file EditParameterDialog.cc.

131  {
132  EndModal(wxID_OK);
133 }

◆ onOk()

void EditParameterDialog::onOk ( wxCommandEvent &  event)
private

Stores new value set by the user.

Definition at line 140 of file EditParameterDialog.cc.

140  {
141 
142  std::string value = WxConversion::toString(paramValue_->GetValue());
143 
144  parameter_->setValue(value);
145 
146  EndModal(wxID_OK);
147 }

References WxConversion::toString().

Here is the call graph for this function:

◆ setTexts()

void EditParameterDialog::setTexts ( )
private

Sets texts for widgets.

Definition at line 101 of file EditParameterDialog.cc.

101  {
103 
104  // Dialog title
105  format fmt = prodeTexts->text(
107  SetTitle(WxConversion::toWxString(fmt.str()));
108 
111  paramValue_->Clear();
113 }

References ProDeTextGenerator::instance(), Texts::TextGenerator::text(), WxConversion::toWxString(), and ProDeTextGenerator::TXT_EDIT_PARAMETER_TITLE.

Here is the call graph for this function:

◆ TransferDataToWindow()

bool EditParameterDialog::TransferDataToWindow ( )
privatevirtual

Transfers data from the AddressSpace object to the dialog widgets.

Returns
false, if an error occured in the transfer, true otherwise.

Definition at line 122 of file EditParameterDialog.cc.

122  {
123  return wxWindow::TransferDataToWindow();
124 }

Member Data Documentation

◆ parameter_

ExplorerPluginParameter* EditParameterDialog::parameter_
private

Definition at line 72 of file EditParameterDialog.hh.

◆ paramName_

wxStaticText* EditParameterDialog::paramName_
private

name

Definition at line 66 of file EditParameterDialog.hh.

◆ paramType_

wxStaticText* EditParameterDialog::paramType_
private

name

Definition at line 68 of file EditParameterDialog.hh.

◆ paramValue_

wxTextCtrl* EditParameterDialog::paramValue_
private

name

Definition at line 70 of file EditParameterDialog.hh.


The documentation for this class was generated from the following files:
WxConversion::toWxString
static wxString toWxString(const std::string &source)
EditParameterDialog::parameter_
ExplorerPluginParameter * parameter_
Definition: EditParameterDialog.hh:72
EditParameterDialog::paramType_
wxStaticText * paramType_
name
Definition: EditParameterDialog.hh:68
EditParameterDialog::ID_VALUE
@ ID_VALUE
Definition: EditParameterDialog.hh:78
ExplorerPluginParameter::typeAsString
TCEString typeAsString() const
Definition: ExplorerPluginParameter.cc:108
FindWindow
Definition: FindWindow.hh:49
ExplorerPluginParameter::name
TCEString name() const
Definition: ExplorerPluginParameter.cc:86
Texts::TextGenerator::text
virtual boost::format text(int textId)
Definition: TextGenerator.cc:94
ProDeTextGenerator
Definition: ProDeTextGenerator.hh:49
EditParameterDialog::paramValue_
wxTextCtrl * paramValue_
name
Definition: EditParameterDialog.hh:70
ExplorerPluginParameter::value
TCEString value() const
Definition: ExplorerPluginParameter.cc:63
EditParameterDialog::ID_NAME
@ ID_NAME
Definition: EditParameterDialog.hh:76
EditParameterDialog::setTexts
void setTexts()
Definition: EditParameterDialog.cc:101
EditParameterDialog::ID_CANCEL
@ ID_CANCEL
Definition: EditParameterDialog.hh:80
EditParameterDialog::ID_TYPE
@ ID_TYPE
Definition: EditParameterDialog.hh:77
ProDeTextGenerator::instance
static ProDeTextGenerator * instance()
Definition: ProDeTextGenerator.cc:382
ExplorerPluginParameter::setValue
void setValue(const std::string &value)
Definition: ExplorerPluginParameter.cc:74
EditParameterDialog::ID_TEXT
@ ID_TEXT
Definition: EditParameterDialog.hh:75
ProDeTextGenerator::TXT_EDIT_PARAMETER_TITLE
@ TXT_EDIT_PARAMETER_TITLE
Edit parameter title.
Definition: ProDeTextGenerator.hh:214
EditParameterDialog::TransferDataToWindow
virtual bool TransferDataToWindow()
Definition: EditParameterDialog.cc:122
EditParameterDialog::paramName_
wxStaticText * paramName_
name
Definition: EditParameterDialog.hh:66
WxConversion::toString
static std::string toString(const wxString &source)
EditParameterDialog::ID_OK
@ ID_OK
Definition: EditParameterDialog.hh:79
EditParameterDialog::createContents
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
Definition: EditParameterDialog.cc:162