OpenASIP 2.2
Loading...
Searching...
No Matches
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
 
wxStaticText * paramType_
 name
 
wxTextCtrl * paramValue_
 name
 
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.

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}
ExplorerPluginParameter * parameter_
virtual bool TransferDataToWindow()
wxTextCtrl * paramValue_
name
wxStaticText * paramName_
name
wxStaticText * paramType_
name
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)

◆ ~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}

References ID_CANCEL, ID_NAME, ID_OK, ID_TEXT, ID_TYPE, and ID_VALUE.

◆ 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}
void setValue(const std::string &value)
static std::string toString(const wxString &source)

References parameter_, paramValue_, ExplorerPluginParameter::setValue(), and 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}
static ProDeTextGenerator * instance()
@ TXT_EDIT_PARAMETER_TITLE
Edit parameter title.
virtual boost::format text(int textId)
static wxString toWxString(const std::string &source)

References ProDeTextGenerator::instance(), ExplorerPluginParameter::name(), parameter_, paramName_, paramType_, paramValue_, Texts::TextGenerator::text(), WxConversion::toWxString(), ProDeTextGenerator::TXT_EDIT_PARAMETER_TITLE, ExplorerPluginParameter::typeAsString(), and ExplorerPluginParameter::value().

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.

Referenced by onOk(), and setTexts().

◆ paramName_

wxStaticText* EditParameterDialog::paramName_
private

name

Definition at line 66 of file EditParameterDialog.hh.

Referenced by setTexts().

◆ paramType_

wxStaticText* EditParameterDialog::paramType_
private

name

Definition at line 68 of file EditParameterDialog.hh.

Referenced by setTexts().

◆ paramValue_

wxTextCtrl* EditParameterDialog::paramValue_
private

name

Definition at line 70 of file EditParameterDialog.hh.

Referenced by onOk(), and setTexts().


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