Ejemplo n.º 1
0
void nuiButton::InitAttributes()
{
  AddAttribute(new nuiAttribute<bool>
               (nglString(_T("Pressed")), nuiUnitBoolean,
                nuiMakeDelegate(this, &nuiButton::IsPressed),
                nuiMakeDelegate(this, &nuiButton::SetPressed)));

  AddAttribute(new nuiAttribute<bool>
               (nglString(_T("AutoRepeat")), nuiUnitBoolean,
                nuiMakeDelegate(this, &nuiButton::GetAutoRepeat),
                nuiMakeDelegate(this, &nuiButton::EnableAutoRepeat)));

  AddAttribute(new nuiAttribute<float>
               (nglString(_T("AutoRepeatDelay")), nuiUnitSeconds,
                nuiMakeDelegate(this, &nuiButton::GetAutoRepeatDelay),
                nuiMakeDelegate(this, &nuiButton::SetAutoRepeatDelay)));
  AddAttribute(new nuiAttribute<float>
               (nglString(_T("AutoRepeatMinDelay")), nuiUnitSeconds,
                nuiMakeDelegate(this, &nuiButton::GetAutoRepeatMinDelay),
                nuiMakeDelegate(this, &nuiButton::SetAutoRepeatMinDelay)));
  
  AddAttribute(new nuiAttribute<nuiSize>
               (nglString(_T("ActivationOffset")), nuiUnitPixels,
                nuiMakeDelegate(this, &nuiButton::GetActivationOffset),
                nuiMakeDelegate(this, &nuiButton::SetActivationOffset)));
}
Ejemplo n.º 2
0
void nuiHyperLink::InitAttributes()
{
  AddAttribute(new nuiAttribute<const nglString&>
               (nglString(_T("URL")), nuiUnitName,
                nuiMakeDelegate(this, &nuiHyperLink::GetURL), 
                nuiMakeDelegate(this, &nuiHyperLink::SetURL)));  
}
Ejemplo n.º 3
0
//-----------------------------------------------------------------------------
// SDEditor class implementation
//-----------------------------------------------------------------------------
SDEditor::SDEditor (AudioEffect *effect)
 : AEffEditor (effect), mpWin(NULL), mLock(false)
{
  SetObjectClass(_T("SDEditor"));

  nuiAttribute<float>* pDelayAttrib = new nuiValueAttribute<float>(_T("Delay"), effect->getParameter(kDelay));
  pDelayAttrib->SetEditor(CreateEditor);
  pDelayAttrib->SetFormater(DelayFormater);
  nuiAttrib<float> delay(this, pDelayAttrib);
  mSlotSink.Connect(delay.GetChangedSignal(), nuiMakeDelegate(this, &SDEditor::SetDelay));
  AddAttribute(pDelayAttrib);

  nuiAttribute<float>* pFeedbackAttrib = new nuiValueAttribute<float>(_T("Feedback"), effect->getParameter(kFeedBack));
  pFeedbackAttrib->SetEditor(CreateEditor);
  pFeedbackAttrib->SetFormater(FeedbackFormater);
  nuiAttrib<float> feedback(this, pFeedbackAttrib);
  mSlotSink.Connect(feedback.GetChangedSignal(), nuiMakeDelegate(this, &SDEditor::SetFeedback));
  AddAttribute(pFeedbackAttrib);

  nuiAttribute<float>* pOutAttrib = new nuiValueAttribute<float>(_T("Out"), effect->getParameter(kOut));
  pOutAttrib->SetEditor(CreateEditor);
  pOutAttrib->SetFormater(OutFormater);
  nuiAttrib<float> out(this, pOutAttrib);
  mSlotSink.Connect(out.GetChangedSignal(), nuiMakeDelegate(this, &SDEditor::SetOut));
  AddAttribute(pOutAttrib);

  mMainRect.top = 0;
  mMainRect.left = 0;
  mMainRect.bottom = 240;
  mMainRect.right = 320;
  effect->setEditor(this);
}
Ejemplo n.º 4
0
void nuiImageDecoration::InitAttributes()
{
  AddAttribute(new nuiAttribute<const nuiRect&>
               (nglString(_T("ClientRect")), nuiUnitNone,
                nuiAttribute<const nuiRect&>::GetterDelegate(this, &nuiImageDecoration::GetSourceClientRect),
                nuiAttribute<const nuiRect&>::SetterDelegate(this, &nuiImageDecoration::SetSourceClientRect)));
  
  AddAttribute(new nuiAttribute<nglPath>
               (nglString(_T("Texture")), nuiUnitNone,
                nuiMakeDelegate(this, &nuiImageDecoration::GetTexturePath), 
                nuiMakeDelegate(this, &nuiImageDecoration::SetTexturePath)));
  
  AddAttribute(new nuiAttribute<nuiPosition>
               (nglString(_T("Position")), nuiUnitPosition,
                nuiMakeDelegate(this, &nuiImageDecoration::GetPosition), 
                nuiMakeDelegate(this, &nuiImageDecoration::SetPosition)));
  
  AddAttribute(new nuiAttribute<const nuiColor&>
               (nglString(_T("Color")), nuiUnitNone,
                nuiMakeDelegate(this, &nuiImageDecoration::GetColor), 
                nuiMakeDelegate(this, &nuiImageDecoration::SetColor)));
  
  AddAttribute(new nuiAttribute<bool>
               (nglString(_T("RepeatX")), nuiUnitBoolean,
                nuiMakeDelegate(this, &nuiImageDecoration::GetRepeatX), 
                nuiMakeDelegate(this, &nuiImageDecoration::SetRepeatX)));  
  
  AddAttribute(new nuiAttribute<bool>
               (nglString(_T("RepeatY")), nuiUnitBoolean,
                nuiMakeDelegate(this, &nuiImageDecoration::GetRepeatY), 
                nuiMakeDelegate(this, &nuiImageDecoration::SetRepeatY)));  
}
Ejemplo n.º 5
0
void nuiFileTree::InitAttributes()
{
  AddAttribute(new nuiAttribute<nuiColor>
               (nglString(_T("HandleColor")), nuiUnitNone,
                nuiMakeDelegate(this, &nuiFileTree::GetHandleColor), 
                nuiMakeDelegate(this, &nuiFileTree::SetHandleColor)));    
}
Ejemplo n.º 6
0
//*************************************************
// MyViewController
//
MyViewController::MyViewController()
: nuiViewController(), mTimer(0.4f), mEventSink(this)
{
  SetObjectClass(_T("MyViewController"));
  SetTitle(_T("Swipe Detector"));
  
  
  // a simple background icon
  nuiImage* pIcon = new nuiImage();
  pIcon->SetObjectName(_T("SwipeIcon"));
  AddChild(pIcon);

  
  // sprite view to manage the sprites
  nuiSpriteView* pSpriteView = new nuiSpriteView();
  AddChild(pSpriteView);
  
  nuiSpriteDef* pDef = new nuiSpriteDef(nglPath(_T("rsrc:/decorations/arrow")));

  nuiSprite* pSprite = NULL;
  float angle = 0;
  
  // a set of sprite, rotated around the pivot
  for (uint32 i = 0; i < 8; i++)
  {
    pSprite = new nuiSprite(pDef);
    mpArrows.push_back(pSprite);
    pSprite->SetAnimation(_T("off"));
    pSprite->SetPosition(160, 310);
    pSprite->SetPivot(nglVectorf(0.f, -80.f, 0.f));
    pSprite->SetAngle(angle);
    pSpriteView->AddSprite(pSprite);
    
    angle += 360 / 8;
  }
  
  // swipe gesture recognizer
  mpSwipeRecognizer = new nuiSwipeGestureRecognizer(nuiGestureDirectionRight);
  mSink.Connect(mpSwipeRecognizer->SignalSwipe, nuiMakeDelegate(this, &MyViewController::OnSignalSwipe));
  mSink.Connect(mpSwipeRecognizer->SignalStateChanged, nuiMakeDelegate(this, &MyViewController::OnSignalRecognizerStateChanged));
  AddChild(mpSwipeRecognizer);

  // a combo box to setup the gesture recognizer
  nuiTreeNode* pTree = new nuiTreeNode(_T("Swipe"), true);
  nuiTreeNode* pNode = new nuiTreeNode(_T("right"), true);
  pTree->AddChild(pNode);
  pTree->AddChild(new nuiTreeNode(_T("right/left")));
  pTree->AddChild(new nuiTreeNode(_T("top/bottom")));
  pTree->AddChild(new nuiTreeNode(_T("diagonals")));
  pTree->AddChild(new nuiTreeNode(_T("all")));
  nuiComboBox* pCombo = new nuiComboBox(pTree);
  pCombo->SetSelected(pNode);
  mEventSink.Connect(pCombo->ValueChanged, &MyViewController::OnComboChanged, (void*)pCombo);
  AddChild(pCombo);
  
  
  // monitor reset
  mEventSink.Connect(mTimer.Tick, &MyViewController::OnResetArrows);  
  
}
Ejemplo n.º 7
0
void nuiFrame::InitAttributes()
{
  nuiAttribute<const nuiRect&>* AttributeRect = new nuiAttribute<const nuiRect&>
   (nglString(_T("ClientRect")), nuiUnitNone,
    nuiAttribute<const nuiRect&>::GetterDelegate(this, &nuiFrame::GetSourceClientRect),
    nuiAttribute<const nuiRect&>::SetterDelegate(this, &nuiFrame::SetSourceClientRect));
  
  nuiAttribute<const nuiColor&>* AttributeColor = new nuiAttribute<const nuiColor&>
   (nglString(_T("Color")), nuiUnitNone,
    nuiAttribute<const nuiColor&>::GetterDelegate(this, &nuiFrame::GetColor), 
    nuiAttribute<const nuiColor&>::SetterDelegate(this, &nuiFrame::SetColor));

  nuiAttribute<bool>* AttributeFrameColor = new nuiAttribute<bool>
  (nglString(_T("UseWidgetFrameColor")), nuiUnitBoolean,
   nuiAttribute<bool>::GetterDelegate(this, &nuiFrame::IsWidgetFrameColorUsed),
   nuiAttribute<bool>::SetterDelegate(this, &nuiFrame::UseWidgetFrameColor));
  
  nuiAttribute<const nglPath&>* AttributeTexture = new nuiAttribute<const nglPath&>
   (nglString(_T("Texture")), nuiUnitNone,
    nuiMakeDelegate(this, &nuiFrame::GetTexturePath), 
    nuiMakeDelegate(this, &nuiFrame::SetTexturePath));

  nuiAttribute<bool>* AttributeInterpolation = new nuiAttribute<bool>
   (nglString(_T("Interpolation")), nuiUnitBoolean,
    nuiAttribute<bool>::GetterDelegate(this, &nuiFrame::IsInterpolated),
    nuiAttribute<bool>::SetterDelegate(this, &nuiFrame::SetInterpolated));
  

	AddAttribute(_T("ClientRect"), AttributeRect);
	AddAttribute(_T("Color"), AttributeColor);
  AddAttribute(_T("UseWidgetFrameColor"), AttributeFrameColor);
	AddAttribute(_T("Texture"), AttributeTexture);
	AddAttribute(_T("Interpolation"), AttributeInterpolation);
}
Ejemplo n.º 8
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.º 9
0
void nuiToggleButton::InitAttributes()
{
  AddAttribute(new nuiAttribute<bool>
               (nglString(_T("CheckBox")), nuiUnitBoolean,
                nuiMakeDelegate(this, &nuiToggleButton::GetDisplayAsCheckBox),
                nuiMakeDelegate(this, &nuiToggleButton::SetDisplayAsCheckBox)));

  AddAttribute(new nuiAttribute<bool>
               (nglString(_T("FrameBox")), nuiUnitBoolean,
                nuiMakeDelegate(this, &nuiToggleButton::GetDisplayAsFrameBox),
                nuiMakeDelegate(this, &nuiToggleButton::SetDisplayAsFrameBox)));
}
Ejemplo n.º 10
0
void nuiDecoration::InitAttributes()
{
    AddAttribute(new nuiAttribute<bool>
                 (nglString(_T("EnableBorder")), nuiUnitBoolean,
                  nuiMakeDelegate(this, &nuiDecoration::IsBorderEnabled),
                  nuiMakeDelegate(this, &nuiDecoration::EnableBorder)));


    AddAttribute(new nuiAttribute<bool>
                 (nglString(_T("UseWidgetAlpha")), nuiUnitNone,
                  nuiMakeDelegate(this, &nuiDecoration::IsWidgetAlphaUsed),
                  nuiMakeDelegate(this, &nuiDecoration::UseWidgetAlpha)));

    AddAttribute(new nuiAttribute<bool>
                 (nglString(_T("RedrawOnHover")), nuiUnitNone,
                  nuiMakeDelegate(this, &nuiDecoration::GetRedrawOnHover),
                  nuiMakeDelegate(this, &nuiDecoration::RedrawOnHover)));


    AddAttribute(new nuiAttribute<nuiDecorationLayer>
                 (nglString(_T("Layer")), nuiUnitNone,
                  nuiMakeDelegate(this, &nuiDecoration::GetLayer),
                  nuiMakeDelegate(this, &nuiDecoration::SetLayer)));

}
Ejemplo n.º 11
0
void nuiColorDecoration::InitAttributes()
{
  AddAttribute(new nuiAttribute<const nuiRect&>
   (nglString(_T("ClientRect")), nuiUnitNone,
    nuiAttribute<const nuiRect&>::GetterDelegate(this, &nuiColorDecoration::GetSourceClientRect),
    nuiAttribute<const nuiRect&>::SetterDelegate(this, &nuiColorDecoration::SetSourceClientRect)));

  AddAttribute(new nuiAttribute<float>
  (nglString(_T("StrokeSize")), nuiUnitPixels,
   nuiMakeDelegate(this, &nuiColorDecoration::GetStrokeSize),
   nuiMakeDelegate(this, &nuiColorDecoration::SetStrokeSize)));
  
  AddAttribute(new nuiAttribute<const nuiColor&>
  (nglString(_T("FillColor")), nuiUnitColor,
   nuiMakeDelegate(this, &nuiColorDecoration::GetFillColor), 
   nuiMakeDelegate(this, &nuiColorDecoration::SetFillColor)));

  AddAttribute(new nuiAttribute<const nuiColor&>
  (nglString(_T("StrokeColor")), nuiUnitColor,
   nuiMakeDelegate(this, &nuiColorDecoration::GetStrokeColor), 
   nuiMakeDelegate(this, &nuiColorDecoration::SetStrokeColor)));

  AddAttribute(new nuiAttribute<nuiShapeMode>
  (nglString(_T("ShapeMode")), nuiUnitNone,
   nuiMakeDelegate(this, &nuiColorDecoration::GetShapeMode), 
   nuiMakeDelegate(this, &nuiColorDecoration::SetShapeMode)));

  
}
Ejemplo n.º 12
0
/////////////
//class nuiHTMLImage : public nuiHTMLItem
nuiHTMLImage::nuiHTMLImage(nuiHTMLNode* pNode, nuiHTMLNode* pAnchor)
    : nuiHTMLItem(pNode, pAnchor, true), mpTexture(NULL), mWidth(8), mHeight(8), mpStream(NULL)
{
    const nuiHTMLAttrib* pSrc = pNode->GetAttribute(nuiHTMLAttrib::eAttrib_SRC);
    const nuiHTMLAttrib* pAlt = pNode->GetAttribute(nuiHTMLAttrib::eAttrib_ALT);

    if (!pSrc)
        return;

    nglString url = pSrc->GetValue();
    //printf("incomming url: %s\n", url.GetChars());
    url = GetAbsoluteURL(url);

    //printf("url: %s\n", url.GetChars());

    // First look up the cache:
    mpTexture = nuiTexture::GetTexture(nglString(url));
    if (!mpTexture)
    {
        mpTexture = nuiTexture::GetTexture(url, NULL);
        if (!mpTexture->IsValid())
        {
            mpTexture->Release();
            mpTexture = NULL;

            mpStream = new nuiAsyncIStream(url, true, nuiMakeDelegate(this, &nuiHTMLImage::StreamDone));
            return;
        }
    }

    mpTexture->SetSource(url);

    mWidth = mpTexture->GetWidth();
    mHeight = mpTexture->GetHeight();
}
Ejemplo n.º 13
0
  nuiAttribute<nuiAnchorType>(const nglString& rName, nuiLayout* pLayout)
  : nuiAttribute<int32>(rName, nuiUnitNone, nuiMakeDelegate(this, &nuiAttribute<nuiAnchorType>::_Get), nuiMakeDelegate(this, &nuiAttribute<nuiAnchorType>::_Set), NUI_INVALID_RANGE),
    mAnchor(rName.Extract(13))
  {
    nuiAttributeBase::SetAsInstanceAttribute(true);

    if (rName.CompareLeft("HAnchorsType_", true) == 0)
    {
      mGetAnchorDelegate = nuiMakeDelegate(pLayout, &nuiLayout::GetHorizontalAnchorType);
      mSetAnchorDelegate = nuiMakeDelegate(pLayout, &nuiLayout::SetHorizontalAnchorType);
    }
    else if (rName.CompareLeft("VAnchorsType_", true) == 0)
    {
      mGetAnchorDelegate = nuiMakeDelegate(pLayout, &nuiLayout::GetVerticalAnchorType);
      mSetAnchorDelegate = nuiMakeDelegate(pLayout, &nuiLayout::SetVerticalAnchorType);
    }
  }
Ejemplo n.º 14
0
void nuiHTMLNode::AddStyleSheet(const nglString& rURL)
{
  nuiCSSStyleSheet* pCSS = nuiCSSEngine::CreateStyleSheet(rURL, nuiMakeDelegate(this, &nuiHTMLNode::StyleSheetDone));
  if (pCSS)
  {
    mStyleSheets.push_back(pCSS);
  }
}
Ejemplo n.º 15
0
  LayoutAnchorValue(const nglString& rName, nuiLayout* pLayout)
  : nuiAttribute<float>(rName, nuiUnitNone, nuiMakeDelegate(this, &LayoutAnchorValue::_Get), nuiMakeDelegate(this, &LayoutAnchorValue::_Set), NUI_INVALID_RANGE),
    mAnchor(rName.Extract(9))
  {
    nuiAttributeBase::SetAsInstanceAttribute(true);

    if (rName.CompareLeft("HAnchors_", true) == 0)
    {
      mGetAnchorDelegate = nuiMakeDelegate(pLayout, &nuiLayout::GetHorizontalAnchorPosition);
      mSetAnchorDelegate = nuiMakeDelegate(pLayout, &nuiLayout::SetHorizontalAnchorPosition);
    }
    else if (rName.CompareLeft("VAnchors_", true) == 0)
    {
      mGetAnchorDelegate = nuiMakeDelegate(pLayout, &nuiLayout::GetVerticalAnchorPosition);
      mSetAnchorDelegate = nuiMakeDelegate(pLayout, &nuiLayout::SetVerticalAnchorPosition);
    }
  }
Ejemplo n.º 16
0
//*********************************************************************************
//
// TITthread
//
//*********************************************************************************
TITthread::TITthread(const nglString& rName)
  : mRunCS(_T("CSrunning"))
  , mLockCS(_T("CSlocking"))
  , mThread(nuiMakeDelegate(this, &TITthread::OnStart), rName)
{
  mRunning = false;

}
Ejemplo n.º 17
0
void nuiScrollView::InitAttributes()
{
  AddAttribute(new nuiAttribute<bool>(_T("EnableHorizontalScroll"), nuiUnitYesNo, nuiMakeDelegate(this, &nuiScrollView::GetEnableHorizontalScroll), nuiMakeDelegate(this, &nuiScrollView::SetEnableHorizontalScroll)));
  AddAttribute(new nuiAttribute<bool>(_T("EnableVerticalScroll"), nuiUnitYesNo, nuiMakeDelegate(this, &nuiScrollView::GetEnableHorizontalScroll), nuiMakeDelegate(this, &nuiScrollView::SetEnableHorizontalScroll)));
  AddAttribute(new nuiAttribute<bool>(_T("EnableSmoothScrolling"), nuiUnitYesNo, nuiMakeDelegate(this, &nuiScrollView::IsSmoothScrollingEnabled), nuiMakeDelegate(this, &nuiScrollView::EnableSmoothScrolling)));

  AddAttribute(new nuiAttribute<float>(_T("HIncrement"), nuiUnitPixels, nuiMakeDelegate(this, &nuiScrollView::GetHIncrement), nuiMakeDelegate(this, &nuiScrollView::SetHIncrement)));
  AddAttribute(new nuiAttribute<float>(_T("VIncrement"), nuiUnitPixels, nuiMakeDelegate(this, &nuiScrollView::GetVIncrement), nuiMakeDelegate(this, &nuiScrollView::SetVIncrement)));  

  AddAttribute(new nuiAttribute<float>(_T("HPos"), nuiUnitPixels, nuiMakeDelegate(this, &nuiScrollView::GetXPos), nuiMakeDelegate(this, &nuiScrollView::SetXPos)));
  AddAttribute(new nuiAttribute<float>(_T("VPos"), nuiUnitPixels, nuiMakeDelegate(this, &nuiScrollView::GetYPos), nuiMakeDelegate(this, &nuiScrollView::SetYPos)));  

  AddAttribute(new nuiAttribute<float>(_T("HOffset"), nuiUnitPixels, nuiMakeDelegate(this, &nuiScrollView::GetXOffset), nuiMakeDelegate(this, &nuiScrollView::SetXOffset)));
  AddAttribute(new nuiAttribute<float>(_T("VOffset"), nuiUnitPixels, nuiMakeDelegate(this, &nuiScrollView::GetYOffset), nuiMakeDelegate(this, &nuiScrollView::SetYOffset)));  
}
Ejemplo n.º 18
0
void nuiSlider::InitAttributes()
{
  AddAttribute(new nuiAttribute<float>(nglString(_T("HandleOffset")), nuiUnitPixels,
                                       nuiMakeDelegate(this, &nuiSlider::GetHandleOffset),
                                       nuiMakeDelegate(this, &nuiSlider::SetHandleOffset)));
  
  AddAttribute(new nuiAttribute<float>(nglString(_T("HandlePosMin")), nuiUnitPixels,
                                       nuiMakeDelegate(this, &nuiSlider::GetHandlePosMin),
                                       nuiMakeDelegate(this, &nuiSlider::SetHandlePosMin)));
  
  AddAttribute(new nuiAttribute<float>(nglString(_T("HandlePosMax")), nuiUnitPixels,
                                       nuiMakeDelegate(this, &nuiSlider::GetHandlePosMax),
                                       nuiMakeDelegate(this, &nuiSlider::SetHandlePosMax)));

  AddAttribute(new nuiAttribute<nuiOrientation>(nglString(_T("Orientation")), nuiUnitOrientation,
                                       nuiMakeDelegate(this, &nuiSlider::GetOrientation),
                                       nuiMakeDelegate(this, &nuiSlider::SetOrientation)));

  AddAttribute(new nuiAttribute<bool>(_T("AutoAdjustHandle"), nuiUnitBoolean,
    nuiMakeDelegate(this, &nuiSlider::GetAutoAdjustHandle),
    nuiMakeDelegate(this, &nuiSlider::SetAutoAdjustHandle)));
}
Ejemplo n.º 19
0
void nuiHugeImage::InitAttributes()
{
  AddAttribute(new nuiAttribute<float>(nglString(_T("Zoom")), nuiUnitCustom,
                                       nuiMakeDelegate(this, &nuiHugeImage::GetZoom),
                                       nuiMakeDelegate(this, &nuiHugeImage::SetZoom)));
  
  AddAttribute(new nuiAttribute<float>(nglString(_T("MinZoom")), nuiUnitCustom,
                                       nuiMakeDelegate(this, &nuiHugeImage::GetMinZoom),
                                       nuiMakeDelegate(this, &nuiHugeImage::SetMaxZoom)));
  
  AddAttribute(new nuiAttribute<float>(nglString(_T("MaxZoom")), nuiUnitCustom,
                                       nuiMakeDelegate(this, &nuiHugeImage::GetMaxZoom),
                                       nuiMakeDelegate(this, &nuiHugeImage::SetMaxZoom)));
  
  AddAttribute(new nuiAttribute<float>(nglString(_T("CenterX")), nuiUnitCustom,
                                       nuiMakeDelegate(this, &nuiHugeImage::GetCenterX),
                                       nuiMakeDelegate(this, &nuiHugeImage::SetCenterX)));

  AddAttribute(new nuiAttribute<float>(nglString(_T("CenterY")), nuiUnitCustom,
                                       nuiMakeDelegate(this, &nuiHugeImage::GetCenterY),
                                       nuiMakeDelegate(this, &nuiHugeImage::SetCenterY)));
}
Ejemplo n.º 20
0
nuiSizeAttributeEditor::nuiSizeAttributeEditor(const nuiAttrib<double>& rAttribute)
	: nuiAttributeEditor(),
    mAttribute(rAttribute)
{
	SetObjectClass(_T("nuiSizeAttributeEditor"));
	
	nglString contents;
	mAttribute.Format(contents);
	
	mpLabel = new nuiLabel(contents);
	AddChild(mpLabel);

	mSink.Connect(mAttribute.GetChangedSignal(), nuiMakeDelegate(this, &nuiSizeAttributeEditor::OnAttributeChanged));
}
Ejemplo n.º 21
0
//////// Style Sheets:
void nuiHTMLNode::AddStyleSheet(const nglString& rBaseURL, const nglString& rText, bool Inline)
{
  nuiCSSStyleSheet* pCSS = nuiCSSEngine::CreateStyleSheet(rBaseURL, rText, Inline, nuiMakeDelegate(this, &nuiHTMLNode::StyleSheetDone));
  if (pCSS)
  {
    if (Inline)
    {
      delete mpInlineStyle;
      mpInlineStyle = pCSS;
    }
    else
      mStyleSheets.push_back(pCSS);
  }
}
Ejemplo n.º 22
0
void TITCSthread::InitAttributes()
{
  AddAttribute(new nuiAttribute<bool>
    (nglString(_T("LockedA")), nuiUnitOnOff,
     nuiMakeDelegate(this, &TITthread::IsLockedA),
     nuiMakeDelegate(this, &TITthread::SetLockedA)));

  AddAttribute(new nuiAttribute<bool>
    (nglString(_T("LockedB")), nuiUnitOnOff,
     nuiMakeDelegate(this, &TITthread::IsLockedB),
     nuiMakeDelegate(this, &TITthread::SetLockedB)));

  AddAttribute(new nuiAttribute<bool>
    (nglString(_T("LockedC")), nuiUnitOnOff,
     nuiMakeDelegate(this, &TITthread::IsLockedC),
     nuiMakeDelegate(this, &TITthread::SetLockedC)));
}
Ejemplo n.º 23
0
void nuiKnob::InitAttributes()
{
  AddAttribute(new nuiAttribute<const nglPath&>
  (nglString(_T("Sequence")), nuiUnitNone,
   nuiMakeDelegate(this, &nuiKnob::GetSequencePath), 
   nuiMakeDelegate(this, &nuiKnob::SetSequencePath)));
  
  AddAttribute(new nuiAttribute<uint32>
  (nglString(_T("NbFrames")), nuiUnitNone,
   nuiMakeDelegate(this, &nuiKnob::GetNbFrames),
   nuiMakeDelegate(this, &nuiKnob::SetNbFrames)));
  
  AddAttribute(new nuiAttribute<nuiOrientation>
  (nglString(_T("Orientation")), nuiUnitNone,
   nuiMakeDelegate(this, &nuiKnob::GetOrientation),
   nuiMakeDelegate(this, &nuiKnob::SetOrientation)));
  
}  
Ejemplo n.º 24
0
void nuiStateDecoration::InitAttributes()
{
  AddAttribute(new nuiAttribute<const nuiRect&>
   (nglString(_T("ClientRect")), nuiUnitNone,
    nuiAttribute<const nuiRect&>::GetterDelegate(this, &nuiStateDecoration::GetSourceClientRect),
    nuiAttribute<const nuiRect&>::SetterDelegate(this, &nuiStateDecoration::SetSourceClientRect)));

  AddAttribute(new nuiAttribute<const nglString&>
   (nglString(_T("OnUp")), nuiUnitNone,
    nuiMakeDelegate(this, &nuiStateDecoration::GetDecoUp), 
    nuiMakeDelegate(this, &nuiStateDecoration::SetDecoUp)));

  AddAttribute(new nuiAttribute<const nglString&>
   (nglString(_T("OnDown")), nuiUnitNone,
    nuiMakeDelegate(this, &nuiStateDecoration::GetDecoDown), 
    nuiMakeDelegate(this, &nuiStateDecoration::SetDecoDown)));

  AddAttribute(new nuiAttribute<const nglString&>
   (nglString(_T("OnUpHover")), nuiUnitNone,
    nuiMakeDelegate(this, &nuiStateDecoration::GetDecoUpHover), 
    nuiMakeDelegate(this, &nuiStateDecoration::SetDecoUpHover)));

  AddAttribute(new nuiAttribute<const nglString&>
   (nglString(_T("OnDownHover")), nuiUnitNone,
    nuiMakeDelegate(this, &nuiStateDecoration::GetDecoDownHover), 
    nuiMakeDelegate(this, &nuiStateDecoration::SetDecoDownHover)));
    
  AddAttribute(new nuiAttribute<const nglString&>
   (nglString(_T("OnSelected")), nuiUnitNone,
    nuiMakeDelegate(this, &nuiStateDecoration::GetDecoSelected), 
    nuiMakeDelegate(this, &nuiStateDecoration::SetDecoSelected)));

  AddAttribute(new nuiAttribute<const nglString&>
   (nglString(_T("OnDisabled")), nuiUnitNone,
    nuiMakeDelegate(this, &nuiStateDecoration::GetDecoDisabled), 
    nuiMakeDelegate(this, &nuiStateDecoration::SetDecoDisabled)));

  AddAttribute(new nuiAttribute<const nglString&>
     (nglString(_T("OnDisabledSelected")), nuiUnitNone,
      nuiMakeDelegate(this, &nuiStateDecoration::GetDecoDisabledSelected), 
      nuiMakeDelegate(this, &nuiStateDecoration::SetDecoDisabledSelected)));

  AddAttribute(new nuiAttribute<const nglString&>
   (nglString(_T("OnUpDisabled")), nuiUnitNone,
    nuiMakeDelegate(this, &nuiStateDecoration::GetDecoUpDisabled), 
    nuiMakeDelegate(this, &nuiStateDecoration::SetDecoUpDisabled)));

  AddAttribute(new nuiAttribute<const nglString&>
   (nglString(_T("OnDownDisabled")), nuiUnitNone,
    nuiMakeDelegate(this, &nuiStateDecoration::GetDecoDownDisabled), 
    nuiMakeDelegate(this, &nuiStateDecoration::SetDecoDownDisabled)));


}
Ejemplo n.º 25
0
void nuiLabel::InitAttributes()
{
  AddAttribute(new nuiAttribute<const nglString&>
  (nglString(_T("Text")), nuiUnitName,
   nuiMakeDelegate(this, &nuiLabel::GetText), 
   nuiMakeDelegate(this, &nuiLabel::SetText)));

  AddAttribute(new nuiAttribute<const nuiColor&>
  (nglString(_T("TextColor")), nuiUnitNone,
   nuiMakeDelegate(this, &nuiLabel::GetTextColor), 
   nuiMakeDelegate(this, &nuiLabel::SetTextColor)));
  

  AddAttribute(new nuiAttribute<const nuiColor&>
  (nglString(_T("BackgroundColor")), nuiUnitNone,
   nuiMakeDelegate(this, &nuiLabel::GetBackgroundColor), 
   nuiMakeDelegate(this, &nuiLabel::SetBackgroundColor)));
  

  AddAttribute(new nuiAttribute<bool>
    (nglString(_T("Background")), nuiUnitYesNo,
    nuiMakeDelegate(this, &nuiLabel::GetBackground), 
    nuiMakeDelegate(this, &nuiLabel::SetBackground)));

  AddAttribute(new nuiAttribute<bool>
    (nglString(_T("Wraping")), nuiUnitYesNo,
    nuiMakeDelegate(this, &nuiLabel::IsWrapping), 
    nuiMakeDelegate(this, &nuiLabel::SetWrapping)));

  AddAttribute(new nuiAttribute<bool>
  (nglString(_T("Underline")), nuiUnitYesNo,
   nuiMakeDelegate(this, &nuiLabel::GetUnderline), 
   nuiMakeDelegate(this, &nuiLabel::SetUnderline)));
  
  AddAttribute(new nuiAttribute<bool>
  (nglString(_T("StrikeThrough")), nuiUnitYesNo,
   nuiMakeDelegate(this, &nuiLabel::GetStrikeThrough), 
   nuiMakeDelegate(this, &nuiLabel::SetStrikeThrough)));
  
  
  AddAttribute(new nuiAttribute<nuiPosition>
  (nglString(_T("TextPosition")), nuiUnitPosition,
   nuiMakeDelegate(this, &nuiLabel::GetTextPosition), 
   nuiMakeDelegate(this, &nuiLabel::SetTextPosition)));
  

  AddAttribute(new nuiAttribute<const nglString&>
  (nglString(_T("Font")), nuiUnitName,
    nuiMakeDelegate(this, &nuiLabel::_GetFont), 
    nuiMakeDelegate(this, &nuiLabel::_SetFont)));
  
  AddAttribute(new nuiAttribute<nuiOrientation>
  (nglString(_T("Orientation")), nuiUnitNone,
   nuiMakeDelegate(this, &nuiLabel::GetOrientation),
   nuiMakeDelegate(this, &nuiLabel::SetOrientation)));
  
  AddAttribute(new nuiAttribute<nuiSize>
               (nglString(_T("HMargin")), nuiUnitNone,
                nuiMakeDelegate(this, &nuiLabel::GetHMargin), 
                nuiMakeDelegate(this, &nuiLabel::SetHMargin)));
  AddAttribute(new nuiAttribute<nuiSize>
               (nglString(_T("VMargin")), nuiUnitNone,
                nuiMakeDelegate(this, &nuiLabel::GetVMargin), 
                nuiMakeDelegate(this, &nuiLabel::SetVMargin)));

  AddAttribute(new nuiAttribute<bool>
               (nglString(_T("UseEllipsis")), nuiUnitYesNo,
                nuiMakeDelegate(this, &nuiLabel::GetUseEllipsis), 
                nuiMakeDelegate(this, &nuiLabel::UseEllipsis)));
  
}
Ejemplo n.º 26
0
bool nuiFileTree::SetRootPath(const nglPath& rPath)
{
  mRootPath = rPath;
  
  mEventSink.DisconnectAll();

  if (mpFileBox)
    mpFileBox->Trash();
  
  mpFileBox = new nuiVBox(2);
  mpFileBox->SetExpand(nuiExpandShrinkAndGrow);
  AddChild(mpFileBox);
  
  mpFileBox->SetCellMinPixels(0, FIRST_ROW_HEIGHT);
  
  mpScrollView = new nuiScrollView(true,true);
  
  mpFileBox->SetCell(1, mpScrollView);
  mpFileBox->SetCellExpand(1, nuiExpandShrinkAndGrow);

  
  if (rPath == nglPath(ROOTPATH_ALLVOLUMES))
  {
    mpFileBox->SetCell(0, NULL);
    
    nuiTreeNodePtr pRoot = new nuiTreeNode(ROOTPATH_ALLVOLUMES);
    pRoot->Open(true);

    mpTreeView = new nuiTreeView(pRoot, false);
    mpTreeView->SetDeSelectable(false);
    mpTreeView->SetMultiSelectable(true);

    mpScrollView->AddChild(mpTreeView);

    std::list<nglPathVolume> volumes;
    nglPath::GetVolumes(volumes, nglPathVolume::All);
    
    std::list<nglPathVolume>::iterator it = volumes.begin();
    std::list<nglPathVolume>::iterator end = volumes.end();

    while (it != end)
    {      
      
      
      const nglPathVolume vol(*it);

      nuiTreeNodePtr pNode = GetNewNode(vol.mPath);
      pRoot->AddChild(pNode);
      
      ++it;
    }
    
    mpTreeView->SetDragStartDelegate(nuiMakeDelegate(this, &nuiFileTree::OnDragStartDelegate));
    mpTreeView->SetDragRequestDataDelegate(nuiMakeDelegate(this, &nuiFileTree::OnDragRequestDataDelegate));
    mpTreeView->SetDragStopDelegate(nuiMakeDelegate(this, &nuiFileTree::OnDragStopDelegate));
    
    return true;
  }
  
  
  // "go to parent folder" link
  nuiButton* pBtn = new nuiButton();
  pBtn->SetPosition(nuiLeft);
  pBtn->SetObjectClass(_T("nuiFileTree::ParentFolderButton"));
  pBtn->SetObjectName(_T("nuiFileTree::ParentFolderButton"));
  
  pBtn->InvalidateLayout();

  nuiImage* pIcon = new nuiImage();
  pIcon->SetObjectName(_T("nuiFileTree::ParentFolderIcon"));
  pIcon->SetObjectClass(_T("nuiFileTree::ParentFolderIcon"));
  pBtn->AddChild(pIcon);
  
  
  // connect link to event
  mEventSink.Connect(pBtn->Activated, &nuiFileTree::OnGotoParentFolder);
  
  
  mpFileBox->SetCell(0, pBtn);

  nuiTreeNodePtr pNode = GetNewNode(rPath);  
  
  
  
  if (pNode)
  {
    nuiTreeNodePtr pRoot = new nuiTreeNode(_T("HiddenRoot"));
    pRoot->AddChild(pNode);
    pRoot->Open(true);
    pNode->Open(true);

    mpTreeView = new nuiTreeView(pRoot, false);
    mpTreeView->SetDeSelectable(false);
    mpScrollView->AddChild(mpTreeView);
  }

  mpTreeView->SetDragStartDelegate(nuiMakeDelegate(this, &nuiFileTree::OnDragStartDelegate));
  mpTreeView->SetDragRequestDataDelegate(nuiMakeDelegate(this, &nuiFileTree::OnDragRequestDataDelegate));
  mpTreeView->SetDragStopDelegate(nuiMakeDelegate(this, &nuiFileTree::OnDragStopDelegate));
  
  
  return true;
}
Ejemplo n.º 27
0
nuiCoverFlow::nuiCoverFlow()
: mSelectedImage(0),
  mBackground(0, 0, 0, 255),
  mReflectionStart(0.3),
  mReflectionEnd(0.0),
  mDrawBackground(true),
  mYOffset(0.0f),
  mSelectionYOffset(0.0f),
  mAngle(60),
  mSideShift(1.1),
  mSideGap(.19),
  mSideDepth(.7),
  mPos(0.0f),
  mLastTime(nglTime()),
  mTimer(1.0f / 30.0f),
  mFlowSink(this)
{
  if (SetObjectClass(_T("nuiCoverFlow")))
  {
    AddAttribute(new nuiAttribute<int32>
                 (nglString(_T("SelectedImage")), nuiUnitNone,
                  nuiMakeDelegate(this, &nuiCoverFlow::GetSelectedIndex), 
                  nuiMakeDelegate(this, &nuiCoverFlow::SelectImageIndex)));
    
    AddAttribute(new nuiAttribute<int32>
                 (nglString(_T("SelectedImageNow")), nuiUnitNone,
                  nuiMakeDelegate(this, &nuiCoverFlow::GetSelectedIndex), 
                  nuiMakeDelegate(this, &nuiCoverFlow::SelectImageIndexNow)));
    
    AddAttribute(new nuiAttribute<float>
                 (nglString(_T("ReflectionStart")), nuiUnitNone,
                  nuiMakeDelegate(this, &nuiCoverFlow::GetReflectionStart), 
                  nuiMakeDelegate(this, &nuiCoverFlow::SetReflectionStart)));

    AddAttribute(new nuiAttribute<float>
                 (nglString(_T("ReflectionEnd")), nuiUnitNone,
                  nuiMakeDelegate(this, &nuiCoverFlow::GetReflectionEnd), 
                  nuiMakeDelegate(this, &nuiCoverFlow::SetReflectionEnd)));

    AddAttribute(new nuiAttribute<bool>
                 (nglString(_T("DrawBackground")), nuiUnitNone,
                  nuiMakeDelegate(this, &nuiCoverFlow::GetDrawBackground), 
                  nuiMakeDelegate(this, &nuiCoverFlow::SetDrawBackground)));

    AddAttribute(new nuiAttribute<float>
                 (nglString(_T("YOffset")), nuiUnitNone,
                  nuiMakeDelegate(this, &nuiCoverFlow::GetYOffset), 
                  nuiMakeDelegate(this, &nuiCoverFlow::SetYOffset)));
    
    AddAttribute(new nuiAttribute<float>
                 (nglString(_T("SelectionYOffset")), nuiUnitNone,
                  nuiMakeDelegate(this, &nuiCoverFlow::GetSelectionYOffset), 
                  nuiMakeDelegate(this, &nuiCoverFlow::SetSelectionYOffset)));
    
    AddAttribute(new nuiAttribute<float>
                 (nglString(_T("Angle")), nuiUnitNone,
                  nuiMakeDelegate(this, &nuiCoverFlow::GetAngle), 
                  nuiMakeDelegate(this, &nuiCoverFlow::SetAngle)));
    
    AddAttribute(new nuiAttribute<float>
                 (nglString(_T("SideShift")), nuiUnitNone,
                  nuiMakeDelegate(this, &nuiCoverFlow::GetSideShift), 
                  nuiMakeDelegate(this, &nuiCoverFlow::SetSideShift)));
    
    AddAttribute(new nuiAttribute<float>
                 (nglString(_T("SideGap")), nuiUnitNone,
                  nuiMakeDelegate(this, &nuiCoverFlow::GetSideGap), 
                  nuiMakeDelegate(this, &nuiCoverFlow::SetSideGap)));
    
    AddAttribute(new nuiAttribute<float>
                 (nglString(_T("SideDepth")), nuiUnitNone,
                  nuiMakeDelegate(this, &nuiCoverFlow::GetSideDepth), 
                  nuiMakeDelegate(this, &nuiCoverFlow::SetSideDepth)));
    
    AddAttribute(new nuiAttribute<const nuiColor&>
                 (nglString(_T("BackgroundColor")), nuiUnitNone,
                  nuiMakeDelegate(this, &nuiCoverFlow::GetBackgroundColor), 
                  nuiMakeDelegate(this, &nuiCoverFlow::SetBackgroundColor)));
  }
  
  mFlowSink.Connect(mTimer.Tick, &nuiCoverFlow::OnUpdateTime);
  SetWantKeyboardFocus(true);
}
Ejemplo n.º 28
0
nuiAnimation::nuiAnimation()
: mAnimSink(this)
{
  mCount = 0;
  mCurrentPosition = 0;
  mDuration = 0.5;
  mCurrentTime = 0;
  mDirection = 1.0;
  mLoopMode = eAnimLoopForward;
  mUpdatingTime = false;
  mEnableCallbacks = true;
  mDeleteOnStop = false;

  mpEasing = NULL;
  //(nuiEasingMethod)(&::nuiEasingIdentity);
  
  AcquireTimer();
  
  if (SetObjectClass(_T("nuiAnimation")))
  {
    AddAttribute(new nuiAttribute<double>
                 (nglString(_T("CurrentTime")), nuiUnitSeconds,
                  nuiMakeDelegate(this, &nuiAnimation::GetTimeFromStart),
                  nuiMakeDelegate(this, &nuiAnimation::SetTimeFromStart)));
    
    AddAttribute(new nuiAttribute<double>
                 (nglString(_T("SetTimeFromNow")), nuiUnitSeconds,
                  nuiMakeDelegate(this, &nuiAnimation::GetTimeFromNow),
                  nuiMakeDelegate(this, &nuiAnimation::SetTimeFromNow)));

    AddAttribute(new nuiAttribute<double>
                 (nglString(_T("CurrentTimeFromEnd")), nuiUnitSeconds,
                  nuiMakeDelegate(this, &nuiAnimation::GetTimeFromEnd),
                  nuiMakeDelegate(this, &nuiAnimation::SetTimeFromEnd)));
    
    AddAttribute(new nuiAttribute<double>
                 (nglString(_T("Position")), nuiUnitSize,
                  nuiMakeDelegate(this, &nuiAnimation::GetPosition)));
    
    AddAttribute(new nuiAttribute<bool>
                 (nglString(_T("IsPlaying")), nuiUnitBoolean,
                  nuiMakeDelegate(this, &nuiAnimation::IsPlaying)));
        
    AddAttribute(new nuiAttribute<double>
                 (nglString(_T("Duration")), nuiUnitSeconds,
                  nuiMakeDelegate(this, &nuiAnimation::GetDuration),
                  nuiMakeDelegate(this, &nuiAnimation::SetDuration)));

    AddAttribute(new nuiAttribute<bool>
                 (nglString(_T("DeleteOnStop")), nuiUnitBoolean,
                  nuiMakeDelegate(this, &nuiAnimation::GetDeleteOnStop),
                  nuiMakeDelegate(this, &nuiAnimation::SetDeleteOnStop)));
    
  }
}
Ejemplo n.º 29
0
void nuiFontRequest::InitAttributes()
{
  // Name
  AddAttribute(new nuiAttribute<const nglString&>
               (nglString(_T("Name")), nuiUnitName,
                nuiFastDelegate0<const nglString&>(),
                nuiMakeDelegate(this, &nuiFontRequest::_SetName)));
  
  // GenericName
  AddAttribute(new nuiAttribute<const nglString&>
               (nglString(_T("GenericName")), nuiUnitName,
                nuiFastDelegate0<const nglString&>(),
                nuiMakeDelegate(this, &nuiFontRequest::_SetGenericName)));
    
  // Style
  AddAttribute(new nuiAttribute<const nglString&>
               (nglString(_T("Style")), nuiUnitName,
                nuiFastDelegate0<const nglString&>(),
                nuiMakeDelegate(this, &nuiFontRequest::_SetStyle)));
  
  // Face
  AddAttribute(new nuiAttribute<int32>
               (nglString(_T("Face")), nuiUnitNone,
                nuiFastDelegate0<int32>(),
                nuiMakeDelegate(this, &nuiFontRequest::_SetFace)));
  
  // Size
  AddAttribute(new nuiAttribute<int32>
               (nglString(_T("Size")), nuiUnitPixels,
                nuiFastDelegate0<int32>(),
                nuiMakeDelegate(this, &nuiFontRequest::_SetSize)));
  
  // Italic
  AddAttribute(new nuiAttribute<bool>
               (nglString(_T("Italic")), nuiUnitName,
                nuiFastDelegate0<bool>(),
                nuiMakeDelegate(this, &nuiFontRequest::_SetItalic)));
  
  // Bold
  AddAttribute(new nuiAttribute<bool>
               (nglString(_T("Bold")), nuiUnitName,
                nuiFastDelegate0<bool>(),
                nuiMakeDelegate(this, &nuiFontRequest::_SetBold)));
  
  // Proportionnal
  AddAttribute(new nuiAttribute<bool>
               (nglString(_T("Proportionnal")), nuiUnitName,
                nuiFastDelegate0<bool>(),
                nuiMakeDelegate(this, &nuiFontRequest::_SetProportionnal)));
  
  // Monospace
  AddAttribute(new nuiAttribute<bool>
               (nglString(_T("Monospace")), nuiUnitName,
                nuiFastDelegate0<bool>(),
                nuiMakeDelegate(this, &nuiFontRequest::_SetMonospace)));
  
  // Scalable
  AddAttribute(new nuiAttribute<bool>
               (nglString(_T("Scalable")), nuiUnitName,
                nuiFastDelegate0<bool>(),
                nuiMakeDelegate(this, &nuiFontRequest::_SetScalable)));
  
  // Panose
  AddAttribute(new nuiAttribute<const nglString&>
               (nglString(_T("Panose")), nuiUnitName,
                nuiFastDelegate0<const nglString&>(),
                nuiMakeDelegate(this, &nuiFontRequest::_SetPanose)));
}
Ejemplo n.º 30
0
//*****************************************************************************************
//
// AUDIO CONTROLS
//
//*****************************************************************************************
bool nuiAudioFifo::Start()
{
    if (mStarted)
        return false;

    nuiAudioDeviceManager::Get().Update();
    if (mOutDeviceName.IsEmpty() || mAPIName.IsEmpty())
    {
        mpAudioDevice = nuiAudioDeviceManager::Get().GetDefaultOutputDevice();
    }
    else
    {
        mpAudioDevice = nuiAudioDeviceManager::Get().GetDeviceWithNameAndAPI(mOutDeviceName, mAPIName);
    }

    if (!mpAudioDevice)
    {
        NGL_LOG(_T("nuiAudioFifo"), NGL_LOG_ERROR, _T("Start ERROR : could not retrieve audio device!\n"));
        return false;
    }

    NGL_LOG(_T("nuiAudioFifo"), NGL_LOG_DEBUG, _T("start\n"));



    // means, no input channels for now, and all output channels are active for now...
    std::vector<uint32> inputChannels;
    std::vector<uint32> outputChannels;
    outputChannels.resize(mNbChannels);
    for (uint i=0; i < mNbChannels; i++)
        outputChannels[i] = i;

    //#FIXME : ensure that samplerate and outbufsize are acceptable values for nuiAudioDevice (should enumerate possible value somewhere in the application)

    // open device access and start process
    bool res = mpAudioDevice->Open(inputChannels/*<=> mNbInputChannels, #FIXME ? do we provide some inputs?*/, outputChannels, mSampleRate, mOutbufSize, nuiMakeDelegate(this, &nuiAudioFifo::Process));

    if (!res)
    {
        NGL_LOG(_T("nuiAudioFifo"), NGL_LOG_ERROR, _T("Start ERROR : could not open audio device!\n"));
        return false;
    }

    // start input thread
    nglThread::Start();

    mStarted = true;
    return true;
}