/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* If the stops have not covered the whole zero to one range,
* the REPEAT spread behaves different from the two others in the lookup texture generation.
*/
-BufferImage Gradient::GenerateLookupTexture()
+Dali::Texture Gradient::GenerateLookupTexture()
{
std::sort( mGradientStops.Begin(), mGradientStops.End() );
* Generate the pixels with the color transit from one stop to next.
*/
unsigned int resolution = EstimateTextureResolution();
- BufferImage texture = BufferImage::New( resolution, 1 );
- PixelBuffer* pixels = texture.GetBuffer();
+
+ unsigned int bufferSize = resolution * 4u;
+ unsigned char* pixels = new unsigned char[ bufferSize ];
+ PixelData pixelData = PixelData::New( pixels, bufferSize, resolution, 1u, Pixel::RGBA8888, PixelData::DELETE_ARRAY );
+
int segmentStart = 0;
int segmentEnd = 0;
int k = 0;
segmentStart = segmentEnd;
}
+ Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, resolution, 1u );
+ texture.Upload( pixelData );
+
// remove the stops added temporarily for generating the pixels, as the spread method might get changed later
if( tempLastStop )
{
#define __DALI_TOOLKIT_INTERNAL_GRADIENT_H__
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/object/ref-object.h>
#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/images/buffer-image.h>
+#include <dali/devel-api/rendering/texture.h>
namespace Dali
{
/**
* Generate the lookup texture with the gradient stops.
- * @return the lookup texture which transit smoothly between stops.
+ * @return The lookup texture which transit smoothly between stops.
*/
- BufferImage GenerateLookupTexture();
+ Dali::Texture GenerateLookupTexture();
private:
void SetupGestures()
{
+ // Will consume tap gestures on handles.
mTapDetector = TapGestureDetector::New();
- mTapDetector.DetectedSignal().Connect( this, &Decorator::Impl::OnTap );
- mPanGestureDetector = PanGestureDetector::New();
- mPanGestureDetector.DetectedSignal().Connect( this, &Decorator::Impl::OnPan );
+ // Will consume double tap gestures on handles.
+ mTapDetector.SetMaximumTapsRequired( 2u );
+
+ // Will consume long press gestures on handles.
+ mLongPressDetector = LongPressGestureDetector::New();
+
+ // Detects pan gestures on handles.
+ mPanDetector = PanGestureDetector::New();
+ mPanDetector.DetectedSignal().Connect( this, &Decorator::Impl::OnPan );
}
void CreateActiveLayer()
grabHandle.actor.SetColor( mHandleColor );
grabHandle.grabArea.TouchSignal().Connect( this, &Decorator::Impl::OnGrabHandleTouched );
- mTapDetector.Attach( grabHandle.grabArea );
- mPanGestureDetector.Attach( grabHandle.grabArea );
+
+ // The grab handle's actor is attached to the tap and long press detectors in order to consume these events.
+ // Note that no callbacks are connected to any signal emitted by the tap and long press detectors.
+ mTapDetector.Attach( grabHandle.actor );
+ mLongPressDetector.Attach( grabHandle.actor );
+
+ // The grab handle's area is attached to the pan detector.
+ // The OnPan() method is connected to the signals emitted by the pan detector.
+ mPanDetector.Attach( grabHandle.grabArea );
mActiveLayer.Add( grabHandle.actor );
}
primary.grabArea.SetAnchorPoint( AnchorPoint::TOP_CENTER );
primary.grabArea.SetSizeModeFactor( DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE );
- mTapDetector.Attach( primary.grabArea );
- mPanGestureDetector.Attach( primary.grabArea );
primary.grabArea.TouchSignal().Connect( this, &Decorator::Impl::OnHandleOneTouched );
+ // The handle's actor is attached to the tap and long press detectors in order to consume these events.
+ // Note that no callbacks are connected to any signal emitted by the tap and long press detectors.
+ mTapDetector.Attach( primary.actor );
+ mLongPressDetector.Attach( primary.actor );
+
+ // The handle's area is attached to the pan detector.
+ // The OnPan() method is connected to the signals emitted by the pan detector.
+ mPanDetector.Attach( primary.grabArea );
+
primary.actor.Add( primary.grabArea );
CreateHandleMarker( primary, mHandleImages[LEFT_SELECTION_HANDLE_MARKER][HANDLE_IMAGE_RELEASED], LEFT_SELECTION_HANDLE );
secondary.grabArea.SetAnchorPoint( AnchorPoint::TOP_CENTER );
secondary.grabArea.SetSizeModeFactor( DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE );
- mTapDetector.Attach( secondary.grabArea );
- mPanGestureDetector.Attach( secondary.grabArea );
secondary.grabArea.TouchSignal().Connect( this, &Decorator::Impl::OnHandleTwoTouched );
+ // The handle's actor is attached to the tap and long press detectors in order to consume these events.
+ // Note that no callbacks are connected to any signal emitted by the tap and long press detectors.
+ mTapDetector.Attach( secondary.actor );
+ mLongPressDetector.Attach( secondary.actor );
+
+ // The handle's area is attached to the pan detector.
+ // The OnPan() method is connected to the signals emitted by the pan detector.
+ mPanDetector.Attach( secondary.grabArea );
+
secondary.actor.Add( secondary.grabArea );
CreateHandleMarker( secondary, mHandleImages[RIGHT_SELECTION_HANDLE_MARKER][HANDLE_IMAGE_RELEASED], RIGHT_SELECTION_HANDLE );
}
}
- void OnTap( Actor actor, const TapGesture& tap )
- {
- if( actor == mHandle[GRAB_HANDLE].actor )
- {
- // TODO
- }
- }
-
void DoPan( HandleImpl& handle, HandleType type, const PanGesture& gesture )
{
if( Gesture::Started == gesture.state )
ControllerInterface& mController;
- TapGestureDetector mTapDetector;
- PanGestureDetector mPanGestureDetector;
+ TapGestureDetector mTapDetector;
+ PanGestureDetector mPanDetector;
+ LongPressGestureDetector mLongPressDetector;
+
Timer mCursorBlinkTimer; ///< Timer to signal cursor to blink
Timer mScrollTimer; ///< Timer used to scroll the text when the grab handle is moved close to the edges.