145{
146 std::vector<long> selectedList;
147 std::vector<long> itemList;
148 long item = -1;
149 while(true) {
150 item = m_listCtrlSwitchings->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
151 if(item == -1) break;
152 selectedList.push_back(item);
153 }
154 while(true) {
155 item = m_listCtrlSwitchings->GetNextItem(item);
156 if(item == -1) break;
157 itemList.push_back(item);
158 }
159
160 for(int i = 0; i < (int)itemList.size(); i++) {
161 for(int j = 0; j < (int)selectedList.size(); j++) {
162 if(i + 1 < (int)itemList.size()) {
163 if(itemList[i + 1] == selectedList[j]) {
164 wxString col1Str[2];
165 wxString col2Str[2];
166
167 col1Str[0] = m_listCtrlSwitchings->GetItemText(itemList[i], 0);
168 col1Str[1] = m_listCtrlSwitchings->GetItemText(selectedList[j], 0);
169 col2Str[0] = m_listCtrlSwitchings->GetItemText(itemList[i], 1);
170 col2Str[1] = m_listCtrlSwitchings->GetItemText(selectedList[j], 1);
171
172 m_listCtrlSwitchings->SetItem(itemList[i], 0, col1Str[1]);
173 m_listCtrlSwitchings->SetItem(selectedList[j], 0, col1Str[0]);
174 m_listCtrlSwitchings->SetItem(itemList[i], 1, col2Str[1]);
175 m_listCtrlSwitchings->SetItem(selectedList[j], 1, col2Str[0]);
176
177 m_listCtrlSwitchings->SetItemState(itemList[i], wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
178 m_listCtrlSwitchings->SetItemState(selectedList[j], 0, wxLIST_STATE_SELECTED);
179
180 i++;
181 break;
182 }
183 }
184 }
185 }
186}