~osomon/oxide/override-touchUngrabEvent

« back to all changes in this revision

Viewing changes to qt/quick/api/oxideqquicktouchselectioncontroller_p.h

  • Committer: Olivier Tilloy
  • Date: 2016-01-12 11:46:34 UTC
  • mfrom: (1272.2.38 touch-selection-api)
  • Revision ID: olivier.tilloy@canonical.com-20160112114634-u1t78baa0u4hfoha
Add a touch selection API, to allow embedders to display handles for resizing the current selection, and contextual actions for it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// vim:expandtab:shiftwidth=2:tabstop=2:
 
2
// Copyright (C) 2015-2016 Canonical Ltd.
 
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.1 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 _OXIDE_QT_QUICK_API_TOUCH_SELECTION_CONTROLLER_H_
 
19
#define _OXIDE_QT_QUICK_API_TOUCH_SELECTION_CONTROLLER_H_
 
20
 
 
21
#include <QObject>
 
22
#include <QRectF>
 
23
#include <QString>
 
24
#include <QtGlobal>
 
25
 
 
26
#include "oxideqquickwebview_p.h"
 
27
 
 
28
class QQmlComponent;
 
29
 
 
30
class OxideQQuickTouchSelectionControllerPrivate;
 
31
 
 
32
class Q_DECL_EXPORT OxideQQuickTouchSelectionController : public QObject {
 
33
  Q_OBJECT
 
34
 
 
35
  Q_ENUMS(HandleOrientation);
 
36
 
 
37
  Q_PROPERTY(bool active READ active NOTIFY activeChanged)
 
38
  Q_PROPERTY(QQmlComponent* handle READ handle WRITE setHandle NOTIFY handleChanged)
 
39
  Q_PROPERTY(QRectF bounds READ bounds NOTIFY boundsChanged)
 
40
 
 
41
  Q_DISABLE_COPY(OxideQQuickTouchSelectionController)
 
42
  Q_DECLARE_PRIVATE(OxideQQuickTouchSelectionController)
 
43
 
 
44
 public:
 
45
  Q_DECL_HIDDEN OxideQQuickTouchSelectionController(OxideQQuickWebView* view);
 
46
  virtual ~OxideQQuickTouchSelectionController();
 
47
 
 
48
  enum HandleOrientation {
 
49
    HandleOrientationLeft,
 
50
    HandleOrientationCenter,
 
51
    HandleOrientationRight,
 
52
    HandleOrientationUndefined
 
53
  };
 
54
 
 
55
  bool active() const;
 
56
 
 
57
  QQmlComponent* handle() const;
 
58
  void setHandle(QQmlComponent* handle);
 
59
 
 
60
  const QRectF& bounds() const;
 
61
 
 
62
 Q_SIGNALS:
 
63
  void activeChanged();
 
64
  void handleChanged();
 
65
  void boundsChanged();
 
66
 
 
67
 private:
 
68
  friend class OxideQQuickWebViewPrivate;
 
69
  void onTouchSelectionChanged(bool active, const QRectF& bounds);
 
70
 
 
71
  QScopedPointer<OxideQQuickTouchSelectionControllerPrivate> d_ptr;
 
72
};
 
73
 
 
74
#endif // _OXIDE_QT_QUICK_API_TOUCH_SELECTION_CONTROLLER_H_