Ejemplo n.º 1
0
//**************************************************************************************************************
//
// nuiCloseButton (for windows)
//
void nuiDefaultDecoration::CloseButton(nuiWidget* pWidget)
{
  
  nuiStateDecoration* pDeco = (nuiStateDecoration*)nuiDecoration::Get(_T("nuiDefaultDecorationCloseButton"));
  if (pDeco)
  {
    pWidget->SetDecoration(pDeco, eDecorationBorder);
    return;
  }
  
  nuiTexture* pTexUp = nuiTexture::GetTexture("CloseButtonUp");
  NGL_ASSERT(pTexUp);
  nuiFrame* pFrameUp = new nuiFrame(_T("nuiDefaultDecorationCloseButtonUp"), pTexUp, nuiRect(0,0,12,15));
  
  
  nuiTexture* pTexHover = nuiTexture::GetTexture("CloseButtonHover");
  NGL_ASSERT(pTexHover);
  nuiFrame* pFrameHover = new nuiFrame(_T("nuiDefaultDecorationCloseButtonHover"), pTexHover, nuiRect(0,0,12,15));
  
  
  nuiTexture* pTexDown = nuiTexture::GetTexture("CloseButtonDown");
  NGL_ASSERT(pTexDown);
  nuiFrame* pFrameDown = new nuiFrame(_T("nuiDefaultDecorationCloseButtonDown"), pTexDown, nuiRect(0,0,12,15));
  
  
  
  nuiStateDecoration* pState = new nuiStateDecoration(_T("nuiDefaultDecorationCloseButton"), 
                                                      _T("nuiDefaultDecorationCloseButtonUp"),
                                                      _T("nuiDefaultDecorationCloseButtonDown"),
                                                      _T("nuiDefaultDecorationCloseButtonHover"));
  pState->SetSourceClientRect(nuiRect(0,0,12,15));
  
  pWidget->SetDecoration(pState, eDecorationBorder);
  
}
Ejemplo n.º 2
0
//**************************************************************************************************************
//
// nuiComboBox
//
void nuiDefaultDecoration::ComboBox(nuiWidget* pWidget)
{
 
  nuiStateDecoration* pDeco = (nuiStateDecoration*)nuiDecoration::Get(_T("nuiDefaultDecorationComboBox"));
  if (pDeco)
  {
    pWidget->SetDecoration(pDeco, eDecorationBorder);
    return;
  }
  
  nuiTexture* pTex = nuiTexture::GetTexture("ComboUp");
  NGL_ASSERT(pTex);
  nuiFrame* pFrame = new nuiFrame(_T("nuiDefaultDecorationComboBoxUp"), pTex, nuiRect(12,4,2,10));
  pFrame->EnableBorder(false);
      
  pTex = nuiTexture::GetTexture("ComboDown");
  NGL_ASSERT(pTex);
  pFrame = new nuiFrame(_T("nuiDefaultDecorationComboBoxDown"), pTex, nuiRect(12,4,2,10));
  pFrame->EnableBorder(false);
    
  
  
  nuiStateDecoration* pState = new nuiStateDecoration(_T("nuiDefaultDecorationComboBox"));
  pState->SetState(nuiStateEnabled  | nuiStateReleased, nuiDecoration::Get(_T("nuiDefaultDecorationComboBoxUp")));
  pState->SetState(nuiStateEnabled  | nuiStateSelected, nuiDecoration::Get(_T("nuiDefaultDecorationComboBoxDown")));
  pWidget->SetDecoration(pState, eDecorationBorder);
  pWidget->SetUserHeight(18);
  
  pWidget->SetColor(eSelectedTextFg, nuiColor(32,32,32));
  
}
Ejemplo n.º 3
0
void nuiFrame::SetTexturePath(const nglPath& rPath)
{
  mTexturePath = rPath;
  nuiTexture* pOld = mpTexture;
  mpTexture = nuiTexture::GetTexture(rPath);

  if (!mpTexture || !mpTexture->IsValid())
  {
    NGL_OUT(_T("nuiFrame::SetTexturePath warning : could not load graphic resource '%ls'\n"), rPath.GetChars());
    return;
  }

  if (GetSourceClientRect() == nuiRect(0,0,0,0))
    SetSourceClientRect(nuiRect(0, 0, mpTexture->GetWidth(), mpTexture->GetHeight()));
  if (pOld)
    pOld->Release();
    
  if (mInterpolated)
  {
    mpTexture->SetMinFilter(GL_LINEAR);
    mpTexture->SetMagFilter(GL_LINEAR);
  }
  else
  {
    mpTexture->SetMinFilter(GL_NEAREST);
    mpTexture->SetMagFilter(GL_NEAREST);
  }
  Changed();
}
Ejemplo n.º 4
0
bool nuiSpriteFrame::SetTexture(const nglPath& rPath)
{
  if (!SetTexture(rPath, nuiRect()))
    return false;
  
  mRect = nuiRect((float)mpTexture->GetWidth(), (float)mpTexture->GetHeight());
  mX = (float)mpTexture->GetWidth() / 2;
  mY = (float)mpTexture->GetHeight() / 2;
  return true;
}
Ejemplo n.º 5
0
void nuiDefaultDecoration::TabView_Contents(nuiTabView* pView, nuiWidget* pContents)
{
  nglString decoName = _T("nuiDefaultDecorationTabTopContents");
  
  nuiRect frameRect;
  
  const char* deco = "TabTopContents";
  
  switch (pView->GetTabPosition())
  {
    case nuiTop:
      decoName = _T("nuiDefaultDecorationTabTopContents");
      deco = "TabTopContents";
      frameRect = nuiRect(4,5,2,4);
      break;
      
    case nuiLeft:
      decoName = _T("nuiDefaultDecorationTabLeftContents");
      deco = "TabLeftContents";
      frameRect = nuiRect(5,4,4,2);
      break;
      
    case nuiRight:
      decoName = _T("nuiDefaultDecorationTabRightContents");
      deco = "TabRightContents";
      frameRect = nuiRect(5,4,4,2);
      break;
      
    case nuiBottom:
      decoName = _T("nuiDefaultDecorationTabBottomContents");
      deco = "TabBottomContents";
      frameRect = nuiRect(4,5,2,4);
      break;

    default:
      NGL_ASSERT(0);
      break;
  }
  
  nuiFrame* pDeco = (nuiFrame*)nuiDecoration::Get(decoName);
  if (pDeco)
  {
    pContents->SetDecoration(pDeco, eDecorationBorder);
    return;
  }
  
  nuiTexture* pTex = nuiTexture::GetTexture(deco);
  NGL_ASSERT(pTex);
  pDeco = new nuiFrame(decoName, pTex, frameRect);
    
  pContents->SetDecoration(pDeco, eDecorationBorder);
  
}
Ejemplo n.º 6
0
void nuiComboBox::ReparentTree(nuiTreeNode* pTree)
{
  NGL_ASSERT(pTree);
  nuiWidgetPtr pWidget = pTree->GetElement();
  NGL_ASSERT(pWidget);

  pWidget->SetLayout(nuiRect(0.f,0.f, GetRect().GetWidth()-mHandleWidth, GetRect().GetHeight()));

  if (pWidget->GetParent() != this)
  {
    AddChild(pWidget);
    pWidget->InvalidateLayout();
  }

  if (GetSelectedWidget() == pWidget)
  {
    if (!pWidget->IsVisible())
      pWidget->SetVisible(true);
  }
  else 
  {
    if (pWidget->IsVisible())
      pWidget->SetVisible(false);
  }

  uint32 count = pTree->GetChildrenCount();
  for (uint32 i = 0; i < count; i++)
  {
    nuiTreeNode* pNode = dynamic_cast<nuiTreeNode*>(pTree->GetChild(i));
    NGL_ASSERT(pNode);
    ReparentTree(pNode);
  }
}
Ejemplo n.º 7
0
nuiRect nuiPathGenerator::GetRect()
{
  float minx = 0, maxx = 0;
  float miny = 0, maxy = 0;
  bool first = true;

  nuiPath points;
  Tessellate(points, 0.01f);

  for (uint32 i = 0; i < points.GetCount(); i++)
  {
    const nuiPoint& rP = points[i];
    float x = rP.Elt[0];
    float y = rP.Elt[1];
    if (!first)
    {
      minx = MIN(minx,x);
      maxx = MAX(maxx,x);
      miny = MIN(miny,y);
      maxy = MAX(maxy,y);
    }
    else
    {
      minx = maxx = x;
      miny = maxy = y;
      first = false;
    }
  }

  return nuiRect(minx, miny, maxx, maxy, false);
}
Ejemplo n.º 8
0
 virtual nuiRect CalcIdealSize()
 {
   if (mpTarget)
     return mpTarget->GetRect().Size();
   else
     return nuiRect(0,0, 32, 32);
 }
Ejemplo n.º 9
0
void MainWindow::OnCreation()
{
    // label with decoration in the third cell
    mMyLabel = new nuiLabel(_T("my label is spinning!"));
    mMyLabel->SetFont(nuiFont::GetFont(30));
    mMyLabel->SetPosition(nuiCenter);
    AddChild(mMyLabel);

    mMyLabel->EnableSurface(true);


    nuiRect r = mMyLabel->CalcIdealSize();
    float s = MAX(r.GetWidth(), r.GetHeight());
    float x = s / 2;
    float y = s / 2;
    mMyLabel->SetUserRect(nuiRect(s, s));
    nuiRotateMatrixAttributeAnimation* pAnim = new nuiRotateMatrixAttributeAnimation();
    pAnim->SetTargetObject(mMyLabel);
    pAnim->SetTargetAttribute(_T("SurfaceMatrix"));
    pAnim->SetStartValue(0, x, y);
    pAnim->SetEndValue(180, x, y);
    pAnim->SetDuration(2);
    pAnim->SetEasing(nuiEasingElasticIn<10>);
    AddAnimation(_T("RotateLabel"), pAnim);
    pAnim->Play(1000, eAnimLoopPingPong);
}
Ejemplo n.º 10
0
void nuiLayout::DoLayout(const nuiRect& rRect)
{
  nuiRect r(GetRect());
  float width = r.GetWidth();
  float height = r.GetHeight();

  SetHorizontalAnchor("left", 0, eAnchorAbsolute);
  SetHorizontalAnchor("right", width, eAnchorAbsolute);
  SetVerticalAnchor("top", 0, eAnchorAbsolute);
  SetVerticalAnchor("bottom", height, eAnchorAbsolute);
  auto it = mConstraints.begin();
  while (it != mConstraints.end())
  {
    nuiWidget* pWidget = it->first;
    float left = 0, right = width, top = 0, bottom = height;
    nuiRect ideal(pWidget->GetIdealRect());
    float l = ideal.Left(), r = ideal.Right(), t = ideal.Top(), b = ideal.Bottom();
    const nuiLayoutConstraint& rH(it->second.first);
    const nuiLayoutConstraint& rV(it->second.second);

    // Horizontal Layout:
    ComputeConstraint(rH, l, r, left, right, ideal.GetWidth(), 0);

    // Vertical Layout:
    ComputeConstraint(rV, t, b, top, bottom, ideal.GetHeight(), 1);

    pWidget->SetLayout(nuiRect(l, t, r, b, false));

    ++it;
  }
}
Ejemplo n.º 11
0
//**************************************************************************************************************
//
// nuiRadioButton
//
void nuiDefaultDecoration::RadioButton(nuiWidget* pWidget)
{
  nuiRadioButton* pBtn = (nuiRadioButton*)pWidget;
  if (pBtn->HasContents())
  {
    nuiDefaultDecoration::Button(pWidget);
    return;
  }
  
  
  nuiStateDecoration* pDeco = (nuiStateDecoration*)nuiDecoration::Get(_T("nuiDefaultDecorationRadioButton"));
  if (pDeco)
  {
    pWidget->SetDecoration(pDeco, eDecorationBorder);
    return;
  }
  
  nuiTexture* pTex = nuiTexture::GetTexture("RadioButtonUp");
  NGL_ASSERT(pTex);
  nuiFrame* pFrame = new nuiFrame(_T("nuiDefaultDecorationRadioButtonUp"), pTex, nuiRect(0,0,13,13));
    
  
  pTex = nuiTexture::GetTexture("RadioButtonDown");
  NGL_ASSERT(pTex);
  pFrame = new nuiFrame(_T("nuiDefaultDecorationRadioButtonDown"), pTex, nuiRect(0,0,13,13));
  
  pTex = nuiTexture::GetTexture("RadioButtonUpDisabled");
  NGL_ASSERT(pTex);
  pFrame = new nuiFrame(_T("nuiDefaultDecorationRadioButtonUpDisabled"), pTex, nuiRect(0,0,13,13));
  
  pTex = nuiTexture::GetTexture("RadioButtonDownDisabled");
  NGL_ASSERT(pTex);
  pFrame = new nuiFrame(_T("nuiDefaultDecorationRadioButtonDownDisabled"), pTex, nuiRect(0,0,13,13));
    
  
  nuiStateDecoration* pState = new nuiStateDecoration(_T("nuiDefaultDecorationRadioButton"), 
                                                      _T("nuiDefaultDecorationRadioButtonUp"),
                                                      _T("nuiDefaultDecorationRadioButtonDown"),
                                                      _T("nuiDefaultDecorationRadioButtonUp"),/* hover up */
                                                      _T("nuiDefaultDecorationRadioButtonDown"), /* hover down*/
                                                      _T("nuiDefaultDecorationRadioButtonUpDisabled"),
                                                      _T("nuiDefaultDecorationRadioButtonDownDisabled"));
  pState->SetSourceClientRect(nuiRect(0,0,13,13));
  
  pWidget->SetDecoration(pState, eDecorationBorder);
  
}
Ejemplo n.º 12
0
void FrameEditor::UpdateFrameViews(bool CopyImageRect)
{
  nuiFixed* pFixed = new nuiFixed();
  mpFrameViewHolder->AddChild(pFixed);
  mpFrameView = new nuiFrameView(mpFrame);
  mpFrameView->AddChild(new nuiLabel(_T("This frame should\nlook nice at any size."), nuiFont::GetFont(20)));
  pFixed->AddChild(mpFrameView);
  
  nuiRectView* pFrameRectView = new nuiRectView(mpFrameView->GetIdealRect());
  mSlotSink.Connect(pFrameRectView->RectChanged, nuiMakeDelegate(this, &FrameEditor::OnFrameViewRectChanged));
	mEventSink.Connect(pFrameRectView->MovedMouse, &FrameEditor::OnFrameMouseMoved);
	pFrameRectView->EnableMouseEvent(true);

  pFrameRectView->SetColor(eShapeStroke, nuiColor(_T("blue")));
  mpFrameViewHolder->AddChild(pFrameRectView);
  
  nuiTexture* pTexture = mpFrame->GetTexture();
	mpImage = new nuiImage(pTexture);
  mpImage->SetPosition(nuiTopLeft);
  mpPictureHolder->AddChild(mpImage);

  if (CopyImageRect)
    mpFrame->SetSourceClientRect(nuiRect(0, 0, pTexture->GetImage()->GetWidth(), pTexture->GetImage()->GetHeight()));
  
  nuiRectView* pRectView = new nuiRectView(mpFrame->GetSourceClientRect());
  mSlotSink.Connect(pRectView->RectChanged, nuiMakeDelegate(this, &FrameEditor::OnFrameRectChanged));
	mEventSink.Connect(pRectView->MovedMouse, &FrameEditor::OnFrameMouseMoved);
	pRectView->EnableMouseEvent(true);
  pRectView->SetColor(eShapeStroke, nuiColor(_T("red")));
  mpPictureHolder->AddChild(pRectView);

  mAttributeScale.Set(mScale);
	
	
	// load attributes editors in inspector	
	mAttributeRect = nuiAttrib<const nuiRect&>(mpFrame->GetAttribute(_T("ClientRect")));
	mAttributeColor = nuiAttrib<const nuiColor&>(mpFrame->GetAttribute(_T("Color")));
	
	
	std::list<nuiAttribBase> attributes;

	attributes.push_back(GetMainWindow()->mAttributeMouseCoord);
	attributes.push_back(mAttributeScale);
	
	ToolPaneAttributes* pTPA = new ToolPaneAttributes(_T("Information"), attributes);
	mpInspector->AddToolpane(pTPA);

	attributes.clear();
	attributes.push_back(mAttributeRect);
	attributes.push_back(mAttributeColor);

	ToolPaneAttributes* pTPA2 = new ToolPaneAttributes(_T("Frame"), attributes);
	mpInspector->AddToolpane(pTPA2);
	
	
	// connect color change signal
	mSlotSink.Connect(mAttributeColor.GetChangedSignal(), nuiMakeDelegate(this, &FrameEditor::OnColorChanged));

}
Ejemplo n.º 13
0
bool nuiComboBox::SetRect(const nuiRect& rRect)
{
  nuiRect rect(rRect);

  nuiWidget::SetRect(rect);
  SetTreeRect(mpChoicesTree, nuiRect(0.f, 0.f, rect.GetWidth() - (mHandleWidth + mHandleOffset), rect.GetHeight()));
  return true;
}
Ejemplo n.º 14
0
//**************************************************************************************************************
//
// InitSelection
//
void nuiDefaultDecoration::InitSelection()
{
  nuiColor color;
  nuiColor::GetColor(_T("nuiDefaultClrSelection"), color);
  
  nuiColorDecoration* pDeco = new nuiColorDecoration(_T("nuiDefaultDecorationSelectionBackground"), 
                                                     nuiRect(3,3,0,0), color);
}
Ejemplo n.º 15
0
nuiSVGView::nuiSVGView(nuiSVGShape* pShape)
  : nuiWidget(),
    mCache(nuiRect())
{
  nuiSVGView::Init();
  mpShape = pShape;
  mAntialias = true;
}
Ejemplo n.º 16
0
nuiRect nuiTextRun::GetRect() const
{
  if (IsDummy())
    return nuiRect(mAdvanceX, mAdvanceY);
  nuiFontInfo finfo;
  mStyle.GetFont()->GetInfo(finfo);
 
//   const nuiTextGlyph& rGlyph(*it);
//   nuiGlyphInfo info;
//   rGlyph.mpFont->GetGlyphInfo(info, rGlyph.Index, nuiFontBase::eGlyphBitmap);
//   nuiSize w = info.AdvanceX;
//   //    nuiSize h = finfo.AdvanceMaxH;
//   nuiSize x = rGlyph.X + info.BearingX;
//   nuiSize y = rGlyph.Y - finfo.Ascender;
//   nuiSize h = finfo.Height;
// 
//   nuiRect rr(r);
//   r.Union(rr, nuiRect(x, y, w, h));
//   return r;
  return nuiRect();
}
Ejemplo n.º 17
0
nuiSVGView::nuiSVGView(const nglPath& rSource)
  : nuiWidget(),
    mCache(nuiRect())
{
  nuiSVGView::Init();
  nglIStream* pFile = rSource.OpenRead();
  if (pFile)
  {
    Load(*pFile);
    delete pFile;
  }
}
Ejemplo n.º 18
0
nuiRect nuiSVGView::CalcIdealSize()
{
  if (!mpShape)
  {
    mIdealRect = nuiRect();
    return mIdealRect;
  }
  mIdealRect = mpShape->GetBoundingRect();
  // Add 2% to the total size in order to balance not taking splines into account while calculating the bounding box.
  mIdealRect.SetSize(mIdealRect.GetWidth()*1.02f, mIdealRect.GetHeight()*1.02f);  
  return mIdealRect;
}
Ejemplo n.º 19
0
void nuiImageDecoration::SetTexturePath(nglPath path)
{
  SetProperty(_T("Texture"), path.GetPathName());
  nuiTexture* pOld = mpTexture;
  mpTexture = nuiTexture::GetTexture(path);
  if (!mpTexture || !mpTexture->IsValid())
  {
    NGL_OUT(_T("nuiImageDecoration::SetTexturePath warning : could not load graphic resource '%ls'\n"), path.GetChars());
    return;
  }
  
  if (GetSourceClientRect() == nuiRect(0,0,0,0))
    SetSourceClientRect(nuiRect(0, 0, mpTexture->GetWidth(), mpTexture->GetHeight()));
  if (pOld)
    pOld->Release();
  
  SetRepeatX(mRepeatX);
  SetRepeatY(mRepeatY);
  
  Changed();
}
Ejemplo n.º 20
0
//**************************************************************************************************************
//
// nuiToggleButton
//
void nuiDefaultDecoration::ToggleButton(nuiWidget* pWidget)
{
  nuiToggleButton* pBtn = (nuiToggleButton*)pWidget;
  if (!pBtn->GetDisplayAsCheckBox() && !pBtn->GetDisplayAsFrameBox())
  {
    nuiDefaultDecoration::Button(pWidget);
    return;
  }
  
  if (pBtn->GetDisplayAsCheckBox())
  {
    nuiStateDecoration* pDeco = (nuiStateDecoration*)nuiDecoration::Get(_T("nuiDefaultDecorationToggleButtonCheckBox"));
    if (pDeco)
    {
      pWidget->SetDecoration(pDeco, eDecorationBorder);
      return;
    }
    
    nuiTexture* pTex = nuiTexture::GetTexture("ToggleButtonUp");
    NGL_ASSERT(pTex);
    nuiImageDecoration* pFrame = new nuiImageDecoration(_T("nuiDefaultDecorationToggleButtonCheckBoxUp"), pTex, nuiRect(0,0,13,13));
    pFrame->SetPosition(nuiLeft);
        
    
    pTex = nuiTexture::GetTexture("ToggleButtonDown");
    NGL_ASSERT(pTex);
    pFrame = new nuiImageDecoration(_T("nuiDefaultDecorationToggleButtonCheckBoxDown"), pTex, nuiRect(0,0,13,13));
    pFrame->SetPosition(nuiLeft);
        
    pTex = nuiTexture::GetTexture("ToggleButtonUpDisabled");
    NGL_ASSERT(pTex);
    pFrame = new nuiImageDecoration(_T("nuiDefaultDecorationToggleButtonCheckBoxUpDisabled"), pTex, nuiRect(0,0,13,13));
    pFrame->SetPosition(nuiLeft);
        
    pTex = nuiTexture::GetTexture("ToggleButtonDownDisabled");
    NGL_ASSERT(pTex);
    pFrame = new nuiImageDecoration(_T("nuiDefaultDecorationToggleButtonCheckBoxDownDisabled"), pTex, nuiRect(0,0,13,13));
    pFrame->SetPosition(nuiLeft);
        
    
    nuiStateDecoration* pState = new nuiStateDecoration(_T("nuiDefaultDecorationToggleButtonCheckBox"), 
                                                        _T("nuiDefaultDecorationToggleButtonCheckBoxUp"),
                                                        _T("nuiDefaultDecorationToggleButtonCheckBoxDown"),
                                                        _T("nuiDefaultDecorationToggleButtonCheckBoxUp"),/* hover up */
                                                        _T("nuiDefaultDecorationToggleButtonCheckBoxDown"), /* hover down*/
                                                        _T("nuiDefaultDecorationToggleButtonCheckBoxUpDisabled"),
                                                        _T("nuiDefaultDecorationToggleButtonCheckBoxDownDisabled"));
    pState->SetSourceClientRect(nuiRect(0,0,13,13));
    pWidget->SetDecoration(pState, eDecorationBorder);
  }
  
}
Ejemplo n.º 21
0
nuiColorDecoration::nuiColorDecoration(const nglString& rName)
: nuiDecoration(rName)
{
  if (SetObjectClass(_T("nuiColorDecoration")))
    InitAttributes();

  mStrokeSize = 0;
  mFillColor = nuiColor(0,0,0);
  mStrokeColor = nuiColor(0,0,0);
  mShapeMode = eFillShape;
  mBlendFunc = nuiBlendTransp;
  mClientRect = nuiRect(0,0,0,0);
}
Ejemplo n.º 22
0
//**************************************************************************************************************
//
// nuiMessageBox
//
void nuiDefaultDecoration::MessageBox(nuiMessageBox* pBox)
{
  nuiFrame* pFrame = (nuiFrame*)nuiDecoration::Get(_T("nuiDefaultDecorationOutterPane"));
  if (!pFrame)
  {
    nuiTexture* pTex = nuiTexture::GetTexture("PaneOutter");
    NGL_ASSERT(pTex);
    pFrame = new nuiFrame(_T("nuiDefaultDecorationOutterPane"), pTex, nuiRect(12,12,0,1));
    pFrame->UseWidgetAlpha(true);
  }
  NGL_ASSERT(pFrame);
  pBox->SetDecoration(pFrame);
}
Ejemplo n.º 23
0
//**************************************************************************************************************
//
// nuiDialog::EditLine
//
void nuiDefaultDecoration::Dialog_EditLine(nuiWidget* pWidget)
{
  nuiFrame* pFrame = (nuiFrame*)nuiDecoration::Get(_T("nuiDefaultDecorationInnerPane"));
  if (!pFrame)
  {
    nuiTexture* pTex = nuiTexture::GetTexture("PaneInner");
    NGL_ASSERT(pTex);
    pFrame = new nuiFrame(_T("nuiDefaultDecorationInnerPane"), pTex, nuiRect(6,6,0,0));
    pFrame->UseWidgetAlpha(true);
  }
  NGL_ASSERT(pFrame);
  pWidget->SetDecoration(pFrame, eDecorationBorder);    
}
Ejemplo n.º 24
0
//**************************************************************************************************************
//
// nuiDialog
//
void nuiDefaultDecoration::Dialog(nuiSimpleContainer* pCont)
{
  nuiFrame* pFrame = (nuiFrame*)nuiDecoration::Get(_T("nuiDefaultDecorationOutterPane"));
  if (!pFrame)
  {
    nuiTexture* pTex = nuiTexture::GetTexture("PaneOutter");
    NGL_ASSERT(pTex);
    pFrame = new nuiFrame(_T("nuiDefaultDecorationOutterPane"), pTex, nuiRect(12,12,0,1));
    pFrame->UseWidgetAlpha(true);
  }
  NGL_ASSERT(pFrame);
  pCont->SetDecoration(pFrame);  
}
Ejemplo n.º 25
0
//**************************************************************************************************************
//
// nuiMainWindow
//
void nuiDefaultDecoration::MainWindow(nuiMainWindow* pWindow)
{
  nuiWidget* pCont = new nuiWidget();
  pWindow->AddChild(pCont);
  nuiColor color1, color2;
  nuiColor::GetColor(_T("nuiDefaultClrWindowBkg1"), color1);
  nuiColor::GetColor(_T("nuiDefaultClrWindowBkg2"), color2);
  nuiGradientDecoration* pDeco = new nuiGradientDecoration(_T("nuiDefaultDecorationMainWindow"), 
                                                           nuiRect(0,0, 0,0), color1, color2, nuiVertical, 0, nuiColor(0,0,0), eFillShape);
  pDeco->SetOffset1(0.f);
  pDeco->SetOffset2(0.5f);                                                           
//  pWindow->SetDecoration(pDeco);  
}
Ejemplo n.º 26
0
nuiRect nuiSlider::CalcIdealSize()
{
  nuiRect Rect;
  nuiRect BgRect = mpBackground ? mpBackground->GetIdealRect() : nuiRect();
  nuiRect HnRect = mpHandle ? mpHandle->GetIdealRect() : nuiRect();
  
  
  if (mOrientation == nuiHorizontal)
  {
    Rect.mRight  = mpBackground ? BgRect.GetWidth() : MAX(mRange.GetRange(),SLIDER_IDEAL_SIZE);
    Rect.mBottom = mpHandle ? HnRect.GetHeight()    : SLIDER_IDEAL_WIDTH;
  }
  else
  {
    Rect.mRight  = mpHandle ? HnRect.GetWidth() : SLIDER_IDEAL_WIDTH;
    Rect.mBottom = mpBackground ? BgRect.GetHeight()      : MAX(mRange.GetRange(),SLIDER_IDEAL_SIZE);
  }
  
  mIdealRect = Rect;
  
  return mIdealRect;
}
Ejemplo n.º 27
0
nuiRect nuiTabBar::CalcIdealSize()
{
  nuiSize width = 0;
  nuiSize height = 0;
  std::vector<nuiTab*>::const_iterator end = mTabs.end();
  for (std::vector<nuiTab*>::const_iterator it = mTabs.begin(); it != end; ++it)
  {
    const nuiRect &childIdealRect = (*it)->GetIdealRect();
    height = MAX(height, childIdealRect.GetHeight());
    width += childIdealRect.GetWidth();
  }
  mIdealRect = nuiRect(0.f, 0.f, width, height); 
  return mIdealRect;
}
Ejemplo n.º 28
0
void nuiHTMLImage::Draw(nuiDrawContext* pContext)
{
    if (!mVisible)
        return;
    if (!mpTexture || !mpTexture->IsValid())
        return;

    //NGL_OUT(_T("nuiHTMLImage::Draw %s\n"), mpTexture->GetObjectName().GetChars());
    pContext->PushState();
    pContext->SetTexture(mpTexture);
    pContext->SetFillColor(nuiColor(255, 255, 255));
    pContext->DrawImage(mIdealRect.Size(), nuiRect((float)mpTexture->GetWidth(), (float)mpTexture->GetHeight()));
    pContext->PopState();
}
Ejemplo n.º 29
0
void  render_handler_nui::begin_display(gameswf::rgba background_color, int viewport_x0, int viewport_y0, int viewport_width, int viewport_height, float x0, float x1, float y0, float y1)
// Set up to render a full frame from a movie and fills the
// background.  Sets up necessary transforms, to scale the
// movie to fit within the given dimensions.  Call
// end_display() when you're done.
//
// The rectangle (viewport_x0, viewport_y0, viewport_x0 +
// viewport_width, viewport_y0 + viewport_height) defines the
// window coordinates taken up by the movie.
//
// The rectangle (x0, y0, x1, y1) defines the pixel
// coordinates of the movie that correspond to the viewport
// bounds.
{
  // Thomas >> - viewport needs to be commented out to work nice with TGE and we manipulate the ortho too
  //glViewport(viewport_x0, viewport_y0, viewport_width, viewport_height);
  /*
  glMatrixMode(GL_MODELVIEW);
  glPushMatrix();
  glLoadIdentity();
  glOrtho(x0, x1, y1, y0, 0, 1);      
  */
  // << Thomas
  mpContext->PushState();
  mpContext->PushClipping();
  mpContext->EnableBlending(true);
  mpContext->SetBlendFunc(nuiBlendTransp);

//  glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);  // GL_MODULATE

//  glDisable(GL_TEXTURE_2D);

  // Clear the background, if background color has alpha > 0.
  if (background_color.m_a > 0)
  {
    // Draw a big quad.
/*
    apply_color(background_color);
    glBegin(GL_QUADS);
    glVertex2f(x0, y0);
    glVertex2f(x1, y0);
    glVertex2f(x1, y1);
    glVertex2f(x0, y1);
    glEnd();
*/
    mpContext->SetFillColor(nuiColor(background_color.m_r, background_color.m_g, background_color.m_b, background_color.m_a));
    mpContext->DrawRect(nuiRect(0.0f, 0.0f, x1-x0, y1-y0), eFillShape);
  }
}
Ejemplo n.º 30
0
nuiRect nuiFixed::CalcIdealSize()
{
    mIdealRect = nuiRect();
    IteratorPtr pIt;
    for (pIt = GetFirstChild(); pIt && pIt->IsValid(); GetNextChild(pIt))
    {
        nuiWidgetPtr pItem = pIt->GetWidget();
        mIdealRect.Union(mIdealRect,pItem->GetIdealRect());
    }
    delete pIt;

    mIdealRect.mLeft = 0;
    mIdealRect.mTop = 0;
    return mIdealRect;
}