dali-toolkit
)
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb --coverage -Wall -Werror")
+ADD_COMPILE_OPTIONS( -O0 -ggdb --coverage -Wall -Werror )
+ADD_COMPILE_OPTIONS( ${${CAPI_LIB}_CFLAGS_OTHER} )
ADD_DEFINITIONS(-DTEST_RESOURCE_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/../../resources\" )
ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.cpp ${TC_SOURCES})
TARGET_LINK_LIBRARIES(${EXEC_NAME}
${${CAPI_LIB}_LIBRARIES}
- -lpthread
+ -lpthread --coverage
)
INSTALL(PROGRAMS ${EXEC_NAME}
visualModel,
metrics );
+ GetCursorPositionParameters parameters;
+ parameters.visualModel = visualModel;
+ parameters.logicalModel = logicalModel;
+ parameters.metrics = metrics;
+ parameters.isMultiline = true;
+
for( unsigned int index = 0; index < data.numberOfTests; ++index )
{
CursorInfo cursorInfo;
- GetCursorPosition( visualModel,
- logicalModel,
- metrics,
- data.logicalIndex[index],
+ parameters.logical = data.logicalIndex[index];
+
+ GetCursorPosition( parameters,
cursorInfo );
if( cursorInfo.primaryPosition.x != data.visualX[index] )
dali-adaptor
)
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb --coverage -Wall -Werror")
+ADD_COMPILE_OPTIONS( -O0 -ggdb --coverage -Wall -Werror )
+ADD_COMPILE_OPTIONS( ${${CAPI_LIB}_CFLAGS_OTHER} )
ADD_DEFINITIONS(-DTEST_RESOURCE_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/../../resources\" )
ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.cpp ${TC_SOURCES})
TARGET_LINK_LIBRARIES(${EXEC_NAME}
${${CAPI_LIB}_LIBRARIES}
- -lpthread -ldl
+ -lpthread -ldl --coverage
)
INSTALL(PROGRAMS ${EXEC_NAME}
dali-toolkit
)
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb --coverage -Wall -Werror")
+#ADD_COMPILE_OPTIONS( -O0 -ggdb --coverage -Wall -Werror )
+# ADD_COMPILE_OPTIONS( ${${CAPI_LIB}_CFLAGS_OTHER} )
+# This works for a homogenous C++ project, but not for mixed C++/C project
+# On CMake >= 3.3, could use
+# ADD_COMPILE_OPTIONS( "$<$<COMPILE_LANGUAGE:CXX>:${${CAPI_LIB}_CFLAGS_OTHER}>" )
+# However, we need to support CMake 2.8, so instead, fall back to setting the CXX_FLAGS directly:
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb --coverage -Wall -Werror" )
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${${CAPI_LIB}_CFLAGS_OTHER}" )
FOREACH(directory ${${CAPI_LIB}_LIBRARY_DIRS})
SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -L${directory}")
ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.cpp ${TC_SOURCES})
TARGET_LINK_LIBRARIES(${EXEC_NAME}
${${CAPI_LIB}_LIBRARIES}
- -lpthread
+ -lpthread --coverage
)
INSTALL(PROGRAMS ${EXEC_NAME}
dali-toolkit
)
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb --coverage -Wall -Werror")
+ADD_COMPILE_OPTIONS( -O0 -ggdb --coverage -Wall -Werror )
+ADD_COMPILE_OPTIONS( ${${CAPI_LIB}_CFLAGS_OTHER} )
ADD_DEFINITIONS(-DTEST_RESOURCE_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/../../resources\" )
ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.cpp ${TC_SOURCES})
TARGET_LINK_LIBRARIES(${EXEC_NAME}
${${CAPI_LIB}_LIBRARIES}
- -lpthread
+ -lpthread --coverage
)
INSTALL(PROGRAMS ${EXEC_NAME}
#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/devel-api/align-enums.h>
#include <dali-toolkit/devel-api/controls/control-devel.h>
+#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+#include <toolkit-event-thread-callback.h>
#include "dummy-control.h"
gKeyInputFocusCallBackCalled = true;
}
+const char* TEST_LARGE_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/tbcol.png";
+const char* TEST_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/gallery-small-1.jpg";
+
} // namespace
///////////////////////////////////////////////////////////////////////////////////////////////////
END_TEST;
}
+
+
+int UtcDaliControlResourcesReady(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "Register 2 visuals and check ResourceReady when a visual is disabled" );
+
+ VisualFactory factory = VisualFactory::Get();
+ DALI_TEST_CHECK( factory );
+
+ Property::Map propertyMapLarge;
+ propertyMapLarge.Insert( Visual::Property::TYPE, Visual::IMAGE );
+ propertyMapLarge.Insert( ImageVisual::Property::URL, TEST_LARGE_IMAGE_FILE_NAME );
+
+ Property::Map propertyMapSmall;
+ propertyMapSmall.Insert( Visual::Property::TYPE, Visual::IMAGE );
+ propertyMapSmall.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
+
+ Visual::Base smallVisual = factory.CreateVisual( propertyMapSmall );
+ smallVisual.SetName("smallVisual");
+ DALI_TEST_CHECK( smallVisual );
+
+ DummyControl actor = DummyControl::New();
+ DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, smallVisual );
+
+ actor.SetSize( 200.f, 200.f );
+ DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( DevelControl::IsResourceReady( actor ), false, TEST_LOCATION );
+
+ Stage::GetCurrent().Add( actor );
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS( DevelControl::IsResourceReady( actor ), true, TEST_LOCATION );
+
+ Visual::Base largeVisual = factory.CreateVisual( propertyMapLarge );
+ largeVisual.SetName("largeVisual");
+ DALI_TEST_CHECK( largeVisual );
+
+ tet_infoline( "Register Visual but set disabled, IsResourceReady should be true" );
+
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL2, largeVisual, false );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS( DevelControl::IsResourceReady( actor ), true, TEST_LOCATION );
+
+ END_TEST;
+}
manager.SetFocus( dummy3 );
DALI_TEST_CHECK( dummy3Impl.keyInputFocusGained );
- Integration::KeyEvent event( "a", "a", 0, 0, 0, Integration::KeyEvent::Up, "", DevelKeyEvent::DeviceClass::TOUCH );
+ Integration::KeyEvent event( "a", "a", 0, 0, 0, Integration::KeyEvent::Up, "", DevelDevice::Class::TOUCH, DevelDevice::Subclass::NONE );
application.ProcessEvent(event);
DALI_TEST_CHECK( callback1.mIsCalled );
manager.SetFocus( dummy3 );
DALI_TEST_CHECK( dummy3Impl.keyInputFocusGained );
- Integration::KeyEvent event( "a", "a", 0, 0, 0, Integration::KeyEvent::Up, "", DevelKeyEvent::DeviceClass::TOUCH );
+ Integration::KeyEvent event( "a", "a", 0, 0, 0, Integration::KeyEvent::Up, "", DevelDevice::Class::TOUCH, DevelDevice::Subclass::NONE );
application.ProcessEvent(event);
DALI_TEST_CHECK( !callback1.mIsCalled );
FocusedActorActivatedCallback focusedActorActivatedCallback(focusedActorActivatedSignalVerified);
manager.FocusedActorEnterKeySignal().Connect( &focusedActorActivatedCallback, &FocusedActorActivatedCallback::Callback );
- Integration::KeyEvent returnEvent( "Return", "", 0, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE );
+ Integration::KeyEvent returnEvent( "Return", "", 0, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE );
// Press Any key to notice physical keyboard event is comming to KeyboardFocusManager
// It makes mIsFocusIndicatorEnabled true
FocusGroupChangedCallback focusGroupChangedCallback(focusGroupChangedSignalVerified);
manager.FocusGroupChangedSignal().Connect( &focusGroupChangedCallback, &FocusGroupChangedCallback::Callback );
- Integration::KeyEvent tabEvent( "Tab", "", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE );
- Integration::KeyEvent shiftTabEvent( "Tab", "", 0, 1, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE );
+ Integration::KeyEvent tabEvent( "Tab", "", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE );
+ Integration::KeyEvent shiftTabEvent( "Tab", "", 0, 1, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE );
// Press Any key to notice physical keyboard event is comming to KeyboardFocusManager
// It makes mIsFocusIndicatorEnabled true
FocusChangedCallback focusChangedCallback(focusChangedSignalVerified);
manager.FocusChangedSignal().Connect( &focusChangedCallback, &FocusChangedCallback::Callback );
- Integration::KeyEvent leftEvent( "Left", "", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE );
- Integration::KeyEvent rightEvent( "Right", "", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE );
- Integration::KeyEvent upEvent( "Up", "", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE );
- Integration::KeyEvent downEvent( "Down", "", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE );
- Integration::KeyEvent pageUpEvent( "Prior", "", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE );
- Integration::KeyEvent pageDownEvent( "Next", "", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE );
+ Integration::KeyEvent leftEvent( "Left", "", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE );
+ Integration::KeyEvent rightEvent( "Right", "", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE );
+ Integration::KeyEvent upEvent( "Up", "", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE );
+ Integration::KeyEvent downEvent( "Down", "", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE );
+ Integration::KeyEvent pageUpEvent( "Prior", "", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE );
+ Integration::KeyEvent pageDownEvent( "Next", "", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE );
// Press Any key to notice physical keyboard event is comming to KeyboardFocusManager
// It makes mIsFocusIndicatorEnabled true
int keyModifier,
unsigned long timeStamp,
const Integration::KeyEvent::State& keyState,
- const std::string& deviceName,
- const DevelKeyEvent::DeviceClass::Type& deviceClass
+ const std::string& deviceName = "",
+ const DevelDevice::Class::Type& deviceClass = DevelDevice::Class::NONE,
+ const DevelDevice::Subclass::Type& deviceSubclass = DevelDevice::Subclass::NONE
)
{
return Integration::KeyEvent( keyName,
timeStamp,
keyState,
deviceName,
- deviceClass );
+ deviceClass,
+ deviceSubclass );
}
} // Anonymous namespace
popup.SetKeyInputFocus();
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::Down, "", DevelKeyEvent::DeviceClass::TOUCH ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::Down, "", DevelDevice::Class::TOUCH, DevelDevice::Subclass::NONE ) );
application.SendNotification();
application.Render();
namespace
{
static const char* TEST_IMAGE_ONE = TEST_RESOURCE_DIR "/gallery-small-1.jpg";
+static const char* TEST_IMAGE_TWO = TEST_RESOURCE_DIR "/icon-delete.jpg";
static const Vector2 INSIDE_TOUCH_POINT_POSITON = Vector2( 240, 400 );
static const Vector3 BUTTON_POSITON_TO_GET_INSIDE_TOUCH_EVENTS = Vector3( 200, 360, 0 );
END_TEST;
}
+
+int UtcDaliPushButtonReplaceButtonImageP2(void)
+{
+ tet_infoline("Set button image then replace with new image and query url");
+
+ ToolkitTestApplication application;
+
+ ResourceImage setImage = ResourceImage::New( TEST_IMAGE_ONE );
+ DALI_TEST_CHECK(setImage);
+
+ Actor imgActorSet = ImageView::New(setImage);
+ DALI_TEST_CHECK(imgActorSet);
+
+ PushButton pushButton = PushButton::New();
+ pushButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, TEST_IMAGE_TWO );
+
+
+ Stage::GetCurrent().Add( pushButton );
+
+ pushButton.SetButtonImage( imgActorSet );
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline("Get button image before it has been able to load");
+
+ ImageView imageView = ImageView::DownCast(pushButton.GetButtonImage());
+
+ ResourceImage getImage = ResourceImage::DownCast( imageView.GetImage() );
+
+ tet_infoline("Check if url matches last assignment even if not loaded yet");
+ DALI_TEST_EQUALS( getImage.GetUrl(), setImage.GetUrl() , TEST_LOCATION );
+
+ END_TEST;
+}
int keyModifier,
unsigned long timeStamp,
const Integration::KeyEvent::State& keyState,
- const std::string& deviceName,
- const DevelKeyEvent::DeviceClass::Type& deviceClass )
+ const std::string& deviceName = DEFAULT_DEVICE_NAME,
+ const DevelDevice::Class::Type& deviceClass = DevelDevice::Class::NONE,
+ const DevelDevice::Subclass::Type& deviceSubclass = DevelDevice::Subclass::NONE )
{
return Integration::KeyEvent( keyName,
keyString,
timeStamp,
keyState,
deviceName,
- deviceClass );
+ deviceClass,
+ deviceSubclass );
}
/**
editor.SetKeyInputFocus();
gTextChangedCallBackCalled = false;
- application.ProcessEvent( GenerateKey( "D", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "D", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
DALI_TEST_CHECK( gTextChangedCallBackCalled );
END_TEST;
gInputStyleMask = TextEditor::InputStyle::NONE;
inputStyleChangedSignal = false;
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
gInputStyleMask = TextEditor::InputStyle::NONE;
inputStyleChangedSignal = false;
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
gInputStyleMask = TextEditor::InputStyle::NONE;
inputStyleChangedSignal = false;
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
editor.SetProperty( TextEditor::Property::INPUT_EMBOSS, "emboss" );
editor.SetProperty( TextEditor::Property::INPUT_OUTLINE, "outline" );
- application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
application.Render();
// Add a key event but as the text editor has not the focus it should do nothing.
- application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
application.Render();
// Now the text editor has the focus, so it can handle the key events.
- application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
- application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
application.Render();
// The second text editor has the focus. It should handle the key events.
- application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
- application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
DALI_TEST_EQUALS( stencil.GetChildCount(), 0u, TEST_LOCATION );
// Now the text editor has the focus, so it can handle the key events.
- application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
- application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
// Move the cursor and check the position changes.
Vector3 position1 = cursor.GetCurrentPosition();
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
DALI_TEST_CHECK( position2.x < position1.x );
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
DALI_TEST_CHECK( position5.x > position4.x );
// Remove all the text.
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
editor.SetProperty( TextEditor::Property::TEXT, "" );
// Render and notify
application.Render();
// Move at the end of the text.
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
for( unsigned int index = 0u; index < 10u; ++index )
{
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
}
// Add a character
- application.ProcessEvent( GenerateKey( "d", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "d", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
DALI_TEST_EQUALS( "Hello\nworld", editor.GetProperty<std::string>( TextEditor::Property::TEXT ), TEST_LOCATION );
// Add some key events
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_UP, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_UP, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_UP, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_UP, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
for( unsigned int index = 0u; index < 10u; ++index )
{
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
}
// Add a character
- application.ProcessEvent( GenerateKey( " ", " ", KEY_WHITE_SPACE_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( " ", " ", KEY_WHITE_SPACE_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
application.Render();
// Move at the end of the text.
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
for( unsigned int index = 0u; index < 10u; ++index )
{
// Add a character
- application.ProcessEvent( GenerateKey( "d", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "d", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
// Continuous scroll left to increase coverage
for( unsigned int index = 0u; index < 10u; ++index )
{
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
DALI_TEST_EQUALS( editor.GetProperty<float>( DevelTextEditor::Property::SCROLL_BAR_FADE_DURATION ), 0.2f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
// Press Escape to increase coverage
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
application.SendNotification();
application.Render();
application.Render();
// Move to seconds line of the text.
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
// Add another script characters ( glyph height is defferent )
- application.ProcessEvent( GenerateKey( "d", "ㅁ", KEY_D_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
- application.ProcessEvent( GenerateKey( "d", "ኢ", KEY_D_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "d", "ㅁ", KEY_D_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "d", "ኢ", KEY_D_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Delete characters
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
DALI_TEST_EQUALS( layoutHeight, editor.GetHeightForWidth( 100.f ), TEST_LOCATION );
int keyModifier,
unsigned long timeStamp,
const Integration::KeyEvent::State& keyState,
- const std::string& deviceName,
- const DevelKeyEvent::DeviceClass::Type& deviceClass )
+ const std::string& deviceName = DEFAULT_DEVICE_NAME,
+ const DevelDevice::Class::Type& deviceClass = DevelDevice::Class::NONE,
+ const DevelDevice::Subclass::Type& deviceSubclass = DevelDevice::Subclass::NONE )
{
return Integration::KeyEvent( keyName,
keyString,
timeStamp,
keyState,
deviceName,
- deviceClass );
+ deviceClass,
+ deviceSubclass );
}
bool DaliTestCheckMaps( const Property::Map& fontStyleMapGet, const Property::Map& fontStyleMapSet )
field.SetKeyInputFocus();
gTextChangedCallBackCalled = false;
- application.ProcessEvent( GenerateKey( "D", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "D", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
DALI_TEST_CHECK( gTextChangedCallBackCalled );
END_TEST;
gMaxCharactersCallBackCalled = false;
- application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
- application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
DALI_TEST_CHECK( gMaxCharactersCallBackCalled );
DALI_TEST_CHECK( maxLengthReachedSignal );
gMaxCharactersCallBackCalled = false;
- application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
- application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
DALI_TEST_CHECK( !gMaxCharactersCallBackCalled );
DALI_TEST_CHECK( !maxLengthReachedSignal );
gInputStyleMask = TextField::InputStyle::NONE;
inputStyleChangedSignal = false;
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
gInputStyleMask = TextField::InputStyle::NONE;
inputStyleChangedSignal = false;
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
gInputStyleMask = TextField::InputStyle::NONE;
inputStyleChangedSignal = false;
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
application.Render();
// Add a key event but as the text field has not the focus it should do nothing.
- application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
application.Render();
// Now the text field has the focus, so it can handle the key events.
- application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
- application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
application.Render();
// The second text field has the focus. It should handle the key events.
- application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
- application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
DALI_TEST_EQUALS( stencil.GetChildCount(), 0u, TEST_LOCATION );
// Now the text field has the focus, so it can handle the key events.
- application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
- application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
// Move the cursor and check the position changes.
Vector3 position1 = cursor.GetCurrentPosition();
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
DALI_TEST_CHECK( position2.x < position1.x );
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
DALI_TEST_CHECK( position5.x > position4.x );
// Remove all the text.
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
field.SetProperty( TextField::Property::TEXT, "" );
// Render and notify
// Should not be a renderer.
DALI_TEST_EQUALS( stencil.GetChildCount(), 0u, TEST_LOCATION );
+ // Chanege exceed policy (EXCEED_POLICY_ORIGINAL doesn't use stencil )
+ field.SetProperty( TextField::Property::TEXT, "This is a long text for the size of the text-field." );
+ field.SetProperty( TextField::Property::EXCEED_POLICY, Dali::Toolkit::TextField::EXCEED_POLICY_ORIGINAL );
+
+ application.SendNotification();
+ application.Render();
+
+ // There are renderer and decorator layer
+ DALI_TEST_EQUALS( field.GetChildCount(), 2u, TEST_LOCATION );
+
END_TEST;
}
Property::Map map;
map[ HiddenInput::Property::MODE ] = HiddenInput::Mode::HIDE_NONE;
field.SetProperty( DevelTextField::Property::HIDDEN_INPUT_SETTINGS, map );
- application.ProcessEvent( GenerateKey( "d", "d", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "d", "d", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
application.SendNotification();
application.Render();
map[ HiddenInput::Property::MODE ] = HiddenInput::Mode::HIDE_ALL;
map[ HiddenInput::Property::SUBSTITUTE_CHARACTER ] = 0x23;
field.SetProperty( DevelTextField::Property::HIDDEN_INPUT_SETTINGS, map );
- application.ProcessEvent( GenerateKey( "d", "d", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "d", "d", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
application.SendNotification();
application.Render();
field.SetProperty( DevelTextField::Property::HIDDEN_INPUT_SETTINGS, map );
for( unsigned int index = 0u; index < 5u; ++index )
{
- application.ProcessEvent( GenerateKey( "d", "d", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "d", "d", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
application.SendNotification();
application.Render();
}
field.SetProperty( DevelTextField::Property::HIDDEN_INPUT_SETTINGS, map );
for( unsigned int index = 0u; index < 5u; ++index )
{
- application.ProcessEvent( GenerateKey( "d", "d", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "d", "d", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
application.SendNotification();
application.Render();
}
map[ HiddenInput::Property::MODE ] = HiddenInput::Mode::SHOW_LAST_CHARACTER;
map[ HiddenInput::Property::SHOW_DURATION ] = 0;
field.SetProperty( DevelTextField::Property::HIDDEN_INPUT_SETTINGS, map );
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
application.SendNotification();
application.Render();
- application.ProcessEvent( GenerateKey( "d", "d", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "d", "d", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
application.SendNotification();
application.Render();
map[ HiddenInput::Property::SHOW_DURATION ] = 100;
field.SetProperty( DevelTextField::Property::HIDDEN_INPUT_SETTINGS, map );
- application.ProcessEvent( GenerateKey( "d", "d", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "d", "d", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
application.SendNotification();
application.Render();
DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
// Press Escape to increase coverage
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
application.SendNotification();
application.Render();
application.Render();
// Add a key event but as the text field has not the focus it should do nothing.
- application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
- application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
application.Render();
// Now the text field has the focus, so it can handle the key events.
- application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
- application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
- application.ProcessEvent( GenerateKey( "d", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
- application.ProcessEvent( GenerateKey( "d", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "d", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "d", "d", KEY_D_CODE, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::TEXT ), std::string("ad"), TEST_LOCATION );
// Generate a Esc key event. The text field should lose the focus.
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
- application.ProcessEvent( GenerateKey( "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
DALI_TEST_EQUALS( false, field.HasKeyInputFocus(), TEST_LOCATION );
// No more text should be introduced
- application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
- application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "a", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
application.Render();
// Generate a Esc key event. The text field should lose the focus.
- application.ProcessEvent( GenerateKey( "XF86PowerOff", "XF86PowerOff", DALI_KEY_POWER, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
- application.ProcessEvent( GenerateKey( "XF86PowerOff", "XF86PowerOff", DALI_KEY_POWER, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "XF86PowerOff", "XF86PowerOff", DALI_KEY_POWER, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "XF86PowerOff", "XF86PowerOff", DALI_KEY_POWER, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
application.Render();
// Generate a Esc key event. The text field should lose the focus.
- application.ProcessEvent( GenerateKey( "XF86Menu", "XF86Menu", DALI_KEY_MENU, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
- application.ProcessEvent( GenerateKey( "XF86Menu", "XF86Menu", DALI_KEY_MENU, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "XF86Menu", "XF86Menu", DALI_KEY_MENU, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "XF86Menu", "XF86Menu", DALI_KEY_MENU, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
application.Render();
// Generate a Esc key event. The text field should lose the focus.
- application.ProcessEvent( GenerateKey( "XF86Home", "XF86Home", DALI_KEY_HOME, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
- application.ProcessEvent( GenerateKey( "XF86Home", "XF86Home", DALI_KEY_HOME, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE ) );
+ application.ProcessEvent( GenerateKey( "XF86Home", "XF86Home", DALI_KEY_HOME, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "XF86Home", "XF86Home", DALI_KEY_HOME, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE ) );
// Render and notify
application.SendNotification();
#include <dali/public-api/rendering/shader.h>
#include <dali/devel-api/object/handle-devel.h>
#include <dali-toolkit/devel-api/controls/control-devel.h>
+#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
#include <dali-toolkit/devel-api/visual-factory/transition-data.h>
#include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
END_TEST;
}
+int UtcDaliRegisterVisualOrder02(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "Register Visual Order with Background Set" );
+
+ DummyControl dummyControl = DummyControl::New(true);
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummyControl.GetImplementation());
+
+ const int backgroundDepthIndex = Toolkit::DepthIndex::BACKGROUND;
+
+ VisualFactory factory = VisualFactory::Get();
+ Property::Map propertyMap;
+ propertyMap.Insert(Visual::Property::TYPE, Visual::COLOR);
+ propertyMap.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE);
+
+ tet_printf( "Register a control background visual, should have depth index of %d\n", backgroundDepthIndex );
+
+ dummyControl.SetProperty( Control::Property::BACKGROUND, propertyMap );
+
+ const int TEST_VISUAL_1_DEPTH_INDEX = 0;
+ tet_printf( "Register visual, should have depth index of %d\n", TEST_VISUAL_1_DEPTH_INDEX );
+ Visual::Base testVisual1 = factory.CreateVisual( propertyMap );
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, testVisual1 );
+ DALI_TEST_EQUALS( testVisual1.GetDepthIndex(), TEST_VISUAL_1_DEPTH_INDEX , TEST_LOCATION );
+
+ tet_printf( "Register another visual, should have a depth index greater than previous(%d)\n", TEST_VISUAL_1_DEPTH_INDEX );
+ Visual::Base testVisual2 = factory.CreateVisual( propertyMap );
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL2, testVisual2 );
+ DALI_TEST_CHECK( testVisual2.GetDepthIndex() > testVisual1.GetDepthIndex() );
+
+ dummyControl.SetSize(200.f, 200.f);
+ Stage::GetCurrent().Add( dummyControl );
+
+ END_TEST;
+}
+
int UtcDaliRegisterVisualWithDepthIndex(void)
{
ToolkitTestApplication application;
DALI_TYPE_REGISTRATION_END()
+/**
+ * @brief Iterate through given container and setOffStage any visual found
+ *
+ * @param[in] container Container of visuals
+ * @param[in] parent Parent actor to remove visuals from
+ */
+void SetVisualsOffStage( const RegisteredVisualContainer& container, Actor parent )
+{
+ for( auto iter = container.Begin(), end = container.End() ; iter!= end; iter++)
+ {
+ if( (*iter)->visual )
+ {
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::SetOffStage Setting visual(%d) off stage\n", (*iter)->index );
+ Toolkit::GetImplementation((*iter)->visual).SetOffStage( parent );
+ }
+ }
+}
+
} // unnamed namespace
mControlImpl.OnLongPress(longPress);
}
-// Called by a Visual when it's resource is ready
-void Control::Impl::ResourceReady( Visual::Base& object)
-{
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "ResourceReady \n");
-
- // A resource is ready, check if is in the replacement visual container
- // Iterate through all visuals in replacement container and store indexes of ready visuals
- Dali::Vector <Property::Index> readyVisuals;
- Actor self = mControlImpl.Self();
-
- for( auto replacementVisualIter = mReplacementVisuals.Begin();
- replacementVisualIter < mReplacementVisuals.End(); ++replacementVisualIter )
- {
- const Toolkit::Visual::Base replacementVisual = (*replacementVisualIter)->visual;
- const Internal::Visual::Base& replacementVisualImpl = Toolkit::GetImplementation( replacementVisual );
-
- if( replacementVisualImpl.IsResourceReady() )
- {
- // Check if new replacement visual (index) is already queued for replacement and swap old for new.
- RegisteredVisualContainer::Iterator registeredVisualsIter;
- if( FindVisual( (*replacementVisualIter)->index, mVisuals, registeredVisualsIter ) )
- {
- Property::Index readyVisualIndex = (*replacementVisualIter)->index;
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "ResourceReady: %d Ready to replace\n", readyVisualIndex );
- readyVisuals.PushBack( readyVisualIndex );
- // Remove current shown visual from stage and from registered visuals container
- Toolkit::GetImplementation((*registeredVisualsIter)->visual).SetOffStage( self );
- mVisuals.Erase( registeredVisualsIter );
- }
- }
- }
-
- for( auto readyVisualsIter = readyVisuals.Begin(); readyVisualsIter != readyVisuals.End(); readyVisualsIter++ )
- {
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "ResourceReady: %d Matched\n", (*readyVisualsIter) );
- // Move new visual to be shown from replacement container into the control's registered visuals container
- // Replacement visual has already been set on stage when it was added to replacement container
- RegisteredVisualContainer::Iterator readyReplacementVisual;
- if( FindVisual( (*readyVisualsIter) , mReplacementVisuals, readyReplacementVisual ) )
- {
- MoveVisual( readyReplacementVisual, mReplacementVisuals, mVisuals ); // Erases visual from replacement queue
- }
- // A visual has been replaced so control will most likely need relayouting
- mControlImpl.RelayoutRequest();
- }
-
- // go through and check if all the visuals are ready, if they are emit a signal
- for( auto visualIter = mVisuals.Begin();
- visualIter != mVisuals.End(); ++visualIter )
- {
- const Toolkit::Visual::Base visual = (*visualIter)->visual;
- const Internal::Visual::Base& visualImpl = Toolkit::GetImplementation( visual );
-
- // one of the visuals is not ready
- if( !visualImpl.IsResourceReady() )
- {
- return;
- }
- }
-
- // all the visuals are ready
- Dali::Toolkit::Control handle( mControlImpl.GetOwner() );
- mResourceReadySignal.Emit( handle );
-}
-
-bool Control::Impl::IsResourceReady() const
-{
- // go through and check all the visuals are ready
- for ( RegisteredVisualContainer::ConstIterator visualIter = mVisuals.Begin();
- visualIter != mVisuals.End(); ++visualIter )
- {
- const Toolkit::Visual::Base visual = (*visualIter)->visual;
- const Internal::Visual::Base& visualImpl = Toolkit::GetImplementation( visual );
-
- // one of the visuals is not ready
- if( !visualImpl.IsResourceReady() )
- {
- return false;
- }
- }
- return true;
-}
-
void Control::Impl::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual )
{
RegisterVisual( index, visual, VisualState::ENABLED, DepthIndexValue::NOT_SET );
bool visualReplaced ( false );
Actor self = mControlImpl.Self();
+ // Set the depth index, if not set by caller this will be either the current visual depth, max depth of all visuals
+ // or zero.
+ int requiredDepthIndex = visual.GetDepthIndex();
+
+ if( depthIndexValueSet == DepthIndexValue::SET )
+ {
+ requiredDepthIndex = depthIndex;
+ }
+
+ // Visual replacement, existing visual should only be removed from stage when replacement ready.
if( !mVisuals.Empty() )
{
RegisteredVisualContainer::Iterator registeredVisualsiter;
- // Check if visual (index) is already registered. Replace if so.
+ // Check if visual (index) is already registered, this is the current visual.
if( FindVisual( index, mVisuals, registeredVisualsiter ) )
{
- if( (*registeredVisualsiter)->visual )
+ Toolkit::Visual::Base& currentRegisteredVisual = (*registeredVisualsiter)->visual;
+ if( currentRegisteredVisual )
{
// Store current visual depth index as may need to set the replacement visual to same depth
const int currentDepthIndex = (*registeredVisualsiter)->visual.GetDepthIndex();
- // Monitor when the visuals resources are ready
- StopObservingVisual( (*registeredVisualsiter)->visual );
- StartObservingVisual( visual );
+ // No longer required to know if the replaced visual's resources are ready
+ StopObservingVisual( currentRegisteredVisual );
- if( self.OnStage() )
+ // If control staged and visual enabled then visuals will be swapped once ready
+ if( self.OnStage() && enabled )
{
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "RegisterVisual Adding visual to replacement Queue: %d \n", index );
- // Check if visual is currently in the process of being replaced
- RegisteredVisualContainer::Iterator queuedReplacementVisual;
- if ( FindVisual( index, mReplacementVisuals, queuedReplacementVisual ) )
+ // Check if visual is currently in the process of being replaced ( is in removal container )
+ RegisteredVisualContainer::Iterator visualQueuedForRemoval;
+ if ( FindVisual( index, mRemoveVisuals, visualQueuedForRemoval ) )
+ {
+ // Visual with same index is already in removal container so current visual pending
+ // Only the the last requested visual will be displayed so remove current visual which is staged but not ready.
+ Toolkit::GetImplementation( currentRegisteredVisual ).SetOffStage( self );
+ mVisuals.Erase( registeredVisualsiter );
+ }
+ else
{
- // If visual on replacement queue is going to be replaced before it's ready then will be removed from queue (and stage)
- // Only the the last requested visual will be queued and then displayed.
- Toolkit::GetImplementation( (*queuedReplacementVisual)->visual ).SetOffStage( self );
- mReplacementVisuals.Erase(queuedReplacementVisual);
+ // current visual not already in removal container so add now.
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "RegisterVisual Move current registered visual to removal Queue: %d \n", index );
+ MoveVisual( registeredVisualsiter, mVisuals, mRemoveVisuals );
}
- // Add to replacement list
- mReplacementVisuals.PushBack( new RegisteredVisual( index, visual, ( enabled == VisualState::ENABLED ? true : false ) ) );
}
else
{
- // Not staged so can just replace registered visual
- (*registeredVisualsiter)->visual = visual;
- (*registeredVisualsiter)->enabled = ( enabled == VisualState::ENABLED ) ? true : false;
+ // Control not staged or visual disabled so can just erase from registered visuals and new visual will be added later.
+ mVisuals.Erase( registeredVisualsiter );
}
// If we've not set the depth-index value and the new visual does not have a depth index applied to it, then use the previously set depth-index for this index
if( ( depthIndexValueSet == DepthIndexValue::NOT_SET ) &&
( visual.GetDepthIndex() == 0 ) )
{
- visual.SetDepthIndex( currentDepthIndex );
+ requiredDepthIndex = currentDepthIndex;
}
}
if( !visualReplaced ) // New registration entry
{
- DALI_LOG_INFO( gLogFilter, Debug::Concise, "New Visual registration %d\n", index);
- mVisuals.PushBack( new RegisteredVisual( index, visual, ( enabled == VisualState::ENABLED ? true : false ) ) );
-
- // monitor when the visuals resources are ready
+ // monitor when the visual resources are ready
StartObservingVisual( visual );
// If we've not set the depth-index value, we have more than one visual and the visual does not have a depth index, then set it to be the highest
if( ( depthIndexValueSet == DepthIndexValue::NOT_SET ) &&
- ( mVisuals.Size() > 1 ) &&
+ ( mVisuals.Size() > 0 ) &&
( visual.GetDepthIndex() == 0 ) )
{
int maxDepthIndex = std::numeric_limits< int >::min();
maxDepthIndex = visualDepthIndex;
}
}
-
++maxDepthIndex; // Add one to the current maximum depth index so that our added visual appears on top
- visual.SetDepthIndex( maxDepthIndex );
+ requiredDepthIndex = std::max( 0, maxDepthIndex ); // Start at zero if maxDepth index belongs to a background
}
}
if( visual )
{
- // If the caller has set the depth-index, then set it here
- if( depthIndexValueSet == DepthIndexValue::SET )
- {
- visual.SetDepthIndex( depthIndex );
- }
+ // Set determined depth index
+ visual.SetDepthIndex( requiredDepthIndex );
+
+ // Monitor when the visual resources are ready
+ StartObservingVisual( visual );
+
+ DALI_LOG_INFO( gLogFilter, Debug::Concise, "New Visual registration index[%d] depth[%d]\n", index, requiredDepthIndex );
+ RegisteredVisual* newRegisteredVisual = new RegisteredVisual( index, visual,
+ ( enabled == VisualState::ENABLED ? true : false ),
+ ( visualReplaced && enabled ) ) ;
+ mVisuals.PushBack( newRegisteredVisual );
// Put on stage if enabled and the control is already on the stage
+ // Visual must be set on stage for the renderer to be created and the ResourceReady triggered.
if( ( enabled == VisualState::ENABLED ) && self.OnStage() )
{
- // Visual must be set on stage for the renderer to be created and the ResourceReady triggered.
Toolkit::GetImplementation(visual).SetOnStage( self );
}
}
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::RegisterVisual() Registered %s(%d), enabled:%s\n", visual.GetName().c_str(), index, enabled?"T":"F" );
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::RegisterVisual() Registered %s(%d), enabled:%s\n", visual.GetName().c_str(), index, enabled?"true":"false" );
}
void Control::Impl::UnregisterVisual( Property::Index index )
visualImpl.AddResourceObserver( *this );
}
+// Called by a Visual when it's resource is ready
+void Control::Impl::ResourceReady( Visual::Base& object)
+{
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "ResourceReady replacements pending[%d]\n", mRemoveVisuals.Count() );
+
+ Actor self = mControlImpl.Self();
+
+ // A resource is ready, find resource in the registered visuals container and get its index
+ for( auto registeredIter = mVisuals.Begin(), end = mVisuals.End(); registeredIter != end; ++registeredIter )
+ {
+ Internal::Visual::Base& registeredVisualImpl = Toolkit::GetImplementation( (*registeredIter)->visual );
+
+ if( &object == ®isteredVisualImpl )
+ {
+ RegisteredVisualContainer::Iterator visualToRemoveIter;
+ // Find visual with the same index in the removal container
+ // Set if off stage as it's replacement is now ready.
+ // Remove if from removal list as now removed from stage.
+ // Set Pending flag on the ready visual to false as now ready.
+ if( FindVisual( (*registeredIter)->index, mRemoveVisuals, visualToRemoveIter ) )
+ {
+ (*registeredIter)->pending = false;
+ Toolkit::GetImplementation( (*visualToRemoveIter)->visual ).SetOffStage( self );
+ mRemoveVisuals.Erase( visualToRemoveIter );
+ }
+ break;
+ }
+ }
+
+ // A visual is ready so control may need relayouting
+ mControlImpl.RelayoutRequest();
+
+ // Emit signal if all enabled visuals registered by the control are ready.
+ if( IsResourceReady() )
+ {
+ Dali::Toolkit::Control handle( mControlImpl.GetOwner() );
+ mResourceReadySignal.Emit( handle );
+ }
+}
+
+bool Control::Impl::IsResourceReady() const
+{
+ // Iterate through and check all the enabled visuals are ready
+ for( auto visualIter = mVisuals.Begin();
+ visualIter != mVisuals.End(); ++visualIter )
+ {
+ const Toolkit::Visual::Base visual = (*visualIter)->visual;
+ const Internal::Visual::Base& visualImpl = Toolkit::GetImplementation( visual );
+
+ // one of the enabled visuals is not ready
+ if( !visualImpl.IsResourceReady() && (*visualIter)->enabled )
+ {
+ return false;
+ }
+ }
+ return true;
+}
+
+
Dali::Animation Control::Impl::CreateTransition( const Toolkit::TransitionData& handle )
{
Dali::Animation transition;
}
}
+void Control::Impl::OnStageDisconnection()
+{
+ Actor self = mControlImpl.Self();
+
+ // Any visuals set for replacement but not yet ready should still be registered.
+ // Reason: If a request was made to register a new visual but the control removed from stage before visual was ready
+ // then when this control appears back on stage it should use that new visual.
+
+ // Iterate through all registered visuals and set off stage
+ SetVisualsOffStage( mVisuals, self );
+
+ // Visuals pending replacement can now be taken out of the removal list and set off stage
+ // Iterate through all replacement visuals and add to a move queue then set off stage
+ for( auto removalIter = mRemoveVisuals.Begin(), end = mRemoveVisuals.End(); removalIter != end; removalIter++ )
+ {
+ Toolkit::GetImplementation((*removalIter)->visual).SetOffStage( self );
+ }
+
+ for( auto replacedIter = mVisuals.Begin(), end = mVisuals.End(); replacedIter != end; replacedIter++ )
+ {
+ (*replacedIter)->pending = false;
+ }
+
+ mRemoveVisuals.Clear();
+}
+
} // namespace Internal
} // namespace Toolkit
namespace Internal
{
-/**
+ /**
* Struct used to store Visual within the control, index is a unique key for each visual.
*/
- struct RegisteredVisual
- {
- Property::Index index;
- Toolkit::Visual::Base visual;
- bool enabled;
-
- RegisteredVisual( Property::Index aIndex, Toolkit::Visual::Base &aVisual, bool aEnabled)
- : index(aIndex), visual(aVisual), enabled(aEnabled)
- {
- }
- };
+struct RegisteredVisual
+{
+ Property::Index index;
+ Toolkit::Visual::Base visual;
+ bool enabled : 1;
+ bool pending : 1;
+
+ RegisteredVisual( Property::Index aIndex, Toolkit::Visual::Base &aVisual, bool aEnabled, bool aPendingReplacement )
+ : index(aIndex), visual(aVisual), enabled(aEnabled), pending( aPendingReplacement )
+ {
+ }
+};
typedef Dali::OwnerContainer< RegisteredVisual* > RegisteredVisualContainer;
*/
bool IsResourceReady() const;
+ /**
+ * @copydoc CustomActorImpl::OnStageDisconnection()
+ */
+ void OnStageDisconnection();
+
private:
/**
bool mIsKeyboardNavigationSupported :1; ///< Stores whether keyboard navigation is supported by the control.
bool mIsKeyboardFocusGroup :1; ///< Stores whether the control is a focus group.
- RegisteredVisualContainer mReplacementVisuals; ///< List of visuals that will be used for replacing current visuals.
+ RegisteredVisualContainer mRemoveVisuals; ///< List of visuals that are being replaced by another visual once ready
// Properties - these need to be members of Internal::Control::Impl as they access private methods/data of Internal::Control and Internal::Control::Impl.
static const PropertyRegistration PROPERTY_1;
{
Control::OnRelayout( size, container );
+ // If visual is being replaced then mVisual will be the replacement visual even if not ready.
+ mVisual = DevelControl::GetVisual( *this, Toolkit::ImageView::Property::IMAGE );
+
if( mVisual )
{
// Pass in an empty map which uses default transform values meaning our visual fills the control
void ImageView::OnResourceReady( Toolkit::Control control )
{
- mVisual = DevelControl::GetVisual( *this, Toolkit::ImageView::Property::IMAGE );
}
///////////////////////////////////////////////////////////
// Creates an extra control to be used as stencil buffer.
mStencil = Control::New();
- mStencil.SetAnchorPoint( AnchorPoint::CENTER );
- mStencil.SetParentOrigin( ParentOrigin::CENTER );
+ mStencil.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ mStencil.SetParentOrigin( ParentOrigin::TOP_LEFT );
// Creates a background visual. Even if the color is transparent it updates the stencil.
mStencil.SetProperty( Toolkit::Control::Property::BACKGROUND,
float TextEditor::GetHeightForWidth( float width )
{
- return mController->GetHeightForWidth( width );
+ Padding padding;
+ Self().GetPadding( padding );
+ return mController->GetHeightForWidth( width ) + padding.top + padding.bottom;
}
void TextEditor::OnRelayout( const Vector2& size, RelayoutContainer& container )
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor OnRelayout\n");
- const Text::Controller::UpdateTextType updateTextType = mController->Relayout( size );
+ Actor self = Self();
+ Padding padding;
+
+ self.GetPadding( padding );
+ Vector2 contentSize( size.x - ( padding.left + padding.right ), size.y - ( padding.top + padding.bottom ) );
+
+ if( mStencil )
+ {
+ mStencil.SetPosition( padding.left , padding.top );
+ }
+ if( mActiveLayer )
+ {
+ mActiveLayer.SetPosition( padding.left , padding.top );
+ }
+
+
+ const Text::Controller::UpdateTextType updateTextType = mController->Relayout( contentSize );
if( ( Text::Controller::NONE_UPDATED != updateTextType ) ||
!mRenderer )
}
RenderText( updateTextType );
+
}
// The text-editor emits signals when the input style changes. These changes of style are
mImfManager.Activate();
// Deliver the tap before the focus event to controller; this allows us to detect when focus is gained due to tap-gestures
- mController->TapEvent( gesture.numberOfTaps, gesture.localPoint.x, gesture.localPoint.y );
+ Padding padding;
+ Self().GetPadding( padding );
+ mController->TapEvent( gesture.numberOfTaps, gesture.localPoint.x - padding.left, gesture.localPoint.y - padding.top );
SetKeyInputFocus();
}
{
mImfManager.Activate();
- mController->LongPressEvent( gesture.state, gesture.localPoint.x, gesture.localPoint.y );
+ Padding padding;
+ Self().GetPadding( padding );
+ mController->LongPressEvent( gesture.state, gesture.localPoint.x - padding.left, gesture.localPoint.y - padding.top );
SetKeyInputFocus();
}
}
else
{
+ actor.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ actor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
Self().Add( actor );
+ mActiveLayer = actor;
}
}
}
std::vector<Actor> mClippingDecorationActors; ///< Decoration actors which need clipping.
Actor mRenderableActor;
+ Actor mActiveLayer;
CallbackBase* mIdleCallback;
float mAlignmentOffset;
float TextField::GetHeightForWidth( float width )
{
- return mController->GetHeightForWidth( width );
+ Padding padding;
+ Self().GetPadding( padding );
+ return mController->GetHeightForWidth( width ) + padding.top + padding.bottom;
}
void TextField::OnRelayout( const Vector2& size, RelayoutContainer& container )
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField OnRelayout\n");
- const Text::Controller::UpdateTextType updateTextType = mController->Relayout( size );
+ Actor self = Self();
+ Padding padding;
+
+ self.GetPadding( padding );
+ Vector2 contentSize( size.x - ( padding.left + padding.right ), size.y - ( padding.top + padding.bottom ) );
+
+ if( mStencil )
+ {
+ mStencil.SetPosition( padding.left , padding.top );
+ }
+ if( mActiveLayer )
+ {
+ mActiveLayer.SetPosition( padding.left , padding.top );
+ }
+
+ const Text::Controller::UpdateTextType updateTextType = mController->Relayout( contentSize );
if( ( Text::Controller::NONE_UPDATED != updateTextType ) ||
!mRenderer )
}
RenderText( updateTextType );
+
}
// The text-field emits signals when the input style changes. These changes of style are
{
const Vector2& scrollOffset = mController->GetTextModel()->GetScrollPosition();
- mRenderableActor.SetPosition( scrollOffset.x + mAlignmentOffset, scrollOffset.y );
+ if( mStencil )
+ {
+ mRenderableActor.SetPosition( scrollOffset.x + mAlignmentOffset, scrollOffset.y );
+ }
+ else
+ {
+ Padding padding;
+ Self().GetPadding( padding );
+ mRenderableActor.SetPosition( scrollOffset.x + mAlignmentOffset + padding.left, scrollOffset.y + padding.top );
+ }
+
// Make sure the actors are parented correctly with/without clipping
Actor self = mStencil ? mStencil : Self();
mImfManager.Activate();
// Deliver the tap before the focus event to controller; this allows us to detect when focus is gained due to tap-gestures
- mController->TapEvent( gesture.numberOfTaps, gesture.localPoint.x, gesture.localPoint.y );
+ Padding padding;
+ Self().GetPadding( padding );
+ mController->TapEvent( gesture.numberOfTaps, gesture.localPoint.x - padding.left, gesture.localPoint.y - padding.top );
SetKeyInputFocus();
}
{
mImfManager.Activate();
- mController->LongPressEvent( gesture.state, gesture.localPoint.x, gesture.localPoint.y );
+ Padding padding;
+ Self().GetPadding( padding );
+ mController->LongPressEvent( gesture.state, gesture.localPoint.x - padding.left, gesture.localPoint.y - padding.top );
SetKeyInputFocus();
}
}
else
{
+ actor.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ actor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
Self().Add( actor );
+ mActiveLayer = actor;
}
}
}
{
// Creates an extra control to be used as stencil buffer.
mStencil = Control::New();
- mStencil.SetAnchorPoint( AnchorPoint::CENTER );
- mStencil.SetParentOrigin( ParentOrigin::CENTER );
+ mStencil.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ mStencil.SetParentOrigin( ParentOrigin::TOP_LEFT );
// Creates a background visual. Even if the color is transparent it updates the stencil.
mStencil.SetProperty( Toolkit::Control::Property::BACKGROUND,
Dali::InputMethodOptions mInputMethodOptions;
Actor mRenderableActor;
+ Actor mActiveLayer;
CallbackBase* mIdleCallback;
float mAlignmentOffset;
float TextLabel::GetHeightForWidth( float width )
{
- return mController->GetHeightForWidth( width );
+ Padding padding;
+ Self().GetPadding( padding );
+ return mController->GetHeightForWidth( width ) + padding.top + padding.bottom;
}
void TextLabel::OnRelayout( const Vector2& size, RelayoutContainer& container )
{
DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel::OnRelayout\n" );
- const Text::Controller::UpdateTextType updateTextType = mController->Relayout( size );
+ Padding padding;
+ Self().GetPadding( padding );
+ Vector2 contentSize( size.x - ( padding.left + padding.right ), size.y - ( padding.top + padding.bottom ) );
+
+
+ const Text::Controller::UpdateTextType updateTextType = mController->Relayout( contentSize );
if( ( Text::Controller::NONE_UPDATED != ( Text::Controller::MODEL_UPDATED & updateTextType ) ) ||
!mRenderer )
if( renderableActor )
{
const Vector2& scrollOffset = mController->GetTextModel()->GetScrollPosition();
- renderableActor.SetPosition( scrollOffset.x + alignmentOffset, scrollOffset.y );
+ Padding padding;
+ self.GetPadding( padding );
+ renderableActor.SetPosition( scrollOffset.x + alignmentOffset + padding.left, scrollOffset.y + padding.top );
self.Add( renderableActor );
}
}
-void GetCursorPosition( VisualModelPtr visualModel,
- LogicalModelPtr logicalModel,
- MetricsPtr metrics,
- CharacterIndex logical,
+void GetCursorPosition( GetCursorPositionParameters& parameters,
CursorInfo& cursorInfo )
{
// Whether the logical cursor position is at the end of the whole text.
- const bool isLastPosition = logicalModel->mText.Count() == logical;
+ const bool isLastPosition = parameters.logicalModel->mText.Count() == parameters.logical;
// Get the line where the character is laid-out.
- const CharacterIndex characterOfLine = isLastPosition ? ( logical - 1u ) : logical;
+ const CharacterIndex characterOfLine = isLastPosition ? ( parameters.logical - 1u ) : parameters.logical;
// Whether the cursor is in the last position and the last position is a new paragraph character.
- const bool isLastNewParagraph = isLastPosition && TextAbstraction::IsNewParagraph( *( logicalModel->mText.Begin() + characterOfLine ) );
+ const bool isLastNewParagraph = parameters.isMultiline && isLastPosition && TextAbstraction::IsNewParagraph( *( parameters.logicalModel->mText.Begin() + characterOfLine ) );
- const LineRun* const modelLines = visualModel->mLines.Begin();
+ const LineRun* const modelLines = parameters.visualModel->mLines.Begin();
- const LineIndex lineIndex = visualModel->GetLineOfCharacter( characterOfLine );
+ const LineIndex lineIndex = parameters.visualModel->GetLineOfCharacter( characterOfLine );
const LineRun& line = *( modelLines + lineIndex );
if( isLastNewParagraph )
cursorInfo.isSecondaryCursor = false;
// Set the line offset and height.
- cursorInfo.lineOffset = CalculateLineOffset( visualModel->mLines,
+ cursorInfo.lineOffset = CalculateLineOffset( parameters.visualModel->mLines,
newLineIndex );
// The line height is the addition of the line ascender and the line descender.
cursorInfo.primaryPosition.y = cursorInfo.lineOffset;
// Transform the cursor info from line's coords to text's coords.
- cursorInfo.primaryPosition.x += ( LTR == line.direction ) ? 0.f : visualModel->mControlSize.width;
+ cursorInfo.primaryPosition.x += ( LTR == line.direction ) ? 0.f : parameters.visualModel->mControlSize.width;
}
else
{
// Whether this line is a bidirectional line.
- const bool bidiLineFetched = logicalModel->FetchBidirectionalLineInfo( characterOfLine );
+ const bool bidiLineFetched = parameters.logicalModel->FetchBidirectionalLineInfo( characterOfLine );
// Check if the logical position is the first or the last one of the line.
- const bool isFirstPositionOfLine = line.characterRun.characterIndex == logical;
- const bool isLastPositionOfLine = line.characterRun.characterIndex + line.characterRun.numberOfCharacters == logical;
+ const bool isFirstPositionOfLine = line.characterRun.characterIndex == parameters.logical;
+ const bool isLastPositionOfLine = line.characterRun.characterIndex + line.characterRun.numberOfCharacters == parameters.logical;
// 'logical' is the logical 'cursor' index.
// Get the next and current logical 'character' index.
- const CharacterIndex characterIndex = isFirstPositionOfLine ? logical : logical - 1u;
- const CharacterIndex nextCharacterIndex = isLastPositionOfLine ? characterIndex : logical;
+ const CharacterIndex characterIndex = isFirstPositionOfLine ? parameters.logical : parameters.logical - 1u;
+ const CharacterIndex nextCharacterIndex = isLastPositionOfLine ? characterIndex : parameters.logical;
// The character's direction buffer.
- const CharacterDirection* const directionsBuffer = bidiLineFetched ? logicalModel->mCharacterDirections.Begin() : NULL;
+ const CharacterDirection* const directionsBuffer = bidiLineFetched ? parameters.logicalModel->mCharacterDirections.Begin() : NULL;
CharacterDirection isCurrentRightToLeft = false;
CharacterDirection isNextRightToLeft = false;
( isFirstPositionOfLine && ( isRightToLeftParagraph != isCurrentRightToLeft ) ) );
// Set the line offset and height.
- cursorInfo.lineOffset = CalculateLineOffset( visualModel->mLines,
+ cursorInfo.lineOffset = CalculateLineOffset( parameters.visualModel->mLines,
lineIndex );
// The line height is the addition of the line ascender and the line descender.
index = isRightToLeftParagraph ? line.characterRun.characterIndex : line.characterRun.characterIndex + line.characterRun.numberOfCharacters - 1u;
if( bidiLineFetched )
{
- index = logicalModel->GetLogicalCharacterIndex( index );
+ index = parameters.logicalModel->GetLogicalCharacterIndex( index );
}
}
else if( isFirstPositionOfLine )
index = isRightToLeftParagraph ? line.characterRun.characterIndex + line.characterRun.numberOfCharacters - 1u : line.characterRun.characterIndex;
if( bidiLineFetched )
{
- index = logicalModel->GetLogicalCharacterIndex( index );
+ index = parameters.logicalModel->GetLogicalCharacterIndex( index );
}
}
else
}
}
- const GlyphIndex* const charactersToGlyphBuffer = visualModel->mCharactersToGlyph.Begin();
- const Length* const glyphsPerCharacterBuffer = visualModel->mGlyphsPerCharacter.Begin();
- const Length* const charactersPerGlyphBuffer = visualModel->mCharactersPerGlyph.Begin();
- const CharacterIndex* const glyphsToCharactersBuffer = visualModel->mGlyphsToCharacters.Begin();
- const Vector2* const glyphPositionsBuffer = visualModel->mGlyphPositions.Begin();
- const GlyphInfo* const glyphInfoBuffer = visualModel->mGlyphs.Begin();
+ const GlyphIndex* const charactersToGlyphBuffer = parameters.visualModel->mCharactersToGlyph.Begin();
+ const Length* const glyphsPerCharacterBuffer = parameters.visualModel->mGlyphsPerCharacter.Begin();
+ const Length* const charactersPerGlyphBuffer = parameters.visualModel->mCharactersPerGlyph.Begin();
+ const CharacterIndex* const glyphsToCharactersBuffer = parameters.visualModel->mGlyphsToCharacters.Begin();
+ const Vector2* const glyphPositionsBuffer = parameters.visualModel->mGlyphPositions.Begin();
+ const GlyphInfo* const glyphInfoBuffer = parameters.visualModel->mGlyphs.Begin();
// Convert the cursor position into the glyph position.
const GlyphIndex primaryGlyphIndex = *( charactersToGlyphBuffer + index );
primaryNumberOfGlyphs,
glyphMetrics,
glyphInfoBuffer,
- metrics );
+ parameters.metrics );
// Whether to add the glyph's advance to the cursor position.
// i.e if the paragraph is left to right and the logical cursor is zero, the position is the position of the first glyph and the advance is not added,
secondaryNumberOfGlyphs,
glyphMetrics,
glyphInfoBuffer,
- metrics );
+ parameters.metrics );
// Set the secondary cursor's position.
};
/**
+ * @brief Parameters passed to the GetCursorPosition() function.
+ */
+struct GetCursorPositionParameters
+{
+ VisualModelPtr visualModel; ///< The visual model.
+ LogicalModelPtr logicalModel; ///< The logical model.
+ MetricsPtr metrics; ///< A wrapper around FontClient used to get metrics.
+ CharacterIndex logical; ///< The logical cursor position (in characters). 0 is just before the first character, a value equal to the number of characters is just after the last character.
+ bool isMultiline; ///< Whether the text control is multi-line.
+};
+
+/**
* @brief Retrieves the closest line for a given touch point.
*
* It returns the first line if the touch point is above the text and the last line if the touch point is below.
* It retrieves as well the line's height and the cursor's height and
* if there is a valid alternative cursor, its position and height.
*
- * @param[in] visualModel The visual model.
- * @param[in] logicalModel The logical model.
- * @param[in] metrics A wrapper around FontClient used to get metrics.
- * @param[in] logical The logical cursor position (in characters). 0 is just before the first character, a value equal to the number of characters is just after the last character.
+ * @param[in] parameters Parameters used to calculate the cursor's position.
* @param[out] cursorInfo The line's height, the cursor's height, the cursor's position and whether there is an alternative cursor.
*/
-void GetCursorPosition( VisualModelPtr visualModel,
- LogicalModelPtr logicalModel,
- MetricsPtr metrics,
- CharacterIndex logical,
+void GetCursorPosition( GetCursorPositionParameters& parameters,
CursorInfo& cursorInfo );
/**
mModel->mLogicalModel->UpdateTextStyleRuns( startOfSelectedText, -static_cast<int>( lengthOfSelectedText ) );
// Mark the paragraphs to be updated.
- mTextUpdateInfo.mCharacterIndex = startOfSelectedText;
- mTextUpdateInfo.mNumberOfCharactersToRemove = lengthOfSelectedText;
+ if( Layout::Engine::SINGLE_LINE_BOX == mLayoutEngine.GetLayout() )
+ {
+ mTextUpdateInfo.mCharacterIndex = 0;
+ mTextUpdateInfo.mNumberOfCharactersToRemove = mTextUpdateInfo.mPreviousNumberOfCharacters;
+ mTextUpdateInfo.mNumberOfCharactersToAdd = mTextUpdateInfo.mPreviousNumberOfCharacters - lengthOfSelectedText;
+ mTextUpdateInfo.mClearAll = true;
+ }
+ else
+ {
+ mTextUpdateInfo.mCharacterIndex = startOfSelectedText;
+ mTextUpdateInfo.mNumberOfCharactersToRemove = lengthOfSelectedText;
+ }
// Delete text between handles
Vector<Character>::Iterator first = utf32Characters.Begin() + startOfSelectedText;
return;
}
- Text::GetCursorPosition( mModel->mVisualModel,
- mModel->mLogicalModel,
- mMetrics,
- logical,
+ const bool isMultiLine = ( Layout::Engine::MULTI_LINE_BOX == mLayoutEngine.GetLayout() );
+ GetCursorPositionParameters parameters;
+ parameters.visualModel = mModel->mVisualModel;
+ parameters.logicalModel = mModel->mLogicalModel;
+ parameters.metrics = mMetrics;
+ parameters.logical = logical;
+ parameters.isMultiline = isMultiLine;
+
+ Text::GetCursorPosition( parameters,
cursorInfo );
- if( Layout::Engine::MULTI_LINE_BOX == mLayoutEngine.GetLayout() )
+ if( isMultiLine )
{
// If the text is editable and multi-line, the cursor position after a white space shouldn't exceed the boundaries of the text control.
mModel->mScrollPosition.x = mModel->mVisualModel->mControlSize.width - positionEndX;
}
- if( decoratorPositionBeginY < 0.f )
- {
- mModel->mScrollPosition.y = -position.y;
- }
- else if( decoratorPositionEndY > mModel->mVisualModel->mControlSize.height )
+ if( Layout::Engine::MULTI_LINE_BOX == mLayoutEngine.GetLayout() )
{
- mModel->mScrollPosition.y = mModel->mVisualModel->mControlSize.height - positionEndY;
+ if( decoratorPositionBeginY < 0.f )
+ {
+ mModel->mScrollPosition.y = -position.y;
+ }
+ else if( decoratorPositionEndY > mModel->mVisualModel->mControlSize.height )
+ {
+ mModel->mScrollPosition.y = mModel->mVisualModel->mControlSize.height - positionEndY;
+ }
}
}
}
// Mark the first paragraph to be updated.
- mImpl->mTextUpdateInfo.mCharacterIndex = std::min( cursorIndex, mImpl->mTextUpdateInfo.mCharacterIndex );
- mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd += maxSizeOfNewText;
+ if( Layout::Engine::SINGLE_LINE_BOX == mImpl->mLayoutEngine.GetLayout() )
+ {
+ mImpl->mTextUpdateInfo.mCharacterIndex = 0;
+ mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters;
+ mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = numberOfCharactersInModel + maxSizeOfNewText;
+ mImpl->mTextUpdateInfo.mClearAll = true;
+ }
+ else
+ {
+ mImpl->mTextUpdateInfo.mCharacterIndex = std::min( cursorIndex, mImpl->mTextUpdateInfo.mCharacterIndex );
+ mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd += maxSizeOfNewText;
+ }
// Update the cursor index.
cursorIndex += maxSizeOfNewText;
( ( cursorIndex + numberOfCharacters ) <= mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters ) )
{
// Mark the paragraphs to be updated.
- mImpl->mTextUpdateInfo.mCharacterIndex = std::min( cursorIndex, mImpl->mTextUpdateInfo.mCharacterIndex );
- mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove += numberOfCharacters;
+ if( Layout::Engine::SINGLE_LINE_BOX == mImpl->mLayoutEngine.GetLayout() )
+ {
+ mImpl->mTextUpdateInfo.mCharacterIndex = 0;
+ mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters;
+ mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters - numberOfCharacters;
+ mImpl->mTextUpdateInfo.mClearAll = true;
+ }
+ else
+ {
+ mImpl->mTextUpdateInfo.mCharacterIndex = std::min( cursorIndex, mImpl->mTextUpdateInfo.mCharacterIndex );
+ mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove += numberOfCharacters;
+ }
// Update the input style and remove the text's style before removing the text.
void Control::OnStageDisconnection()
{
- for(RegisteredVisualContainer::Iterator iter = mImpl->mVisuals.Begin(); iter!= mImpl->mVisuals.End(); iter++)
- {
- // Check whether the visual is empty
- if( (*iter)->visual )
- {
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::OnStageDisconnection Setting visual(%d) off stage\n", (*iter)->index );
- Actor self( Self() );
- Toolkit::GetImplementation((*iter)->visual).SetOffStage( self );
- }
- }
+ mImpl->OnStageDisconnection();
}
void Control::OnKeyInputFocusGained()
const unsigned int TOOLKIT_MAJOR_VERSION = 1;
const unsigned int TOOLKIT_MINOR_VERSION = 2;
-const unsigned int TOOLKIT_MICRO_VERSION = 47;
+const unsigned int TOOLKIT_MICRO_VERSION = 48;
const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
Name: dali-toolkit
Summary: The OpenGLES Canvas Core Library Toolkit
-Version: 1.2.47
+Version: 1.2.48
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT