Logo Search packages:      
Sourcecode: basket version File versions  Download package

void Basket::selectRange ( Item start,
Item end 
) [slot]

Select a range of items and deselect the others. The order between start and end has no importance (end could be before start)

Definition at line 1150 of file basket.cpp.

References Item::next(), and Item::setSelected().

{
      Item *cur;
      Item *realEnd = 0L;

      // Avoid crash when start (or end) is null
      if (start == 0L)
            start = end;
      else if (end == 0L)
            end = start;
      // And if *both* are null
      if (start == 0L) {
            unselectAll();
            return;
      }
      // In case there is only one item to select
      if (start == end) {
            unselectAllBut(start);
            return;
      }

      // Search the REAL first (and deselect the others before it) :
      for (cur = firstItem(); cur != 0L; cur = cur->next()) {
            if (cur == start || cur == end)
                  break;
            cur->setSelected(false);
      }

      // Select the items after REAL start, until REAL end :
      if (cur == start)
            realEnd = end;
      else if (cur == end)
            realEnd = start;

      for (/*cur = cur*/; cur != 0L; cur = cur->next()) {
            cur->setSelected(cur->isShown()); // Select all items in the range, but only if they are shown
            if (cur == realEnd)
                  break;
      }

      // Deselect the leaving items :
      for (cur = cur->next(); cur != 0L; cur = cur->next())
            cur->setSelected(false);

      recolorizeItems();
}


Generated by  Doxygen 1.6.0   Back to index