// -------------------------------------------------------------------------------------------------------- void KFileTreeWidget::setCurrentDir ( const std::string & dirName ) { std::string absDirPath; if (dirName[0] == '.' && current_dir_node) { // path relative to the current directory should begin with a dot absDirPath = current_dir_node->getAbsPathName() + "/" + dirName; } else { absDirPath = kFileAbsPathName(dirName); } if (kFileIsDir(absDirPath) && (current_dir_node == NULL || (current_dir_node->getAbsPathName() != absDirPath))) { removeAllPickables(); if (current_dir_node) { delete current_dir_node; } current_dir_node = new KFileTreeDirCurrent(absDirPath); addPickable(up_node); addPickable(current_dir_node); current_dir_node->createTree(); up_node->setCurrentDir(current_dir_node); initializeIds(); deleteDisplayList(); notifyReceivers (current_dir_node->getAbsPathName(), KDL_NOTIFICATION_TYPE_OPEN_DIRECTORY); } }
// -------------------------------------------------------------------------------------------------------- KFileTreeWidget::~KFileTreeWidget () { if (current_dir_node) { delete current_dir_node; } delete up_node; deleteDisplayList(); }
void RenderNode::destroyHardwareResources(TreeObserver* observer, TreeInfo* info) { if (mLayer) { destroyLayer(mLayer); mLayer = nullptr; } if (mDisplayList) { for (auto&& child : mDisplayList->getChildren()) { child->renderNode->destroyHardwareResources(observer, info); } if (mNeedsDisplayListSync) { // Next prepare tree we are going to push a new display list, so we can // drop our current one now deleteDisplayList(observer, info); } } }
// -------------------------------------------------------------------------------------------------------- bool KFileTreeWidget::pick ( const KMouseEvent & event ) { if (KWidget::flags[KDL_WIDGET_FLAG_VISIBLE] == false) return false; KPosition mouseWidgetPos = event.pos - getScreenPos(); if ((mouseWidgetPos.x > 0) && (mouseWidgetPos.x < size.w) && (mouseWidgetPos.y > 0) && (mouseWidgetPos.y < size.h)) { deleteDisplayList(); getWindow()->unpick(); KPickHandler::pick(event); return true; } else { return false; } }
void RenderNode::syncDisplayList(TreeInfo* info) { // Make sure we inc first so that we don't fluctuate between 0 and 1, // which would thrash the layer cache if (mStagingDisplayList) { for (auto&& child : mStagingDisplayList->getChildren()) { child->renderNode->incParentRefCount(); } } deleteDisplayList(info ? info->observer : nullptr, info); mDisplayList = mStagingDisplayList; mStagingDisplayList = nullptr; if (mDisplayList) { for (auto& iter : mDisplayList->getFunctors()) { (*iter.functor)(DrawGlInfo::kModeSync, nullptr); } for (size_t i = 0; i < mDisplayList->getPushStagingFunctors().size(); i++) { (*mDisplayList->getPushStagingFunctors()[i])(); } } }
// -------------------------------------------------------------------------------------------------------- void KFileTreeWidget::unpicked () { deleteDisplayList(); }
// -------------------------------------------------------------------------------------------------------- void KFileTreeWidget::picked () { deleteDisplayList(); notifyReceivers (((KFileTreeNode*)picked_pickable)->getPathName(), KDL_NOTIFICATION_TYPE_SELECT_NODE); }