Skip to content

Commit

Permalink
Client|GuiRootWidget: Routing all mouse events to a widget
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed May 31, 2013
1 parent fd039bb commit e916091
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 2 additions & 0 deletions doomsday/client/include/ui/widgets/guirootwidget.h
Expand Up @@ -61,6 +61,8 @@ class GuiRootWidget : public de::RootWidget
*/
de::Matrix4f projMatrix2D() const;

void routeMouse(de::Widget *routeTo);

// Events.
void update();

Expand Down
17 changes: 12 additions & 5 deletions doomsday/client/src/ui/widgets/guirootwidget.cpp
Expand Up @@ -89,15 +89,13 @@ DENG2_PIMPL(GuiRootWidget)
frame.fill(QColor(255, 255, 255, 0).rgba());
QPainter painter(&frame);
painter.setBrush(Qt::NoBrush);
painter.setPen(QColor(0, 0, 0, 160));
painter.drawRect(QRect(0, 0, 11, 11));
painter.setPen(QColor(255, 255, 255, 255));
painter.setPen(QColor(255, 255, 255, 32));
painter.drawRect(QRect(1, 1, 9, 9));
painter.setPen(QColor(255, 255, 255, 192));
painter.setPen(QColor(255, 255, 255, 64));
painter.drawRect(QRect(2, 2, 7, 7));
painter.setPen(QColor(255, 255, 255, 128));
painter.drawRect(QRect(3, 3, 5, 5));
painter.setPen(QColor(255, 255, 255, 64));
painter.setPen(QColor(255, 255, 255, 255));
painter.drawRect(QRect(4, 4, 3, 3));
gradientFrame = atlas->alloc(frame);
}
Expand Down Expand Up @@ -160,6 +158,15 @@ Matrix4f GuiRootWidget::projMatrix2D() const
return Matrix4f::ortho(0, size.x, 0, size.y);
}

void GuiRootWidget::routeMouse(Widget *routeTo)
{
setEventRouting(QList<int>()
<< Event::MouseButton
<< Event::MouseMotion
<< Event::MousePosition
<< Event::MouseWheel, routeTo);
}

void GuiRootWidget::update()
{
// Allow GL operations.
Expand Down

0 comments on commit e916091

Please sign in to comment.