Esempio n. 1
0
nuiRect nuiPositioner::CalcIdealSize()
{
    nuiRect rect;
    IteratorPtr pIt;
    //NGL_OUT(_T("nuiPositioner CalcIdealSize\n"));
    for (pIt = GetFirstChild(); pIt && pIt->IsValid(); GetNextChild(pIt))
    {
        nuiWidgetPtr pItem = pIt->GetWidget();
        nuiRect wrect(pItem->GetIdealRect());
        //NGL_OUT(_T("  WRect %ls\n"), wrect.GetValue().GetChars());
        rect.Union(rect,wrect.Size());
    }
    delete pIt;

    //NGL_OUT(_T("nuiPositioner Ideal Size: %d x %d\n"),(int)rect.GetWidth(),(int)rect.GetHeight());
    return rect.Size();
}
Esempio n. 2
0
void FLCheckBox::drawButton(QPainter *p)
{
  QRect rect, wrect(this->rect());
  rect.setRect((wrect.width() - 13) / 2, (wrect.height() - 13) / 2, 13, 13);

  if (state() == QButton::On) {
    QBrush bu(green, SolidPattern);
    p->fillRect(0, 0, wrect.width() - 1, wrect.height() - 1, bu);
  }

  QRect irect = QStyle::visualRect(rect, this);
  p->fillRect(irect, Qt::white);
  p->drawRect(irect);

  if (state() == QButton::On) {
    QPointArray a(7 * 2);
    int i, xx, yy;
    xx = irect.x() + 3;
    yy = irect.y() + 5;

    for (i = 0; i < 3; i++) {
      a.setPoint(2 * i,   xx, yy);
      a.setPoint(2 * i + 1, xx, yy + 2);
      xx++;
      yy++;
    }

    yy -= 2;
    for (i = 3; i < 7; i++) {
      a.setPoint(2 * i,   xx, yy);
      a.setPoint(2 * i + 1, xx, yy + 2);
      xx++;
      yy--;
    }

    p->drawLineSegments(a);
  }

  drawButtonLabel(p);
}
Esempio n. 3
0
void nuiPositioner::Invalidate()
{
    // Get the rect of all the children:
    nuiRect rect;
    IteratorPtr pIt;
    //NGL_OUT(_T("nuiPositioner CalcIdealSize\n"));
    for (pIt = GetFirstChild(); pIt && pIt->IsValid(); GetNextChild(pIt))
    {
        nuiWidgetPtr pItem = pIt->GetWidget();
        nuiRect wrect(pItem->GetIdealRect());
        //NGL_OUT(_T("  WRect %ls\n"), wrect.GetValue().GetChars());
        rect.Union(rect,wrect.Size());
    }
    delete pIt;

    rect.SetPosition(mPPosition, GetRect().Size());

    nuiWidget::InvalidateRect(rect);
    SilentInvalidate();

    if (mpParent)
        ((nuiPositioner*)mpParent)->BroadcastInvalidate(this); //#HACK!
    DebugRefreshInfo();
}