1 /** @file clientrootwidget.cpp 2 * 3 * @authors Copyright (c) 2014-2017 Jaakko Keränen <jaakko.keranen@iki.fi> 4 * 5 * @par License 6 * GPL: http://www.gnu.org/licenses/gpl.html 7 * 8 * <small>This program is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by the 10 * Free Software Foundation; either version 2 of the License, or (at your 11 * option) any later version. This program is distributed in the hope that it 12 * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty 13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 14 * Public License for more details. You should have received a copy of the GNU 15 * General Public License along with this program; if not, see: 16 * http://www.gnu.org/licenses</small> 17 */ 18 19 #include "ui/clientrootwidget.h" 20 #include "ui/clientwindow.h" 21 #include "ui/clientwindowsystem.h" 22 #include "ui/inputsystem.h" 23 #include "clientapp.h" 24 25 using namespace de; 26 DENG2_PIMPL_NOREF(ClientRootWidget)27DENG2_PIMPL_NOREF(ClientRootWidget) 28 { 29 PackageIconBank packageIconBank; 30 }; 31 ClientRootWidget(GLWindow * window)32ClientRootWidget::ClientRootWidget(GLWindow *window) 33 : GuiRootWidget(window) 34 , d(new Impl) 35 { 36 d->packageIconBank.setDisplaySize(GuiWidget::pointsToPixels(PackageIconBank::Size(32, 32))); 37 } 38 window()39ClientWindow &ClientRootWidget::window() 40 { 41 return GuiRootWidget::window().as<ClientWindow>(); 42 } 43 packageIconBank()44PackageIconBank &ClientRootWidget::packageIconBank() 45 { 46 return d->packageIconBank; 47 } 48 update()49void ClientRootWidget::update() 50 { 51 if (!DoomsdayApp::app().isShuttingDown()) 52 { 53 GuiRootWidget::update(); 54 55 if (window().isGLReady() && !d->packageIconBank.atlas()) 56 { 57 d->packageIconBank.setAtlas(&atlas()); 58 } 59 } 60 } 61 addOnTop(GuiWidget * widget)62void ClientRootWidget::addOnTop(GuiWidget *widget) 63 { 64 // The window knows what is the correct top to add to. 65 window().addOnTop(widget); 66 } 67 dispatchLatestMousePosition()68void ClientRootWidget::dispatchLatestMousePosition() 69 { 70 ClientApp::windowSystem().dispatchLatestMousePosition(); 71 } 72 handleEventAsFallback(Event const & event)73void ClientRootWidget::handleEventAsFallback(Event const &event) 74 { 75 // The bindings might have use for this event. 76 ClientApp::inputSystem().tryEvent(event, "global"); 77 } 78