Пример #1
0
void
ListControl::EnsureVisible(unsigned i)
{
  assert(i < length);

  if (origin > i || (origin == i && pixel_pan > 0)) {
    SetOrigin(i);
    SetPixelPan(0);
  } else if (origin + items_visible <= i) {
    SetOrigin(i - items_visible);

    if (origin > 0 || i >= items_visible)
      SetPixelPan(((items_visible + 1) * item_height - GetHeight()) % item_height);
  }
}
Пример #2
0
void
ListControl::EnsureVisible(unsigned i)
{
  assert(i < length);

  if (origin > i+items_visible/2) { // big jump up
    SetOrigin(i<items_visible/2 ? 0 : i-items_visible/2 );
  } else if (origin > i || (origin == i && pixel_pan > 0)) { //small jump up
    SetOrigin(i);
    SetPixelPan(0);
  } else if (origin + items_visible+items_visible/2 < i){ //big jump down

    if (UsePixelPan()) {
      if(i+items_visible/2 > length)
        SetOrigin(length - items_visible);
      else
        SetOrigin(i-items_visible/2);

      if (origin > 0 || i >= items_visible)
        SetPixelPan(((items_visible + 1) * item_height - GetHeight()) % item_height);

    } else { // small jump down
      /* no pixel panning on e-paper screens to avoid tearing */
      if(i+items_visible/2 > length)
        SetOrigin(length - items_visible);
      else
        SetOrigin(i-items_visible/2);

    }


  } else if (origin + items_visible <= i) {
    if (UsePixelPan()) {
      SetOrigin(i - items_visible);

      if (origin > 0 || i >= items_visible)
        SetPixelPan(((items_visible + 1) * item_height - GetHeight()) % item_height);
    } else {
      /* no pixel panning on e-paper screens to avoid tearing */
      SetOrigin(i + 1 - items_visible);
    }
  }
}
Пример #3
0
void
ListControl::EnsureVisible(unsigned i)
{
  assert(i < length);

  if (origin > i || (origin == i && pixel_pan > 0)) {
    SetOrigin(i);
    SetPixelPan(0);
  } else if (origin + items_visible <= i) {
    if (UsePixelPan()) {
      SetOrigin(i - items_visible);

      if (origin > 0 || i >= items_visible)
        SetPixelPan(((items_visible + 1) * item_height - GetHeight()) % item_height);
    } else {
      /* no pixel panning on e-paper screens to avoid tearing */
      SetOrigin(i + 1 - items_visible);
    }
  }
}
Пример #4
0
  void SetPixelOrigin(int pixel_origin) {
    int max = length * item_height - get_height();
    if (pixel_origin > max)
      pixel_origin = max;

    if (pixel_origin < 0)
      pixel_origin = 0;

    SetOrigin(pixel_origin / item_height);
    SetPixelPan(pixel_origin % item_height);
  }
Пример #5
0
void
ListControl::SetPixelOrigin(int pixel_origin)
{
  int max = length * item_height - GetHeight();
  if (pixel_origin > max)
    pixel_origin = max;

  if (pixel_origin < 0)
    pixel_origin = 0;

  SetOrigin(pixel_origin / item_height);

  /* no pixel panning on e-paper screens to avoid tearing */
  SetPixelPan(UsePixelPan() ? pixel_origin % item_height : 0);
}