nuiHyperLink::nuiHyperLink(const nglString& rURL, const nglString& rLabel) : nuiLabel(rLabel.IsNull() ? rURL : rLabel), mURL(rURL) { if (SetObjectClass(_T("nuiHyperLink"))) InitAttributes(); SetTextColor(nuiColor(_T("nuiHyperLink"))); }
nuiFileTree::nuiFileTree(const nglPath& rPath, const nglPath& rRootPath, const nglString& rFilter, bool showHiddenFiles) : nuiFileSelectorBase(), mEventSink(this) { std::list<nglString> filters; if (!rFilter.IsNull()) filters.push_back(rFilter); Init(rPath, rRootPath, filters, showHiddenFiles); }
void nuiStateDecoration::SetState(nuiStateDescription State, const nglString& rDecorationName) { if (rDecorationName.IsNull()) return; nuiDecoration* pDecoration = nuiDecoration::Get(rDecorationName, true); if (!pDecoration) return; SetState(State, pDecoration); }
nuiStateDecoration::nuiStateDecoration(const nglString& rName, const nglString& rUp, const nglString& rDown, const nglString& rHoverOn, const nglString& rDisabled, const nglString& rDisabledSelected) : nuiDecoration(rName), mClientRect(0,0,0,0), mUseSourceClientRect(false) { if (SetObjectClass(_T("nuiStateDecoration"))) InitAttributes(); if (!rUp.IsNull()) SetState(nuiStateEnabled | nuiStateReleased, GetDecoration(rUp)); if (!rDown.IsNull()) SetState(nuiStateEnabled | nuiStatePressed, GetDecoration(rDown)); if (!rHoverOn.IsNull()) SetState(nuiStateEnabled | nuiStateHoverOn, GetDecoration(rHoverOn)); if (!rDisabled.IsNull()) SetState(nuiStateDisabled | nuiStateReleased, GetDecoration(rDisabled)); if (!rDisabledSelected.IsNull()) { SetState(nuiStateDisabled | nuiStateSelected, GetDecoration(rDisabledSelected)); SetState(nuiStateDisabled | nuiStatePressed, GetDecoration(rDisabledSelected)); } }
bool nuiZipWriter::AddFile(nglIStream* pStream, const nglString& rPathInZip, const nglString& rComment, bool OwnStream) { NGL_ASSERT(IsValid()); zip_fileinfo info; nglTime tm; nglTimeInfo t; tm.GetLocalTime(t); info.tmz_date.tm_sec = t.Seconds; info.tmz_date.tm_min = t.Minutes; info.tmz_date.tm_hour = t.Hours; info.tmz_date.tm_mday = t.Day; info.tmz_date.tm_mon = t.Month; info.tmz_date.tm_year = t.Year; info.dosDate = 0; info.internal_fa = 0; info.external_fa = 0; bool res = zipOpenNewFileInZip(mpZip, rPathInZip.IsNull() ? NULL : rPathInZip.GetStdString().c_str(), &info, NULL, 0, NULL, 0, rComment.IsNull() ? NULL : rComment.GetStdString().c_str(), 0, 0) == Z_OK; if (!res) return res; const uint32 bufsize = 4096; uint8 buf[bufsize]; uint64 todo = pStream->Available(); uint32 _read = -1; while (todo && _read) { uint32 toread = MIN(todo, bufsize); _read = pStream->Read(buf, toread, 1); res = zipWriteInFileInZip(mpZip, buf, _read) == Z_OK; todo -= _read; if (_read != toread) return false; } res = zipCloseFileInZip(mpZip) == Z_OK; if (OwnStream) delete pStream; return res; }
bool nuiZipWriter::Close(const nglString& rComment) { NGL_ASSERT(mpZip); return Z_OK == zipClose(mpZip, rComment.IsNull() ? NULL : rComment.GetStdString().c_str()); mpZip = NULL; }