nuiDialogSelectDirectory::nuiDialogSelectDirectory(nuiMainWindow* pParent, const nglString& rTitle, const nglPath& rPath, const nglPath& rRootPath, nuiSize Left, nuiSize Top, nuiSize Width, nuiSize Height)
: nuiDialog(pParent), mpParent(pParent), mPath(rPath), mEventSink(this)
{
  mpContainer = new nuiSimpleContainer();

  nuiSize userWidth = (Width == 0.f) ? mpParent->GetWidth() * .8 : Width;
  nuiSize userHeight = (Height == 0.f) ? mpParent->GetHeight() * .8 : Height;
  
  mpContainer->SetUserSize(userWidth, userHeight);
  
  mpSelector = new nuiFileSelector(mPath, rRootPath);
  mpContainer->AddChild(mpSelector);
  
  mEventSink.Connect(mpSelector->OK, &nuiDialogSelectDirectory::OnSelectorOK);
  
  nuiLabel* pTitle = new nuiLabel(rTitle);
  pTitle->SetObjectName(_T("nuiDialog::Title"));
  InitDialog(pTitle, NULL, nuiDialog::eDialogButtonOk + nuiDialog::eDialogButtonCancel);
  
  nuiButton* pButton = new nuiButton(_T("New Folder"));
  pButton->SetObjectName(_T("nuiDialog::Button"));
  AddButton(pButton, nuiDialog::eDialogButtonCustom);
  mEventSink.Connect(pButton->Activated, &nuiDialogSelectDirectory::OnCreateNewFolder);
  
  SetContents(mpContainer);
  
  if ((Top == 0.f) && (Left == 0.f) && (Width == 0.f) && (Height == 0.f))
    SetDefaultPos();
  else
    SetUserPos(Left, Top);

  mEventSink.Connect(DialogDone, &nuiDialogSelectDirectory::OnDialogDone);
  
  mpSelector->UpdateLayout();
}
void CEditSliderCtrl::SetInfo(const INFO& Info, CNumEdit *Edit)
{
    SetEditCtrl(Edit);
    SetRange(Info.RangeMin, Info.RangeMax, TRUE);
    SetLogBase(Info.LogBase);
    SetScale(Info.SliderScale);
    SetDefaultPos(Info.DefaultPos);
    SetTicCount(Info.TicCount);
    if (m_Edit != NULL) {
        m_Edit->SetScale(Info.EditScale);
        m_Edit->SetPrecision(Info.EditPrecision);
    }
}
Example #3
0
void nuiDialogSelectFile::Init(nuiMainWindow* pParent, const nglString& rTitle, const nglPath& rPath, const nglPath& rRootPath, const nglString& defaultEntry, const std::list<nglString>& rFilters, bool showHiddenFiles, nuiSize Left, nuiSize Top, nuiSize Width, nuiSize Height)
{
  mPath = rPath;
  mRootPath = rRootPath;

  nuiSimpleContainer* pEditContainer = new nuiSimpleContainer();
  pEditContainer->SetBorder(16,16,10,0);
  
  mpEditLine = new nuiEditLine();
  mpEditLine->SetObjectName(_T("nuiDialog::EditLine"));
  mpEditLine->SetObjectClass(_T("nuiDialog::EditLine"));
  mpEditLine->SetColor(eNormalTextFg, nuiColor(64,64,64));
  mpEditLine->SetColor(eSelectedTextFg, nuiColor(64,64,64));
  pEditContainer->AddChild(mpEditLine);
	
  mpContainer = new nuiSimpleContainer();
  
  
  mpSelector = new nuiFileSelector(rPath, rRootPath, rFilters, mpEditLine);
  mpSelector->SetBorder(6,0);
  
  mEventSink.Connect(mpSelector->OK, &nuiDialogSelectFile::OnSelectorOK);
  
  nuiVBox* pBox = new nuiVBox();
  mpContainer->AddChild(mpSelector);
  pBox->AddCell(mpContainer);
  

  
  pBox->AddCell(pEditContainer);
  
  nuiSize userWidth = (Width == 0.f) ? mpParent->GetWidth() * .8 : Width;
  nuiSize userHeight = (Height == 0.f) ? mpParent->GetHeight() * .8 : Height;
  mpContainer->SetUserSize(userWidth, userHeight);
  
  
  pBox->SetCellExpand(0, nuiExpandShrinkAndGrow);
  pBox->SetCellExpand(1, nuiExpandFixed);
  

  
  nuiLabel* pTitle = new nuiLabel(rTitle);
//  pTitle->SetObjectName(_T("nuiDialogSelectFile::Title"));
//  pTitle->SetObjectClass(_T("nuiDialogSelectFile::Title"));
  
  nuiSimpleContainer* pLayoutPane = new nuiSimpleContainer();
  pLayoutPane->SetObjectClass(_T("nuiDialog::Pane"));
  pLayoutPane->SetObjectName(_T("nuiDialog::Pane"));
  pLayoutPane->SetColor(eNormalTextFg, nuiColor(0,0,0));
  
  nuiDefaultDecoration::Dialog(pLayoutPane);
  
  InitDialog(pTitle, pLayoutPane, nuiDialog::eDialogButtonOk | nuiDialog::eDialogButtonCancel);
    

  
  nuiButton* pButton = new nuiButton(_T("New Folder"));
  pButton->SetObjectName(_T("nuiDialog::Button"));
  AddButton(pButton, nuiDialog::eDialogButtonCustom);
  mEventSink.Connect(pButton->Activated, &nuiDialogSelectFile::OnCreateNewFolder);
  
  nuiDialog::GetButtonsGrid()->SetBorder(0,10,0,10);
  
  
  SetContents(pBox, nuiCenter);
  if ((Top == 0.f) && (Left == 0.f) && (Width == 0.f) && (Height == 0.f))
    SetDefaultPos();
  else
    SetUserPos(Left, Top);
  mEventSink.Connect(DialogDone, &nuiDialogSelectFile::OnDialogDone);
  
  mpSelector->UpdateLayout();

  mpEditLine->SetText(defaultEntry);
}