void MButtonGroup::addButton(MButton *button) { Q_D(MButtonGroup); if (d->buttonList.contains(button)) { return; } d->buttonList.append(button); button->setGroup(this); connect(button, SIGNAL(pressed()), d, SLOT(buttonPress())); connect(button, SIGNAL(released()), d, SLOT(buttonRelease())); connect(button, SIGNAL(clicked()), d, SLOT(buttonClick())); connect(button, SIGNAL(toggled(bool)), d, SLOT(buttonToggle(bool))); /* Adding a checked button to a group makes it the currently checked button */ if (button->isCheckable() && button->isChecked()) { if (exclusive() && d->checkedButton) { //TODO do this somehow differently if possible. d->exclusive = false; d->checkedButton->setChecked(false); d->exclusive = true; } d->checkedButton = button; } }
void MSWidget::event(const XEvent *pEvent_) { if (!_eventOverride||!(*_eventOverride)(pEvent_->type)) switch (pEvent_->type) { case Expose: expose(pEvent_); break; case NoExpose: noExpose(pEvent_); break; case GraphicsExpose: graphicsExpose(pEvent_); break; case VisibilityNotify: visibilityNotify(pEvent_); break; case EnterNotify: if (_server->eventGrabbed(pEvent_,this)==MSTrue) enterNotify(pEvent_); break; case LeaveNotify: leaveNotify(pEvent_); break; case ConfigureNotify: configureNotify(pEvent_); break; case CreateNotify: createNotify(pEvent_); break; case DestroyNotify: destroyNotify(pEvent_); break; case ReparentNotify: reparentNotify(pEvent_); break; case MapNotify: mapNotify(pEvent_); break; case UnmapNotify: unmapNotify(pEvent_); break; case PropertyNotify: propertyNotify(pEvent_); break; case SelectionNotify: selectionNotify(pEvent_); break; case SelectionClear: selectionClear(pEvent_); break; case SelectionRequest: selectionRequest(pEvent_); break; case ClientMessage: clientMessage(pEvent_); break; case MotionNotify: if (_server->eventGrabbed(pEvent_,this)==MSTrue) motionNotify(pEvent_); break; case ButtonRelease: if (_server->eventGrabbed(pEvent_,this)==MSTrue) buttonRelease(pEvent_); break; case ButtonPress: if (_server->eventGrabbed(pEvent_,this)==MSTrue) buttonPress(pEvent_); else _server->bell(); break; case KeyRelease: if (_server->eventGrabbed(pEvent_,this)==MSTrue) keyRelease(pEvent_); break; case KeyPress: if (_server->eventGrabbed(pEvent_,this)==MSTrue) keyPressEvent(pEvent_); else _server->bell(); break; case FocusIn: focusInEventNotify(pEvent_); break; case FocusOut: focusOutEventNotify(pEvent_); break; default: break; } // this event handler is intended to support the mstk builder // i.e. it is easier to get events this way rather than // subclass every widget and override the event methods if (_eventHandler!=0) (*_eventHandler)(this,pEvent_,_eventHandlerData); }