TouchEventHandler.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Copyright (C) 2010, 2011, 2012 Research In Motion Limited. All rights reserved.
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2 of the License, or (at your option) any later version.
  8. *
  9. * This library 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 GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef TouchEventHandler_h
  19. #define TouchEventHandler_h
  20. #include "ChromeClient.h"
  21. #include "FatFingers.h"
  22. #include "IntPoint.h"
  23. #include <BlackBerryPlatformTouchEvent.h>
  24. namespace BlackBerry {
  25. namespace WebKit {
  26. class WebPagePrivate;
  27. class TouchEventHandler {
  28. public:
  29. TouchEventHandler(WebPagePrivate* webpage);
  30. ~TouchEventHandler();
  31. void doFatFingers(const Platform::TouchPoint&);
  32. void handleTouchHold();
  33. void handleTouchPoint(const Platform::TouchPoint&, unsigned modifiers);
  34. void sendClickAtFatFingersPoint(unsigned modifiers = 0);
  35. const FatFingersResult& lastFatFingersResult() const { return m_lastFatFingersResult; }
  36. void cacheTextResult(FatFingersResult result) { m_lastTextResult = result; }
  37. void resetLastFatFingersResult() { m_lastFatFingersResult.reset(); }
  38. void playSoundIfAnchorIsTarget() const;
  39. void drawTapHighlight();
  40. // This value should reset to false on MouseReleased
  41. bool m_userTriggeredTouchPressOnTextInput;
  42. private:
  43. void handleFatFingerPressed(bool shiftActive = false, bool altActive = false, bool ctrlActive = false);
  44. private:
  45. WebPagePrivate* m_webPage;
  46. WebCore::TouchEventMode m_existingTouchMode;
  47. WebCore::IntPoint m_lastScreenPoint; // Screen Position
  48. FatFingersResult m_lastFatFingersResult;
  49. FatFingersResult m_lastTextResult;
  50. imf_sp_text_t m_spellCheckOptionRequest;
  51. bool m_shouldRequestSpellCheckOptions;
  52. };
  53. }
  54. }
  55. #endif // TouchEventHandler_h