QWidget *FormWindowBase::widgetUnderMouse(const QPoint &formPos, WidgetUnderMouseMode /* wum */) { // widget_under_mouse might be some temporary thing like the dropLine. We need // the actual widget that's part of the edited GUI. QWidget *rc = widgetAt(formPos); if (!rc || qobject_cast<ConnectionEdit*>(rc)) return 0; if (rc == mainContainer()) { // Refuse main container areas if the main container has a container extension, // for example when hitting QToolBox/QTabWidget empty areas. if (qt_extension<QDesignerContainerExtension*>(core()->extensionManager(), rc)) return 0; return rc; } // If we hit on container extension type container, make sure // we use the top-most current page if (QWidget *container = findContainer(rc, false)) if (QDesignerContainerExtension *c = qt_extension<QDesignerContainerExtension*>(core()->extensionManager(), container)) { // For container that do not have a "stacked" nature (QToolBox, QMdiArea), // make sure the position is within the current page const int ci = c->currentIndex(); if (ci < 0) return 0; QWidget *page = c->widget(ci); QRect pageGeometry = page->geometry(); pageGeometry.moveTo(page->mapTo(this, pageGeometry.topLeft())); if (!pageGeometry.contains(formPos)) return 0; return page; } return rc; }
void MToolBarLayoutPolicy::setLayoutPosition(int widgetIndex, M::Position position) { MWidgetController* widget = dynamic_cast<MWidgetController*>(widgetAt(widgetIndex)); if (widget) { widget->setLayoutPosition(position); } }
QWidget *FormWindowBase::widgetUnderMouse(const QPoint &formPos, WidgetUnderMouseMode /* wum */) { // widget_under_mouse might be some temporary thing like the dropLine. We need // the actual widget that's part of the edited GUI. QWidget *rc = widgetAt(formPos); if (!rc || qobject_cast<ConnectionEdit*>(rc)) return 0; if (QWidget *container = findContainer(rc, false)) if (QDesignerContainerExtension *c = qt_extension<QDesignerContainerExtension*>(core()->extensionManager(), container)) rc = c->widget(c->currentIndex()); return rc; }
int MToolBarLayoutPolicy::labelOnlyButtonCount() const { int cnt(0); for (int i = 0; i < widgetCount(); i++) { MButton *button = dynamic_cast<MButton *>(widgetAt(i)); if (button && !button->text().isEmpty() && button->iconID().isEmpty() && button->viewType() == MButton::defaultType) { cnt++; } } return cnt; }
Widget* Widget::widgetAt(const Point& p) { return widgetAt(p.x, p.y); }
QDesignerWidgetBoxInterface::Widget WidgetBoxCategoryModel::widgetAt(const QModelIndex & index) const { return widgetAt(index.row()); }
bool qapp::x11EventFilter(XEvent *event) { xwindow *client; Window w; XEvent ev; XConfigureRequestEvent *cev; XClientMessageEvent *mev; XCrossingEvent *xev; XCirculateRequestEvent *rev; XPropertyEvent *pev; #ifdef DEBUGMSG #include "eventnames.h" if(event->type < 36) logmsg << "Received: " << event_names[event->type] << " (WId:" << event->xany.window << ")\n"; #endif while(waitpid(-1, NULL, WNOHANG) > 0); if(sighup) { wm_restart(); tb_mn->readmenu(); read_cprops(); sighup = FALSE; } switch(event->type) { case DestroyNotify: w = event->xdestroywindow.window; if((client = cwindows.find(w)) != NULL) { clients.remove(client); if(smode && client->isstate()) keyboard::tscreen(); // turn off screen mode tb_pg->draw_pager(); return TRUE; } if(tb_ap->remove(w)) // client on toolbar return TRUE; if(event->xdestroywindow.event != w) return TRUE; if(w == tb->winId() || w == tb_pg->winId() || w == tb_wl->winId() || w == tb_mn->winId() || w == tb_pb->winId()) sig_term(SIGTERM); return FALSE; case MapNotify: if(event->xmap.event != event->xmap.window) return TRUE; if((client = pwindows.find(event->xmap.window)) != NULL) tb_pg->add(client); // add to pager return FALSE; case UnmapNotify: if((client = cwindows.find(event->xunmap.window)) != NULL) { if(event->xunmap.send_event) { // client requested transitions // normal -> withdrawn // iconic -> withdrawn client->withdraw(); } else client->unmap(); return TRUE; } if(event->xunmap.event != event->xunmap.window) return TRUE; if(pwindows.find(event->xunmap.window) != NULL) tb_pg->draw_pager(); return FALSE; case EnterNotify: xev = &event->xcrossing; if(event->xcrossing.window == qt_xrootwin()) { stopautofocus(); rootptr = TRUE; } else if(mrb == FALSE && menu_open == FALSE && (client = (xwindow *)widgetAt(xev->x_root, xev->y_root)) != NULL && clients.find(client) != -1 && ((client = clients.current()) != focusclient || rootptr)) { rootptr = FALSE; setinactive(client); // old client to inactive, save new client if(xev->detail != NotifyInferior) client->startautofocus(); client->setchildfocus(xev->time); client->setcmapfocus(); } return FALSE; case ColormapNotify: if((client = cwindows.find(event->xcolormap.window)) != NULL) { client->setcmap(event->xcolormap.colormap); return TRUE; } return FALSE; case PropertyNotify: pev = &event->xproperty; if((client = cwindows.find(pev->window)) != NULL) { if(pev->atom == XA_WM_NORMAL_HINTS) { client->get_wmnormalhints(); } else if(pev->atom == XA_WM_HINTS) { client->get_wmhints(); } else if(pev->atom == XA_WM_NAME || pev->atom == XA_WM_ICON_NAME) { client->get_wmname(); } else if(pev->atom == wm_colormaps) { client->get_colormaps(); if(client == focusclient) client->setcmapfocus(); } return TRUE; } return FALSE; case ConfigureNotify: if(event->xconfigure.event != event->xconfigure.window) return TRUE; if((client = pwindows.find(event->xconfigure.window)) != NULL) { tb_pg->draw_pager(); while(XCheckTypedEvent(qt_xdisplay(), ConfigureNotify, &ev)); } return TRUE; case ReparentNotify: if((client = cwindows.find(event->xreparent.window)) != NULL && event->xreparent.parent != client->winId()) { clients.remove(client); tb_pg->draw_pager(); } return TRUE; case ButtonPress: w = event->xbutton.window; if(w == qt_xrootwin()) // set focus to root window XSetInputFocus(qt_xdisplay(), w, RevertToPointerRoot, CurrentTime); if(w == tb->winId() || w == tb_pb->winId() || w == tb_ap->winId()) XRaiseWindow(qt_xdisplay(), tb->winId()); if(w == qt_xrootwin() || w == tb_pg->winId()) install_colormap(None); return FALSE; case FocusOut: if(menu_open) // Qt 2.2.4 does not seem to like this if a menu is open return TRUE; return FALSE; case ClientMessage: mev = &event->xclient; if(mev->message_type == wm_change_state && mev->format == 32 && mev->data.l[0] == IconicState && (client = cwindows.find(mev->window)) != NULL) client->iconify(); return TRUE; case CirculateRequest: rev = &event->xcirculaterequest; if(rev->place == PlaceOnTop) XRaiseWindow(qt_xdisplay(), rev->window); else XLowerWindow(qt_xdisplay(), rev->window); return TRUE; case ConfigureRequest: cev = &event->xconfigurerequest; XWindowChanges wc; if((client = cwindows.find(cev->window)) != NULL) { #ifdef DEBUGMSG logmsg << "configure request to client (WId:" << client->winId() << ")\n"; #endif if(cev->value_mask & (CWWidth|CWHeight|CWX|CWY)) { if(smode && client->isstate()) keyboard::tscreen(); if(! client->is_tiled() || client == tmaxclient) { int cx,cy,cw,ch; if(cev->value_mask & CWWidth) cw = cev->width; else cw = client->width(); if(cev->value_mask & CWHeight) ch = cev->height; else ch = client->getcheight(); if((cev->value_mask & CWX) && ! client->is_tiled()) cx = cev->x; else cx = client->x(); if((cev->value_mask & CWY) && ! client->is_tiled()) cy = cev->y; else cy = client->y(); client->resize_request(cx, cy, cw, ch); } cev->value_mask &= ~(CWWidth|CWHeight|CWX|CWY); } if(! cev->value_mask) return TRUE; wc.width = client->width(); wc.height = client->height(); wc.x = client->x(); wc.y = client->y(); wc.border_width = 0; wc.sibling = cev->above; wc.stack_mode = cev->detail; XConfigureWindow(qt_xdisplay(), client->winId(), cev->value_mask, &wc); send_configurenotify(client); } else // never mapped window { if(cev->window == tb->winId() || tb_ap->client_exists(cev->window)) // deny requests on toolbar return TRUE; #ifdef DEBUGMSG logmsg << "configure request to unreparented window (WId:" << cev->window << ")\n"; #endif wc.x = cev->x; wc.y = cev->y; wc.width = cev->width; wc.height = cev->height; cev->value_mask &= (CWX|CWY|CWWidth|CWHeight); XConfigureWindow(qt_xdisplay(), cev->window, cev->value_mask, &wc); } return TRUE; case MapRequest: run_client(event->xmaprequest.window); return TRUE; case KeyPress: return(keyboard::keypress(&event->xkey)); default: if(servershapes && event->type == (ShapeEventBase + ShapeNotify)) { XShapeEvent *sev = (XShapeEvent *)event; if((client = cwindows.find(sev->window)) != NULL) { client->reshape(); return TRUE; } } } return FALSE; }
QWidget *KNWidgetSwitcher::currentWidget() { //Get the widget at m_currentIndex. return widgetAt(m_currentIndex); }
HGWidget* HGView::rootWidget() const { return widgetAt(0); }