void PopUpWidget::handleMouseDown(int x, int y, int button, int clickCount) { if (isEnabled()) { PopUpDialog popupDialog(this, x + getAbsX(), y + getAbsY()); int newSel = popupDialog.runModal(); if (newSel != -1 && _selectedItem != newSel) { _selectedItem = newSel; sendCommand(kPopUpItemSelectedCmd, _entries[_selectedItem].tag); } g_gui.clearDragWidget(); } }
void Widget::draw() { if (!isVisible() || !_boss->isVisible()) return; if (_needsRedraw) { int oldX = _x, oldY = _y; // Account for our relative position in the dialog _x = getAbsX(); _y = getAbsY(); Common::Rect oldClip = g_gui.theme()->swapClipRect(_boss->getClipRect()); // Draw border if (_flags & WIDGET_BORDER) { g_gui.theme()->drawWidgetBackground(Common::Rect(_x, _y, _x + _w, _y + _h), 0, ThemeEngine::kWidgetBackgroundBorder); _x += 4; _y += 4; _w -= 8; _h -= 8; } // Now perform the actual widget draw drawWidget(); g_gui.theme()->swapClipRect(oldClip); // Restore x/y if (_flags & WIDGET_BORDER) { _x -= 4; _y -= 4; _w += 8; _h += 8; } _x = oldX; _y = oldY; _needsRedraw = false; } // Draw all children Widget *w = _firstWidget; while (w) { w->draw(); w = w->_next; } }
int16 ScrollContainerWidget::getChildX() const { return getAbsX() - _scrolledX; }