|
NIREP
|
00001 00002 // Name: CreateEvaluatorCommand.cpp 00003 // Purpose: 00004 // Author: 00005 // Modified by: 00006 // Created: 29/07/2010 11:13:39 00007 // RCS-ID: 00008 // Copyright: 00009 // Licence: 00011 00012 // For compilers that support precompilation, includes "wx/wx.h". 00013 #include "wx/wxprec.h" 00014 00015 #ifdef __BORLANDC__ 00016 #pragma hdrstop 00017 #endif 00018 00019 #ifndef WX_PRECOMP 00020 #include "wx/wx.h" 00021 #endif 00022 00023 00024 #include "CreateEvaluatorCommand.h" 00025 #include "NIREPDefinitions.h" 00026 00027 00028 00029 /* 00030 * CreateEvaluatorCommand type definition 00031 */ 00032 00033 IMPLEMENT_CLASS( CreateEvaluatorCommand, wxFrame ) 00034 00035 00036 /* 00037 * CreateEvaluatorCommand event table definition 00038 */ 00039 00040 BEGIN_EVENT_TABLE( CreateEvaluatorCommand, wxFrame ) 00041 EVT_BUTTON(wxID_ANY, CreateEvaluatorCommand::OnButtonClick) 00042 00043 00044 END_EVENT_TABLE() 00045 00046 00047 /* 00048 * CreateEvaluatorCommand constructors 00049 */ 00050 00051 CreateEvaluatorCommand::CreateEvaluatorCommand() 00052 { 00053 Init(); 00054 } 00055 00056 CreateEvaluatorCommand::CreateEvaluatorCommand( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) 00057 { 00058 Init(); 00059 Create( parent, id, caption, pos, size, style ); 00060 } 00061 00062 00063 /* 00064 * CreateEvaluatorCommand creator 00065 */ 00066 00067 bool CreateEvaluatorCommand::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) 00068 { 00069 wxFrame::Create( parent, id, caption, pos, size, style ); 00070 00071 CreateControls(); 00072 Centre(); 00073 return true; 00074 } 00075 00076 00077 /* 00078 * CreateEvaluatorCommand destructor 00079 */ 00080 00081 CreateEvaluatorCommand::~CreateEvaluatorCommand() 00082 { 00083 } 00084 00085 00086 /* 00087 * Member initialisation 00088 */ 00089 00090 void CreateEvaluatorCommand::Init() 00091 { 00092 } 00093 00094 00095 /* 00096 * Control creation for CreateEvaluatorCommand 00097 */ 00098 00099 void CreateEvaluatorCommand::CreateControls() 00100 { 00101 CreateEvaluatorCommand* itemFrame1 = this; 00102 00103 wxPanel* itemPanel2 = new wxPanel( itemFrame1, ID_PANEL10, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL ); 00104 00105 wxFlexGridSizer* itemFlexGridSizer3 = new wxFlexGridSizer(0, 1, 0, 0); 00106 itemFlexGridSizer3->AddGrowableCol(0); 00107 itemPanel2->SetSizer(itemFlexGridSizer3); 00108 00109 m_text = new wxTextCtrl( itemPanel2, ID_TEXTCTRL8, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); 00110 itemFlexGridSizer3->Add(m_text, 0, wxGROW|wxGROW|wxALL, 5); 00111 00112 wxFlexGridSizer* itemFlexGridSizer5 = new wxFlexGridSizer(0, 4, 0, 0); 00113 itemFlexGridSizer3->Add(itemFlexGridSizer5, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL, 5); 00114 00115 for(EvaluatorCmdList::iterator eCMD = EvalCmd.begin(); eCMD != EvalCmd.end(); eCMD++) { 00116 wxButton* itemButton6 = new wxButton( itemPanel2, wxID_ANY, _(eCMD->second.c_str()), wxDefaultPosition, wxDefaultSize, 0 ); 00117 itemFlexGridSizer5->Add(itemButton6, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); 00118 } 00119 00120 wxStaticText* itemStaticText12 = new wxStaticText( itemPanel2, wxID_STATIC, _("Data Manager ID's"), wxDefaultPosition, wxDefaultSize, 0 ); 00121 itemFlexGridSizer3->Add(itemStaticText12, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); 00122 00123 wxGrid* itemGrid13 = new wxGrid( itemPanel2, ID_GRID3, wxDefaultPosition, wxSize(200, 150), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL ); 00124 itemGrid13->SetDefaultColSize(50); 00125 itemGrid13->SetDefaultRowSize(25); 00126 itemGrid13->SetColLabelSize(25); 00127 itemGrid13->SetRowLabelSize(50); 00128 itemGrid13->CreateGrid(5, 5, wxGrid::wxGridSelectCells); 00129 itemFlexGridSizer3->Add(itemGrid13, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL, 5); 00130 } 00131 00132 00133 /* 00134 * Should we show tooltips? 00135 */ 00136 00137 bool CreateEvaluatorCommand::ShowToolTips() 00138 { 00139 return true; 00140 } 00141 00142 /* 00143 * Get bitmap resources 00144 */ 00145 00146 wxBitmap CreateEvaluatorCommand::GetBitmapResource( const wxString& name ) 00147 { 00148 // Bitmap retrieval 00149 wxUnusedVar(name); 00150 return wxNullBitmap; 00151 } 00152 00153 /* 00154 * Get icon resources 00155 */ 00156 00157 wxIcon CreateEvaluatorCommand::GetIconResource( const wxString& name ) 00158 { 00159 // Icon retrieval 00160 wxUnusedVar(name); 00161 return wxNullIcon; 00162 } 00163 00164 void CreateEvaluatorCommand::OnButtonClick( wxCommandEvent& event ) 00165 { 00166 wxString temp = this->FindItem(event.GetId())->GetLabel(); 00167 wxString value = m_text->GetValue(); 00168 //if(value.find_last_of("(") != wxString::npos) { 00169 // m_text->SetInsertionPoint(value.find_last_of("(")); 00170 //} 00171 m_text->AppendText(temp); 00172 m_text->AppendText("("); 00173 m_text->AppendText(")"); 00174 00175 } 00176 00177