TouchCounter.h (1078B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_layers_TouchCounter_h 8 #define mozilla_layers_TouchCounter_h 9 10 #include "mozilla/EventForwards.h" 11 12 namespace mozilla { 13 14 class MultiTouchInput; 15 16 namespace layers { 17 18 // TouchCounter simply tracks the number of active touch points. Feed it 19 // your input events to update the internal state. Generally you should 20 // only be calling one of the Update functions, depending on which type 21 // of touch inputs you have access to. 22 class TouchCounter { 23 public: 24 TouchCounter(); 25 void Update(const MultiTouchInput& aInput); 26 void Update(const WidgetTouchEvent& aEvent); 27 uint32_t GetActiveTouchCount() const; 28 29 private: 30 uint32_t mActiveTouchCount; 31 }; 32 33 } // namespace layers 34 } // namespace mozilla 35 36 #endif /* mozilla_layers_TouchCounter_h */