1 /*************************************************************************** 2 * Mechanized Assault and Exploration Reloaded Projectfile * 3 * * 4 * This program is free software; you can redistribute it and/or modify * 5 * it under the terms of the GNU General Public License as published by * 6 * the Free Software Foundation; either version 2 of the License, or * 7 * (at your option) any later version. * 8 * * 9 * This program is distributed in the hope that it will be useful, * 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 * GNU General Public License for more details. * 13 * * 14 * You should have received a copy of the GNU General Public License * 15 * along with this program; if not, write to the * 16 * Free Software Foundation, Inc., * 17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 18 ***************************************************************************/ 19 20 #ifndef ui_graphical_game_control_rightmousebuttonscrollerH 21 #define ui_graphical_game_control_rightmousebuttonscrollerH 22 23 #include <memory> 24 25 #include "ui/graphical/widget.h" 26 #include "utility/position.h" 27 #include "utility/signal/signalconnectionmanager.h" 28 #include "utility/signal/signal.h" 29 30 class cMouse; 31 class cAnimationTimer; 32 class cImage; 33 34 class cRightMouseButtonScrollerWidget : public cWidget 35 { 36 public: 37 cRightMouseButtonScrollerWidget (std::shared_ptr<cAnimationTimer> animationTimer); 38 39 bool isScrolling() const; 40 41 mutable cSignal<void (const cPosition&)> scroll; 42 43 mutable cSignal<void ()> mouseFocusReleased; 44 45 mutable cSignal<void ()> startedScrolling; 46 mutable cSignal<void ()> stoppedScrolling; 47 48 virtual bool handleMouseMoved (cApplication& application, cMouse& mouse, const cPosition& offset) MAXR_OVERRIDE_FUNCTION; 49 50 virtual bool handleMousePressed (cApplication& application, cMouse& mouse, eMouseButtonType button) MAXR_OVERRIDE_FUNCTION; 51 virtual bool handleMouseReleased (cApplication& application, cMouse& mouse, eMouseButtonType button) MAXR_OVERRIDE_FUNCTION; 52 53 virtual void handleLooseMouseFocus (cApplication& application) MAXR_OVERRIDE_FUNCTION; 54 private: 55 static const double factor; 56 static const double minDistanceSquared; 57 58 cSignalConnectionManager signalConnectionManager; 59 cSignalConnectionManager animationTimerSignalConnectionManager; 60 61 std::shared_ptr<cAnimationTimer> animationTimer; 62 63 cImage* startIndicator; 64 65 cPosition startPosition; 66 bool hasStartedScrolling; 67 68 cPosition getCursorCenter (cMouse& mouse) const; 69 }; 70 71 #endif // ui_graphical_game_control_rightmousebuttonscrollerH 72