当前位置: 首页>>代码示例>>C++>>正文


C++ nuiRect::GetHeight方法代码示例

本文整理汇总了C++中nuiRect::GetHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ nuiRect::GetHeight方法的具体用法?C++ nuiRect::GetHeight怎么用?C++ nuiRect::GetHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nuiRect的用法示例。


在下文中一共展示了nuiRect::GetHeight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: BlurRect

void nuiGLDrawContext::BlurRect(const nuiRect& rRect, uint Strength)
{
  nuiRect Rect = rRect;
  if (mClippingRect.mEnabled)
    Rect.Intersect(mClippingRect,rRect);
  nuiRect size = Rect.Size();

  nuiTexture* pScratchPad = GetScratchPad(ToZero(size.GetWidth()), ToZero(size.GetHeight()));

  if (!pScratchPad)
    return;

  SetTexture(pScratchPad);

  glPushMatrix();
  glLoadIdentity();

  EnableBlending(true);
  EnableTexture2D(true);
  SetBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

  do
  {
    glCopyTexSubImage2D(
      GL_TEXTURE_2D, 0, 
      0, 0, 
      ToZero(rRect.mLeft), ToZero(mHeight) - 1 - ToZero(rRect.mTop) - ToZero(rRect.GetHeight()), 
      ToZero(rRect.GetWidth()), ToZero(rRect.GetHeight())
      );

    SetFillColor(nuiColor(1,1,1,.15f));
    nuiRect rect = Rect;

    rect.Move(-1,-1);
    DrawImage(rect,size);
    rect.Move(1,0);
    DrawImage(rect,size);
    rect.Move(1,0);
    DrawImage(rect,size);

    rect.Move(-2,1);
    DrawImage(rect,size);
    rect.Move(1,0);
    DrawImage(rect,size);
    rect.Move(1,0);
    DrawImage(rect,size);

    rect.Move(-2,1);
    DrawImage(rect,size);
    rect.Move(0,1);
    DrawImage(rect,size);
    rect.Move(0,1);
    DrawImage(rect,size);
  } while ((long)(Strength--) > 0);

  EnableBlending(false);
  EnableTexture2D(false);

  glPopMatrix();
}
开发者ID:JamesLinus,项目名称:nui3,代码行数:60,代码来源:nuiGLDrawContext.cpp

示例2: AdjustRectsPos

nuiSize nuiPopupMenu::AdjustRectsPos(nuiSize& rX, nuiSize& rY, uint depth, nuiRect CurRect)
{
  nuiTopLevel* pRoot = GetTopLevel();
  NGL_ASSERT(pRoot);
  NGL_ASSERT(depth+1 < mRects.size());
  nuiRect MainRect = pRoot->GetRect();
  nuiRect& prevRect(mRects[depth]->mRect); // prevRect is the previous rect in the hierarchy (NOT the previous rect of this sub menu)
  depth++;

  nuiMenuRect* pMenuRect = mRects[depth];
  nuiRect& rRect(pMenuRect->mRect);

  nuiSize x, y;
  x = rX + (mXdir * rRect.GetWidth()) - (mXdir < 0 ? prevRect.GetWidth() : 0); // Compute X so that the rect doesn't get out of the main container
  y = rY + (mYdir * rRect.GetHeight()) + (mYdir < 0 ? CurRect.GetHeight() : 0); // Compute Y so that the rect doesn't get out of the main container
  if (x > MainRect.GetWidth() || x < 0) // Should we change the current x direction?
    mXdir *= -1;
  if (y > MainRect.GetHeight() || y < 0)  // Should we change the current y direction?
    mYdir *= -1;

  rX = rX - ((mXdir < 0) ? rRect.GetWidth()  + prevRect.GetWidth() : 0);
  rY = rY - ((mYdir < 0) ? rRect.GetHeight() - CurRect.GetHeight() : 0);

  if (rY < 0)
    rY = 0;
  if ( 
    ( (mYdir > 0) && (MainRect.GetHeight() < (rY + rRect.GetHeight()) ) ) ||
    ( (mYdir < 0) && (0 > (rY - rRect.GetHeight()) ) )
    )
  {
    nuiSize heightDiff = MainRect.GetHeight() - rRect.GetHeight();
    if (heightDiff > 0)
    {
      rY = heightDiff;
    }
    else
    {
      nuiRect r( ToNearest(rX + rRect.GetWidth() - SB_WIDTH), 0, ToNearest(SB_WIDTH), ToNearest(MainRect.GetHeight()));
      pMenuRect->mpSBar->GetRange().SetRange(0.f, rRect.GetHeight());
      pMenuRect->mpSBar->GetRange().SetPageSize(MainRect.GetHeight());
      pMenuRect->mpSBar->GetRange().SetIncrement(10.f);

      pMenuRect->mpSBar->SetLayout(r);
      pMenuRect->mpSBar->SetVisible(true);
      pMenuRect->mpSBar->SetSelected(false);
      pMenuRect->mpSBar->SetEnabled(true);
      rY = -pMenuRect->mpSBar->GetRange().GetValue();
      return (SB_WIDTH);
    }
  }
  if (pMenuRect->mpSBar)
  {
    pMenuRect->mpSBar->SetVisible(false);
    pMenuRect->mpSBar->SetEnabled(false);
  }
  return (0.f);
}
开发者ID:,项目名称:,代码行数:57,代码来源:

示例3: LoadProjectionMatrix

void nuiDrawContext::Set2DProjectionMatrix(const nuiRect& rRect)
{
  //printf("Set2DProjectionMatrix: %s\n", rRect.GetValue().GetChars());
  nuiMatrix m;
  m.Translate(-1.0f, 1.0f, 0.0f);
  m.Scale(2.0f/rRect.GetWidth(), -2.0f/rRect.GetHeight(), 1.0f);
  LoadProjectionMatrix(rRect, m);
}
开发者ID:JamesLinus,项目名称:nui3,代码行数:8,代码来源:nuiDrawContext.cpp

示例4: nuiPainter

nuiSoftwarePainter::nuiSoftwarePainter(const nuiRect& rRect, nglContext* pContext)
: nuiPainter(rRect, pContext)
{
  mWidth = ToNearest(rRect.GetWidth());
  mHeight = ToNearest(rRect.GetHeight());
  mpRasterizer = new nuiRasterizer(mWidth, mHeight);
  AddNeedTextureBackingStore();
}
开发者ID:jbl2024,项目名称:nui3,代码行数:8,代码来源:nuiSoftwarePainter.cpp

示例5: LoadProjectionMatrix

void nuiMetaPainter::LoadProjectionMatrix(const nuiRect& rViewport, const nuiMatrix& rMatrix)
{
  StoreOpCode(eLoadProjectionMatrix);
  StoreFloat(rViewport.Left());
  StoreFloat(rViewport.Top());
  StoreFloat(rViewport.GetWidth());
  StoreFloat(rViewport.GetHeight());
  StoreBuffer(rMatrix.Array, sizeof(nuiSize), 16);  
  
  nuiPainter::LoadProjectionMatrix(rViewport, rMatrix);
}
开发者ID:JamesLinus,项目名称:nui3,代码行数:11,代码来源:nuiMetaPainter.cpp

示例6: CalcTreeSize

void nuiPopupMenu::CalcTreeSize(nuiRect& rRect, nuiTreeNode* pTree, uint32& cpt)
{
  NGL_ASSERT(pTree); // no chance to happen
  cpt++;
  nuiRect rect(0,0,0,0);
  nuiWidgetPtr pWidget;
  nuiRect WidgetRect;

  uint32 depth = cpt;

  uint32 count = pTree->GetChildrenCount();
  if (count <= 0)
    return;

  bool HasNonEmpty = false;

  for (uint32 i = 0; i < count; i++)
  {
    nuiTreeNode* pNode = dynamic_cast<nuiTreeNode*>(pTree->GetChild(i));
    NGL_ASSERT(pNode);
    pWidget = pNode->GetElement();
    NGL_ASSERT(pWidget);
    WidgetRect = pWidget->GetIdealRect();
    rect.SetSize(MAX(rect.GetWidth(), WidgetRect.GetWidth()), rect.GetHeight() + WidgetRect.GetHeight());
    if (!pNode->IsEmpty())
    {
      HasNonEmpty = true;
    }
    if (pNode->IsOpened())
    {
      if (mRects.size() <= depth + 1) // ensure that there is a rect for the next node
      {
        nuiMenuRect* pMenuRect = new nuiMenuRect(this, cpt+1);
        mRects.push_back(pMenuRect);
        mPopupTreeSink.Connect(pMenuRect->mpSBar->ValueChanged, &nuiPopupMenu::OnScrollBarChange, pMenuRect);
      }
      mRects[depth+1]->mpFromNode = pNode;
      CalcTreeSize(rRect, pNode, cpt);
    }
  }
  if (HasNonEmpty)
  {
    mRects[depth]->mHasNonEmpty = true;
    rect.SetSize(rect.GetWidth() + NUI_POPUP_TREE_HANDLE_SIZE * 2, rect.GetHeight());
  }
  else
  {
    mRects[depth]->mHasNonEmpty = false;
  }

  mRects[depth]->mRect = rect;
  NGL_ASSERT(mRects.size() >= depth+1);
  rRect.SetSize(rect.GetWidth()+rRect.GetWidth(), rect.GetHeight()+rRect.GetHeight());
}
开发者ID:,项目名称:,代码行数:54,代码来源:

示例7:

/****************************************************************************
 *
 * Constructor / Destructor
 *
 ****************************************************************************/
nuiDrawContext::nuiDrawContext(const nuiRect& rRect)
{
  mWidth = rRect.GetWidth();
  mHeight = rRect.GetHeight();

  mClipOffsetX = mClipOffsetY = 0;

  mPermitAntialising = true;

  mpPainter = NULL;
  mpMainPainter = NULL;
  mpSavedPainter = NULL;
  mpAATexture = nuiTexture::GetAATexture();
  
  mStateChanges = 1;
}
开发者ID:JamesLinus,项目名称:nui3,代码行数:21,代码来源:nuiDrawContext.cpp

示例8: ResetStats

///////////////////////////////////
// nuiPainter implementation:
nuiPainter::nuiPainter(const nuiRect& rRect, nglContext* pContext) 
{
  ResetStats();
  mWidth = ToNearest(rRect.GetWidth());
  mHeight = ToNearest(rRect.GetHeight());
  mMatrixStack.push(nuiMatrix());
  mProjectionMatrixStack.push(nuiMatrix());
  mProjectionViewportStack.push(nuiRect());
  
  mDummyMode = false;
  mpSurface = NULL;

  mAngle=0;

  mEnableDrawArray = true;
}
开发者ID:YetToCome,项目名称:nui3,代码行数:18,代码来源:nuiPainter.cpp

示例9: Draw

void nuiImageDecoration::Draw(nuiDrawContext* pContext, nuiWidget* pWidget, const nuiRect& rDestRect)
{
  if (!mpTexture || !mpTexture->GetImage() || !mpTexture->GetImage()->GetPixelSize())
    return;
  
  pContext->PushState();
  pContext->ResetState();
  
  nuiRect rect = mClientRect;
  rect.SetPosition(mPosition, rDestRect);
  rect.RoundToBelow();
  
  pContext->EnableTexturing(true);
  pContext->EnableBlending(true);
  pContext->SetBlendFunc(nuiBlendTransp);
  pContext->SetTexture(mpTexture);
  nuiColor col(mColor);
  if (mUseWidgetAlpha && pWidget)
    col.Multiply(pWidget->GetMixedAlpha());
  
  pContext->SetFillColor(col);
  
  nuiRect srcrect(mClientRect);
  if (mRepeatX)
  {
    srcrect.SetWidth(rDestRect.GetWidth());
    srcrect.MoveTo(0, srcrect.Top());
  }

  if (mRepeatY)
  {
    srcrect.SetHeight(rDestRect.GetHeight());
    srcrect.MoveTo(srcrect.Left(), 0);
  }

  if (mRepeatX || mRepeatY)
    rect = rDestRect;
  
  
  pContext->DrawImage(rect, srcrect);
  //pContext->DrawRect(rDestRect, eStrokeShape);
  pContext->PopState();
}
开发者ID:jpastuszek,项目名称:nui3,代码行数:43,代码来源:nuiImageDecoration.cpp

示例10: SetRect

bool nuiPositioner::SetRect(const nuiRect& rRect)
{
    nuiWidget::SetRect(rRect);

    //NGL_OUT(_T("nuiPositioner::SetRect: %d x %d\n"),(int)rRect.GetWidth(),(int)rRect.GetHeight());

    nuiWidget::LayoutConstraint contraint;
    contraint.mMaxWidth = rRect.GetWidth();
    contraint.mMaxHeight = rRect.GetHeight();

    IteratorPtr pIt;
    for (pIt = GetFirstChild(); pIt && pIt->IsValid(); GetNextChild(pIt))
    {
        nuiWidgetPtr pItem = pIt->GetWidget();
        pItem->SetLayoutConstraint(contraint);
    }
    delete pIt;

    mIdealRect = CalcIdealSize();

    nuiRect mainrect(rRect.Size());

    pIt = NULL;
    for (pIt = GetFirstChild(); pIt && pIt->IsValid(); GetNextChild(pIt))
    {
        nuiWidgetPtr pItem = pIt->GetWidget();
        nuiRect rect = pItem->GetIdealRect().Size();
        if (mExpandWidth)
            rect.SetSize(mainrect.GetWidth(), rect.GetHeight());
        if (mExpandHeight)
            rect.SetSize(rect.GetWidth(), mainrect.GetHeight());

        rect.SetPosition(mPPosition, mainrect);
        if (mLimitBounds)
            rect.Intersect(rect, mainrect);
        rect.RoundToBiggest();
        pItem->SetLayout(rect);
    }
    delete pIt;

    return true;
}
开发者ID:,项目名称:,代码行数:42,代码来源:

示例11: SetPosition

void nuiRect::SetPosition(nuiPosition Position, const nuiRect& Inside)
{
  nuiSize x,y,w,h;
  nuiSize rx,ry,rw,rh;
  rx = Inside.mLeft;
  ry = Inside.mTop;
  rw = Inside.GetWidth();
  rh = Inside.GetHeight();
  w = GetWidth();
  h = GetHeight();
  x = (rw - w) / 2.f;
  y = (rh - h) / 2.f;

  switch (Position)
  {
  case nuiCenter:
    mLeft = x;
    mRight = x+w;
    mTop = y;
    mBottom = y+h;
    break;
  case nuiFill:
    mLeft=0;
    mRight=rw;
    mTop=0;
    mBottom=rh;
    break;
  case nuiFillHorizontal:
    mLeft=0;
    mRight=rw;
    mTop=y;
    mBottom=y+h;
    break;
  case nuiFillVertical:
    mLeft=x;
    mRight=x+w;
    mTop=0;
    mBottom=rh;
    break;
  case nuiFillLeft:
    mLeft=0;
    mRight=w;
    mTop=0;
    mBottom=rh;
    break;
  case nuiFillRight:
    mLeft = rw-w;
    mRight = rw;
    mTop = 0;
    mBottom = rh;
    break;
  case nuiFillTop:
    mLeft = 0;
    mRight = rw;
    mTop = 0;
    mBottom = h;
    break;
  case nuiFillBottom:
    mLeft = 0;
    mRight = rw;
    mTop = rh - h;
    mBottom = rh;
    break;
  case nuiLeft:
    mLeft=0;
    mTop =y; 
    mRight=w;
    mBottom=y+h;
    break;
  case nuiRight:
    mLeft=rw-w;
    mTop =y; 
    mRight=rw;
    mBottom=y+h;
    break;
  case nuiTop:
    mLeft=x;
    mTop =0; 
    mRight=x+w;
    mBottom=h;
    break;
  case nuiBottom:
    mLeft=x;
    mTop =rh-h; 
    mRight=x+w;
    mBottom=rh;
    break;
  case nuiTopLeft:
    mLeft=0;
    mRight=w;
    mTop=0;
    mBottom=h;
    break;
  case nuiTopRight:
    mLeft=rw-w;
    mRight=rw;
    mTop=0;
    mBottom=h;
    break;
  case nuiBottomLeft:
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例12: SetRectHorizontal

//*******************************************
//
// ORIENTATION HORIZONTAL
//
bool nuiSplitter::SetRectHorizontal(const nuiRect& rRect)
{
  nuiSize Height = rRect.GetHeight();
  nuiSize Width = rRect.GetWidth();
  nuiRect Rect;
  
  nuiWidgetList::iterator it;
  nuiWidgetList::iterator end = mpChildren.end();

  list<nuiRect>::iterator rit = mPositions.begin();
  Rect = (*rit);

  ++rit;


  // First Child:
  nuiWidgetPtr pItem;
  Height = 0;
  // We only care about the first two widgets!
  int i;
  it = mpChildren.begin();
  i = 0;
  nuiSize h;
  
  // don't process the splitter handle before the first child (we need the size of the first child)
  if (it != end)
  {
    pItem = (*it);
    if (pItem == mpHandle)
      ++it;
  }


  if (it != end)
  {
    pItem = (*it);

    //*****************************************************
    //
    // MASTERCHILD TRUE
    if (mMasterChild)
    {
      h = pItem->GetIdealRect().GetHeight();

      mHandlePos = h;
      if (mMode == eModePercentage) 
      {
        mHandlePos = (mHandlePos / (rRect.GetHeight() * (mHandlePosMax / 100.0f))) * 100.0f; 
        h = mHandlePos;
      }
      
      Rect.Set(0.f, Height, Width, h);
      Rect.RoundToBelow();
    }

    // MASTERCHILD FALSE
    else
    {
      h = mHandlePos;

      if (mMode == eModePercentage) 
        h = mRect.GetHeight() * (h / 100.0f);

      h = MAX(h, mFirstWidgetMinPixels);

      if (h + mSeconWidgetMinPixels > mRect.GetHeight())
      {
        h = mRect.GetHeight() - mSeconWidgetMinPixels;

        mHandlePos = h;
        if (mMode == eModePercentage)
          mHandlePos = ((h / mRect.GetHeight()) * 100.f); 
      }

      Rect.Set(0.f, Height, Width, h);
      Rect.RoundToBelow();
    }

    Height += h;
    pItem->SetLayout(Rect);
  }


  //******************************************
  //
  // handle
  nuiSize handleSize =0;
  if (mpHandle)
  {
    const nuiRect& handleRect = mpHandle->GetIdealRect();
    handleSize = handleRect.GetHeight();

    Rect.Set(0.0f, Height, rRect.GetWidth(), handleSize);
    Rect.RoundToBelow();
    mpHandle->SetLayout(Rect);
    Height += handleSize;
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例13: SetRect

bool nuiZoomView::SetRect(const nuiRect& rRect)
{
  nuiWidget::SetRect(rRect);

  nuiSize XOffset = 0;
  nuiSize YOffset = 0;

  if (mpHorizontalScrollbar)
    XOffset = (nuiSize)ToNearest(mpHorizontalScrollbar->GetRange().GetValue());
  if (mpVerticalScrollbar)
    YOffset = (nuiSize)ToNearest(mpVerticalScrollbar->GetRange().GetValue());

  nuiSize HorizontalZoomLevel = mHorizontalZoomLevel; 
  nuiSize VerticalZoomLevel = mVerticalZoomLevel;

  if (mpVerticalSlider)
    VerticalZoomLevel = mpVerticalSlider->GetRange().GetValue();
  if (mpHorizontalSlider)
    HorizontalZoomLevel = mpHorizontalSlider->GetRange().GetValue();

  nuiSize x;
  nuiSize y;
  nuiSize xx = rRect.GetWidth();
  nuiSize yy = rRect.GetHeight();

  if (mCalcWidthFromIdealSize)
    x = GetIdealRect().GetWidth();
  else
    x = xx * HorizontalZoomLevel;
  if (mCalcHeightFromIdealSize)
    y = GetIdealRect().GetHeight();
  else
    y = yy * VerticalZoomLevel;

  bool needv = y > yy;
  bool needh = x > xx;
  
  if (mpHorizontalScrollbar)
  {
    nuiRange& hrange = mpHorizontalScrollbar->GetRange();
    hrange.SetRange(0,x);
    hrange.SetPageSize(MAX(0, xx));
    hrange.SetIncrement(16.0f);
    hrange.SetPageIncrement(MAX(0, xx - xx / 8.f)); // 1/8th of page skip overlaps with the next and previous
    hrange.EnableEvents(false); 
    hrange.SetValue(XOffset); 
    hrange.EnableEvents(true);
    XOffset = hrange.GetValue();
  }
  if (mpVerticalScrollbar)
  {
    nuiRange& vrange = mpVerticalScrollbar->GetRange();
    vrange.SetRange(0,y);
    vrange.SetPageSize(MAX(0, yy));
    vrange.SetIncrement(16.0f);
    vrange.SetPageIncrement(MAX(0, yy - yy / 8.f)); // 1/8th of page skip overlaps with the next and previous
    vrange.EnableEvents(false); 
    vrange.SetValue(YOffset); 
    vrange.EnableEvents(true);
    YOffset = vrange.GetValue();
  }

  if (x < xx)
    x = xx;
  if (y < yy)
    y = yy;

  IteratorPtr pIt;  
  for (pIt = GetFirstChild(); pIt && pIt->IsValid(); GetNextChild(pIt))
  {
    nuiWidgetPtr pItem = pIt->GetWidget();
    nuiRect rect(-XOffset, -YOffset, x, y);
    pItem->SetLayout(rect);
  }
  delete pIt;

  needv = needv | mAlwaysDisplayVScrollbar;
  needh = needh | mAlwaysDisplayHScrollbar;

  if (mpVerticalScrollbar)
    mpVerticalScrollbar->SetVisible(needv);
  if (mpHorizontalScrollbar)
    mpHorizontalScrollbar->SetVisible(needh);

  return true;
}
开发者ID:YetToCome,项目名称:nui3,代码行数:86,代码来源:nuiZoomView.cpp

示例14: SetRectVertical

//*******************************************
//
// ORIENTATION VERTICAL
//  
bool nuiSplitter::SetRectVertical(const nuiRect& rRect)
{
  nuiSize Height = rRect.GetHeight();
//  nuiSize Width = rRect.GetWidth();
  nuiSize left;
  nuiRect Rect;
  
  nuiSize handleSize = 0;
  if (mpHandle)
  {
    const nuiRect& handleRect = mpHandle->GetIdealRect();
    handleSize = handleRect.GetWidth();
  }
  
  nuiWidgetPtr pItem = NULL;
  nuiWidgetList::iterator it;
  nuiWidgetList::iterator end = mpChildren.end();

  list<nuiRect>::iterator rit=mPositions.begin();
  Rect=(*rit);

  ++rit;

  left = 0;
  nuiSize w=0;
  int i;
  it=mpChildren.begin();
  i=0;
  
   // don't process the splitter handle before the first child (we need the size of the first child)
  if (it != end)
  {
    pItem = (*it);
    if (pItem == mpHandle)
    {
      ++it;
      i++;
    }
  }



  //******************************************
  //
  // First Child:

  if (it != end)
  {
    pItem = (*it);

    if (mMasterChild)
    {
      w = pItem->GetIdealRect().GetWidth();

      mHandlePos = (mMode == eModePercentage) ? ((w / rRect.GetWidth()) * 100.0f) : w;

      Rect.Set(left, 0.f, w, Height);
      Rect.RoundToBelow();
    }
    else
    {
      w = (mMode == eModePercentage) ? MAX((mRect.GetWidth() * (mHandlePos/100.0f)), mFirstWidgetMinPixels) : MAX(mHandlePos, mFirstWidgetMinPixels);
      
      if (w + mSeconWidgetMinPixels > mRect.GetWidth())
      {

        w = mRect.GetWidth() - mSeconWidgetMinPixels;
        mHandlePos = (mMode == eModePercentage) ? (w / mRect.GetWidth() * 100.0f) : w;
      }


      Rect.Set(left, 0.f, w, Height);
      Rect.RoundToBelow();
    }

    pItem->SetLayout(Rect);

    left += w;
  }
  // no child
  else
  {
    if (mMasterChild)
    {
      left = (mMode == eModePercentage) ? ((mHandlePos / rRect.GetWidth()) * 100.0f) : mHandlePos;
    }
    else
    {
      left = (mMode == eModePercentage) ? MAX((mRect.GetWidth() * (mHandlePos/100.0f)), mFirstWidgetMinPixels) : MAX(mHandlePos, mFirstWidgetMinPixels);
    }
  }





//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例15: SetRect

bool nuiList::SetRect(const nuiRect& rRect)
{
  nuiWidget::SetRect(rRect);
  nuiSize Height = (nuiSize)rRect.GetHeight();
  nuiSize Width = (nuiSize)rRect.GetWidth();
  nuiSize pageincr = 0, value = 0;
  nuiRect Rect;
  nuiSize w,h;

  list<nuiRect>::iterator rit=mPositions.begin();

  Rect=(*rit);

  ++rit;
  if (mOrientation == nuiVertical)
  {
    pageincr = rRect.GetHeight() - 2.0f;

    Height = (nuiSize)-value;

    IteratorPtr pIt;
    for (pIt = GetFirstChild(); pIt && pIt->IsValid(); GetNextChild(pIt))
    {
      nuiWidgetPtr pItem = pIt->GetWidget();
      Rect=(*rit);
      if (mFixedAspectRatio)
      {
        nuiSize rratio,rw,rh;
        rratio = (nuiSize)Rect.GetWidth() / (nuiSize)Rect.GetHeight();

        rw = (nuiSize)Width;
        rh = rw / rratio;

        h=rh;

      }
      else
      {
        h=(nuiSize)Rect.GetHeight();
      }
      
      Rect.Set(mBorderSize, Height, Width - 2 * mBorderSize, h);
      Rect.RoundToAbove();

      Height += h + mBorderSize;
      Height = (nuiSize)ToAbove(Height);
      pItem->SetLayout(Rect);
      mRects[pItem] = Rect;

      ++rit;
    }
    delete pIt;
  }
  else
  {
    pageincr = rRect.GetWidth() - 2.0f;

    Width = (nuiSize) -value;
    IteratorPtr pIt;
    for (pIt = GetFirstChild(); pIt && pIt->IsValid(); GetNextChild(pIt))
    {
      nuiWidgetPtr pItem = pIt->GetWidget();
      Rect=(*rit);
      if (mFixedAspectRatio)
      {
        nuiSize rratio,rw,rh;
        rratio = (nuiSize)Rect.GetWidth() / (nuiSize)Rect.GetHeight();

        rh = (nuiSize)Height;
        rw = rh * rratio;
        
        w=rw;
      }
      else
      {
        w=(nuiSize)(int)((nuiSize)Rect.GetWidth());
      }
      
      Rect.Set(Width, mBorderSize, w, Height - 2 * mBorderSize);
      Rect.RoundToAbove();
      Width += w + mBorderSize;
      Width = (nuiSize)ToAbove(Width);
      pItem->SetLayout(Rect);
      mRects[pItem] = Rect;
      ++rit;
    }
    delete pIt;
  }

  return true;
}
开发者ID:jpastuszek,项目名称:nui3,代码行数:91,代码来源:nuiList.cpp


注:本文中的nuiRect::GetHeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。