bool Dialog::onMouseButton(const int x, const int y, const MouseButton button, const bool pressed){ showSelection = false; if (closeButton->isCapturing() || closeButton->isInWidget(x, y)){ closeButton->onMouseButton(x, y, button, pressed); capture = true; return true; } if (currTab < tabs.getCount()){ DialogTab *tab = tabs[currTab]; if (tab->widgets.goToFirst()){ do { Widget *widget = tab->widgets.getCurrent().widget; if (widget->isEnabled() && widget->isVisible() && (widget->isInWidget(x, y) || widget->isCapturing())){ if (widget->onMouseButton(x, y, button, pressed)){ tab->widgets.moveCurrentToTop(); capture = isModal || widget->isCapturing(); return true; } } } while (tab->widgets.goToNext()); } } if (button == MOUSE_LEFT){ capture = isModal || pressed; if (isInWidget(x, y)){ draging = pressed; sx = x; sy = y; if (pressed){ if (x > xPos + 2 * borderWidth && y > yPos + 2 * borderWidth && y < yPos + 2 * borderWidth + tabHeight){ for (uint i = 0; i < tabs.getCount(); i++){ if (x < tabs[i]->rightX){ currTab = i; draging = false; break; } } } } } } return true; }
bool PushButton::onMouseButton(const int x, const int y, const MouseButton button, const bool pressed){ if (pressed == pushed) return false; if (button == MOUSE_LEFT){ if (pressed){ pushed = true; capture = true; } else { if (buttonListener && isInWidget(x, y)) buttonListener->onButtonClicked(this); pushed = false; capture = false; } } return true; }
bool AxisWaiterButton::onMouseButton(const int x, const int y, const MouseButton button, const bool pressed){ if (pressed == pushed) return false; if (button == MOUSE_LEFT){ if (pressed){ pushed = true; capture = true; } else { if (isInWidget(x, y)){ if (buttonListener) buttonListener->onButtonClicked(this); waitingForAxis = true; } pushed = false; } } return true; }