33 #include <wx/statline.h>
34 #include <wx/valgen.h>
66 wxDialog(parent,
id, _T("Cost Estimation Data")),
67 hdb_(hdb), pluginID_(pluginID), dataID_(dataID) {
69 createContents(
this,
true,
true);
71 typeChoice_ =
dynamic_cast<wxChoice*
>(
FindWindow(ID_ENTRY_TYPE));
72 idChoice_ =
dynamic_cast<wxChoice*
>(
FindWindow(ID_ENTRY_ID));
74 typeChoice_->Append(ENTRY_TYPE_NONE);
75 typeChoice_->Append(ENTRY_TYPE_FU);
76 typeChoice_->Append(ENTRY_TYPE_RF);
77 typeChoice_->Append(ENTRY_TYPE_BUS);
78 typeChoice_->Append(ENTRY_TYPE_SOCKET);
80 FindWindow(ID_NAME)->SetValidator(wxGenericValidator(&name_));
81 FindWindow(ID_VALUE)->SetValidator(wxGenericValidator(&value_));
84 typeChoice_->Disable();
110 typeChoice_->SetStringSelection(ENTRY_TYPE_FU);
113 typeChoice_->SetStringSelection(ENTRY_TYPE_RF);
116 typeChoice_->SetStringSelection(ENTRY_TYPE_BUS);
119 typeChoice_->SetStringSelection(ENTRY_TYPE_SOCKET);
123 idChoice_->SetSelection(0);
125 typeChoice_->SetSelection(0);
126 wxCommandEvent
dummy;
127 onEntryTypeSelection(
dummy);
130 return wxDialog::TransferDataToWindow();
141 if (typeChoice_->GetStringSelection() == ENTRY_TYPE_FU) {
143 const std::set<RowID> fuIDs = hdb_.fuEntryIDs();
144 std::set<RowID>::const_iterator iter = fuIDs.begin();
145 for (; iter != fuIDs.end(); iter++) {
148 }
else if (typeChoice_->GetStringSelection() == ENTRY_TYPE_RF) {
150 const std::set<RowID> rfIDs = hdb_.rfEntryIDs();
151 std::set<RowID>::const_iterator iter = rfIDs.begin();
152 for (; iter != rfIDs.end(); iter++) {
155 }
else if (typeChoice_->GetStringSelection() == ENTRY_TYPE_BUS) {
157 const std::set<RowID> busIDs = hdb_.busEntryIDs();
158 std::set<RowID>::const_iterator iter = busIDs.begin();
159 for (; iter != busIDs.end(); iter++) {
163 }
else if (typeChoice_->GetStringSelection() == ENTRY_TYPE_SOCKET) {
165 const std::set<RowID> socketIDs = hdb_.socketEntryIDs();
166 std::set<RowID>::const_iterator iter = socketIDs.begin();
167 for (; iter != socketIDs.end(); iter++) {
171 idChoice_->Disable();
176 idChoice_->SetSelection(0);
185 TransferDataFromWindow();
187 if (name_.IsEmpty()) {
188 wxString message(_T(
"Data name not set."));
204 if (typeChoice_->GetStringSelection() != ENTRY_TYPE_NONE) {
207 wxString message(_T(
"Invalid entry reference."));
215 if (typeChoice_->GetStringSelection() == ENTRY_TYPE_FU) {
217 }
else if (typeChoice_->GetStringSelection() == ENTRY_TYPE_RF) {
219 }
else if (typeChoice_->GetStringSelection() == ENTRY_TYPE_BUS) {
221 }
else if (typeChoice_->GetStringSelection() == ENTRY_TYPE_SOCKET) {
227 hdb_.modifyCostEstimationData(dataID_, data);
229 hdb_.addCostEstimationData(data);
240 wxWindow* parent,
bool call_fit,
bool set_sizer) {
242 wxBoxSizer *item0 =
new wxBoxSizer( wxVERTICAL );
244 wxFlexGridSizer *item1 =
new wxFlexGridSizer( 2, 0, 0 );
246 wxStaticText *item2 =
new wxStaticText( parent, ID_TEXT, wxT(
"Entry type:"), wxDefaultPosition, wxDefaultSize, 0 );
247 item1->Add( item2, 0, wxALIGN_RIGHT|wxALL, 5 );
249 wxString *strs3 = (wxString*) NULL;
250 wxChoice *item3 =
new wxChoice( parent, ID_ENTRY_TYPE, wxDefaultPosition, wxSize(100,-1), 0, strs3, 0 );
251 item1->Add( item3, 0, wxGROW|wxALL, 5 );
253 wxStaticText *item4 =
new wxStaticText( parent, ID_TEXT, wxT(
"Entry ID:"), wxDefaultPosition, wxDefaultSize, 0 );
254 item1->Add( item4, 0, wxALIGN_RIGHT|wxALL, 5 );
256 wxString *strs5 = (wxString*) NULL;
257 wxChoice *item5 =
new wxChoice( parent, ID_ENTRY_ID, wxDefaultPosition, wxSize(100,-1), 0, strs5, 0 );
258 item1->Add( item5, 0, wxGROW|wxALL, 5 );
260 wxStaticText *item6 =
new wxStaticText( parent, ID_TEXT, wxT(
"Name:"), wxDefaultPosition, wxDefaultSize, 0 );
261 item1->Add( item6, 0, wxALIGN_RIGHT|wxALL, 5 );
263 wxTextCtrl *item7 =
new wxTextCtrl( parent, ID_NAME, wxT(
""), wxDefaultPosition, wxSize(200,-1), 0 );
264 item1->Add( item7, 0, wxALIGN_CENTER|wxALL, 5 );
266 wxStaticText *item8 =
new wxStaticText( parent, ID_TEXT, wxT(
"Value:"), wxDefaultPosition, wxDefaultSize, 0 );
267 item1->Add( item8, 0, wxALIGN_RIGHT|wxALL, 5 );
269 wxTextCtrl *item9 =
new wxTextCtrl( parent, ID_VALUE, wxT(
""), wxDefaultPosition, wxSize(200,-1), 0 );
270 item1->Add( item9, 0, wxALIGN_CENTER|wxALL, 5 );
272 item0->Add( item1, 0, wxALIGN_CENTER|wxALL, 5 );
274 wxStaticLine *item10 =
new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
275 item0->Add( item10, 0, wxGROW|wxALL, 5 );
277 wxBoxSizer *item11 =
new wxBoxSizer( wxHORIZONTAL );
279 wxButton *item12 =
new wxButton( parent, wxID_OK, wxT(
"&OK"), wxDefaultPosition, wxDefaultSize, 0 );
280 item11->Add( item12, 0, wxALIGN_CENTER|wxALL, 5 );
282 wxButton *item13 =
new wxButton( parent, wxID_CANCEL, wxT(
"&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
283 item11->Add( item13, 0, wxALIGN_CENTER|wxALL, 5 );
285 item0->Add( item11, 0, wxALL, 5 );
289 parent->SetSizer( item0 );
291 item0->SetSizeHints( parent );