TextArea: don't reparent handles out of flickable

Reparating them higher up sounds like a good idea, but it
causes strange drawing artifacts other places. E.g you would
need to ensure that the handels follows the text area pixel
perfect while flicking, which is hard to track and needs hacks to work.
Moreover, the handles would also be drawn when selection is flicked outside
the view (since they would follow the coordinates of the content view), which
will make them appear on top of other components. In the end, just keeping
them as children of the text area works the best, even if they get clipped in some
cases. This is also how native controls on e.g iOS does it.

Change-Id: Ie119c3a725dd0fc451fba83e390e2cbc93685cf3
TextHandle: fix mapping of touch position to handle position

Regardless of where the user drags on the mouse area (which
can be big for the user to hit it), you should continue dragging
on the selection where it is, not jump the location under the finger.

This patch will change offset to be the distance from the text position
under the handle to the touch point, so regardless where the user
touches the handle, the selection will not jump when the drag starts.

Change-Id: I849e42c5e94f44aec355224a9db146bcdf22d43f
TextHandle: change when a handle should be enabled and visible

Only let a handle be enabled if it's visible, otherwise the
handle will still be in the scene and eat mouse events.
The result will be that you e.g cannot move the cursor to
the place where you left the handle, since you cannot touch
the input field underneath.
And keep the handles visible when there is a selection, and hide them
otherwise. No need for extra calculation logic that was needed
back when the handles got reparented out the flickable.

Change-Id: I2147824629c321096ebadf6252e41a88766dc527
TextHandle: only commit IM upon starting a drag

As an optimization, only commit current IM composing
when the handle drag starts. While dragging, there
should be no ongoing IM anyway.

Change-Id: Ibc57a708652ce853426e42961ad9bb258d37ff3d
Texthandle: prevent flickables from stealing drag

When starting a drag on the handles, you don't wan't
any flickable to cancel it. The handle should win
in this case. The current implementation seems to
do the same, but will sometimes fail.

Change-Id: If3c735acfe0aacab2fcc257c9a391511993b1990
TextHandle: align all handles pixel-perfect with text selection

The current code is a bit fragile when it comes to how the
text edits are layered, and did not take into account
that text are drawn mapped to nearest whole pixel. This patch will
align the handles exactly at the top of the cursor rects.

Change-Id: I1319bf33c2ca41f47b4c1ee938b9a2f7766ba5ee
TextHandle: add clicked signal

Add a clicked signal to TextHandle that emits
if the handle is clicked without being dragged
Since the handle will move along with the drag, we
cannot rely on the MouseAreas own clicked signal
since that one will get confused and fire also after
a drag.

The handle instances will use this signal to move the
cursor where the user clicked, even when the user
clicks on a handle.

Change-Id: I4e611e73a6f76822e1008ccf75f0f5562fc673dc
TextSelection: improve logic that sync handles with selection

Since property 'selectionPosition' is updated by QML after
'onSelectionStartChanged', we cannot depend on it directly
from within the handler.
Moreover, since selectionStart gets updated before cursorPosition, we
need to update both selectionHandle and cursorHandle when either
change to ensure that we use the latest values in both cases.

This will fix two bugs that causes the handles to jump to wrong
positions (and even wrong lines) once the user starts dragging.

Change-Id: I74919abb4169439659bd42952d5d5e6020f33853
TextSingleton: implement support for tracking selection item

On some platforms (iOS) you can select text without giving
focus to the input. To be able to clear selection from other
parts of the code (iOS will only let one input have selection
at a time), we need to track this. Later patches will make
use of it.

Change-Id: I4689253b439e0a86349e53c2edf2554fc96225f8
Add new private control 'EditMenu'

This control will be used as a part of the different
text edit controls for controlling how the edit menu
should work.

Change-Id: Id3ed5795111c37269fce62a97cf4d9bde1b5f6b3
Add EditMenu to input controls

Add EditMenu to TextArea, TextField, ComboBox and
SpinBox.

Change-Id: Ic2fed55c467dde65334006d252f4052430f3f40c
update example

Change-Id: Id7abcc298e7b5586f0b328f431feae3ee7015698