JFRect JViewSet::calculateExtent() { JFRect rect; void* arg[] = { &rect, &(eventMask=0)}; forEachChild(DoCalculateExtent, arg); reshape(rect); return rect; }
void JViewSet::ungroup(JViewSet& np, JFocusSet& set) { if (!parent->parent) { void* arg[] = {&np, &set}; forEachChild(DoUngroup, arg); remove(); } else JViewObj::ungroup(np, set); }
boolean JViewSet::handleJEvent(JEvent& e) { switch (e.id) { case JEvent::GLOBAL_KEY_PRESS: case JEvent::GLOBAL_KEY_ACTION: case JEvent::GLOBAL_KEY_RELEASE: if (!needEvent(GLOBAL_KEYBOARD_MASK)) return false; break; case JEvent::GLOBAL_MOUSE_MOVE: case JEvent::GLOBAL_MOUSE_DOWN: case JEvent::GLOBAL_MOUSE_ACTION: case JEvent::GLOBAL_MOUSE_UP: if (!needEvent(GLOBAL_MOUSE_MASK)) return false; break; case JEvent::KEY_PRESS: case JEvent::KEY_ACTION: case JEvent::KEY_RELEASE: if (!needEvent(KEYBOARD_MASK)) return false; break; case JEvent::GOT_FOCUS: case JEvent::LOST_FOCUS: if (!needEvent(FOCUS_MASK)) return false; break; case JEvent::MIXER_LINE_NOTIFY: case JEvent::MIXER_CONTROL_NOTIFY: if (!needEvent(MIXER_MASK)) return false; break; } forEachChild(DoHandleJEvent, (void**)&e); return true; }
JArray JViewSet::getProperties() { JArray properties; JDictionary dict(101); void* arg[] = { &properties, &dict}; forEachChild(DoGetProperties, arg); return properties; }
// Increases count if key is glo_from by the number of its edges // equal to glo_to void countEdges(void *key, void *value) { uint64 from = *(uint64 *)key; if(from == glo_from) { uint64 *edges = (uint64 *)value; forEachChild(from, edges, increaseCountByMatchingEdges); } }
void KdmItem::updateVisible() { updateThisVisible(); forEachChild (itm) itm->updateVisible(); }
void printNodeAndChildren(void *k, void *v) { uint64 parent = *(uint64 *)k; uint64 *edges = (uint64 *)v; printf("%lli -> [", parent); forEachChild(parent, edges, printEdge); printf("]\n"); }
JViewObj* JViewSet::duplicate(JViewSet* _parent, JDictionary* dict) { JViewSet *set = (JViewSet*)JViewObj::duplicate(_parent); void* arg[] = { set, dict}; set->delAll(); forEachChild(DoDuplicate, arg); return set; }
JFocusSet JViewSet::select(JFRect& r) { JFocusSet set; if (r && *this) { void* arg[] = {&r, &set}; forEachChild(DoLocate, arg); } return set; }
void KdmItem::plugActions(bool plug) { if (myWidget) plug = false; doPlugActions(plug); forEachChild (itm) itm->plugActions(plug); }
JViewObj* JFocusSet::duplicateFocus(JViewSet& linkSet, JViewSet* _parent) { JFocusSet newSet; JDictionary dict(101); void* arg[] = { _parent, &dict, &newSet}; forEachChild(DoFocusDuplicate, arg); linkSet.forEachChild(DoLinkRebuild, (void**)&dict); newSet.reshape(*this); *this = newSet; return null; }
void KdmItem::showWidget(bool show) { if (!isVisible()) show = false; if (myWidget) { if (show) { QSize sz(area.size().expandedTo(myWidget->minimumSize()) .boundedTo(myWidget->maximumSize())); QSize off((area.size() - sz) / 2); myWidget->setGeometry( area.x() + off.width(), area.y() + off.height(), sz.width(), sz.height()); } myWidget->setVisible(show); } forEachChild (itm) itm->showWidget(show); }
void KdmItem::paint(QPainter *p, const QRect &rect, bool background, bool primaryScreen) { if (!isVisible()) return; if (background && (p->device()->width() < m_minScrWidth || p->device()->height() < m_minScrHeight)) return; if (myWidget) return; QRect contentsRect = area.intersected(rect); if (!contentsRect.isEmpty() && (!background || isBackground) && (paintOnScreen == ScrAll || ((paintOnScreen == ScrGreeter) == primaryScreen))) { drawContents(p, contentsRect); if (debugLevel & DEBUG_THEMING) { // Draw bounding rect for this item QPen pen(Qt::white); pen.setCapStyle(Qt::FlatCap); pen.setDashPattern(QVector<qreal>() << 5 << 6); p->setPen(pen); p->setBackgroundMode(Qt::OpaqueMode); p->setBackground(Qt::black); p->drawRect(area.x(), area.y(), area.width() - 1, area.height() - 1); p->setBackgroundMode(Qt::TransparentMode); } } // Dispatch paint events to children forEachChild (itm) itm->paint(p, rect, background, primaryScreen); }
bool NCObject::isOnTopOf(NCObject* a, NCObject* b) { // Determine which is on top, winKeys or the chat windows int aPos = 0; int bPos = 0; int counter = 0; forEachChild([&](ncpp::ncobject::NCObject* obj) { ++counter; if(obj == a) { aPos = counter; } else if(obj == b) { bPos = counter; } if(0 != aPos && 0 != bPos) return false; return true; }); return aPos > bPos; }
void JFocusSet::toFront() { forEachChild(DoToFront);}
void JViewSet::reparent(JViewSet& np) { forEachChild(DoReparent, (void**)&np);}
void KdmItem::update() { forEachChild (itm) itm->update(); }
void JViewSet::close() { forEachChild(DoClose); JViewObj::close(); }
void JViewSet::startup() { JViewObj::startup(); forEachChild(DoStartup); }
void JViewSet::remove() { forEachChild(DoRemove); JViewObj::remove(); }
void JViewSet::rescale(JFRect& info, double wscale, double hscale) { void* arg[] = { &info, &wscale, &hscale}; forEachChild(DoRescale, arg); JViewObj::rescale(info, wscale, hscale); }
void JViewSet::nearest(double _x, double _y, double& d, JViewObj*& dest) { void* arg[] = {&_x, &_y, &d, &dest}; forEachChild(DoNearest, arg); }
void JViewSet::touch(JFRect& r, JFocusSet& set) { if (r && *this) { void* arg[] = {&r, &set}; forEachChild(DoTouch, arg); } }
void JViewSet::toHash(JHashTable& hash) { forEachChild(DoToHash, (void**)&hash);}
void JViewSet::fixPointer(JDictionary& dict) { forEachChild(DoFixPointer, (void**)&dict);}
void JViewSet::fixParent(JViewSet* _parent) { parent = _parent; forEachChild(DoFixParent, (void**)this); }
JFRect JViewSet::calculateUpdate() { JFRect rect; forEachChild(DoCalculateUpdate, (void**)&rect); return rect; }
void JFocusSet::ungroup(JViewSet& np, JFocusSet& set) { void* arg[] = {&np, &set}; forEachChild(DoUngroup, arg); }
boolean JViewSet::updateProperty(JProperty& prop) { forEachChild(DoUpdateProperty, (void**)&prop); return false; }
JFPoint& JViewSet::translate(double dx, double dy) { JViewObj::translate(dx, dy); void* arg[] = { &dx, &dy}; forEachChild(DoTranslate, arg); return *this; }