Changeset 57 in flair-src for branches/mavlink


Ignore:
Timestamp:
Jul 28, 2016, 6:05:09 PM (8 years ago)
Author:
Thomas Fuhrmann
Message:

Management of lists using red/black colors

Location:
branches/mavlink/lib/FlairCore/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/mavlink/lib/FlairCore/src/ListWidget.cpp

    r53 r57  
    3030ListWidget::ListWidget(const LayoutPosition *position, string name)
    3131    : Widget(position->getLayout(), name, string("ListWidget")) {
     32 
     33  selected_item_row = -1;
     34  selected_item_changed = false;
     35
    3236  size_t count = 0;
    3337  while (1) {
     
    4347    count++;
    4448  }
    45   // value_changed = true;
     49
    4650  SetVolatileXmlProp("row", position->Row());
    4751  SetVolatileXmlProp("col", position->Col());
     
    5357
    5458void ListWidget::AddItem(string name) {
     59  items.push_back(name);
    5560  SetVolatileXmlProp("item", name);
    5661  SendXml();
     
    5863
    5964void ListWidget::RemoveItem(void) {
    60   SetVolatileXmlProp("delete", 0);
    61   SendXml();
     65  if (selected_item_changed) {
     66    selected_item_changed = false;
     67    SetVolatileXmlProp("delete", selected_item_row);
     68    SendXml();
     69  }
    6270}
    6371
    6472void ListWidget::XmlEvent(void) {
    65   std::cout << "FlairCore ListWidget XmlEvent" << std::endl;
    66   // GetMutex();
    67   // if (GetPersistentXmlProp("value", box_value))
    68   //   SetValueChanged();
    69   // ReleaseMutex();
     73  if (GetPersistentXmlProp("value", selected_item_row)) {
     74    selected_item_changed = true;
     75  }
    7076}
    7177
  • branches/mavlink/lib/FlairCore/src/ListWidget.h

    r53 r57  
    7171  //store the items
    7272  std::vector<std::string> items;
     73  //selected item row, starting from 0
     74  uint16_t selected_item_row;
     75  bool selected_item_changed;
    7376};
    7477
Note: See TracChangeset for help on using the changeset viewer.