Changeset 59 in flair-src for branches/mavlink/lib/FlairCore/src/ListWidget.cpp
- Timestamp:
- 07/29/16 15:02:35 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/mavlink/lib/FlairCore/src/ListWidget.cpp
r57 r59 20 20 21 21 #include <sstream> 22 #include <iostream>23 22 24 23 using std::string; 25 using std::ostringstream;26 24 27 25 namespace flair { … … 29 27 30 28 ListWidget::ListWidget(const LayoutPosition *position, string name) 31 : Widget(position->getLayout(), name, string("ListWidget")) { 32 33 selected_item_row = -1; 34 selected_item_changed = false; 35 29 : Widget(position->getLayout(), name, string("ListWidget")), 30 selectedItemRow(-1), selectedItemChanged(false) { 31 // load the items in the xml file and send them to the ground station 36 32 size_t count = 0; 37 33 while (1) { 38 34 string item; 39 ostringstream item_prop;35 std::ostringstream item_prop; 40 36 item_prop << "item" << count; 41 if (GetPersistentXmlProp(item_prop.str(), item)) {37 if (GetPersistentXmlProp(item_prop.str(), item)) { 42 38 SetVolatileXmlProp(item_prop.str(), item); 43 39 items.push_back(item); … … 47 43 count++; 48 44 } 49 50 45 SetVolatileXmlProp("row", position->Row()); 51 46 SetVolatileXmlProp("col", position->Col()); … … 63 58 64 59 void ListWidget::RemoveItem(void) { 65 if (selected_item_changed) { 66 selected_item_changed = false; 67 SetVolatileXmlProp("delete", selected_item_row); 60 if (selectedItemChanged) { 61 selectedItemChanged = false; 62 items.erase(items.cbegin() + selectedItemRow); 63 SetVolatileXmlProp("delete", selectedItemRow); 68 64 SendXml(); 69 65 } … … 71 67 72 68 void ListWidget::XmlEvent(void) { 73 if (GetPersistentXmlProp("value", selected _item_row)) {74 selected _item_changed = true;69 if (GetPersistentXmlProp("value", selectedItemRow)) { 70 selectedItemChanged = true; 75 71 } 76 72 }
Note:
See TracChangeset
for help on using the changeset viewer.